mirror of
https://github.com/cyberboy666/r_e_c_u_r.git
synced 2025-12-12 11:20:15 +01:00
refactor call_method_name into actions.py so all the input messages go through the same pipe (mainly to be compatible with workings in plugins dev branch)
This commit is contained in:
18
actions.py
18
actions.py
@@ -905,10 +905,26 @@ class Actions(object):
|
|||||||
found_method = me
|
found_method = me
|
||||||
parsed_args = list(map(int,matches.groups()))
|
parsed_args = list(map(int,matches.groups()))
|
||||||
if argument is not None:
|
if argument is not None:
|
||||||
#args = [argument] + parsed_args
|
|
||||||
args = parsed_args + [argument]
|
args = parsed_args + [argument]
|
||||||
else:
|
else:
|
||||||
args = parsed_args
|
args = parsed_args
|
||||||
|
|
||||||
return (found_method, args)
|
return (found_method, args)
|
||||||
|
|
||||||
|
def call_method_name(self, method_name, argument=None):
|
||||||
|
# if the target method doesnt exist, call the handler
|
||||||
|
if not hasattr(self, method_name):
|
||||||
|
self.call_parse_method_name(method_name, argument)
|
||||||
|
return
|
||||||
|
|
||||||
|
if argument is not None:
|
||||||
|
getattr(self, method_name)(argument)
|
||||||
|
else:
|
||||||
|
getattr(self, method_name)()
|
||||||
|
|
||||||
|
|
||||||
|
def call_parse_method_name(self, method_name, argument):
|
||||||
|
method, arguments = self.get_callback_for_method(method_name, argument)
|
||||||
|
method(*arguments)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -69,15 +69,9 @@ class AnalogInput(object):
|
|||||||
norm_channel_value = None
|
norm_channel_value = None
|
||||||
|
|
||||||
print('the action being called is {}'.format(method_name))
|
print('the action being called is {}'.format(method_name))
|
||||||
self.call_method_name(method_name, norm_channel_value)
|
self.actions.call_method_name(method_name, norm_channel_value)
|
||||||
## not sure whether we want to update the screen in general; here - probably not most of the time ...
|
## not sure whether we want to update the screen in general; here - probably not most of the time ...
|
||||||
#if 'cc' not in message_name:
|
#if 'cc' not in message_name:
|
||||||
# self.display.refresh_display()
|
# self.display.refresh_display()
|
||||||
|
|
||||||
def call_method_name(self, method_name, argument=None):
|
|
||||||
if argument is not None:
|
|
||||||
getattr(self.actions, method_name)(argument)
|
|
||||||
else:
|
|
||||||
getattr(self.actions, method_name)()
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -123,26 +123,8 @@ class MidiInput(object):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
norm_message_value = None
|
norm_message_value = None
|
||||||
self.call_method_name(method_name, norm_message_value)
|
self.actions.call_method_name(method_name, norm_message_value)
|
||||||
## only update screen if not continuous - seeing if cc can respond faster if not refreshing screen on every action
|
## only update screen if not continuous - seeing if cc can respond faster if not refreshing screen on every action
|
||||||
if 'continuous' not in message_name:
|
if 'continuous' not in message_name:
|
||||||
self.display.refresh_display()
|
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)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user