#4208 get_icon_state accepts negative step kwarg
This commit is contained in:
parent
1659332c81
commit
6a41396dd2
@ -581,11 +581,10 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
|
|||||||
palette = property(get_palette, set_palette)
|
palette = property(get_palette, set_palette)
|
||||||
|
|
||||||
def get_icon_state(base_name, perc, step=5):
|
def get_icon_state(base_name, perc, step=5):
|
||||||
assert step > 0, 'get_icon_state(): step must be positive\n'
|
|
||||||
strength = round(perc / step) * step
|
strength = round(perc / step) * step
|
||||||
icon_theme = gtk.icon_theme_get_default()
|
icon_theme = gtk.icon_theme_get_default()
|
||||||
|
|
||||||
while strength <= 100:
|
while strength <= 100 and strength >= 0:
|
||||||
icon_name = '%s-%03d' % (base_name, strength)
|
icon_name = '%s-%03d' % (base_name, strength)
|
||||||
if icon_theme.has_icon(icon_name):
|
if icon_theme.has_icon(icon_name):
|
||||||
return icon_name
|
return icon_name
|
||||||
|
Loading…
Reference in New Issue
Block a user