[output] Using "instance" for callback registration doesn't make sense
"instance" is actually better suited to be an argument to the callback (which it already is) than part of the key for callback lookup.
This commit is contained in:
parent
7c2170f58a
commit
a63094af47
1 changed files with 1 additions and 10 deletions
|
@ -4,30 +4,21 @@ class Output(object):
|
|||
self._theme = theme
|
||||
self._callbacks = {}
|
||||
|
||||
def add_callback(self, cmd, button, module=None, instance=None):
|
||||
def add_callback(self, cmd, button, module=None):
|
||||
self._callbacks[(
|
||||
button,
|
||||
module,
|
||||
instance
|
||||
)] = cmd
|
||||
|
||||
def callback(self, event):
|
||||
cb = self._callbacks.get((
|
||||
event.get("button", -1),
|
||||
event.get("name", None),
|
||||
event.get("instance", None)
|
||||
), None)
|
||||
if cb is not None: return cb
|
||||
cb = self._callbacks.get((
|
||||
event.get("button", -1),
|
||||
event.get("name", None),
|
||||
None
|
||||
), None)
|
||||
if cb is not None: return cb
|
||||
cb = self._callbacks.get((
|
||||
event.get("button", -1),
|
||||
None,
|
||||
None
|
||||
), None)
|
||||
return cb
|
||||
|
||||
|
|
Loading…
Reference in a new issue