From 2bda8f7717adf28da4af0d34fb82f63d2868c31d Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: 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 --- superkaramba/examples/autoHide/main.py | 62 ++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 superkaramba/examples/autoHide/main.py (limited to 'superkaramba/examples/autoHide/main.py') diff --git a/superkaramba/examples/autoHide/main.py b/superkaramba/examples/autoHide/main.py new file mode 100644 index 0000000..85e2b37 --- /dev/null +++ b/superkaramba/examples/autoHide/main.py @@ -0,0 +1,62 @@ +#this import statement allows access to the karamba functions +import karamba + +hidden = 0 +counter = 0 + +def initWidget(widget): + global hidden + hidden = 0 + +def widgetUpdated(widget): + global hidden + global counter + if hidden == 0: + counter = counter + 1 + + if (counter > 5): + hidden = 1 + karamba.moveWidget(widget, 0, -210) + + +#This gets called everytime our widget is clicked. +#Notes: +# widget = reference to our widget +# x = x position (relative to our widget) +# y = y position (relative to our widget) +# botton = button clicked: +# 1 = Left Mouse Button +# 2 = Middle Mouse Button +# 3 = Right Mouse Button, but this will never happen +# because the right mouse button brings up the +# Karamba menu. +def widgetClicked(widget, x, y, button): + pass + +#This gets called everytime our widget is clicked. +#Notes +# widget = reference to our widget +# x = x position (relative to our widget) +# y = y position (relative to our widget) +# botton = button being held: +# 0 = No Mouse Button +# 1 = Left Mouse Button +# 2 = Middle Mouse Button +# 3 = Right Mouse Button, but this will never happen +# because the right mouse button brings up the +# Karamba menu. +def widgetMouseMoved(widget, x, y, button): + #Warning: Don't do anything too intensive here + #You don't want to run some complex piece of code everytime the mouse moves + global hidden + global counter + if (hidden==1): + karamba.moveWidget(widget, 0, 0) + hidden = 0 + counter = 0 + + + +# This will be printed when the widget loads. +print "Loaded my python extension!" + -- cgit v1.2.1