# 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: rta_measurements.pyc # Compiled at: 2022-04-20 07:08:45 import wx, os, data_model, traceback, one_unit, sys, mytime mac_names = 'posix' default_colours = ( (128, 0, 0), (128, 128, 0), (0, 128, 0), (0, 128, 128), (0, 0, 168), (128, 0, 128), (128, 50, 90), (90, 120, 60), (0, 64, 128), (80, 0, 160)) smoothing_choices = {'1 Octave': 1, '1/2 Octave': 0.5, '1/3 Octave': 0.33, '1/6 Octave': 0.167, '1/12 Octave': 0.083, '1/24 Octave': 0.042, 'Off': 0} smoothing_list = ('1 Octave', '1/2 Octave', '1/3 Octave', '1/6 Octave', '1/12 Octave', '1/24 Octave', 'Off') FFT_choices = {'1k': 1024, '2k': 2048, '4k': 4096, '8k': 8192, '16k': 16384, '32k': 32768} FFT_list = ('1k', '2k', '4k', '8k', '16k', '32k') class rtaDialog(wx.Dialog): def __init__(self, parent, settings=False): if settings == True: title = 'RTA Setup' else: title = 'Save Measurement' wx.Dialog.__init__(self, None, wx.ID_ANY, title, size=(440, 100), style=wx.STAY_ON_TOP | wx.CAPTION | wx.DEFAULT_DIALOG_STYLE) self.parent = parent 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.settings = settings fgcolour = 'red' optionspanel = wx.Panel(self, -1) optionsvbox = wx.BoxSizer(wx.VERTICAL) buttonspanel = wx.Panel(self, -1) buttonshbox = wx.BoxSizer(wx.HORIZONTAL) mainvbox = wx.BoxSizer(wx.VERTICAL) self.colourData = wx.ColourData() self.linepanel = {} self.linebox = {} self.visible = {} self.enabled = {} self.name = {} self.weight = {} self.weightlabel = {} self.colour_button = {} self.f1 = {} self.f1label = {} self.f2 = {} self.f2label = {} if self.settings == True: self.settings_panel = wx.Panel(optionspanel, -1, size=(740, 25)) smoothinglabel = wx.StaticText(self.settings_panel, label='Smoothing', pos=(23, 5)) self.smoothing = wx.Choice(self.settings_panel, -1, pos=(100, 3), size=(120, 20), choices=smoothing_list) for val in smoothing_choices.keys(): if smoothing_choices[val] == one_unit.app.rta_smoothing: self.smoothing.SetStringSelection(val) avglabel = wx.StaticText(self.settings_panel, label='Avg', pos=(243, 5)) self.avg = wx.TextCtrl(self.settings_panel, -1, value=str(int(one_unit.app.rta_time_avg)), size=(50, 20), pos=(273, 3)) FFT_lenlabel = wx.StaticText(self.settings_panel, label='FFT Size', pos=(330, 5)) self.FFT_len = wx.Choice(self.settings_panel, -1, pos=(390, 3), size=(70, 20), choices=FFT_list) for val in FFT_choices.keys(): if FFT_choices[val] == one_unit.app.FFT_len: self.FFT_len.SetStringSelection(val) self.one_shot = wx.CheckBox(self.settings_panel, -1, 'One Shot', size=(100, 20), pos=(500, 3)) self.one_shot.SetValue(one_unit.app.rta_one_shot) self.auto_mute = wx.CheckBox(self.settings_panel, -1, 'Auto Unmute / Mute', size=(150, 20), pos=(600, 3)) self.auto_mute.SetValue(one_unit.app.rta_auto_mute) optionsvbox.Add(self.settings_panel, 1, border=0, flag=wx.ALIGN_LEFT | wx.ALL) self.settings_panel_line_2 = wx.Panel(optionspanel, -1, size=(740, 25)) inputlabel = wx.StaticText(self.settings_panel_line_2, label='Input', pos=(23, 5)) self.input = wx.Choice(self.settings_panel_line_2, -1, pos=(100, 3), size=(223, 20), choices=one_unit.app.available_audio_devices.values()) if one_unit.app.audio_input_device == None: if len(one_unit.app.available_audio_devices.values()) == 0: self.input.SetStringSelection('No available input devices.') else: self.input.SetStringSelection(one_unit.app.available_audio_devices.values()[0]) else: self.input.SetStringSelection(one_unit.app.audio_input_device) self.auto_scale = wx.CheckBox(self.settings_panel_line_2, -1, 'Auto Scale', size=(100, 20), pos=(500, 3)) self.auto_scale.SetValue(one_unit.app.rta_auto_scale) self.auto_scale.Show(False) self.show_peq = wx.CheckBox(self.settings_panel_line_2, -1, 'Show Filters', size=(100, 20), pos=(600, 3)) self.show_peq.SetValue(one_unit.app.rta_show_peq) optionsvbox.Add(self.settings_panel_line_2, 1, border=0, flag=wx.ALIGN_LEFT | wx.ALL) else: one_unit.app.rta_data[len(one_unit.app.rta_data)] = ( 1.0, 'Measurement ' + str(len(one_unit.app.rta_data) - 1), True, True, default_colours[(len(one_unit.app.rta_data) - 2) % len(default_colours)], one_unit.app.rta_data[0][5], 0, 20000) for i in range(0, len(one_unit.app.rta_data)): self.linepanel[i] = wx.Panel(optionspanel, -1, size=(780, 25)) if i > 1: self.enabled[i] = wx.CheckBox(self.linepanel[i], 100 + i, '', size=(20, 20), pos=(3, 3)) self.enabled[i].SetValue(one_unit.app.rta_data[i][2]) self.Bind(wx.EVT_CHECKBOX, self.OnEnabled, self.enabled[i]) self.name[i] = wx.TextCtrl(self.linepanel[i], 200 + i, style=wx.TE_PROCESS_ENTER, value=one_unit.app.rta_data[i][1], size=(300, 20), pos=(23, 3)) self.name[i].Bind(wx.EVT_TEXT_ENTER, self.OnNameEnter, self.name[i]) if i > 1: self.weightlabel[i] = wx.StaticText(self.linepanel[i], label='Weight', pos=(335, 5)) self.weight[i] = wx.TextCtrl(self.linepanel[i], 400 + i, value=str(round(one_unit.app.rta_data[i][0], 1)), size=(50, 20), pos=(383, 3)) self.weight[i].Bind(wx.EVT_TEXT_ENTER, self.OnWeightEnter, self.weight[i]) self.f1label[i] = wx.StaticText(self.linepanel[i], label='From', pos=(447, 5)) self.f1[i] = wx.TextCtrl(self.linepanel[i], 500 + i, value=str(int(one_unit.app.rta_data[i][6])), size=(50, 20), pos=(483, 3)) self.f1[i].Bind(wx.EVT_TEXT_ENTER, self.OnF1Enter, self.f1[i]) self.f2label[i] = wx.StaticText(self.linepanel[i], label='To', pos=(547, 5)) self.f2[i] = wx.TextCtrl(self.linepanel[i], 600 + i, value=str(int(one_unit.app.rta_data[i][7])), size=(50, 20), pos=(568, 3)) self.f2[i].Bind(wx.EVT_TEXT_ENTER, self.OnF2Enter, self.f2[i]) self.visible[i] = wx.CheckBox(self.linepanel[i], -1, 'Visible', size=(70, 20), pos=(630, 3)) self.visible[i].SetValue(one_unit.app.rta_data[i][3]) self.colour_button[i] = wx.Button(self.linepanel[i], 300 + i, 'Colour', pos=(700, 3), size=(70, 24)) self.colour_button[i].SetBackgroundColour(one_unit.app.rta_data[i][4]) self.Bind(wx.EVT_BUTTON, self.OnSelectColour, self.colour_button[i]) if i > 1: self.enable(i) optionsvbox.Add(self.linepanel[i], 1, border=0, flag=wx.ALIGN_LEFT | wx.ALL) optionspanel.SetSizer(optionsvbox) optionsvbox.SetMinSize((250, 10)) mainvbox.Add(optionspanel, 0, border=10, flag=wx.LEFT | wx.RIGHT) self.OK_button = wx.Button(buttonspanel, 1, 'OK') self.OK_button.Enable(True) self.OK_button.Show(True) buttonshbox.Add(self.OK_button, 1, border=3, flag=wx.ALL) buttonshbox.Add(wx.Button(buttonspanel, 2, 'Cancel'), 1, border=3, flag=wx.ALL) buttonspanel.SetSizer(buttonshbox) buttonshbox.SetMinSize((150, self.frame_height)) mainvbox.Add(buttonspanel, 0, border=5, flag=wx.ALL) self.SetSizerAndFit(mainvbox) self.Centre() self.Bind(wx.EVT_BUTTON, self.OnOK, id=1) self.Bind(wx.EVT_BUTTON, self.OnCancel, id=2) self.CenterOnScreen() self.mainvbox = mainvbox return def OnF1Enter(self, e): i = e.GetId() - 500 self.f2[i].SetFocus() return def OnF2Enter(self, e): i = e.GetId() - 600 self.SetFocus() return def OnNameEnter(self, e): i = e.GetId() - 200 self.weight[i].SetFocus() return def OnWeightEnter(self, e): i = e.GetId() - 400 self.f1[i].SetFocus() return def OnSelectColour(self, e): i = e.GetId() - 300 print mytime.displayTime() + ' Pick a colour' data = wx.ColourData() data.SetChooseFull(True) data.SetColour(one_unit.app.rta_data[i][4]) dlg = wx.ColourDialog(self, data) if os.name in mac_names: self.Show(False) if dlg.ShowModal(): col = dlg.GetColourData().GetColour() print mytime.displayTime() + ' Selected', col self.colour_button[i].SetBackgroundColour(col) dlg.Destroy() if os.name in mac_names: self.Show(True) return def OnEnabled(self, e): i = e.GetId() - 100 self.enable(i) return def enable(self, i): if self.enabled[i].GetValue() == True: self.name[i].Enable(True) self.weight[i].Enable(True) self.visible[i].Enable(True) self.f1[i].Enable(True) self.f2[i].Enable(True) self.name[i].SetForegroundColour('black') self.weight[i].SetForegroundColour('black') self.f1[i].SetForegroundColour('black') self.f2[i].SetForegroundColour('black') else: self.name[i].Enable(False) self.weight[i].Enable(False) self.visible[i].Enable(False) self.f1[i].Enable(False) self.f2[i].Enable(False) self.name[i].SetForegroundColour('light grey') self.weight[i].SetForegroundColour('light grey') self.f1[i].SetForegroundColour('light grey') self.f2[i].SetForegroundColour('light grey') return def OnOK(self, evt): for i in range(0, len(one_unit.app.rta_data)): name = self.name[i].GetValue() if i > 1: try: weight = float(self.weight[i].GetValue()) except: weight = 1.0 else: try: f1 = int(self.f1[i].GetValue()) except: f1 = 0 else: if f1 < 0: f1 = 0 if f1 > 20000: f1 = 20000 try: f2 = int(self.f2[i].GetValue()) except: f2 = 20000 else: if f2 < 0: f2 = 0 if f2 > 20000: f2 = 20000 enabled = self.enabled[i].GetValue() else: weight = 1.0 enabled = True f1 = 0 f2 = 20000 visible = self.visible[i].GetValue() colour = self.colour_button[i].GetBackgroundColour() one_unit.app.rta_data[i] = list((weight, name, enabled, visible, colour, one_unit.app.rta_data[i][5], f1, f2)) if self.settings == True: one_unit.app.rta_smoothing = smoothing_choices[self.smoothing.GetStringSelection()] one_unit.app.FFT_len = FFT_choices[self.FFT_len.GetStringSelection()] try: avg = int(self.avg.GetValue()) if avg < 1: avg = 1 except: avg = 3 else: if avg > 100: avg = 100 one_unit.app.rta_time_avg = avg one_unit.app.rta_one_shot = self.one_shot.GetValue() one_unit.app.rta_auto_mute = self.auto_mute.GetValue() one_unit.app.audio_input_device = self.input.GetStringSelection() one_unit.app.rta_show_peq = self.show_peq.GetValue() one_unit.app.rta_auto_scale = True one_unit.app.last_rta_measurement_saved = True self.Close() return def OnCancel(self, evt): if self.settings == False: del one_unit.app.rta_data[len(one_unit.app.rta_data) - 1] self.Close() return # okay decompiling pycode/rta_measurements.pyc