Merge lp:~codeforger/simplegc/ProgressBar into lp:simplegc/stable

Proposed by Sam Bull
Status: Merged
Merged at revision: 356
Proposed branch: lp:~codeforger/simplegc/ProgressBar
Merge into: lp:simplegc/stable
Diff against target: 0 lines
To merge this branch: bzr merge lp:~codeforger/simplegc/ProgressBar
Reviewer Review Type Date Requested Status
Sam Bull Approve
Review via email: mp+216547@code.launchpad.net

This proposal supersedes a proposal from 2013-08-01.

Description of the change

Implemented a progress bar widget

To post a comment you must log in.
Revision history for this message
Sam Bull (dreamsorcerer) wrote : Posted in a previous version of this proposal

Images - 'overlay':
  This is not a valid image. It should simply draw the text onto the widget. Also, the text could be used as a string with an argument which you format with the current percentage, e.g. "Percent: %s%%".

Documentation is incomplete, there is no documentation for pulse() or percent. Try compiling the documentation and viewing it before finalising it.

can_focus defaults to False, so that line can simply be removed.

bar_percent and percent should be renamed to fraction, to better portray their 0-1 value.

throbber_speed:
  Should not move throbber once each time pulse is called. A smooth animation should be achieved if pulse() is called, say once every 250ms. You could instead use a throbber_step to decide how far it should move for each pulse, but the pulse animation should continue for 250ms after the last pulse() call. throbber_step should also be a fraction (0-1), not a pixel number.
  Note: GTK defaults to 0.1. Perhaps have the progress bar take 1 second to get from one side to the other, and use the step to define how far it will travel before it stops. This means if people have slow update loops, they can set the step to say, 0.5 to last half a second between updates.

Looking at GtkProgressBar, it makes more sense to switch between activity/percentage mode automatically when pulse() or fraction are used, thus losing the activity_mode config argument.

throbber_x can be a class attribute...

throbber_velocity seems to be the same variable as throbber_speed, there is no reason for this to exist.

Do the images need to be hidden everytime config() is called? Looks like something that should be in init.

Bar image is not drawn to full image:
  draw.rect(image, self._settings["col"], (2, 2, size[0] - 4, size[1] - 4))
Instead, you should set the size to be smaller, fill the whole image, and set it's position to the offset.
"bar": ((1, 0), (1, 0)) should be "bar": ((1, -4), (1, -4))

Same goes for throbber image.

update() is non-standard:
  This function doesn't get documented as it should be the same as all others, so you're warning will not be visible to users. I also don't understand why they would be clipped in 'pulse' (activity) mode, or why it would be unusual in 'default' (percentage) mode.

  Why is everything being blitted here? This should be done automatically by the widget, the only thing that should be happening here is moving the throbber's position when in activity mode.

self._throbber_velocity *= -1
Shouldn't be doing multiplication, if you want to invert it, just negate it:
self._throbber_velocity = -self._throbber_velocity

review: Needs Fixing
Revision history for this message
Sam Bull (dreamsorcerer) wrote : Posted in a previous version of this proposal

Code's looking good, just sort out a few formatting problems:

46: *Displays
104: No reason for line wrapping.
117: Huh? What has that to do with rounding?
138: Pointless docstring, which is not displayed anyway.
162/197: Docstring should be lined up, not indented further.
191: Remove leading/trailing space.

Switching modes is a significant activity and should not be done in a property method. Leave the fraction property as read-only.

Does the text property make sense? Under what case would you need to retrieve the text? I can't think of a reason, and then setting the text makes more sense as a config argument.

review: Needs Fixing
Revision history for this message
Michael Rochester (codeforger) wrote : Posted in a previous version of this proposal

On Wed, Aug 7, 2013 at 10:49 AM, Sam Bull <email address hidden> wrote:

> 46: *Displays
> 104: No reason for line wrapping.
> 117: Huh? What has that to do with rounding?
> 138: Pointless docstring, which is not displayed anyway.
> 162/197: Docstring should be lined up, not indented further.
> 191: Remove leading/trailing space.
>

These line numbers bear no relevance to the code, most of them point to
empty lines, and furthur more the entire file is only 165 lines long :/

Revision history for this message
Sam Bull (dreamsorcerer) wrote : Posted in a previous version of this proposal

Set the fraction of the bar, then run pulse(). The progress bar is still displayed in addition to the throbber.

review: Needs Fixing
Revision history for this message
Michael Rochester (codeforger) wrote : Posted in a previous version of this proposal

> Set the fraction of the bar, then run pulse(). The progress bar is still
> displayed in addition to the throbber.

This is fixed in revision 364

Revision history for this message
Sam Bull (dreamsorcerer) wrote : Posted in a previous version of this proposal

Merged to 0.2 branch.

review: Approve
Revision history for this message
Sam Bull (dreamsorcerer) :
review: Approve

Preview Diff

Empty

Subscribers

People subscribed via source and target branches

to all changes: