summaryrefslogtreecommitdiffstats
path: root/superkaramba/examples/autoHide/main.py
blob: 85e2b37713735475d004586e4e9de178c1b988b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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!"