Läuft die Voice Acoustic VA-Remotecontrol (AllDSP AllControl) nativ unter Linux auf echtem wxGTK 3.0 — ohne Wine und ohne dekompilierten App-Code. Ausgeführt wird das unveränderte Python-2.7-Bytecode aus dem macOS-.app; C-Extensions (wxGTK/numpy/ scipy/PortAudio) kommen nativ aus Debian stretch. Enthält: va/ (Original-.pyc + pure-Python-Libs + Assets + launch.py mit den drei Linux-Fixes), Dockerfile/run.sh/entrypoint.sh, reference/ (dekompilierter Quellcode zum Debuggen) und README/STATUS. img.cache (378 MB, regenerierbar) ist per .gitignore ausgeschlossen. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
709 lines
32 KiB
Python
709 lines
32 KiB
Python
# uncompyle6 version 3.9.3
|
|
# Python bytecode version base 2.6 (62161)
|
|
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
|
# [GCC 14.2.0]
|
|
# Embedded file name: select_keys.pyc
|
|
# Compiled at: 2025-03-13 16:01:06
|
|
import wx, os, data_model, traceback, one_unit, ConfigParser, protocol, sys, mytime, wx.lib.buttons
|
|
mac_names = 'posix'
|
|
if os.name in mac_names:
|
|
newline = '\n'
|
|
else:
|
|
newline = '\r\n'
|
|
global_text = {}
|
|
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_CHECK_PASSWORD, 0, 0)
|
|
global_text[key] = 'Password'
|
|
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_CHECK_PIN, 0, 0)
|
|
global_text[key] = 'PIN'
|
|
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_GAIN, 0, 0)
|
|
global_text[key] = 'Master Volume'
|
|
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_GAIN, 0, 1)
|
|
global_text[key] = 'Bass'
|
|
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_GAIN, 0, 2)
|
|
global_text[key] = 'Mid'
|
|
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_GAIN, 0, 3)
|
|
global_text[key] = 'Treble'
|
|
key = data_model.Key(protocol.STRUCT_ID_PRESET_GLOBAL, protocol.MEMBER_ID_PRESET_NUMBER, 0, 0)
|
|
global_text[key] = 'Preset Selection'
|
|
key = data_model.Key(protocol.STRUCT_ID_PRESET_GLOBAL, protocol.MEMBER_ID_SHORT_NAME, 0, 0)
|
|
global_text[key] = 'Preset Name'
|
|
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_HARDWARE_STATUS_FLAGS, 0, 0)
|
|
global_text[key] = 'Hardware Settings'
|
|
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_SHORT_NAME, 0, 0)
|
|
global_text[key] = 'Unit Name'
|
|
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_STANDBY_DELAY, 0, 0)
|
|
global_text[key] = 'Standby Delay'
|
|
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_CONNECTOR_NAME, 0, 0)
|
|
global_text[key] = 'Hardware Input 1'
|
|
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_CONNECTOR_NAME, 1, 0)
|
|
global_text[key] = 'Hardware Input 2'
|
|
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_CONNECTOR_NAME, 2, 0)
|
|
global_text[key] = 'Hardware Input 3'
|
|
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_CONNECTOR_NAME, 3, 0)
|
|
global_text[key] = 'Hardware Input 4'
|
|
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_CONNECTOR_NAME, 4, 0)
|
|
global_text[key] = 'Hardware Input 5'
|
|
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_CONNECTOR_NAME, 5, 0)
|
|
global_text[key] = 'Hardware Input 6'
|
|
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_CONNECTOR_NAME, 6, 0)
|
|
global_text[key] = 'Hardware Input 7'
|
|
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_CONNECTOR_NAME, 7, 0)
|
|
global_text[key] = 'Hardware Input 8'
|
|
cmd_text = {}
|
|
key = data_model.Key(protocol.STRUCT_ID_COMMAND, protocol.MEMBER_ID_COMMAND, 0, protocol.cmdLoadPreset)
|
|
cmd_text[key] = 'Load Preset'
|
|
key = data_model.Key(protocol.STRUCT_ID_COMMAND, protocol.MEMBER_ID_COMMAND, 0, protocol.cmdSavePreset)
|
|
cmd_text[key] = 'Save Preset'
|
|
key = data_model.Key(protocol.STRUCT_ID_COMMAND, protocol.MEMBER_ID_COMMAND, 0, protocol.cmdGotoStandby)
|
|
cmd_text[key] = 'Go to Standby'
|
|
key = data_model.Key(protocol.STRUCT_ID_COMMAND, protocol.MEMBER_ID_COMMAND, 0, protocol.cmdExitStandby)
|
|
cmd_text[key] = 'Exit Standby'
|
|
key = data_model.Key(protocol.STRUCT_ID_COMMAND, protocol.MEMBER_ID_COMMAND, 0, protocol.cmdActivateNewNetworkSettings)
|
|
cmd_text[key] = 'Apply Network Settings'
|
|
relative_structure_ids = (
|
|
protocol.STRUCT_ID_GAIN,
|
|
protocol.STRUCT_ID_DELAY)
|
|
|
|
class Dialog(wx.Dialog):
|
|
|
|
def __init__(self, parent, id, title, infotext='', unit_type=None, existing_links=[], bg=None, size=(510, 500), bgcolour=(
|
|
220, 220, 220), fgcolour=(70, 70, 70), only_numbers=False, group_type=None, restrictMemberFormat=False, restrictDataType=None, blockPEQBandsOver10=True):
|
|
wx.Dialog.__init__(self, None, wx.ID_ANY, title, size=size, style=wx.STAY_ON_TOP | wx.DEFAULT_DIALOG_STYLE)
|
|
self.result = existing_links
|
|
if bg != None:
|
|
self.bg = bg
|
|
self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
|
|
self.frame_height = 2 * wx.SystemSettings.GetMetric(wx.SYS_CAPTION_Y) + wx.SystemSettings.GetMetric(wx.SYS_BORDER_Y)
|
|
if os.name in mac_names:
|
|
self.frame_height = 24
|
|
self.infotext = None
|
|
if infotext != '':
|
|
textstring = wx.StaticText(self, -1, infotext, style=wx.ALIGN_LEFT, pos=(25,
|
|
10))
|
|
textstring.SetForegroundColour(fgcolour)
|
|
self.infotext = textstring
|
|
self.infostring = infotext
|
|
if os.name in mac_names:
|
|
textstring.SetFont(wx.Font(11, wx.SWISS, wx.NORMAL, wx.NORMAL))
|
|
textstring.Wrap(350)
|
|
self.group_type = group_type
|
|
self.existing_links = ''
|
|
self.first_time = True
|
|
self.member_ids = []
|
|
self.last_member_id = None
|
|
style = wx.TE_READONLY
|
|
existinglabel = wx.StaticText(self, -1, 'Active Links:', style=wx.ALIGN_LEFT, pos=(25,
|
|
30))
|
|
self.existing = wx.TextCtrl(self, 4, self.existing_links, style=style | wx.TE_MULTILINE, pos=(130,
|
|
30), size=(370,
|
|
280))
|
|
self.keys = []
|
|
levels = [
|
|
5, 18, 19, 20, 21]
|
|
models = [_[1] for fw in range(0, 255)]
|
|
models.append('')
|
|
paths = []
|
|
for model in models:
|
|
for level in levels:
|
|
path = os.path.join(one_unit.app.cwd, one_unit.app.skin_path, unit_type + model + level, 'default.cfg')
|
|
if os.path.exists(path):
|
|
paths.append(path)
|
|
|
|
model_firmware = 0
|
|
self.exclusions = []
|
|
self.exclusions.append(data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_HARDWARE_STATUS_FLAGS, 0, 0))
|
|
self.keys.append(data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_CHECK_PASSWORD, 0, 0))
|
|
self.keys.append(data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_CHECK_PIN, 0, 0))
|
|
self.keys.append(data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_GAIN, 0, 0))
|
|
self.keys.append(data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_GAIN, 0, 1))
|
|
self.keys.append(data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_GAIN, 0, 2))
|
|
self.keys.append(data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_GAIN, 0, 3))
|
|
self.keys.append(data_model.Key(protocol.STRUCT_ID_COMMAND, protocol.MEMBER_ID_COMMAND, 0, protocol.cmdLoadPreset))
|
|
self.keys.append(data_model.Key(protocol.STRUCT_ID_COMMAND, protocol.MEMBER_ID_COMMAND, 0, protocol.cmdSavePreset))
|
|
self.keys.append(data_model.Key(protocol.STRUCT_ID_COMMAND, protocol.MEMBER_ID_COMMAND, 0, protocol.cmdGotoStandby))
|
|
self.keys.append(data_model.Key(protocol.STRUCT_ID_COMMAND, protocol.MEMBER_ID_COMMAND, 0, protocol.cmdExitStandby))
|
|
self.keys.append(data_model.Key(protocol.STRUCT_ID_PRESET_GLOBAL, protocol.MEMBER_ID_PRESET_NUMBER, 0, 0))
|
|
self.keys.append(data_model.Key(protocol.STRUCT_ID_PRESET_GLOBAL, protocol.MEMBER_ID_SHORT_NAME, 0, 0))
|
|
for path in paths:
|
|
try:
|
|
print mytime.displayTime() + 'sk.Reading config from', path
|
|
self.config = ConfigParser.ConfigParser()
|
|
self.config.read(path)
|
|
for var in self.config.sections():
|
|
try:
|
|
struct_id = self.config.getint(var, 'struct_id')
|
|
member_id = self.config.getint(var, 'member_id')
|
|
num = self.config.getint(var, 'num')
|
|
except:
|
|
continue
|
|
|
|
if struct_id in (
|
|
protocol.STRUCT_ID_VU,
|
|
protocol.STRUCT_ID_GR,
|
|
protocol.STRUCT_ID_INTERNAL):
|
|
continue
|
|
if member_id in (
|
|
protocol.MEMBER_ID_AMP_READINGS,
|
|
protocol.MEMBER_ID_CURRENT_USER,
|
|
protocol.MEMBER_ID_AMP_READINGS_2,
|
|
protocol.MEMBER_ID_AES_FS,
|
|
protocol.MEMBER_ID_MODEL_NUMBER,
|
|
protocol.MEMBER_ID_MODEL_FIRMWARE,
|
|
protocol.MEMBER_ID_MODEL_NAME):
|
|
continue
|
|
channels = self.channels_for_var(var)
|
|
for channel in channels:
|
|
key = data_model.Key(struct_id, member_id, channel, num)
|
|
if key not in self.keys:
|
|
self.keys.append(key)
|
|
|
|
except:
|
|
traceback.print_exc(file=sys.stdout)
|
|
|
|
model_firmware += 1
|
|
|
|
if self.group_type == 'Relative':
|
|
new_keys = []
|
|
for key in self.keys:
|
|
if key.struct_id not in relative_structure_ids:
|
|
continue
|
|
new_keys.append(key)
|
|
|
|
self.keys = new_keys
|
|
if self.group_type == 'Advanced':
|
|
try:
|
|
struct_ids = eval(one_unit.app.main_config.get('ROOT', 'advanced_structure_ids'))
|
|
new_keys = []
|
|
for key in self.keys:
|
|
if key.struct_id not in struct_ids:
|
|
continue
|
|
new_keys.append(key)
|
|
|
|
self.keys = new_keys
|
|
except:
|
|
pass
|
|
|
|
try:
|
|
struct_id_exclusions = eval(one_unit.app.main_config.get('ROOT', 'grouping_struct_id_exclusions'))
|
|
print 'sk.found exclusions', struct_id_exclusions
|
|
new_keys = []
|
|
for key in self.keys:
|
|
if key in self.exclusions:
|
|
continue
|
|
if key.struct_id in struct_id_exclusions.keys():
|
|
if key.channel in struct_id_exclusions[key.struct_id]:
|
|
continue
|
|
new_keys.append(key)
|
|
|
|
self.keys = new_keys
|
|
except:
|
|
pass
|
|
|
|
try:
|
|
key_exclusions = eval(one_unit.app.main_config.get('ROOT', 'grouping_key_exclusions'))
|
|
new_keys = []
|
|
for key in self.keys:
|
|
if key in key_exclusions:
|
|
continue
|
|
new_keys.append(key)
|
|
|
|
self.keys = new_keys
|
|
except:
|
|
pass
|
|
|
|
try:
|
|
key_exclusions = eval(one_unit.app.main_config.get('ROOT', 'grouping_channel_exclusions'))
|
|
new_keys = []
|
|
for key in self.keys:
|
|
try:
|
|
if key.channel >= 128 and 'outputs' in key_exclusions or key.channel < 128 and 'inputs' in key_exclusions:
|
|
continue
|
|
except:
|
|
pass
|
|
|
|
try:
|
|
if key.channel in key_exclusions:
|
|
continue
|
|
except:
|
|
pass
|
|
|
|
new_keys.append(key)
|
|
|
|
self.keys = new_keys
|
|
except:
|
|
pass
|
|
|
|
if only_numbers == True:
|
|
new_keys = []
|
|
for key in self.keys:
|
|
if protocol.get_member_format(key.member_id) not in ('>h', '>H', '>L',
|
|
'>l'):
|
|
continue
|
|
new_keys.append(key)
|
|
|
|
self.keys = new_keys
|
|
if restrictMemberFormat == True and len(self.result) > 0:
|
|
memberFormat = protocol.get_member_format(self.result[0].member_id)
|
|
print 'sk.restricting member formats to', memberFormat
|
|
new_keys = []
|
|
for key in self.keys:
|
|
if protocol.get_member_format(key.member_id) == memberFormat:
|
|
new_keys.append(key)
|
|
|
|
self.keys = new_keys
|
|
if restrictDataType != None:
|
|
print 'sk.restricting data type to', restrictDataType
|
|
new_keys = []
|
|
for key in self.keys:
|
|
if protocol.get_member_data_type(key.member_id) == restrictDataType:
|
|
new_keys.append(key)
|
|
|
|
self.keys = new_keys
|
|
if blockPEQBandsOver10 == True:
|
|
print 'sk.restricting PEQ index to 0...9'
|
|
new_keys = []
|
|
for key in self.keys:
|
|
if key.struct_id == protocol.STRUCT_ID_PEQ and key.num > 9:
|
|
continue
|
|
new_keys.append(key)
|
|
|
|
self.keys = new_keys
|
|
self.struct_ids = []
|
|
self.struct_id_text = {'All': 'All'}
|
|
for key in self.keys:
|
|
if key.struct_id < 0:
|
|
continue
|
|
if key.struct_id not in self.struct_ids:
|
|
self.struct_ids.append(key.struct_id)
|
|
|
|
self.struct_ids.sort()
|
|
try:
|
|
struct_id_renames = eval(one_unit.app.main_config.get('ROOT', 'grouping_struct_id_renames'))
|
|
except:
|
|
struct_id_renames = {}
|
|
|
|
for struct_id in self.struct_ids:
|
|
try:
|
|
if struct_id in struct_id_renames.keys():
|
|
self.struct_id_text[struct_id] = struct_id_renames[struct_id]
|
|
elif struct_id == protocol.STRUCT_ID_PRESET_GLOBAL:
|
|
self.struct_id_text[struct_id] = 'Presets'
|
|
else:
|
|
self.struct_id_text[struct_id] = protocol.STRUCT_ID_TEXT[struct_id]
|
|
except:
|
|
print mytime.displayTime() + ' undefined structure ID:', struct_id
|
|
|
|
style = wx.BORDER_NONE | wx.CB_READONLY
|
|
cat_label = wx.StaticText(self, -1, 'Category:', style=wx.ALIGN_LEFT, pos=(25,
|
|
323))
|
|
par_label = wx.StaticText(self, -1, 'Parameter:', style=wx.ALIGN_LEFT, pos=(25,
|
|
353))
|
|
chan_label = wx.StaticText(self, -1, 'Channel:', style=wx.ALIGN_LEFT, pos=(25,
|
|
383))
|
|
index_label = wx.StaticText(self, -1, 'Index:', style=wx.ALIGN_LEFT, pos=(25,
|
|
413))
|
|
self.select_category = wx.ComboBox(self, 30, choices=self.struct_id_text.values(), style=style, pos=(130,
|
|
320), size=(250,
|
|
25))
|
|
self.select_category.SetStringSelection(self.struct_id_text[self.struct_id_text.keys()[0]])
|
|
self.select_parameter = wx.ComboBox(self, 30, choices=[], style=style, pos=(130,
|
|
350), size=(250,
|
|
25))
|
|
self.select_channel = wx.ComboBox(self, 30, choices=[], style=style, pos=(130,
|
|
380), size=(250,
|
|
25))
|
|
self.select_index = wx.ComboBox(self, 30, choices=[], style=style, pos=(130,
|
|
410), size=(250,
|
|
25))
|
|
self.add_button = wx.lib.buttons.GenButton(self, 3, 'Add', pos=(400, 320), size=(100,
|
|
20))
|
|
self.remove_button = wx.lib.buttons.GenButton(self, 4, 'Remove', pos=(400,
|
|
350), size=(100,
|
|
20))
|
|
ok_button = wx.Button(self, 1, 'Ok', pos=(335, 445), size=(70, 20))
|
|
cancel_button = wx.Button(self, 2, 'Cancel', pos=(415, 445), size=(70, 20))
|
|
self.Centre()
|
|
self.parent = parent
|
|
self.SetBackgroundColour(bgcolour)
|
|
self.Bind(wx.EVT_BUTTON, self.OnOK, id=1)
|
|
self.Bind(wx.EVT_BUTTON, self.OnCancel, id=2)
|
|
self.Bind(wx.EVT_BUTTON, self.OnAdd, id=3)
|
|
self.Bind(wx.EVT_BUTTON, self.OnRemove, id=4)
|
|
self.CenterOnScreen()
|
|
self.response = None
|
|
self.last_struct_id = -1
|
|
self.last_selected_channel = 'All'
|
|
self.refresh_timer = wx.Timer(self)
|
|
self.Bind(wx.EVT_TIMER, self.on_timer, self.refresh_timer)
|
|
self.refresh_timer.Start(100)
|
|
return
|
|
|
|
def getStructIDText(self, struct_id):
|
|
if struct_id not in self.struct_id_text:
|
|
self.struct_id_text[struct_id] = protocol.STRUCT_ID_TEXT[struct_id]
|
|
return self.struct_id_text[struct_id]
|
|
|
|
def OnAdd(self, e):
|
|
struct_ids = self.get_struct_id_from_text(self.select_category.GetStringSelection())
|
|
member_ids = self.get_member_id_from_text(self.select_parameter.GetStringSelection())
|
|
channels = self.get_channel_from_text(self.select_channel.GetStringSelection())
|
|
nums = self.get_num_from_text(self.select_index.GetStringSelection())
|
|
for struct_id in struct_ids:
|
|
for member_id in member_ids:
|
|
for channel in channels:
|
|
for num in nums:
|
|
key = data_model.Key(struct_id, member_id, channel, num)
|
|
if key in self.keys and key not in self.result:
|
|
self.result.append(key)
|
|
|
|
self.SetText()
|
|
return
|
|
|
|
def OnRemove(self, e):
|
|
struct_ids = self.get_struct_id_from_text(self.select_category.GetStringSelection())
|
|
member_ids = self.get_member_id_from_text(self.select_parameter.GetStringSelection())
|
|
channels = self.get_channel_from_text(self.select_channel.GetStringSelection())
|
|
nums = self.get_num_from_text(self.select_index.GetStringSelection())
|
|
remove_keys = []
|
|
for struct_id in struct_ids:
|
|
for member_id in member_ids:
|
|
for channel in channels:
|
|
for num in nums:
|
|
key = data_model.Key(struct_id, member_id, channel, num)
|
|
if key in self.keys:
|
|
remove_keys.append(key)
|
|
|
|
links = []
|
|
for key in self.result:
|
|
if key not in remove_keys:
|
|
links.append(key)
|
|
|
|
self.result = links
|
|
self.SetText()
|
|
return
|
|
|
|
def on_timer(self, e):
|
|
if self.select_category.GetStringSelection() == 'All':
|
|
all_struct_ids = True
|
|
struct_id = 'All'
|
|
else:
|
|
all_struct_ids = False
|
|
struct_id = self.get_struct_id_from_text(self.select_category.GetStringSelection())[0]
|
|
member_id = None
|
|
try:
|
|
if self.select_parameter.Enabled == True:
|
|
member_ids = self.get_member_id_from_text(self.select_parameter.GetStringSelection())
|
|
if len(member_ids) > 1:
|
|
member_id = None
|
|
else:
|
|
member_id = member_ids[0]
|
|
except:
|
|
pass
|
|
|
|
selected_channel = None
|
|
try:
|
|
if self.select_channel.Enabled == True:
|
|
selected_channels = self.get_channel_from_text(self.select_channel.GetStringSelection())
|
|
if len(selected_channels) > 1:
|
|
selected_channel = 'All'
|
|
else:
|
|
selected_channel = selected_channels[0]
|
|
except:
|
|
pass
|
|
|
|
if selected_channel == None:
|
|
selected_channel = 'All'
|
|
if self.last_struct_id != struct_id or self.last_member_id != member_id or self.last_selected_channel != selected_channel:
|
|
print 'sk.1'
|
|
if self.last_struct_id != struct_id:
|
|
member_id = None
|
|
selected_channel = None
|
|
if self.last_member_id != member_id:
|
|
selected_channel = None
|
|
self.last_struct_id = struct_id
|
|
self.last_member_id = member_id
|
|
self.last_selected_channel = selected_channel
|
|
if member_id == None:
|
|
self.member_ids = []
|
|
self.member_id_text = ['All']
|
|
for key in self.keys:
|
|
if key.struct_id == struct_id or all_struct_ids == True:
|
|
if key.member_id not in self.member_ids:
|
|
self.member_ids.append(key.member_id)
|
|
|
|
self.member_ids.sort()
|
|
for mymember_id in self.member_ids:
|
|
if struct_id == protocol.STRUCT_ID_GLOBAL and mymember_id == protocol.MEMBER_ID_GAIN:
|
|
self.member_id_text.append('Levels')
|
|
elif struct_id == protocol.STRUCT_ID_GLOBAL and mymember_id == protocol.MEMBER_ID_SHORT_NAME:
|
|
self.member_id_text.append('Unit Name')
|
|
elif struct_id == protocol.STRUCT_ID_PRESET_GLOBAL and mymember_id == protocol.MEMBER_ID_PRESET_NUMBER:
|
|
self.member_id_text.append('Preset Selection')
|
|
else:
|
|
self.member_id_text.append(protocol.get_member_text(mymember_id))
|
|
|
|
print 'sk.4', self.member_ids, struct_id, self.member_id_text
|
|
if len(self.member_ids) <= 1 or struct_id in (protocol.STRUCT_ID_GAIN, protocol.STRUCT_ID_MUTE, protocol.STRUCT_ID_LINK, protocol.STRUCT_ID_COMMAND):
|
|
if len(self.member_ids) == 1:
|
|
try:
|
|
self.select_parameter.SetItems(self.member_id_text)
|
|
self.select_parameter.SetStringSelection(self.member_id_text[1])
|
|
member_id = self.member_ids[0]
|
|
except:
|
|
traceback.proint_exc(file=sys.stdout)
|
|
|
|
else:
|
|
self.select_parameter.SetStringSelection('')
|
|
self.select_parameter.Disable()
|
|
else:
|
|
self.select_parameter.SetItems(self.member_id_text)
|
|
self.select_parameter.SetStringSelection(self.member_id_text[0])
|
|
self.select_parameter.Enable()
|
|
if struct_id not in (protocol.STRUCT_ID_GLOBAL, protocol.STRUCT_ID_PRESET_GLOBAL, protocol.STRUCT_ID_COMMAND) or member_id == protocol.MEMBER_ID_INPUT_SELECT:
|
|
self.select_channel.Enable()
|
|
else:
|
|
self.select_channel.Disable()
|
|
if selected_channel == None:
|
|
selected_channel = 'All'
|
|
self.last_selected_channel = 'All'
|
|
self.channels = []
|
|
self.channel_text = ['All']
|
|
for key in self.keys:
|
|
if key.struct_id == struct_id and (key.member_id == member_id or member_id == None) or all_struct_ids == True:
|
|
if key.channel not in self.channels:
|
|
self.channels.append(key.channel)
|
|
|
|
self.channels.sort()
|
|
for channel in self.channels:
|
|
if member_id == protocol.MEMBER_ID_INPUT_SELECT and channel >= 128:
|
|
continue
|
|
if channel < 128:
|
|
channel_name = 'Input ' + str(channel + 1)
|
|
if struct_id == protocol.STRUCT_ID_LINK:
|
|
channel_name += ' & ' + str(channel + 2)
|
|
else:
|
|
channel_name = 'Output ' + str(channel - 127)
|
|
if struct_id == protocol.STRUCT_ID_LINK:
|
|
channel_name += ' & ' + str(channel - 126)
|
|
self.channel_text.append(channel_name)
|
|
|
|
if len(self.channel_text) <= 2:
|
|
self.select_channel.Disable()
|
|
self.select_channel.SetItems(('', ' '))
|
|
self.select_channel.SetStringSelection('')
|
|
else:
|
|
self.select_channel.SetItems(self.channel_text)
|
|
self.select_channel.SetStringSelection(self.channel_text[0])
|
|
self.indexes = []
|
|
self.index_text = [
|
|
'All']
|
|
for key in self.keys:
|
|
if key.struct_id == struct_id and (key.member_id == member_id or member_id == None) and (key.channel == selected_channel or selected_channel == 'All') or all_struct_ids == True:
|
|
if key.num not in self.indexes:
|
|
self.indexes.append(key.num)
|
|
|
|
self.indexes.sort()
|
|
for index in self.indexes:
|
|
index_name = str(index + 1)
|
|
txtkey = data_model.Key(struct_id, member_id, 0, index)
|
|
if key.struct_id == protocol.STRUCT_ID_GLOBAL and key.member_id == protocol.MEMBER_ID_INPUT_SELECT:
|
|
continue
|
|
if struct_id == protocol.STRUCT_ID_GLOBAL:
|
|
try:
|
|
self.index_text.append(global_text[txtkey])
|
|
except:
|
|
self.index_text.append(index_name)
|
|
|
|
elif struct_id == protocol.STRUCT_ID_COMMAND:
|
|
if txtkey in cmd_text:
|
|
self.index_text.append(cmd_text[txtkey])
|
|
elif struct_id == protocol.STRUCT_ID_COMPRESSOR:
|
|
if index == 0:
|
|
self.index_text.append('Full Range')
|
|
else:
|
|
self.index_text.append('BLC band ' + str(index))
|
|
elif struct_id == protocol.STRUCT_ID_PEQ:
|
|
if index > 9:
|
|
self.index_text.append('BLC band ' + str(index - 9))
|
|
else:
|
|
self.index_text.append('band ' + str(index + 1))
|
|
else:
|
|
self.index_text.append(index_name)
|
|
|
|
if len(self.indexes) <= 1:
|
|
if len(self.indexes) == 1 and len(self.index_text[0]) > 1 and False:
|
|
self.select_index.SetStringSelection(self.index_text[0])
|
|
else:
|
|
self.select_index.SetStringSelection('')
|
|
self.select_index.SetItems(('', ' '))
|
|
self.select_index.Disable()
|
|
else:
|
|
self.select_index.SetItems(self.index_text)
|
|
self.select_index.SetStringSelection(self.index_text[0])
|
|
self.select_index.Enable()
|
|
if self.first_time:
|
|
self.first_time = False
|
|
self.SetText()
|
|
self.Show(True)
|
|
self.Raise()
|
|
return
|
|
|
|
def SetText(self):
|
|
text = ''
|
|
for key in self.result:
|
|
if key.struct_id in (protocol.STRUCT_ID_GLOBAL, protocol.STRUCT_ID_PRESET_GLOBAL) and key in global_text:
|
|
text += global_text[key]
|
|
elif key.struct_id == protocol.STRUCT_ID_COMMAND and key in cmd_text:
|
|
text += cmd_text[key]
|
|
else:
|
|
text += self.getStructIDText(key.struct_id)
|
|
if key.struct_id in (protocol.STRUCT_ID_PEQ, protocol.STRUCT_ID_LPF, protocol.STRUCT_ID_HPF, protocol.STRUCT_ID_LIMITER, protocol.STRUCT_ID_MIXER, protocol.STRUCT_ID_COMPRESSOR) or key.member_id == protocol.MEMBER_ID_INPUT_SELECT:
|
|
text += ' ' + protocol.get_member_text(key.member_id)
|
|
if key.channel < 128:
|
|
channel_name = ' Input ' + str(key.channel + 1)
|
|
else:
|
|
channel_name = ' Output ' + str(key.channel - 127)
|
|
if key.struct_id not in (protocol.STRUCT_ID_GLOBAL, protocol.STRUCT_ID_PRESET_GLOBAL, protocol.STRUCT_ID_COMMAND) or key.member_id == protocol.MEMBER_ID_INPUT_SELECT:
|
|
text += channel_name
|
|
if key.struct_id == protocol.STRUCT_ID_MIXER:
|
|
text += ' no. ' + str(key.num + 1)
|
|
if key.struct_id == protocol.STRUCT_ID_COMPRESSOR and key.num > 0:
|
|
text += ' BLC band ' + str(key.num)
|
|
if key.struct_id == protocol.STRUCT_ID_PEQ:
|
|
if key.num > 9:
|
|
text += ' BLC band ' + str(key.num - 9)
|
|
else:
|
|
text += ' band ' + str(key.num + 1)
|
|
text += newline
|
|
|
|
self.existing.SetValue(text)
|
|
return
|
|
|
|
def get_struct_id_from_text(self, text):
|
|
i = 1
|
|
if text == 'All':
|
|
return self.struct_ids
|
|
res = []
|
|
for testval in self.struct_id_text.keys():
|
|
if testval == 'All':
|
|
continue
|
|
if self.struct_id_text[testval] == text:
|
|
res.append(testval)
|
|
return res
|
|
i += 1
|
|
|
|
if text == 'All':
|
|
return self.struct_ids
|
|
return
|
|
|
|
def get_member_id_from_text(self, text):
|
|
i = 1
|
|
if len(self.member_ids) <= 1:
|
|
return self.member_ids
|
|
else:
|
|
if text == 'All':
|
|
return self.member_ids
|
|
res = []
|
|
for testval in self.member_id_text:
|
|
if testval == 'All':
|
|
continue
|
|
if testval == text:
|
|
res.append(self.member_ids[i - 1])
|
|
return res
|
|
i += 1
|
|
|
|
if text in ('All', '', ' ', None, 'None'):
|
|
return self.member_ids
|
|
return
|
|
|
|
def get_channel_from_text(self, text):
|
|
i = 1
|
|
if text in ('All', '', ' ', None, 'None'):
|
|
return self.channels
|
|
else:
|
|
res = []
|
|
try:
|
|
for testval in self.channel_text:
|
|
if testval == 'All':
|
|
continue
|
|
if testval == text:
|
|
res.append(self.channels[i - 1])
|
|
return res
|
|
i += 1
|
|
|
|
except:
|
|
res.append('All')
|
|
return res
|
|
|
|
return
|
|
|
|
def get_num_from_text(self, text):
|
|
i = 1
|
|
if len(self.indexes) <= 1:
|
|
return self.indexes
|
|
else:
|
|
if text in ('All', '', ' ', None, 'None'):
|
|
return self.indexes
|
|
res = []
|
|
for testval in self.index_text:
|
|
if testval == 'All':
|
|
continue
|
|
if testval == text:
|
|
res.append(self.indexes[i - 1])
|
|
return res
|
|
i += 1
|
|
|
|
return
|
|
|
|
def channels_for_var(self, var):
|
|
channels = []
|
|
try:
|
|
channels = self.config.get(var, 'channels')
|
|
except ConfigParser.NoOptionError:
|
|
try:
|
|
channel = self.config.get(var, 'channel')
|
|
except ConfigParser.NoOptionError:
|
|
print mytime.displayTime() + " variable '%s' has neither 'channels' nor 'channel' attributes defined. This is wrong, variable ignored." % var
|
|
return []
|
|
else:
|
|
channel = int(channel, 0)
|
|
channels = [channel]
|
|
else:
|
|
channels = [_[1] for s in channels.split(',')]
|
|
|
|
return channels
|
|
|
|
def OnEraseBackground(self, evt):
|
|
"""
|
|
Add a picture to the background
|
|
"""
|
|
dc = evt.GetDC()
|
|
if not dc:
|
|
dc = wx.ClientDC(self)
|
|
rect = self.GetUpdateRegion().GetBox()
|
|
dc.SetClippingRect(rect)
|
|
dc.Clear()
|
|
bmp = wx.Bitmap(self.bg)
|
|
dc.DrawBitmap(bmp, 0, 0)
|
|
return
|
|
|
|
def OnOK(self, evt):
|
|
self.response = 'OK'
|
|
if self.IsModal() == False:
|
|
self.Destroy()
|
|
else:
|
|
self.Close()
|
|
return
|
|
|
|
def OnCancel(self, evt):
|
|
self.response = 'Cancel'
|
|
if self.IsModal == False:
|
|
self.Destroy()
|
|
else:
|
|
self.Close()
|
|
return
|
|
|
|
|
|
|
|
# okay decompiling pycode/select_keys.pyc
|