2
from bee.segments import *
3
from libcontext.socketclasses import *
4
from libcontext.pluginclasses import *
6
class mouse(bee.worker):
8
The mouse sensor reports any mouse input during the last tick
11
#What kind of mouse click events are we listening for?
12
mode = variable("str")
13
parameter(mode, "LClick")
15
#Has a mouse event happened during the last tick?
16
is_active = variable("bool")
17
startvalue(is_active, False)
18
active = output("pull", "bool")
19
connect(is_active, active)
21
#What are the X and Y positions?
24
x = output("pull", "int")
28
y = output("pull", "int")
31
# Mark "x" and "y" as an advanced output segment, and capitalize the I/O names
33
"identifier" : {"name": "Identifier", "fold" : True},
34
"x" : {"name": "X Position", "advanced" : True},
35
"y" : {"name": "Y Position", "advanced" : True},
36
"active" : {"name": "Active"},
37
"_memberorder" : ["identifier", "x", "y", "active"],
40
# Method to manipulate the parameter form as it appears in the GUI
43
f.mode.name = "Detection mode"
44
f.mode.type = "option"
45
f.mode.options = "Move", "LClick", "RClick", "LDoubleClick", "MiddleClick", "LDrag", "RDrag"
46
f.mode.optiontitles = "Move", "Left Click", "Right Click", "Double Click", "Middle Click", "Left Button Drag", "Right Button Drag"
48
# Finally, declare our sockets and plugins, to communicate with the rest of the hive
50
raise NotImplementedError("sparta.sensors.mouse has not been implemented yet")