# 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: user_config_leds.pyc # Compiled at: 2024-11-13 12:27:47 import wx, os, data_model, traceback, one_unit, ConfigParser, protocol, sys, select_keys, select_units, d_protocol, mytime, string from user_config_helpers import * ledFunctionNone = 0 ledFunctionSignal = 1 ledFunctionGainReduction = 2 ledFunctionPresetNumber = 3 ledFunctionWink = 4 ledFunctionStandby = 5 ledFunctionPresetChanged = 6 ledFunctionShowValue = 7 ledFunctionAutoIndicatePeakInput = 8 ledFunctionIndicateNetworkConnected = 9 ledFunctionProtection = 10 ledFunctionDHCPBound = 11 ledFunctionLinkUp = 12 ledFunctionClockSynced = 13 ledFunctionDanteModuleDetected = 14 ledFunctionFault = 15 ledFunctionBridgeMode = 16 ledFunctionAESSampleRate = 17 ledFunctionAESSelected = 18 ledFunctionAsCapable = 19 ledFunctionAvbStreamActive = 20 ledFunctionTemperature = 21 ledFunctionSystemMuted = 22 ledFunctionBlink = 23 ledFunctionOn = 24 ledFunctionOff = 25 ledFunctionClip = 27 ledFlagHideDuringStandby = 1 ledFlagBlinkWhenChanged = 2 ledFunctions = {ledFunctionNone: 'None', ledFunctionSignal: 'Signal Level', ledFunctionGainReduction: 'Gain Reduction', ledFunctionPresetNumber: 'Preset Number', ledFunctionWink: 'Wink (Locate)', ledFunctionStandby: 'Standby', ledFunctionPresetChanged: 'Setting Change', ledFunctionShowValue: 'Is Enabled', ledFunctionAutoIndicatePeakInput: 'Show Peaking Input', ledFunctionIndicateNetworkConnected: 'Software Connected', ledFunctionProtection: 'Protection', ledFunctionDHCPBound: 'DHCP Bound', ledFunctionLinkUp: 'Link Status', ledFunctionClockSynced: 'Clock Synced', ledFunctionDanteModuleDetected: 'Digital Audio Module Installed', ledFunctionFault: 'Fault', ledFunctionBridgeMode: 'Bridge Mode', ledFunctionAESSampleRate: 'AES/EBU Sample rate', ledFunctionAESSelected: 'AES/EBU Selected', ledFunctionAsCapable: 'AVB Detected', ledFunctionAvbStreamActive: 'AVB Connected', ledFunctionTemperature: 'Temperature', ledFunctionSystemMuted: 'Fire Mute', ledFunctionBlink: 'Blink', ledFunctionOn: 'On', ledFunctionOff: 'Off', ledFunctionClip: 'Clip'} ledSelectOptions = {ledFunctionNone: '', ledFunctionSignal: 'cv', ledFunctionGainReduction: 'cv', ledFunctionPresetNumber: 'v', ledFunctionWink: 'v', ledFunctionStandby: 'v', ledFunctionPresetChanged: 'v', ledFunctionShowValue: 'sciv', ledFunctionAutoIndicatePeakInput: 'cv', ledFunctionIndicateNetworkConnected: 'v', ledFunctionProtection: 'v', ledFunctionDHCPBound: 'v', ledFunctionLinkUp: 'cv', ledFunctionClockSynced: 'v', ledFunctionDanteModuleDetected: 'v', ledFunctionFault: 'v', ledFunctionBridgeMode: 'cv', ledFunctionAESSampleRate: 'v', ledFunctionAESSelected: 'v', ledFunctionAsCapable: 'cv', ledFunctionAvbStreamActive: 'cv', ledFunctionTemperature: 'cv', ledFunctionSystemMuted: 'v', ledFunctionBlink: '', ledFunctionOn: '', ledFunctionOff: '', ledFunctionClip: 'cv'} ledAdditionalText = {ledFunctionNone: '', ledFunctionSignal: 'The signal level of', ledFunctionGainReduction: 'The gain reduction of', ledFunctionPresetNumber: 'The active preset number', ledFunctionWink: '', ledFunctionStandby: '', ledFunctionPresetChanged: '', ledFunctionShowValue: '', ledFunctionAutoIndicatePeakInput: 'The gain reduction contribution by', ledFunctionIndicateNetworkConnected: 'The remote software connection state', ledFunctionProtection: '', ledFunctionDHCPBound: 'The DHCP connection state', ledFunctionLinkUp: 'The link status of network link', ledFunctionClockSynced: 'The digital clock sync status', ledFunctionDanteModuleDetected: 'Digital Audio Module Installed', ledFunctionFault: '', ledFunctionBridgeMode: '', ledFunctionAESSampleRate: 'The AES/EBU sample rate in kHz', ledFunctionAESSelected: 'At least one input is set to AES/EBU', ledFunctionAsCapable: 'An AVB network is detected', ledFunctionAvbStreamActive: 'A valid AVB stream is being received', ledFunctionTemperature: 'Temperature of channel', ledFunctionSystemMuted: 'Fire (External) Mute is asserted', ledFunctionBlink: '', ledFunctionOn: '', ledFunctionOff: '', ledFunctionClip: 'The clip signal of'} keyComparisonOptions = {0: 'Is Equal To', 1: 'Is Equal To Or Greater Than', 2: 'Is Equal To Or Smaller Than', 3: 'Is Not Equal To', 4: 'Is Greater Than', 5: 'Is Smaller Than'} class frontPanelLeds(wx.Panel): def __init__(self, parent, frame, uiNumber, panelName): self.frame = frame self.name = panelName self.ledIndex = uiNumber uiNumber = 184 self.uiNumber = uiNumber self.parent = parent wx.Panel.__init__(self, parent, size=(964, 500)) self.lines = {} self.factoryItems = 0 self.frame = frame self.Show(True) self.initFinished = False return def initMe(self, force=False): if self.IsShown() == False and force == False: return if self.initFinished == True: return 0 print mytime.displayTime(), 'ucl.initMe FrontPanelLeds', self.name frame = self.frame uiNumber = self.uiNumber self.struct_id_choices = ['Selected'] i = 0 for strID in (3, 4, 5, 7, 8, 18): self.struct_id_choices.append(protocol.get_strid_text(strID)) self.member_id_choices = [ 'Selected'] for membID in (0, 1, 2, 3, 4, 5, 6, 7, 8, 14, 15, 24, 27): self.member_id_choices.append(protocol.get_member_text(membID)) self.channels = {127: 'Any Input', 255: 'Any Output'} for c in self.frame.frame.parent.unit_channels: if c < 128: s = 'Input ' + str(c + 1) else: s = 'Output ' + str(c - 127) self.channels[c] = s self.strFunction = wx.StaticText(self, -1, 'Function', pos=(80, 20)) self.strItem = wx.StaticText(self, -1, 'Process', pos=(220, 20)) self.strSubItem = wx.StaticText(self, -1, 'Parameter', pos=(330, 20)) self.strChannel = wx.StaticText(self, -1, 'Channel', pos=(440, 20)) self.strIndex = wx.StaticText(self, -1, 'Index', pos=(550, 20)) self.strComparison = wx.StaticText(self, -1, 'Comparison', pos=(600, 20)) self.strBlnkWhenChanged = wx.StaticText(self, -1, 'BwC HdS IwM Pre', pos=(820, 20)) self.uiKeys = getKeys(frame, uiNumber, memberID=self.ledIndex) for uiIndex in self.uiKeys: (key, val) = self.uiKeys[uiIndex] print mytime.displayTime(), 'ucl.key:', key, val if key.channel != 1 or key.index < 128: continue self.createLine(i) self.lines[i].key = key self.lines[i].checkBox.Enable(False) self.lines[i].checkBox.SetLabel('Factory') self.lines[i].struct_id_choice.Enable(False) self.lines[i].member_id_choice.Enable(False) self.lines[i].index_choice.Enable(False) self.lines[i].keyComparisonChoice.Enable(False) self.lines[i].checkBox.SetValue(True) try: self.lines[i].struct_id_choice.SetStringSelection(protocol.get_strid_text(val[1] & 63)) except: pass try: self.lines[i].member_id_choice.SetStringSelection(protocol.get_member_text(0)) except: pass channel = val[3] if channel == 255: channel = 'Any Output' elif channel == 127: channel = 'Any Input' elif channel < 128: channel = 'Input ' + str(channel + 1) else: channel = 'Output ' + str(channel - 128 + 1) self.lines[i].channel_choice.SetStringSelection(channel) self.lines[i].index_choice.SetStringSelection(str((val[6] >> 4 & 15) + 1)) ledFunction = val[4] if ledFunction == ledFunctionSignal and val[1] & 1 == 1: self.lines[i].preBox.SetValue(1) self.lines[i].ledFunctionChoice.SetStringSelection(ledFunctions[ledFunction]) self.lines[i].keyComparisonChoice.SetStringSelection(keyComparisonOptions[val[6] & 15]) if ledFunction in (ledFunctionSignal, ledFunctionGainReduction, ledFunctionAutoIndicatePeakInput): self.lines[i].value.SetValue(str(val[5] - 128) + 'dBu') else: self.lines[i].value.SetValue(str(val[5])) self.enable(i) self.lines[i].channel_choice.Enable(False) self.lines[i].ledFunctionChoice.Enable(False) self.lines[i].struct_id_choice.Enable(False) self.lines[i].member_id_choice.Enable(False) self.lines[i].index_choice.Enable(False) self.lines[i].keyComparisonChoice.Enable(False) self.lines[i].value.Enable(False) i += 1 self.factoryItems += 1 for uiIndex in self.uiKeys: (key, val) = self.uiKeys[uiIndex] if key.channel == 1 and key.index >= 128: continue self.createLine(i) self.lines[i].key = key self.lines[i].checkBox.SetValue(True) try: self.lines[i].struct_id_choice.SetStringSelection(protocol.get_strid_text(val[1] & 63)) except: pass try: self.lines[i].member_id_choice.SetStringSelection(protocol.get_member_text(0)) except: pass channel = val[3] if channel == 255: channel = 'Any Output' elif channel == 127: channel = 'Any Input' elif channel < 128: channel = 'Input ' + str(channel + 1) else: channel = 'Output ' + str(channel - 128 + 1) self.lines[i].channel_choice.SetStringSelection(channel) self.lines[i].index_choice.SetStringSelection(str((val[6] >> 4 & 15) + 1)) ledFunction = val[4] if ledFunction == ledFunctionSignal and val[1] & 1 == 1: self.lines[i].preBox.SetValue(1) self.lines[i].ledFunctionChoice.SetStringSelection(ledFunctions[ledFunction]) self.lines[i].keyComparisonChoice.SetStringSelection(keyComparisonOptions[val[6] & 15]) if ledFunction == ledFunctionSignal: self.lines[i].value.SetValue(str(val[5] - 128) + 'dBu') elif ledFunction in (ledFunctionGainReduction, ledFunctionAutoIndicatePeakInput): self.lines[i].value.SetValue(str(val[5] - 128) + 'dB') else: self.lines[i].value.SetValue(str(val[5])) if val[7] & 4 == 4: self.lines[i].invertBox.SetValue(1) if val[7] & 2 == 2: self.lines[i].blinkBox.SetValue(1) if val[7] & 1 == 1: self.lines[i].standbyBox.SetValue(1) self.enable(i) i += 1 if i - self.factoryItems < 8: self.createLine(i) self.initFinished = True return def createLine(self, i): p = wx.Panel(self, size=(964, 28)) p.Show(False) p.checkBox = wx.CheckBox(p, 10 + i, ' User', pos=(10, 2), size=(70, 20)) p.keyComparisonChoice = wx.Choice(p, 80 + i, choices=keyComparisonOptions.values(), style=wx.BORDER_NONE, pos=(600, 0), size=(160, 26)) p.keyComparisonChoice.SetStringSelection(keyComparisonOptions.values()[0]) p.ledFunctionChoice = wx.Choice(p, 30 + i, choices=sorted(ledFunctions.values()), style=wx.BORDER_NONE, pos=(80, 0), size=(130, 26)) p.ledFunctionChoice.SetStringSelection(ledFunctions.values()[0]) p.struct_id_choice = wx.Choice(p, 40 + i, choices=self.struct_id_choices, style=wx.BORDER_NONE, pos=(220, 0), size=(100, 26)) p.struct_id_choice.SetStringSelection(self.struct_id_choices[0]) p.member_id_choice = wx.Choice(p, 50 + i, choices=self.member_id_choices, style=wx.BORDER_NONE, pos=(330, 0), size=(100, 26)) p.member_id_choice.SetStringSelection(self.member_id_choices[0]) p.channel_choice = wx.Choice(p, 60 + i, choices=sorted(self.channels.values()), style=wx.BORDER_NONE, pos=(440, 0), size=(100, 26)) p.channel_choice.SetStringSelection(self.channels.values()[0]) p.index_choice = wx.Choice(p, 70 + i, choices=[_[1] for j in range(10)], style=wx.BORDER_NONE, pos=(550, 0), size=(40, 26)) p.index_choice.SetStringSelection('1') p.value = wx.TextCtrl(p, 20 + i, '', pos=(770, 1), size=(40, 20)) p.value.Show(False) p.additionalLabel = wx.StaticText(p, -1, '', pos=(220, 5)) p.additionalLabel.Show(False) p.blinkBox = wx.CheckBox(p, 80 + i, '', pos=(830, 2), size=(20, 20)) p.standbyBox = wx.CheckBox(p, 80 + i, '', pos=(860, 2), size=(20, 20)) p.invertBox = wx.CheckBox(p, 80 + i, '', pos=(890, 2), size=(20, 20)) p.preBox = wx.CheckBox(p, 80 + i, '', pos=(920, 2), size=(20, 20)) p.SetPosition((0, 40 + 28 * i)) p.checkBox.SetValue(0) p.checkBox.Enable(True) p.key = None self.Bind(wx.EVT_CHECKBOX, self.OnEnabled, id=10 + i) self.Bind(wx.EVT_CHOICE, self.OnStructId, id=40 + i) self.Bind(wx.EVT_CHOICE, self.OnChangeledFunction, id=30 + i) self.lines[i] = p self.enable(i) p.Show(True) return def enable(self, i): val = self.lines[i].checkBox.GetValue() self.showChoices(i, self.getledFunction(self.lines[i]), val) return def showChoices(self, i, ledFunctionInt, enabled): self.lines[i].ledFunctionChoice.Enable(enabled) try: ledFunctionFields = ledSelectOptions[ledFunctionInt] except: ledFunctionFields = None self.lines[i].struct_id_choice.Show(False) self.lines[i].member_id_choice.Show(False) self.lines[i].channel_choice.Show(False) self.lines[i].index_choice.Show(False) self.lines[i].keyComparisonChoice.Show(enabled) self.lines[i].struct_id_choice.Enable(enabled) self.lines[i].member_id_choice.Enable(enabled) self.lines[i].channel_choice.Enable(enabled) self.lines[i].index_choice.Enable(enabled) self.lines[i].keyComparisonChoice.Show(enabled) self.lines[i].value.Show(False) if ledFunctionFields.find('s') >= 0: self.lines[i].struct_id_choice.Show(True) if self.lines[i].struct_id_choice.GetStringSelection() not in ('Selected', 'All'): if ledFunctionFields.find('m') >= 0: self.lines[i].member_id_choice.Show(True) if ledFunctionFields.find('c') >= 0: self.lines[i].channel_choice.Show(True) if ledFunctionFields.find('i') >= 0: self.lines[i].index_choice.Show(True) elif ledFunctionFields.find('m') >= 0: self.lines[i].member_id_choice.Show(True) if ledFunctionFields.find('c') >= 0: self.lines[i].channel_choice.Show(True) if ledFunctionFields.find('i') >= 0: self.lines[i].index_choice.Show(True) if ledFunctionFields.find('v') >= 0: self.lines[i].value.Show(True) if ledFunctionFields == 'sm': self.lines[i].struct_id_choice.Show(True) self.lines[i].member_id_choice.Show(True) if ledAdditionalText[ledFunctionInt] == '': self.lines[i].additionalLabel.Show(False) else: self.lines[i].additionalLabel.SetLabel(ledAdditionalText[ledFunctionInt]) self.lines[i].additionalLabel.Show(True) return def OnEnabled(self, e): i = e.GetId() - 10 self.enable(i) if i == len(self.lines) - 1 and self.lines[i].checkBox.GetValue() == True and i < 7 + self.factoryItems: self.createLine(i + 1) return def OnChangeledFunction(self, e): i = e.GetId() - 30 self.showChoices(i, self.getledFunction(self.lines[i]), 1) print mytime.displayTime() + ' on change key function', self.lines[i].ledFunctionChoice.GetStringSelection() return def OnStructId(self, e): print mytime.displayTime() + ' OnStructid' i = e.GetId() - 40 self.showChoices(i, self.getledFunction(self.lines[i]), True) return def getledFunction(self, line): fName = line.ledFunctionChoice.GetStringSelection() for k in ledFunctions.keys(): if ledFunctions[k] == fName: return k return def getKeyComparison(self, line): fName = line.keyComparisonChoice.GetStringSelection() for k in keyComparisonOptions.keys(): if keyComparisonOptions[k] == fName: return k return def stripValue(self, v): for s in data_model.validFilenameChars + data_model.forbiddenFilenameChars: if s in string.digits: continue if s in ('-', '.'): continue if s == ',': v = v.replace(s, '.') continue v = v.replace(s, '') try: return float(v) except: traceback.print_exc(file=sys.stdout) return v return def evaluateLine(self, line): if line.checkBox.GetValue() == False: return else: ledFunction = self.getledFunction(line) channel = line.channel_choice.GetStringSelection() signalSource = 0 if channel == 'Any Input': channel = 127 elif channel == 'Any Output': channel = 255 elif channel.find('Input ') >= 0: channel = int(channel.replace('Input ', '')) - 1 elif channel.find('Output ') >= 0: channel = int(channel.replace('Output ', '')) - 1 + 128 keyComparison = self.getKeyComparison(line) strID = 0 flags = 0 if ledFunction in (ledFunctionSignal, ledFunctionGainReduction, ledFunctionAutoIndicatePeakInput): if line.preBox.GetValue() == 1 and ledFunction == ledFunctionSignal: signalSource = 1 strID = signalSource index = ledFunction flags = 0 try: value = int(self.stripValue(line.value.GetValue())) if value > 120: value = 120 if value < -120: value = -120 value += 128 except: traceback.print_exc(file=sys.stdout) value = 0 elif ledFunction in (ledFunctionPresetNumber, ledFunctionBridgeMode, ledFunctionAESSampleRate, ledFunctionAESSelected, ledFunctionTemperature): strID = 0 flags = 0 try: value = int(self.stripValue(line.value.GetValue())) if value > 250: value = 250 except: traceback.print_exc(file=sys.stdout) value = 1 elif ledFunction == ledFunctionStandby: strID = 0 flags = 0 try: value = int(self.stripValue(line.value.GetValue())) if value > 250: value = 250 except: traceback.print_exc(file=sys.stdout) value = 1 elif ledFunction == ledFunctionWink: strID = 0 flags = 0 try: value = int(self.stripValue(line.value.GetValue())) if value > 250: value = 250 except: traceback.print_exc(file=sys.stdout) value = 1 elif ledFunction == ledFunctionPresetChanged: strID = 0 flags = 0 try: value = int(self.stripValue(line.value.GetValue())) if value > 250: value = 250 except: traceback.print_exc(file=sys.stdout) value = 1 elif ledFunction == ledFunctionShowValue: strID = protocol.get_strid_by_text(line.struct_id_choice.GetStringSelection()) if strID == None: print mytime.displayTime(), 'ucl. None Structure ID Text for structure ID', line.struct_id_choice.GetStringSelection() strID = 0 index = int(line.index_choice.GetStringSelection()) - 1 keyComparison |= index << 4 flags = 0 try: value = int(self.stripValue(line.value.GetValue())) if value > 250: value = 250 if value < 0: value = 0 except: traceback.print_exc(file=sys.stdout) value = 1 elif ledFunction in (ledFunctionLinkUp, ledFunctionAsCapable, ledFunctionAvbStreamActive, ledFunctionSystemMuted): strID = 0 flags = 0 try: value = int(self.stripValue(line.value.GetValue())) if value > 1: value = 1 if value < 0: value = 0 except: traceback.print_exc(file=sys.stdout) value = 1 elif ledFunction == ledFunctionClip: strID = 0 flags = 0 try: value = int(self.stripValue(line.value.GetValue())) if value > 1: value = 1 if value < 0: value = 0 except: traceback.print_exc(file=sys.stdout) value = 1 else: strID = 0 channel = 0 flags = 0 try: value = int(line.value.GetValue().replace('dBu', '')) if value > 250: value = 250 if value < 0: value = 0 except: value = 1 if line.standbyBox.GetValue() == 1: flags |= 1 if line.blinkBox.GetValue() == 1: flags |= 2 if line.invertBox.GetValue() == 1: flags |= 4 try: sendString = '' + chr(self.uiNumber) sendString += chr(strID) sendString += chr(self.ledIndex) sendString += chr(channel) sendString += chr(ledFunction) sendString += chr(value) sendString += chr(keyComparison) sendString += chr(flags) return sendString except: print mytime.displayTime(), 'ucl.fpk.eL.failed to build string' traceback.print_exc(file=sys.stdout) return return # okay decompiling pycode/user_config_leds.pyc