Merge lp:~codeforger/simplegc/ProgressBar into lp:simplegc
Proposed by
Michael Rochester
Status: | Superseded | ||||
---|---|---|---|---|---|
Proposed branch: | lp:~codeforger/simplegc/ProgressBar | ||||
Merge into: | lp:simplegc | ||||
Diff against target: |
205 lines (+179/-0) 3 files modified
docs/sgc.widgets.rst (+13/-0) sgc/__init__.py (+1/-0) sgc/widgets/progress.py (+165/-0) |
||||
To merge this branch: | bzr merge lp:~codeforger/simplegc/ProgressBar | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Sam Bull | Needs Fixing | ||
Review via email: mp+166932@code.launchpad.net |
This proposal has been superseded by a proposal from 2013-08-01.
Description of the change
Implimented a progress bar widget
To post a comment you must log in.
Unmerged revisions
- 364. By Michael Rochester
-
fixed issue where if bar was displayed in fraction mode and then switched to pulse mode, the bar remained visible.
- 363. By Michael Rochester
-
fixed bug where text did not show.
- 362. By Michael Rochester
-
made requested tweaks
- 361. By Michael Rochester
-
made requested tweaks
- 360. By Michael Rochester
-
finalized tweaks that were requested
- 359. By Michael Rochester
-
made all requested changed
- 358. By Michael Rochester
-
Improved efficiency of pulse().
- 357. By Michael Rochester
-
Changed behaviour to be more like the GTK toolkit. Also some usability tweaks.
- 356. By Michael Rochester
-
implimented a progress bar widget
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_