mirror of
https://github.com/gryf/wmdocklib.git
synced 2025-12-19 20:38:03 +01:00
added still not working wmoo.ProgressBar
This commit is contained in:
@@ -118,20 +118,58 @@ class Button(Widget):
|
|||||||
pywmhelpers.copyXPMArea(patternOrig[0], patternOrig[1] + 64, w, h, x, y)
|
pywmhelpers.copyXPMArea(patternOrig[0], patternOrig[1] + 64, w, h, x, y)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
BOUNCE = 0
|
||||||
|
BAR = 1
|
||||||
|
TSIZE = 2
|
||||||
|
TUSED = 3
|
||||||
|
TFREE = 4
|
||||||
|
TPERCENT = 5
|
||||||
|
EMPTY = 6
|
||||||
|
|
||||||
|
HORIZONTAL = 0
|
||||||
|
VERTICAL = 1
|
||||||
|
|
||||||
class ProgressBar(Widget):
|
class ProgressBar(Widget):
|
||||||
"""a bit more generic than a progress bar...
|
"""a bit more generic than a progress bar...
|
||||||
|
|
||||||
it shows as a progress bar, a percentage, an absolute quantity or a custom pixmap.
|
it shows as a progress bar, a percentage, an absolute quantity or a
|
||||||
|
custom pixmap.
|
||||||
|
|
||||||
properties (all are mutable)
|
properties (all are mutable)
|
||||||
size: the total 'capacity'.
|
capacity: defaults to 1
|
||||||
used: the amount completed.
|
used: how much of capacity used.
|
||||||
style: one of [size, used, free, bar, percent, empty]
|
style: one of [bar, bounce, (t-size, t-used, t-free, t-percent, empty)]
|
||||||
|
orientation: [horizontal, vertical]
|
||||||
fg, bg: the colours for the bar.
|
fg, bg: the colours for the bar.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
def __init__(self, container, orig, size, style=BAR,
|
||||||
|
orientation=HORIZONTAL):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def showCacheLevel(self):
|
||||||
|
if self._buffering:
|
||||||
|
self._cacheLevel += 1
|
||||||
|
if self._cacheLevel >= 25:
|
||||||
|
self._cacheLevel -= 25
|
||||||
|
for i in range(-1, 25):
|
||||||
|
if abs(i - self._cacheLevel) <= 1:
|
||||||
|
self.putPattern(54, self._buffering, 5, 1, 54, 51-i)
|
||||||
|
else:
|
||||||
|
self.putPattern(54, 0, 5, 1, 54, 51-i)
|
||||||
|
else:
|
||||||
|
if self._flash:
|
||||||
|
colour = self._colour = 3 - self._colour
|
||||||
|
self._flash = max(0, self._flash - 1)
|
||||||
|
else:
|
||||||
|
colour = 2
|
||||||
|
for i in range(-1, 25):
|
||||||
|
if (i*4 < self._cacheLevel) or self._flash:
|
||||||
|
self.putPattern(54, colour, 5, 1, 54, 51-i)
|
||||||
|
else:
|
||||||
|
self.putPattern(54, 0, 5, 1, 54, 51-i)
|
||||||
|
|
||||||
class Application:
|
class Application:
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
"""initializes the object
|
"""initializes the object
|
||||||
|
|||||||
Reference in New Issue
Block a user