reduce pollution of the global namespace
This commit is contained in:
parent
48d8c3ec4f
commit
ee08529059
|
@ -22,19 +22,19 @@ from time import sleep
|
|||
|
||||
logger = logging.getLogger("CommentMacro")
|
||||
|
||||
# button state constants
|
||||
buttonDOWN = 1
|
||||
buttonUP = 0
|
||||
|
||||
|
||||
class HogDevice():
|
||||
# button state constants
|
||||
buttonDOWN = 1
|
||||
buttonUP = 0
|
||||
|
||||
def __init__(self, servers):
|
||||
self.servers = servers
|
||||
|
||||
def button_press(self, device, path, delay=0.05):
|
||||
self.send_message(device, path, buttonDOWN) # button down
|
||||
self.send_message(device, path, HogDevice.buttonDOWN) # button down
|
||||
sleep(delay)
|
||||
self.send_message(device, path, buttonUP) # button up
|
||||
self.send_message(device, path, HogDevice.buttonUP) # button up
|
||||
|
||||
# utility function to send simple messages with one argument
|
||||
def send_message(self, device, path, arg):
|
||||
|
@ -160,9 +160,11 @@ class HogDevice():
|
|||
|
||||
def _release_all(self, ctx):
|
||||
logger.info("Release All")
|
||||
self.osc.send_message(ctx.device, "/hog/hardware/pig", buttonDOWN)
|
||||
self.osc.send_message(ctx.device, "/hog/hardware/pig",
|
||||
HogDevice.buttonDOWN)
|
||||
self.osc.button_press(ctx.device, "/hog/hardware/release")
|
||||
self.osc.send_message(ctx.device, "/hog/hardware/pig", buttonUP)
|
||||
self.osc.send_message(ctx.device, "/hog/hardware/pig",
|
||||
HogDevice.buttonUP)
|
||||
|
||||
def _list_go(self, ctx):
|
||||
for i in ctx.targets:
|
||||
|
|
Loading…
Reference in New Issue