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 | ||||
Related bugs: |
|
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.
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: "col"], (2, 2, size[0] - 4, size[1] - 4))
draw.rect(image, self._settings[
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 velocity = -self._ throbber_ velocity
Shouldn't be doing multiplication, if you want to invert it, just negate it:
self._throbber_