diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 2bda8f7717adf28da4af0d34fb82f63d2868c31d (patch) | |
tree | 8d927b7b47a90c4adb646482a52613f58acd6f8c /superkaramba/examples/change_interval/interval.py | |
download | tdeutils-2bda8f7717adf28da4af0d34fb82f63d2868c31d.tar.gz tdeutils-2bda8f7717adf28da4af0d34fb82f63d2868c31d.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeutils@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'superkaramba/examples/change_interval/interval.py')
-rw-r--r-- | superkaramba/examples/change_interval/interval.py | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/superkaramba/examples/change_interval/interval.py b/superkaramba/examples/change_interval/interval.py new file mode 100644 index 0000000..6c3422a --- /dev/null +++ b/superkaramba/examples/change_interval/interval.py @@ -0,0 +1,60 @@ +# +# Written by Luke Kenneth Casson Leighton <lkcl@lkcl.net> + +# This theme is demonstrates the interval timer changing. + +#this import statement allows access to the karamba functions +import karamba + +seq = 0 +text = None + +#this is called when you widget is initialized +def initWidget(widget): + + karamba.redrawWidget(widget) + +# sequence drops down to zero and changes the time interval to 1 second. +# keeps counting down thereafter... + +def widgetUpdated(widget): + global seq + global text + + seq -= 1 + + if seq <= 0: + karamba.changeInterval(widget, 1000) + + if seq <= 0: + message = "biding-time seq:%d" % -seq + else: + message = "wiggle seq:%d" % seq + + # delete previous text if exists. + if text is not None: + karamba.deleteText(widget, text) + + # display new message + text = karamba.createText(widget, 0, 20, 300, 20, message) + karamba.changeTextColor(widget, text, 252,252,252) + + karamba.redrawWidget(widget) + +# wiggle the mouse over the widget to get the sequence number increased more. +# also set the refresh rate to 50ms so that the theme has to fight against +# the wiggling. + +def widgetMouseMoved(widget, x, y, button): + global seq + + if seq <= 0: + seq = 0 + karamba.changeInterval(widget, 50) + + seq += 1 + + +# This will be printed when the widget loads. +print "Loaded my python extension!" + |