PythonEFL: change the way progressbar pulse mode work.

Prior to this commit you enable (and start) the pulsing animation by doing:
pb.pulse = True
pb.pulse(True)

Now you need to use the less-confusing syntax:
pb.pulse_mode = True
pb.pulse(True)

Sorry for braking the API but was really confusing before.
This commit is contained in:
Davide Andreoli 2013-08-12 16:50:50 +02:00
parent 478709be29
commit 66e7f00308
2 changed files with 19 additions and 21 deletions

View File

@ -71,15 +71,6 @@ include "widget_header.pxi"
from layout_class cimport LayoutClass
from object cimport Object
class ProgressbarPulseState(int):
def __new__(cls, Object obj, int state):
return int.__new__(cls, state)
def __init__(self, Object obj, int state):
self.obj = obj
def __call__(self, int state):
return self.obj._pulse(state)
cdef class Progressbar(LayoutClass):
@ -88,7 +79,7 @@ cdef class Progressbar(LayoutClass):
def __init__(self, evasObject parent):
self._set_obj(elm_progressbar_add(parent.obj))
property pulse:
property pulse_mode:
"""Whether a given progress bar widget is at "pulsing mode" or not.
By default, progress bars will display values from the low to high
@ -101,24 +92,31 @@ cdef class Progressbar(LayoutClass):
start and stop this pulsing animation, one has to explicitly call
pulse(True) or pulse(False).
:type pulse: bool
:type: bool
"""
def __set__(self, pulse):
elm_progressbar_pulse_set(self.obj, pulse)
def __get__(self):
return ProgressbarPulseState(self, elm_progressbar_pulse_get(self.obj))
return bool(elm_progressbar_pulse_get(self.obj))
def _pulse(self, state):
elm_progressbar_pulse(self.obj, state)
def pulse_set(self, state):
def pulse_mode_set(self, state):
elm_progressbar_pulse_set(self.obj, state)
def pulse_get(self):
def pulse_mode_get(self):
return bool(elm_progressbar_pulse_get(self.obj))
def pulse(self, state):
"""Start (state=True) or stop (state=False) the pulsing animation.
Note that :py:attr:`pulse_mode` must be enabled for this to work.
:param state: Whenever to start or stop the pulse animation.
:type state: bool
"""
elm_progressbar_pulse(self.obj, state)
property value:
"""The progress value (in percentage) on a given progress bar widget.

View File

@ -77,7 +77,7 @@ def progressbar_clicked(obj):
pb2.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
pb2.size_hint_align = evas.EVAS_HINT_FILL, 0.5
pb2.text = "Infinite bounce"
pb2.pulse = True
pb2.pulse_mode = True
bx.pack_end(pb2)
pb2.show()
@ -118,7 +118,7 @@ def progressbar_clicked(obj):
pb5.size_hint_align = evas.EVAS_HINT_FILL, 0.5
pb5.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
pb5.span_size = 80
pb5.pulse = True
pb5.pulse_mode = True
pb5.unit_format = None
pb5.text = "Infinite bounce"
hbx.pack_end(pb5)
@ -144,7 +144,7 @@ def progressbar_clicked(obj):
pb7 = Progressbar(win)
pb7.style = "wheel"
pb7.text = "Style: wheel"
pb7.pulse = True
pb7.pulse_mode = True
pb7.size_hint_align = evas.EVAS_HINT_FILL, 0.5
pb7.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
bx.pack_end(pb7)