Skip to content

Commit

Permalink
proper prefix handling in the Grid
Browse files Browse the repository at this point in the history
  • Loading branch information
artfwo committed Oct 29, 2017
1 parent 0173718 commit 0dc54db
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions monome.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def __init__(self):
'/sys/connect': lambda *args: self.__sys_connect(),
'/sys/disconnect': lambda *args: self.__sys_disconnect(),
'/sys/{id,size,host,port,prefix,rotation}': self.__sys_info,
'/{}/grid/key'.format(self.prefix): self.__grid_key,
'/{}/tilt'.format(self.prefix): self.__tilt,
'/*/grid/key'.format(self.prefix): self.__grid_key,
'/*/tilt'.format(self.prefix): self.__tilt,
})

self.event_handler = None
Expand Down Expand Up @@ -97,11 +97,11 @@ def __ready(self):
self.event_handler.on_grid_ready()

def __grid_key(self, addr, path, x, y, s):
if self.event_handler is not None:
if self.event_handler is not None and path.startswith("/" + self.prefix):
self.event_handler.on_grid_key(x, y, s)

def __tilt(self, addr, path, n, x, y, z):
if self.event_handler is not None:
if self.event_handler is not None and path.startswith("/" + self.prefix):
self.event_handler_on_tilt(n, x, y, z)

def led_set(self, x, y, s):
Expand Down

0 comments on commit 0dc54db

Please sign in to comment.