mirror of
https://github.com/cyberboy666/r_e_c_u_r.git
synced 2025-12-11 19:00:04 +01:00
improvements+fixes to plugin recur screens, WJSendPlugin has a working recur screen too now
This commit is contained in:
@@ -156,7 +156,7 @@ class SequencePlugin(Plugin):
|
|||||||
def run_sequence(self, position):
|
def run_sequence(self, position):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
from typing import Pattern
|
||||||
class ActionsPlugin(Plugin):
|
class ActionsPlugin(Plugin):
|
||||||
def __init__(self, plugin_collection):
|
def __init__(self, plugin_collection):
|
||||||
super().__init__(plugin_collection)
|
super().__init__(plugin_collection)
|
||||||
@@ -168,12 +168,21 @@ class ActionsPlugin(Plugin):
|
|||||||
]
|
]
|
||||||
|
|
||||||
def is_handled(self, method_name):
|
def is_handled(self, method_name):
|
||||||
|
|
||||||
|
if isinstance(self, DisplayPlugin):
|
||||||
|
if method_name in self.get_display_modes():
|
||||||
|
return True
|
||||||
|
|
||||||
for a in self.parserlist:
|
for a in self.parserlist:
|
||||||
if (a[0]==method_name):
|
if (a[0]==method_name):
|
||||||
return True
|
return True
|
||||||
regex = a[0]
|
regex = a[0]
|
||||||
me = a[1]
|
me = a[1]
|
||||||
|
#if not isinstance(regex, Pattern):
|
||||||
|
# continue
|
||||||
|
|
||||||
matches = re.match(regex, method_name)
|
matches = re.match(regex, method_name)
|
||||||
|
|
||||||
if matches:
|
if matches:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -182,6 +191,9 @@ class ActionsPlugin(Plugin):
|
|||||||
for a in self.parserlist:
|
for a in self.parserlist:
|
||||||
regex = a[0]
|
regex = a[0]
|
||||||
me = a[1]
|
me = a[1]
|
||||||
|
#if not isinstance(regex, Pattern):
|
||||||
|
# continue
|
||||||
|
|
||||||
matches = re.search(regex, method_name)
|
matches = re.search(regex, method_name)
|
||||||
|
|
||||||
if matches:
|
if matches:
|
||||||
|
|||||||
@@ -468,9 +468,18 @@ class Display(object):
|
|||||||
else:
|
else:
|
||||||
selected_list.append('<{}>'.format(v[:2].lower()))
|
selected_list.append('<{}>'.format(v[:2].lower()))
|
||||||
# 18 char to PURPLE : 18 - 29 ,18 after
|
# 18 char to PURPLE : 18 - 29 ,18 after
|
||||||
|
if selected_list_index>4:
|
||||||
|
selected_list = selected_list[selected_list_index-4:len(selected_list)]
|
||||||
|
selected_list = ['--'] + selected_list
|
||||||
selected_string = ''.join(selected_list)
|
selected_string = ''.join(selected_list)
|
||||||
output = ('-' * (19 - (selected_list_index * 4))) + selected_string + ('-' * (18 - ((len(display_modes) - selected_list_index - 1) * 4)))
|
#if len(selected_string)<19:
|
||||||
|
# selected_string += '-'*(21-len(selected_string))
|
||||||
|
#selected_string = selected_string[:30]
|
||||||
|
#wid = 19 #int(2+((len(display_modes)/2)*4))
|
||||||
|
output = ('-' * ((19) - (selected_list_index * 4))) + \
|
||||||
|
selected_string + \
|
||||||
|
('-' * (18 - ((len(display_modes) - selected_list_index - 1) * 4)))
|
||||||
|
output = output[0:46]
|
||||||
return output
|
return output
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|||||||
@@ -42,40 +42,44 @@
|
|||||||
"control_change 48": {
|
"control_change 48": {
|
||||||
"DEFAULT": ["set_the_shader_param_0_layer_offset_0_continuous","set_strobe_amount_continuous"],
|
"DEFAULT": ["set_the_shader_param_0_layer_offset_0_continuous","set_strobe_amount_continuous"],
|
||||||
"NAV_DETOUR": ["set_detour_speed_position_continuous"],
|
"NAV_DETOUR": ["set_detour_speed_position_continuous"],
|
||||||
"MANIPULA": ["wj_set_colour_T_x","wj_set_position_N_x"]
|
"WJMXSEND": ["wj_set_position_N_x"],
|
||||||
|
"MANIPULA": ["set_variable_A"]
|
||||||
},
|
},
|
||||||
"control_change 49": {
|
"control_change 49": {
|
||||||
"DEFAULT": ["set_the_shader_param_1_layer_offset_0_continuous","set_shader_speed_layer_0_amount"],
|
"DEFAULT": ["set_the_shader_param_1_layer_offset_0_continuous","set_shader_speed_layer_0_amount"],
|
||||||
"NAV_DETOUR": ["set_detour_start_continuous"],
|
"NAV_DETOUR": ["set_detour_start_continuous"],
|
||||||
"MANIPULA": ["wj_set_colour_T_y","wj_set_position_N_y"]
|
"WJMXSEND": ["wj_set_position_N_y"],
|
||||||
|
"MANIPULA": ["f:sin(x*pi):|set_variable_SIN"]
|
||||||
},
|
},
|
||||||
"control_change 50": {
|
"control_change 50": {
|
||||||
"DEFAULT": ["set_the_shader_param_2_layer_offset_0_continuous","set_shader_speed_layer_1_amount"],
|
"DEFAULT": ["set_the_shader_param_2_layer_offset_0_continuous","set_shader_speed_layer_1_amount"],
|
||||||
"NAV_DETOUR": ["set_detour_end_continuous"]
|
"NAV_DETOUR": ["set_detour_end_continuous"],
|
||||||
|
"WJMXSEND": ["wj_set_colour_T_x"]
|
||||||
},
|
},
|
||||||
"control_change 51": {
|
"control_change 51": {
|
||||||
"DEFAULT": ["set_the_shader_param_3_layer_offset_0_continuous","set_shader_speed_layer_2_amount"],
|
"DEFAULT": ["set_the_shader_param_3_layer_offset_0_continuous","set_shader_speed_layer_2_amount"],
|
||||||
"NAV_DETOUR": ["set_detour_end_continuous"]
|
"NAV_DETOUR": ["set_detour_end_continuous"]
|
||||||
|
"WJMXSEND": ["wj_set_colour_T_y"]
|
||||||
},
|
},
|
||||||
"control_change 52": {
|
"control_change 52": {
|
||||||
"DEFAULT": ["set_the_shader_param_0_layer_offset_1_continuous","set_param_0_layer_offset_0_modulation_level_continuous"],
|
"DEFAULT": ["set_the_shader_param_0_layer_offset_1_continuous","set_param_0_layer_offset_0_modulation_level_continuous"],
|
||||||
"NAV_DETOUR": ["set_detour_speed_position_continuous"],
|
"NAV_DETOUR": ["set_detour_speed_position_continuous"],
|
||||||
"MANIPULA": ["wj_set_mix"]
|
"WJMXSEND": ["wj_set_mix","wj_send_append_pad_2_VCG:T"]
|
||||||
},
|
},
|
||||||
"control_change 53": {
|
"control_change 53": {
|
||||||
"DEFAULT": ["set_the_shader_param_1_layer_offset_1_continuous","set_param_1_layer_offset_0_modulation_level_continuous"],
|
"DEFAULT": ["set_the_shader_param_1_layer_offset_1_continuous","set_param_1_layer_offset_0_modulation_level_continuous"],
|
||||||
"NAV_DETOUR": ["set_detour_start_continuous"],
|
"NAV_DETOUR": ["set_detour_start_continuous"],
|
||||||
"MANIPULA": ["wj_set_back_colour_x"]
|
"WJMXSEND": ["wj_set_back_colour_x","wj_set_back_wash_colour_x"]
|
||||||
},
|
},
|
||||||
"control_change 54": {
|
"control_change 54": {
|
||||||
"DEFAULT": ["set_the_shader_param_2_layer_offset_1_continuous","set_param_2_layer_offset_0_modulation_level_continuous"],
|
"DEFAULT": ["set_the_shader_param_2_layer_offset_1_continuous","set_param_2_layer_offset_0_modulation_level_continuous"],
|
||||||
"NAV_DETOUR": ["set_detour_end_continuous"],
|
"NAV_DETOUR": ["set_detour_end_continuous"],
|
||||||
"MANIPULA": ["wj_set_back_colour_y"]
|
"WJMXSEND": ["wj_set_back_colour_y","wj_set_back_wash_colour_y"]
|
||||||
},
|
},
|
||||||
"control_change 55": {
|
"control_change 55": {
|
||||||
"DEFAULT": ["set_the_shader_param_3_layer_offset_1_continuous","set_param_3_layer_offset_0_modulation_level_continuous"],
|
"DEFAULT": ["set_the_shader_param_3_layer_offset_1_continuous","set_param_3_layer_offset_0_modulation_level_continuous"],
|
||||||
"NAV_DETOUR": ["set_detour_end_continuous"],
|
"NAV_DETOUR": ["set_detour_end_continuous"],
|
||||||
"MANIPULA": ["wj_set_back_colour_z"]
|
"WJMXSEND": ["wj_set_back_colour_z","wj_set_back_wash_colour_z"]
|
||||||
},
|
},
|
||||||
"control_change 56": {
|
"control_change 56": {
|
||||||
"DEFAULT": ["set_the_shader_param_0_layer_offset_2_continuous"],
|
"DEFAULT": ["set_the_shader_param_0_layer_offset_2_continuous"],
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ class ManipulatePlugin(ActionsPlugin,DisplayPlugin):
|
|||||||
( r"^set_variable_([a-zA-Z0-9]+)$", self.set_variable ),
|
( r"^set_variable_([a-zA-Z0-9]+)$", self.set_variable ),
|
||||||
( r"^([A-Z0-9]+)>(.*)$", self.recall_variable ), # recall variable and pipe into righthand side eg ```VAR1>invert|set_the_shader_.....```
|
( r"^([A-Z0-9]+)>(.*)$", self.recall_variable ), # recall variable and pipe into righthand side eg ```VAR1>invert|set_the_shader_.....```
|
||||||
( r"^(.*)>\&(.*)$", self.run_multi ), # pick up piped commands that duplicate a chain of values last
|
( r"^(.*)>\&(.*)$", self.run_multi ), # pick up piped commands that duplicate a chain of values last
|
||||||
( "MANIPULA", None )
|
|
||||||
]
|
]
|
||||||
|
|
||||||
def show_plugin(self, display, display_mode):
|
def show_plugin(self, display, display_mode):
|
||||||
@@ -70,10 +69,10 @@ class ManipulatePlugin(ActionsPlugin,DisplayPlugin):
|
|||||||
|
|
||||||
|
|
||||||
def get_display_modes(self):
|
def get_display_modes(self):
|
||||||
return ["MANIPULA",None] #"NAV_MANIPULATE"]
|
return ["MANIPULA","NAV_MANI"] #"NAV_MANIPULATE"]
|
||||||
|
|
||||||
def run_multi(self, action1, action2, value):
|
def run_multi(self, action1, action2, value):
|
||||||
print("multi running %s and %s with value %s" % (action1, action2, value))
|
print("ManipulatePlugin>> multi-running '%s' and '%s' with value %s" % (action1, action2, value))
|
||||||
self.pc.actions.call_method_name(action1, value)
|
self.pc.actions.call_method_name(action1, value)
|
||||||
self.pc.actions.call_method_name(action2, value)
|
self.pc.actions.call_method_name(action2, value)
|
||||||
|
|
||||||
@@ -89,20 +88,20 @@ class ManipulatePlugin(ActionsPlugin,DisplayPlugin):
|
|||||||
|
|
||||||
def formula(self, formula, action, value):
|
def formula(self, formula, action, value):
|
||||||
self.variables['x'] = value
|
self.variables['x'] = value
|
||||||
print("evaluating formula `%s` with value `%s`" % (formula, value))
|
print("ManipulatePlugin>> evaluating formula `%s` with value `%s`" % (formula, value))
|
||||||
value = eval(formula, globals(), self.variables)
|
value = eval(formula, globals(), self.variables)
|
||||||
print("got evaluated value `%s`" % value)
|
print("ManipulatePlugin>> got evaluated value `%s`" % value)
|
||||||
|
|
||||||
self.pc.actions.call_method_name(
|
self.pc.actions.call_method_name(
|
||||||
action, value
|
action, value
|
||||||
)
|
)
|
||||||
|
|
||||||
def set_variable(self, var_name, value):
|
def set_variable(self, var_name, value):
|
||||||
print("set_variable (%s) to %s" % (var_name, value))
|
print("ManipulatePlugin>> set_variable (%s) to %s" % (var_name, value))
|
||||||
self.variables[var_name] = value
|
self.variables[var_name] = value
|
||||||
|
|
||||||
def recall_variable(self, var_name, action, *args):
|
def recall_variable(self, var_name, action, *args):
|
||||||
print ("recall_variable (%s) as %s" % (var_name,args))
|
print ("ManipulatePlugin>> recall_variable (%s) as %s" % (var_name,args))
|
||||||
self.pc.actions.call_method_name(
|
self.pc.actions.call_method_name(
|
||||||
action, self.variables.get(var_name)# + list(args)
|
action, self.variables.get(var_name)# + list(args)
|
||||||
)
|
)
|
||||||
@@ -118,14 +117,14 @@ class ManipulatePlugin(ActionsPlugin,DisplayPlugin):
|
|||||||
tail, value
|
tail, value
|
||||||
)"""
|
)"""
|
||||||
|
|
||||||
def pipe(self, left, right, value):
|
"""def pipe(self, left, right, value):
|
||||||
# ??
|
# ??
|
||||||
print("pipe calling left '%s' and right '%s', both with value '%s'" % (left, right, value))
|
print("ManipulatePlugin>> pipe calling left '%s' and right '%s', both with value '%s'" % (left, right, value))
|
||||||
self.pc.actions.call_method_name(
|
self.pc.actions.call_method_name(
|
||||||
left, value
|
left, value
|
||||||
)
|
)
|
||||||
|
|
||||||
self.pc.actions.call_method_name(
|
self.pc.actions.call_method_name(
|
||||||
right, value
|
right, value
|
||||||
)
|
)"""
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import serial
|
import serial
|
||||||
from serial import Serial
|
from serial import Serial
|
||||||
import data_centre.plugin_collection
|
import data_centre.plugin_collection
|
||||||
from data_centre.plugin_collection import ActionsPlugin, SequencePlugin
|
from data_centre.plugin_collection import ActionsPlugin, SequencePlugin, DisplayPlugin
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
class WJSendPlugin(ActionsPlugin,SequencePlugin):
|
class WJSendPlugin(ActionsPlugin,SequencePlugin,DisplayPlugin):
|
||||||
disabled = False#True
|
disabled = False#True
|
||||||
ser = None
|
ser = None
|
||||||
# from http://depot.univ-nc.nc/sources/boxtream-0.9999/boxtream/switchers/panasonic.py
|
# from http://depot.univ-nc.nc/sources/boxtream-0.9999/boxtream/switchers/panasonic.py
|
||||||
@@ -54,6 +54,19 @@ class WJSendPlugin(ActionsPlugin,SequencePlugin):
|
|||||||
import traceback
|
import traceback
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
|
def show_plugin(self, display, display_mode):
|
||||||
|
from tkinter import Text, END
|
||||||
|
#super(DisplayPlugin).show_plugin(display, display_mode)
|
||||||
|
#print("show plugin?")
|
||||||
|
display.display_text.insert(END, '{} \n'.format(display.body_title))
|
||||||
|
display.display_text.insert(END, "test from WJSendPlugin!\n\n")
|
||||||
|
|
||||||
|
for queue, last in self.last.items():
|
||||||
|
display.display_text.insert(END, "last %s:\t%s\n" % (queue,self.last.get(queue)))
|
||||||
|
|
||||||
|
def get_display_modes(self):
|
||||||
|
return ["WJMXSEND","NAV_WJMX"]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def parserlist(self):
|
def parserlist(self):
|
||||||
return [
|
return [
|
||||||
@@ -61,10 +74,11 @@ class WJSendPlugin(ActionsPlugin,SequencePlugin):
|
|||||||
( r"^wj_send_serial_([0-9a-zA-Z:]*)$", self.send_serial_string ),
|
( r"^wj_send_serial_([0-9a-zA-Z:]*)$", self.send_serial_string ),
|
||||||
( r"^wj_set_colour_([A|B|T])_([x|y])$", self.set_colour ),
|
( r"^wj_set_colour_([A|B|T])_([x|y])$", self.set_colour ),
|
||||||
( r"^wj_set_back_colour_([x|y|z])$", self.set_back_colour ),
|
( r"^wj_set_back_colour_([x|y|z])$", self.set_back_colour ),
|
||||||
|
( r"^wj_set_back_wash_colour_([x|y|z])$", self.set_back_wash_colour ),
|
||||||
( r"^wj_set_position_([N|L])_([x|y])$", self.set_position ),
|
( r"^wj_set_position_([N|L])_([x|y])$", self.set_position ),
|
||||||
( r"^wj_set_mix$", self.set_mix ),
|
( r"^wj_set_mix$", self.set_mix ),
|
||||||
( r"^wj_send_append_pad_([0-9]*)_(([A-Z:[0-9a-zA-Z])$", self.send_append_pad ),
|
( r"^wj_send_append_pad_([0-9]*)_([[:0-9a-zA-Z]*)$", self.send_append_pad ),
|
||||||
( r"^wj_send_append_([A-Z:[0-9a-zA-Z])$", self.send_append ),
|
( r"^wj_send_append_([:0-9a-zA-Z]*)$", self.send_append ),
|
||||||
]
|
]
|
||||||
|
|
||||||
def send_serial_string(self, string):
|
def send_serial_string(self, string):
|
||||||
@@ -128,6 +142,22 @@ class WJSendPlugin(ActionsPlugin,SequencePlugin):
|
|||||||
output = "VBM:{:02X}{:02X}{:02X}".format(self.back_colour_x,self.back_colour_y,self.back_colour_z) #,random.randint(0,255))
|
output = "VBM:{:02X}{:02X}{:02X}".format(self.back_colour_x,self.back_colour_y,self.back_colour_z) #,random.randint(0,255))
|
||||||
self.send('VBM', output)
|
self.send('VBM', output)
|
||||||
|
|
||||||
|
back_wash_colour_x = 127
|
||||||
|
back_wash_colour_y = 127
|
||||||
|
back_wash_colour_z = 127
|
||||||
|
def set_back_wash_colour(self, dim, value):
|
||||||
|
# chan can be A, B or T (both)
|
||||||
|
if dim=='x':
|
||||||
|
self.back_wash_colour_x = int(255*value)
|
||||||
|
elif dim=='y':
|
||||||
|
self.back_wash_colour_y = int(255*value)
|
||||||
|
elif dim=='z':
|
||||||
|
self.back_wash_colour_z = int(255*value)
|
||||||
|
|
||||||
|
output = "VBW:{:02X}{:02X}{:02X}".format(self.back_wash_colour_x,self.back_wash_colour_y,self.back_wash_colour_z) #,random.randint(0,255))
|
||||||
|
self.send('VBW', output)
|
||||||
|
|
||||||
|
|
||||||
position_x = 127
|
position_x = 127
|
||||||
position_y = 127
|
position_y = 127
|
||||||
def set_position(self, mode, dim, value):
|
def set_position(self, mode, dim, value):
|
||||||
|
|||||||
Reference in New Issue
Block a user