map generic bank/slot midi command eg 'play_shader_0_0' to method

This commit is contained in:
Tristan Rowley
2019-12-07 20:54:07 +00:00
parent a5f95eba3c
commit bfde14a9d7
2 changed files with 31 additions and 4 deletions

View File

@@ -129,15 +129,20 @@ class MidiInput(object):
self.display.refresh_display()
def call_method_name(self, method_name, argument=None):
# if the target method doesnt exist, call the handler
if not hasattr(self.actions, method_name):
self.call_parse_method_name(method_name, argument)
return
if argument is not None:
getattr(self.actions, method_name)(argument)
else:
getattr(self.actions, method_name)()
def call_parse_method_name(self, method_name, argument):
method, arguments = self.actions.get_callback_for_method(method_name, argument)
method(*arguments)