mirror of
https://github.com/cyberboy666/r_e_c_u_r.git
synced 2025-12-17 05:39:59 +01:00
Whitespace
This commit is contained in:
@@ -14,14 +14,14 @@ class OscInput(object):
|
||||
self.actions = actions
|
||||
self.data = data
|
||||
self.osc_mappings = data.osc_mappings
|
||||
|
||||
|
||||
self.osc_enabled = False
|
||||
self.osc_server = None
|
||||
self.poll_settings_for_osc_info()
|
||||
|
||||
def poll_settings_for_osc_info(self):
|
||||
self.data.settings['user_input'].setdefault('OSC_INPUT',
|
||||
self.data.default_settings['user_input'].get('OSC_INPUT'))
|
||||
self.data.default_settings['user_input'].get('OSC_INPUT'))
|
||||
osc_setting_enabled = self.data.settings['user_input']['OSC_INPUT']['value'] == 'enabled'
|
||||
if osc_setting_enabled and not self.osc_enabled:
|
||||
self.setup_osc_server()
|
||||
@@ -34,7 +34,7 @@ class OscInput(object):
|
||||
def setup_osc_server(self):
|
||||
ip_address = self.data.get_ip_for_osc_client()
|
||||
if ip_address == 'none':
|
||||
self.message_handler.set_message('INFO', 'osc failed - could not find ip')
|
||||
self.message_handler.set_message('INFO', 'osc failed - could not find ip')
|
||||
return
|
||||
print('%%%%%%%%%%%%%%%%%%%%% setting up external_osc on ', ip_address)
|
||||
server_parser = argparse.ArgumentParser()
|
||||
@@ -44,15 +44,15 @@ class OscInput(object):
|
||||
server_args = server_parser.parse_args()
|
||||
|
||||
this_dispatcher = dispatcher.Dispatcher()
|
||||
|
||||
# this_dispatcher.map("/keyboard/*", self.on_osc_input)
|
||||
# this_dispatcher.map("/shaderparam0", self.on_param_osc_input)
|
||||
# this_dispatcher.map("/shaderparam1", self.on_param_osc_input)
|
||||
# this_dispatcher.map("/shaderparam2", self.on_param_osc_input)
|
||||
# this_dispatcher.map("/shaderparam3", self.on_param_osc_input)
|
||||
# this_dispatcher.map("/shutdown", self.exit_osc_server)
|
||||
|
||||
# this_dispatcher.map("/keyboard/*", self.on_osc_input)
|
||||
# this_dispatcher.map("/shaderparam0", self.on_param_osc_input)
|
||||
# this_dispatcher.map("/shaderparam1", self.on_param_osc_input)
|
||||
# this_dispatcher.map("/shaderparam2", self.on_param_osc_input)
|
||||
# this_dispatcher.map("/shaderparam3", self.on_param_osc_input)
|
||||
# this_dispatcher.map("/shutdown", self.exit_osc_server)
|
||||
this_dispatcher.map("/*", self.on_osc_input)
|
||||
|
||||
|
||||
try:
|
||||
osc_server.ThreadingOSCUDPServer.allow_reuse_address = True
|
||||
server = osc_server.ThreadingOSCUDPServer((server_args.ip, server_args.port), this_dispatcher)
|
||||
@@ -63,7 +63,6 @@ class OscInput(object):
|
||||
except:
|
||||
self.message_handler.set_message('INFO', 'failed to start osc listener')
|
||||
|
||||
|
||||
def exit_osc_server(self, unused_addr, args):
|
||||
print('%%%%%%%%%%%%%%%%%%%%% exiting external_osc')
|
||||
try:
|
||||
@@ -71,7 +70,6 @@ class OscInput(object):
|
||||
self.message_handler.set_message('INFO', 'osc deactive')
|
||||
except:
|
||||
self.message_handler.set_message('INFO', 'osc shutdown failed')
|
||||
|
||||
|
||||
def on_osc_input(self, addr, args):
|
||||
if 'keyboard' in addr:
|
||||
@@ -79,8 +77,7 @@ class OscInput(object):
|
||||
elif 'shutdown' in addr:
|
||||
self.exit_osc_server(addr, args)
|
||||
else:
|
||||
self.on_param_osc_input(addr,args)
|
||||
|
||||
self.on_param_osc_input(addr, args)
|
||||
|
||||
def on_key_osc_input(self, addr, args):
|
||||
args = str(args)
|
||||
@@ -98,7 +95,7 @@ class OscInput(object):
|
||||
print("the address", addr)
|
||||
|
||||
self.run_action_for_osc_channel(addr, param_value=args)
|
||||
|
||||
|
||||
def run_action_for_osc_channel(self, channel, param_value=None):
|
||||
this_mapping = self.osc_mappings[channel]
|
||||
if type(self.data.control_mode) is list:
|
||||
@@ -111,16 +108,15 @@ class OscInput(object):
|
||||
mode = self.data.control_mode
|
||||
elif 'DEFAULT' in this_mapping:
|
||||
mode = 'DEFAULT'
|
||||
|
||||
|
||||
if self.data.function_on and len(this_mapping[mode]) > 1:
|
||||
method_name = this_mapping[mode][1]
|
||||
if self.data.settings['sampler']['FUNC_GATED']['value'] == 'off':
|
||||
self.data.function_on = False
|
||||
else:
|
||||
method_name = this_mapping[mode][0]
|
||||
|
||||
|
||||
self.actions.call_method_name(method_name, param_value)
|
||||
|
||||
if 'continuous' not in method_name:
|
||||
self.display.refresh_display()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user