def __init__(self, parent): self.config_obj = None self.dut_cfg = {} self.test_cfg_suc = None self.ico = None self.config_win_text_ctrl_width = 200 self.config_win_text_ctrl_hight = 20 wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"DUT配置", pos=wx.DefaultPosition, size=wx.Size(500, 700), style=wx.DEFAULT_FRAME_STYLE | wx.FRAME_NO_TASKBAR | wx.FRAME_SHAPED | wx.TAB_TRAVERSAL) #style=wx.CAPTION | wx.SYSTEM_MENU | wx.TAB_TRAVERSAL) self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) self.SetBackgroundColour(wx.Colour(255, 255, 255)) vbox_config = wx.BoxSizer(wx.VERTICAL) general_config = wx.StaticBoxSizer( wx.StaticBox(self, wx.ID_ANY, u"通用配置"), wx.VERTICAL) hbox_general_ip_config = wx.BoxSizer(wx.HORIZONTAL) self.general_ip_config = wx.StaticText(self, wx.ID_ANY, u"DUT IP", wx.DefaultPosition, wx.DefaultSize, 0) self.general_ip_config.Wrap(-1) hbox_general_ip_config.Add(self.general_ip_config, 0, wx.ALL, 5) self.text_general_ip = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) self.text_general_ip.SetMinSize( wx.Size(self.config_win_text_ctrl_width, self.config_win_text_ctrl_hight)) hbox_general_ip_config.Add(self.text_general_ip, 0, wx.ALL, 5) general_config.Add(hbox_general_ip_config, 1, wx.EXPAND, 5) hbox_general_submask = wx.BoxSizer(wx.HORIZONTAL) self.label_general_submask = wx.StaticText(self, wx.ID_ANY, u"DUT LAN掩码", wx.DefaultPosition, wx.DefaultSize, 0) self.label_general_submask.Wrap(-1) hbox_general_submask.Add(self.label_general_submask, 0, wx.ALL, 5) self.text_lan_submask = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) self.text_lan_submask.SetMinSize( wx.Size(self.config_win_text_ctrl_width, self.config_win_text_ctrl_hight)) hbox_general_submask.Add(self.text_lan_submask, 0, wx.ALL, 5) general_config.Add(hbox_general_submask, 1, wx.EXPAND, 5) hbox_dhcp_start_ip1 = wx.BoxSizer(wx.HORIZONTAL) self.label_dhcp_start_ip1 = wx.StaticText(self, wx.ID_ANY, u"DHCP起始IP地址", wx.DefaultPosition, wx.DefaultSize, 0) self.label_dhcp_start_ip1.Wrap(-1) hbox_dhcp_start_ip1.Add(self.label_dhcp_start_ip1, 0, wx.ALL, 5) self.text_apitest_start_ip = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) self.text_apitest_start_ip.SetMinSize( wx.Size(self.config_win_text_ctrl_width, self.config_win_text_ctrl_hight)) hbox_dhcp_start_ip1.Add(self.text_apitest_start_ip, 0, wx.ALL, 5) general_config.Add(hbox_dhcp_start_ip1, 1, wx.EXPAND, 5) vbox_config.Add(general_config, 1, wx.EXPAND, 5) web_config = wx.StaticBoxSizer( wx.StaticBox(self, wx.ID_ANY, u"WEB相关配置"), wx.HORIZONTAL) hbox_web_login = wx.BoxSizer(wx.HORIZONTAL) self.web_username = wx.StaticText(self, wx.ID_ANY, u"WEB登录名", wx.DefaultPosition, wx.DefaultSize, 0) self.web_username.Wrap(-1) hbox_web_login.Add(self.web_username, 0, wx.ALL, 5) self.text_web_username = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) self.text_web_username.SetMinSize( wx.Size(self.config_win_text_ctrl_width, self.config_win_text_ctrl_hight)) hbox_web_login.Add(self.text_web_username, 0, wx.ALL, 5) self.web_password = wx.StaticText(self, wx.ID_ANY, u"WEB密码", wx.DefaultPosition, wx.DefaultSize, 0) self.web_password.Wrap(-1) hbox_web_login.Add(self.web_password, 0, wx.ALL, 5) self.text_web_password = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_PASSWORD) self.text_web_password.SetMinSize( wx.Size(self.config_win_text_ctrl_width, self.config_win_text_ctrl_hight)) hbox_web_login.Add(self.text_web_password, 0, wx.ALL, 5) web_config.Add(hbox_web_login, 1, wx.EXPAND, 5) vbox_config.Add(web_config, 1, wx.EXPAND, 5) telnet_config = wx.StaticBoxSizer( wx.StaticBox(self, wx.ID_ANY, u"telnet相关配置"), wx.HORIZONTAL) hbox_telnet_user = wx.BoxSizer(wx.HORIZONTAL) self.label_telnet_user = wx.StaticText(self, wx.ID_ANY, u"Telnet用户名", wx.DefaultPosition, wx.DefaultSize, 0) self.label_telnet_user.Wrap(-1) hbox_telnet_user.Add(self.label_telnet_user, 0, wx.ALL, 5) self.text_telnet_username = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) self.text_telnet_username.SetMinSize( wx.Size(self.config_win_text_ctrl_width, self.config_win_text_ctrl_hight)) hbox_telnet_user.Add(self.text_telnet_username, 0, wx.ALL, 5) self.label_telnet_password = wx.StaticText(self, wx.ID_ANY, u"Telnet密码", wx.DefaultPosition, wx.DefaultSize, 0) self.label_telnet_password.Wrap(-1) hbox_telnet_user.Add(self.label_telnet_password, 0, wx.ALL, 5) self.text_telnet_password = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_PASSWORD) self.text_telnet_password.SetMinSize( wx.Size(self.config_win_text_ctrl_width, self.config_win_text_ctrl_hight)) hbox_telnet_user.Add(self.text_telnet_password, 0, wx.ALL, 5) telnet_config.Add(hbox_telnet_user, 1, wx.EXPAND, 5) vbox_config.Add(telnet_config, 1, wx.EXPAND, 5) smartgateway_config = wx.StaticBoxSizer( wx.StaticBox(self, wx.ID_ANY, u"智能相关配置"), wx.HORIZONTAL) self.m_radioBox1Choices = [u"中国移动", u"中国电信"] self.m_radioBox1 = wx.RadioBox(self, wx.ID_ANY, u"选择待测设备运营商", wx.DefaultPosition, wx.DefaultSize, self.m_radioBox1Choices, 1, wx.RA_SPECIFY_COLS) self.m_radioBox1.SetSelection(0) smartgateway_config.Add(self.m_radioBox1, 0, wx.ALL, 5) cn_smartgateway_config = wx.StaticBoxSizer( wx.StaticBox(self, wx.ID_ANY, u"中国电信智能相关配置"), wx.HORIZONTAL) smartgateway_config.Add(cn_smartgateway_config, 1, wx.EXPAND, 5) cm_smartgateway_config = wx.StaticBoxSizer( wx.StaticBox(self, wx.ID_ANY, u"中国移动智能相关配置"), wx.HORIZONTAL) vbox_apitest_config = wx.BoxSizer(wx.VERTICAL) hbox_cm_apitest_port_config = wx.BoxSizer(wx.HORIZONTAL) self.label_cm_apitest_port = wx.StaticText(self, wx.ID_ANY, u"Apitest界面端口", wx.DefaultPosition, wx.DefaultSize, 0) self.label_cm_apitest_port.Wrap(-1) hbox_cm_apitest_port_config.Add(self.label_cm_apitest_port, 0, wx.ALL, 5) self.spin_apitest_port = wx.SpinCtrl(self, wx.ID_ANY, u"8080", wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 65535, 0) hbox_cm_apitest_port_config.Add(self.spin_apitest_port, 0, wx.ALL, 5) vbox_apitest_config.Add(hbox_cm_apitest_port_config, 1, wx.EXPAND, 5) hbox_apitest_host_mac = wx.BoxSizer(wx.HORIZONTAL) self.label_cm_apitest_host_mac = wx.StaticText(self, wx.ID_ANY, u"主机MAC地址", wx.DefaultPosition, wx.DefaultSize, 0) self.label_cm_apitest_host_mac.Wrap(-1) hbox_apitest_host_mac.Add(self.label_cm_apitest_host_mac, 0, wx.ALL, 5) self.text_cm_host_mac = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) hbox_apitest_host_mac.Add(self.text_cm_host_mac, 0, wx.ALL, 5) vbox_apitest_config.Add(hbox_apitest_host_mac, 1, wx.EXPAND, 5) cm_smartgateway_config.Add(vbox_apitest_config, 1, wx.EXPAND, 5) smartgateway_config.Add(cm_smartgateway_config, 1, wx.EXPAND, 5) vbox_config.Add(smartgateway_config, 1, wx.EXPAND, 5) btn_config = wx.BoxSizer(wx.VERTICAL) self.m_button2 = wx.Button(self, wx.ID_ANY, u"保存配置", wx.DefaultPosition, wx.DefaultSize, 0) self.m_button2.SetForegroundColour( wx.SystemSettings.GetColour(wx.SYS_COLOUR_HIGHLIGHT)) btn_config.Add(self.m_button2, 0, wx.ALIGN_CENTER | wx.ALL, 5) vbox_config.Add(btn_config, 1, wx.ALIGN_CENTER | wx.EXPAND, 5) self.SetSizer(vbox_config) self.Layout() # Connect Events self.m_button2.Bind(wx.EVT_BUTTON, self.on_dut_config_submit)
def __init__(self, parent, controller, tagname, exclude_input=False): """ Constructor @param parent: Parent wx.Window of dialog for modal @param controller: Reference to project controller @param tagname: Tagname of project POU edited @param exclude_input: Exclude input from variable class selection """ BlockPreviewDialog.__init__(self, parent, controller, tagname, title=_('Variable Properties')) # Init common sizers self._init_sizers(4, 2, 4, None, 3, 2) # Create label for variable class class_label = wx.StaticText(self, label=_('Class:')) self.LeftGridSizer.AddWindow(class_label, flag=wx.GROW) # Create a combo box for defining variable class self.Class = wx.ComboBox(self, style=wx.CB_READONLY) self.Bind(wx.EVT_COMBOBOX, self.OnClassChanged, self.Class) self.LeftGridSizer.AddWindow(self.Class, flag=wx.GROW) # Create label for variable execution order execution_order_label = wx.StaticText(self, label=_('Execution Order:')) self.LeftGridSizer.AddWindow(execution_order_label, flag=wx.GROW) # Create spin control for defining variable execution order self.ExecutionOrder = wx.SpinCtrl(self, min=0, style=wx.SP_ARROW_KEYS) self.Bind(wx.EVT_SPINCTRL, self.OnExecutionOrderChanged, self.ExecutionOrder) self.LeftGridSizer.AddWindow(self.ExecutionOrder, flag=wx.GROW) # Create label for variable expression name_label = wx.StaticText(self, label=_('Expression:')) self.RightGridSizer.AddWindow(name_label, border=5, flag=wx.GROW | wx.BOTTOM) # Create text control for defining variable expression self.Expression = wx.TextCtrl(self) self.Bind(wx.EVT_TEXT, self.OnExpressionChanged, self.Expression) self.RightGridSizer.AddWindow(self.Expression, flag=wx.GROW) # Create a list box to selected variable expression in the list of # variables defined in POU self.VariableName = wx.ListBox(self, size=wx.Size(-1, 120), style=wx.LB_SINGLE | wx.LB_SORT) self.Bind(wx.EVT_LISTBOX, self.OnNameChanged, self.VariableName) self.RightGridSizer.AddWindow(self.VariableName, border=4, flag=wx.GROW | wx.TOP) # Add preview panel and associated label to sizers self.MainSizer.AddWindow(self.PreviewLabel, border=20, flag=wx.GROW | wx.LEFT | wx.RIGHT) self.MainSizer.AddWindow(self.Preview, border=20, flag=wx.GROW | wx.LEFT | wx.RIGHT) # Add buttons sizer to sizers self.MainSizer.AddSizer(self.ButtonSizer, border=20, flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT) # Set options that can be selected in class combo box for var_class, choice in VARIABLE_CLASSES_DICT.iteritems(): if not exclude_input or var_class != INPUT: self.Class.Append(choice) self.Class.SetSelection(0) # Extract list of variables defined in POU self.RefreshVariableList() # Refresh values in name list box self.RefreshNameList() self.Preview.SetInitialSize(wx.Size(-1, 60)) self.Fit() # Class combo box is default control having keyboard focus self.Class.SetFocus()
def __init__(self, parent, col_values, misc_values): wx.Dialog.__init__(self, parent, -1, 'Data loader settings') box_sizer = wx.BoxSizer(wx.HORIZONTAL) # Make the box for putting in the columns col_box = wx.StaticBox(self, -1, "Columns") col_box_sizer = wx.StaticBoxSizer(col_box, wx.VERTICAL) # col_values = {'y': 1,'x': 0,'y error': 1} col_grid = wx.GridBagSizer(len(col_values), 2) self.col_controls = col_values.copy() keys = list(col_values.keys()) keys.sort() for i, name in enumerate(keys): text = wx.StaticText(self, -1, name + ': ') control = wx.SpinCtrl(self) control.SetRange(0, 100) control.SetValue(col_values[name]) col_grid.Add(text, (i, 0), flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, border=5) col_grid.Add(control, (i, 1), flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, border=5) self.col_controls[name] = control col_box_sizer.Add(col_grid, 0, wx.ALIGN_CENTRE | wx.ALL, 5) box_sizer.Add(col_box_sizer, 0, wx.ALIGN_CENTRE | wx.ALL | wx.EXPAND, 5) col_box = wx.StaticBox(self, -1, "Misc") col_box_sizer = wx.StaticBoxSizer(col_box, wx.VERTICAL) # Lets add another box for comments and rows to skip # misc_values = {'Comment': '#', 'Skip rows': 0,'Delimiter': 'None'} col_grid = wx.GridBagSizer(len(misc_values), 2) self.misc_controls = misc_values.copy() keys = list(misc_values.keys()) keys.sort() for i, name in enumerate(keys): text = wx.StaticText(self, -1, name + ': ') if type(misc_values[name]) == type(1): control = wx.SpinCtrl(self) control.SetRange(0, 100) control.SetValue(misc_values[name]) else: control = wx.TextCtrl(self, value=misc_values[name], style=wx.EXPAND) col_grid.Add(text, (i, 0), flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, border=5) col_grid.Add(control, (i, 1), flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, border=5) self.misc_controls[name] = control col_box_sizer.Add(col_grid, 0, wx.ALIGN_CENTRE | wx.ALL, 5) box_sizer.Add(col_box_sizer, 0, wx.ALIGN_CENTRE | wx.ALL | wx.EXPAND, 5) button_sizer = wx.StdDialogButtonSizer() okay_button = wx.Button(self, wx.ID_OK) okay_button.SetDefault() button_sizer.AddButton(okay_button) button_sizer.AddButton(wx.Button(self, wx.ID_CANCEL)) button_sizer.Realize() sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(box_sizer, 1, wx.GROW, 20) line = wx.StaticLine(self, -1, size=(20, -1), style=wx.LI_HORIZONTAL) sizer.Add(line, 0, wx.GROW, 30) sizer.Add(button_sizer, 0, flag=wx.ALIGN_RIGHT, border=20) self.SetSizer(sizer) sizer.Fit(self) self.Layout()
def AddTypeEdit(self, row, value): type = Wammu.Utils.GetItemType(value['Type']) self.fulltypes[row] = value['Type'] self.types[row] = type if type == 'text' or type is None: # text editor edit = wx.TextCtrl(self, -1, StrConv(value['Value']), size=(200, -1)) self.sizer.Add(edit, (row + self.rowoffset, 4), (1, 4)) self.edits[row] = [edit] elif type == 'phone': # phone editor with voice tag edit = wx.TextCtrl( self, -1, StrConv(value['Value']), size=(150, -1), validator=Wammu.PhoneValidator.PhoneValidator(pause=True)) self.sizer.Add(edit, (row + self.rowoffset, 4), (1, 3)) try: v = hex(value['VoiceTag']) except: v = '0x0' if v[-1] == 'L': v = v[:-1] edit2 = wx.TextCtrl(self, -1, v, size=(50, -1)) self.sizer.Add(edit2, (row + self.rowoffset, 7), (1, 1)) self.edits[row] = [edit, edit2] elif type == 'bool': # boolean try: val = bool(value['Value']) except: val = False edit = wx.CheckBox(self, -1, '', size=(200, -1)) edit.SetValue(val) self.sizer.Add(edit, (row + self.rowoffset, 4), (1, 4)) self.edits[row] = [edit] elif type == 'contact': # contact editor try: val = int(value['Value']) except: val = 0 edit = wx.SpinCtrl(self, -1, str(val), style=wx.SP_WRAP | wx.SP_ARROW_KEYS, min=0, max=10000, initial=val, size=(50, -1)) edit.row = row self.sizer.Add(edit, (row + self.rowoffset, 4), (1, 1)) edit2 = wx.Button(self, -1, self.GetContactText(val), style=wx.BU_EXACTFIT, size=(150, -1)) edit2.row = row self.sizer.Add(edit2, (row + self.rowoffset, 5), (1, 3)) self.edits[row] = [edit, edit2] self.Bind(wx.EVT_SPINCTRL, self.OnContactSpinChange, edit) self.Bind(wx.EVT_BUTTON, self.OnContactButton, edit2) elif type == 'id': # ID editor try: v = hex(value['Value']) except: v = '0x0' if v[-1] == 'L': v = v[:-1] edit = wx.TextCtrl(self, -1, StrConv(v), size=(200, -1)) self.sizer.Add(edit, (row + self.rowoffset, 4), (1, 4)) self.edits[row] = [edit] elif type == 'category' or type == 'number': # number editor # FIXME: category should be selectable try: val = int(value['Value']) except: val = 0 edit = wx.SpinCtrl(self, -1, str(val), style=wx.SP_WRAP | wx.SP_ARROW_KEYS, min=-10000, max=10000, initial=val, size=(200, -1)) self.sizer.Add(edit, (row + self.rowoffset, 4), (1, 4)) self.edits[row] = [edit] elif type == 'datetime': # date + time editor edit = TimeCtrl(self, -1, fmt24hr=True) Wammu.Utils.FixupMaskedEdit(edit) edit.SetValue(TimeToText(value['Value'], self.cfg)) self.sizer.Add(edit, (row + self.rowoffset, 4), (1, 2)) edit2 = DateControl(self, DateToText(value['Value'], self.cfg)) self.sizer.Add(edit2, (row + self.rowoffset, 6), (1, 2)) self.edits[row] = [edit, edit2] elif type == 'date': # date editor edit = DateControl(self, DateToText(value['Value'], self.cfg)) self.sizer.Add(edit, (row + self.rowoffset, 4), (1, 4)) self.edits[row] = [edit] else: print('warning: creating TextCtrl for %s' % type) edit = wx.TextCtrl(self, -1, StrConv(value['Value']), size=(200, -1)) self.sizer.Add(edit, (row + self.rowoffset, 4), (1, 4)) self.edits[row] = [edit] self.sizer.Fit(self) self.sizer.SetSizeHints(self) self.sizer.Layout()
def __init__(self, parent): wx.aui.AuiMDIChildFrame.__init__(self, parent, -1, title=u"Зоны") self.head_0 = wx.StaticText(self, wx.ID_ANY, (u"")) self.head_1 = wx.StaticText(self, wx.ID_ANY, (u"")) self.head_2 = wx.StaticText(self, wx.ID_ANY, (u"")) self.head_3 = wx.StaticText(self, wx.ID_ANY, (u"")) self.head_4 = wx.StaticText(self, wx.ID_ANY, (u"")) self.head_5 = wx.StaticText(self, wx.ID_ANY, (u"")) self.head_6 = wx.StaticText(self, wx.ID_ANY, (u"")) self.head_7 = wx.StaticText(self, wx.ID_ANY, (u"")) self.head_8 = wx.StaticText(self, wx.ID_ANY, (u"")) self.head_9 = wx.StaticText(self, wx.ID_ANY, (u"")) self.head_10 = wx.StaticText(self, wx.ID_ANY, (u"З")) self.head_11 = wx.StaticText(self, wx.ID_ANY, (u"О")) self.head_12 = wx.StaticText(self, wx.ID_ANY, (u"Н")) self.head_13 = wx.StaticText(self, wx.ID_ANY, (u"Ы")) self.head_14 = wx.StaticText(self, wx.ID_ANY, (u"")) self.head_15 = wx.StaticText(self, wx.ID_ANY, (u"")) self.head_16 = wx.StaticText(self, wx.ID_ANY, (u"")) self.head_17 = wx.StaticText(self, wx.ID_ANY, (u"")) self.head_18 = wx.StaticText(self, wx.ID_ANY, (u"")) self.head_19 = wx.StaticText(self, wx.ID_ANY, (u"")) self.head2_0 = wx.StaticText(self, wx.ID_ANY, (u"")) self.head2_1 = wx.StaticText(self, wx.ID_ANY, (u"ID Раздела")) self.head2_2 = wx.StaticText(self, wx.ID_ANY, (u"Вход (сек.)")) self.head2_3 = wx.StaticText(self, wx.ID_ANY, (u"Выход (сек.)")) self.head2_4 = wx.StaticText(self, wx.ID_ANY, (u"1")) self.head2_5 = wx.StaticText(self, wx.ID_ANY, (u"2")) self.head2_6 = wx.StaticText(self, wx.ID_ANY, (u"3")) self.head2_7 = wx.StaticText(self, wx.ID_ANY, (u"4")) self.head2_8 = wx.StaticText(self, wx.ID_ANY, (u"5")) self.head2_9 = wx.StaticText(self, wx.ID_ANY, (u"6")) self.head2_10 = wx.StaticText(self, wx.ID_ANY, (u"7")) self.head2_11 = wx.StaticText(self, wx.ID_ANY, (u"8")) self.head2_12 = wx.StaticText(self, wx.ID_ANY, (u"9")) self.head2_13 = wx.StaticText(self, wx.ID_ANY, (u"10")) self.head2_14 = wx.StaticText(self, wx.ID_ANY, (u"11")) self.head2_15 = wx.StaticText(self, wx.ID_ANY, (u"12")) self.head2_16 = wx.StaticText(self, wx.ID_ANY, (u"13")) self.head2_17 = wx.StaticText(self, wx.ID_ANY, (u"14")) self.head2_18 = wx.StaticText(self, wx.ID_ANY, (u"15")) self.head2_19 = wx.StaticText(self, wx.ID_ANY, (u"16")) self.left_1 = wx.StaticText(self, wx.ID_ANY, (u"Раздел 1")) self.sc1_0 = wx.SpinCtrl(self, -1, "", (30, 30)) self.sc1_1 = wx.SpinCtrl(self, -1, "", (30, 30)) self.sc1_2 = wx.SpinCtrl(self, -1, "", (30, 30)) self.cb1_1 = wx.CheckBox(self, -1, "") self.cb1_2 = wx.CheckBox(self, -1, "") self.cb1_3 = wx.CheckBox(self, -1, "") self.cb1_4 = wx.CheckBox(self, -1, "") self.cb1_5 = wx.CheckBox(self, -1, "") self.cb1_6 = wx.CheckBox(self, -1, "") self.cb1_7 = wx.CheckBox(self, -1, "") self.cb1_8 = wx.CheckBox(self, -1, "") self.cb1_9 = wx.CheckBox(self, -1, "") self.cb1_10 = wx.CheckBox(self, -1, "") self.cb1_11 = wx.CheckBox(self, -1, "") self.cb1_12 = wx.CheckBox(self, -1, "") self.cb1_13 = wx.CheckBox(self, -1, "") self.cb1_14 = wx.CheckBox(self, -1, "") self.cb1_15 = wx.CheckBox(self, -1, "") self.cb1_16 = wx.CheckBox(self, -1, "") self.left_2 = wx.StaticText(self, wx.ID_ANY, (u"Раздел 2")) self.sc2_0 = wx.SpinCtrl(self, -1, "", (30, 30)) self.sc2_1 = wx.SpinCtrl(self, -1, "", (30, 30)) self.sc2_2 = wx.SpinCtrl(self, -1, "", (30, 30)) self.cb2_1 = wx.CheckBox(self, -1, "") self.cb2_2 = wx.CheckBox(self, -1, "") self.cb2_3 = wx.CheckBox(self, -1, "") self.cb2_4 = wx.CheckBox(self, -1, "") self.cb2_5 = wx.CheckBox(self, -1, "") self.cb2_6 = wx.CheckBox(self, -1, "") self.cb2_7 = wx.CheckBox(self, -1, "") self.cb2_8 = wx.CheckBox(self, -1, "") self.cb2_9 = wx.CheckBox(self, -1, "") self.cb2_10 = wx.CheckBox(self, -1, "") self.cb2_11 = wx.CheckBox(self, -1, "") self.cb2_12 = wx.CheckBox(self, -1, "") self.cb2_13 = wx.CheckBox(self, -1, "") self.cb2_14 = wx.CheckBox(self, -1, "") self.cb2_15 = wx.CheckBox(self, -1, "") self.cb2_16 = wx.CheckBox(self, -1, "") self.left_3 = wx.StaticText(self, wx.ID_ANY, (u"Раздел 3")) self.sc3_0 = wx.SpinCtrl(self, -1, "", (30, 30)) self.sc3_1 = wx.SpinCtrl(self, -1, "", (30, 30)) self.sc3_2 = wx.SpinCtrl(self, -1, "", (30, 30)) self.cb3_1 = wx.CheckBox(self, -1, "") self.cb3_2 = wx.CheckBox(self, -1, "") self.cb3_3 = wx.CheckBox(self, -1, "") self.cb3_4 = wx.CheckBox(self, -1, "") self.cb3_5 = wx.CheckBox(self, -1, "") self.cb3_6 = wx.CheckBox(self, -1, "") self.cb3_7 = wx.CheckBox(self, -1, "") self.cb3_8 = wx.CheckBox(self, -1, "") self.cb3_9 = wx.CheckBox(self, -1, "") self.cb3_10 = wx.CheckBox(self, -1, "") self.cb3_11 = wx.CheckBox(self, -1, "") self.cb3_12 = wx.CheckBox(self, -1, "") self.cb3_13 = wx.CheckBox(self, -1, "") self.cb3_14 = wx.CheckBox(self, -1, "") self.cb3_15 = wx.CheckBox(self, -1, "") self.cb3_16 = wx.CheckBox(self, -1, "") self.left_4 = wx.StaticText(self, wx.ID_ANY, (u"Раздел 4")) self.sc4_0 = wx.SpinCtrl(self, -1, "", (30, 30)) self.sc4_1 = wx.SpinCtrl(self, -1, "", (30, 30)) self.sc4_2 = wx.SpinCtrl(self, -1, "", (30, 30)) self.cb4_1 = wx.CheckBox(self, -1, "") self.cb4_2 = wx.CheckBox(self, -1, "") self.cb4_3 = wx.CheckBox(self, -1, "") self.cb4_4 = wx.CheckBox(self, -1, "") self.cb4_5 = wx.CheckBox(self, -1, "") self.cb4_6 = wx.CheckBox(self, -1, "") self.cb4_7 = wx.CheckBox(self, -1, "") self.cb4_8 = wx.CheckBox(self, -1, "") self.cb4_9 = wx.CheckBox(self, -1, "") self.cb4_10 = wx.CheckBox(self, -1, "") self.cb4_11 = wx.CheckBox(self, -1, "") self.cb4_12 = wx.CheckBox(self, -1, "") self.cb4_13 = wx.CheckBox(self, -1, "") self.cb4_14 = wx.CheckBox(self, -1, "") self.cb4_15 = wx.CheckBox(self, -1, "") self.cb4_16 = wx.CheckBox(self, -1, "") self.left_5 = wx.StaticText(self, wx.ID_ANY, (u"Раздел 5")) self.sc5_0 = wx.SpinCtrl(self, -1, "", (30, 30)) self.sc5_1 = wx.SpinCtrl(self, -1, "", (30, 30)) self.sc5_2 = wx.SpinCtrl(self, -1, "", (30, 30)) self.cb5_1 = wx.CheckBox(self, -1, "") self.cb5_2 = wx.CheckBox(self, -1, "") self.cb5_3 = wx.CheckBox(self, -1, "") self.cb5_4 = wx.CheckBox(self, -1, "") self.cb5_5 = wx.CheckBox(self, -1, "") self.cb5_6 = wx.CheckBox(self, -1, "") self.cb5_7 = wx.CheckBox(self, -1, "") self.cb5_8 = wx.CheckBox(self, -1, "") self.cb5_9 = wx.CheckBox(self, -1, "") self.cb5_10 = wx.CheckBox(self, -1, "") self.cb5_11 = wx.CheckBox(self, -1, "") self.cb5_12 = wx.CheckBox(self, -1, "") self.cb5_13 = wx.CheckBox(self, -1, "") self.cb5_14 = wx.CheckBox(self, -1, "") self.cb5_15 = wx.CheckBox(self, -1, "") self.cb5_16 = wx.CheckBox(self, -1, "") self.left_6 = wx.StaticText(self, wx.ID_ANY, (u"Раздел 6")) self.sc6_0 = wx.SpinCtrl(self, -1, "", (30, 30)) self.sc6_1 = wx.SpinCtrl(self, -1, "", (30, 30)) self.sc6_2 = wx.SpinCtrl(self, -1, "", (30, 30)) self.cb6_1 = wx.CheckBox(self, -1, "") self.cb6_2 = wx.CheckBox(self, -1, "") self.cb6_3 = wx.CheckBox(self, -1, "") self.cb6_4 = wx.CheckBox(self, -1, "") self.cb6_5 = wx.CheckBox(self, -1, "") self.cb6_6 = wx.CheckBox(self, -1, "") self.cb6_7 = wx.CheckBox(self, -1, "") self.cb6_8 = wx.CheckBox(self, -1, "") self.cb6_9 = wx.CheckBox(self, -1, "") self.cb6_10 = wx.CheckBox(self, -1, "") self.cb6_11 = wx.CheckBox(self, -1, "") self.cb6_12 = wx.CheckBox(self, -1, "") self.cb6_13 = wx.CheckBox(self, -1, "") self.cb6_14 = wx.CheckBox(self, -1, "") self.cb6_15 = wx.CheckBox(self, -1, "") self.cb6_16 = wx.CheckBox(self, -1, "") self.left_7 = wx.StaticText(self, wx.ID_ANY, (u"Раздел 7")) self.sc7_0 = wx.SpinCtrl(self, -1, "", (30, 30)) self.sc7_1 = wx.SpinCtrl(self, -1, "", (30, 30)) self.sc7_2 = wx.SpinCtrl(self, -1, "", (30, 30)) self.cb7_1 = wx.CheckBox(self, -1, "") self.cb7_2 = wx.CheckBox(self, -1, "") self.cb7_3 = wx.CheckBox(self, -1, "") self.cb7_4 = wx.CheckBox(self, -1, "") self.cb7_5 = wx.CheckBox(self, -1, "") self.cb7_6 = wx.CheckBox(self, -1, "") self.cb7_7 = wx.CheckBox(self, -1, "") self.cb7_8 = wx.CheckBox(self, -1, "") self.cb7_9 = wx.CheckBox(self, -1, "") self.cb7_10 = wx.CheckBox(self, -1, "") self.cb7_11 = wx.CheckBox(self, -1, "") self.cb7_12 = wx.CheckBox(self, -1, "") self.cb7_13 = wx.CheckBox(self, -1, "") self.cb7_14 = wx.CheckBox(self, -1, "") self.cb7_15 = wx.CheckBox(self, -1, "") self.cb7_16 = wx.CheckBox(self, -1, "") self.left_8 = wx.StaticText(self, wx.ID_ANY, (u"Раздел 8")) self.sc8_0 = wx.SpinCtrl(self, -1, "", (30, 30)) self.sc8_1 = wx.SpinCtrl(self, -1, "", (30, 30)) self.sc8_2 = wx.SpinCtrl(self, -1, "", (30, 30)) self.cb8_1 = wx.CheckBox(self, -1, "") self.cb8_2 = wx.CheckBox(self, -1, "") self.cb8_3 = wx.CheckBox(self, -1, "") self.cb8_4 = wx.CheckBox(self, -1, "") self.cb8_5 = wx.CheckBox(self, -1, "") self.cb8_6 = wx.CheckBox(self, -1, "") self.cb8_7 = wx.CheckBox(self, -1, "") self.cb8_8 = wx.CheckBox(self, -1, "") self.cb8_9 = wx.CheckBox(self, -1, "") self.cb8_10 = wx.CheckBox(self, -1, "") self.cb8_11 = wx.CheckBox(self, -1, "") self.cb8_12 = wx.CheckBox(self, -1, "") self.cb8_13 = wx.CheckBox(self, -1, "") self.cb8_14 = wx.CheckBox(self, -1, "") self.cb8_15 = wx.CheckBox(self, -1, "") self.cb8_16 = wx.CheckBox(self, -1, "") self.left_90 = wx.StaticText(self, wx.ID_ANY, (u"")) self.left_91 = wx.StaticText(self, wx.ID_ANY, (u"")) self.left_92 = wx.StaticText(self, wx.ID_ANY, (u"")) self.left_93 = wx.StaticText(self, wx.ID_ANY, (u"Входная зона")) self.cb9_1 = wx.CheckBox(self, -1, "") self.cb9_2 = wx.CheckBox(self, -1, "") self.cb9_3 = wx.CheckBox(self, -1, "") self.cb9_4 = wx.CheckBox(self, -1, "") self.cb9_5 = wx.CheckBox(self, -1, "") self.cb9_6 = wx.CheckBox(self, -1, "") self.cb9_7 = wx.CheckBox(self, -1, "") self.cb9_8 = wx.CheckBox(self, -1, "") self.cb9_9 = wx.CheckBox(self, -1, "") self.cb9_10 = wx.CheckBox(self, -1, "") self.cb9_11 = wx.CheckBox(self, -1, "") self.cb9_12 = wx.CheckBox(self, -1, "") self.cb9_13 = wx.CheckBox(self, -1, "") self.cb9_14 = wx.CheckBox(self, -1, "") self.cb9_15 = wx.CheckBox(self, -1, "") self.cb9_16 = wx.CheckBox(self, -1, "") self.left_100 = wx.StaticText(self, wx.ID_ANY, (u"")) self.left_101 = wx.StaticText(self, wx.ID_ANY, (u"")) self.left_102 = wx.StaticText(self, wx.ID_ANY, (u"")) self.left_103 = wx.StaticText(self, wx.ID_ANY, (u"Проходная зона")) self.cb10_1 = wx.CheckBox(self, -1, "") self.cb10_2 = wx.CheckBox(self, -1, "") self.cb10_3 = wx.CheckBox(self, -1, "") self.cb10_4 = wx.CheckBox(self, -1, "") self.cb10_5 = wx.CheckBox(self, -1, "") self.cb10_6 = wx.CheckBox(self, -1, "") self.cb10_7 = wx.CheckBox(self, -1, "") self.cb10_8 = wx.CheckBox(self, -1, "") self.cb10_9 = wx.CheckBox(self, -1, "") self.cb10_10 = wx.CheckBox(self, -1, "") self.cb10_11 = wx.CheckBox(self, -1, "") self.cb10_12 = wx.CheckBox(self, -1, "") self.cb10_13 = wx.CheckBox(self, -1, "") self.cb10_14 = wx.CheckBox(self, -1, "") self.cb10_15 = wx.CheckBox(self, -1, "") self.cb10_16 = wx.CheckBox(self, -1, "") self.left_110 = wx.StaticText(self, wx.ID_ANY, (u"")) self.left_111 = wx.StaticText(self, wx.ID_ANY, (u"")) self.left_112 = wx.StaticText(self, wx.ID_ANY, (u"")) self.left_113 = wx.StaticText(self, wx.ID_ANY, (u"24 часовая")) self.cb11_1 = wx.CheckBox(self, -1, "") self.cb11_2 = wx.CheckBox(self, -1, "") self.cb11_3 = wx.CheckBox(self, -1, "") self.cb11_4 = wx.CheckBox(self, -1, "") self.cb11_5 = wx.CheckBox(self, -1, "") self.cb11_6 = wx.CheckBox(self, -1, "") self.cb11_7 = wx.CheckBox(self, -1, "") self.cb11_8 = wx.CheckBox(self, -1, "") self.cb11_9 = wx.CheckBox(self, -1, "") self.cb11_10 = wx.CheckBox(self, -1, "") self.cb11_11 = wx.CheckBox(self, -1, "") self.cb11_12 = wx.CheckBox(self, -1, "") self.cb11_13 = wx.CheckBox(self, -1, "") self.cb11_14 = wx.CheckBox(self, -1, "") self.cb11_15 = wx.CheckBox(self, -1, "") self.cb11_16 = wx.CheckBox(self, -1, "") self.left_120 = wx.StaticText(self, wx.ID_ANY, (u"")) self.left_121 = wx.StaticText(self, wx.ID_ANY, (u"")) self.left_122 = wx.StaticText(self, wx.ID_ANY, (u"")) self.left_123 = wx.StaticText(self, wx.ID_ANY, (u"Нормально открытая")) self.cb12_1 = wx.CheckBox(self, -1, "") self.cb12_2 = wx.CheckBox(self, -1, "") self.cb12_3 = wx.CheckBox(self, -1, "") self.cb12_4 = wx.CheckBox(self, -1, "") self.cb12_5 = wx.CheckBox(self, -1, "") self.cb12_6 = wx.CheckBox(self, -1, "") self.cb12_7 = wx.CheckBox(self, -1, "") self.cb12_8 = wx.CheckBox(self, -1, "") self.cb12_9 = wx.CheckBox(self, -1, "") self.cb12_10 = wx.CheckBox(self, -1, "") self.cb12_11 = wx.CheckBox(self, -1, "") self.cb12_12 = wx.CheckBox(self, -1, "") self.cb12_13 = wx.CheckBox(self, -1, "") self.cb12_14 = wx.CheckBox(self, -1, "") self.cb12_15 = wx.CheckBox(self, -1, "") self.cb12_16 = wx.CheckBox(self, -1, "") self.left_130 = wx.StaticText(self, wx.ID_ANY, (u"")) self.left_131 = wx.StaticText(self, wx.ID_ANY, (u"")) self.left_132 = wx.StaticText(self, wx.ID_ANY, (u"")) self.left_133 = wx.StaticText(self, wx.ID_ANY, (u"Управление режимом охраны")) self.cb13_1 = wx.CheckBox(self, -1, "") self.cb13_2 = wx.CheckBox(self, -1, "") self.cb13_3 = wx.CheckBox(self, -1, "") self.cb13_4 = wx.CheckBox(self, -1, "") self.cb13_5 = wx.CheckBox(self, -1, "") self.cb13_6 = wx.CheckBox(self, -1, "") self.cb13_7 = wx.CheckBox(self, -1, "") self.cb13_8 = wx.CheckBox(self, -1, "") self.cb13_9 = wx.CheckBox(self, -1, "") self.cb13_10 = wx.CheckBox(self, -1, "") self.cb13_11 = wx.CheckBox(self, -1, "") self.cb13_12 = wx.CheckBox(self, -1, "") self.cb13_13 = wx.CheckBox(self, -1, "") self.cb13_14 = wx.CheckBox(self, -1, "") self.cb13_15 = wx.CheckBox(self, -1, "") self.cb13_16 = wx.CheckBox(self, -1, "") self.left_140 = wx.StaticText(self, wx.ID_ANY, (u"")) self.left_141 = wx.StaticText(self, wx.ID_ANY, (u"")) self.left_142 = wx.StaticText(self, wx.ID_ANY, (u"")) self.left_143 = wx.StaticText(self, wx.ID_ANY, (u"Кнопка выход")) self.cb14_1 = wx.CheckBox(self, -1, "") self.cb14_2 = wx.CheckBox(self, -1, "") self.cb14_3 = wx.CheckBox(self, -1, "") self.cb14_4 = wx.CheckBox(self, -1, "") self.cb14_5 = wx.CheckBox(self, -1, "") self.cb14_6 = wx.CheckBox(self, -1, "") self.cb14_7 = wx.CheckBox(self, -1, "") self.cb14_8 = wx.CheckBox(self, -1, "") self.cb14_9 = wx.CheckBox(self, -1, "") self.cb14_10 = wx.CheckBox(self, -1, "") self.cb14_11 = wx.CheckBox(self, -1, "") self.cb14_12 = wx.CheckBox(self, -1, "") self.cb14_13 = wx.CheckBox(self, -1, "") self.cb14_14 = wx.CheckBox(self, -1, "") self.cb14_15 = wx.CheckBox(self, -1, "") self.cb14_16 = wx.CheckBox(self, -1, "") self.left_150 = wx.StaticText(self, wx.ID_ANY, (u"")) self.left_151 = wx.StaticText(self, wx.ID_ANY, (u"")) self.left_152 = wx.StaticText(self, wx.ID_ANY, (u"")) self.left_153 = wx.StaticText(self, wx.ID_ANY, (u"Внутренняя")) self.cb15_1 = wx.CheckBox(self, -1, "") self.cb15_2 = wx.CheckBox(self, -1, "") self.cb15_3 = wx.CheckBox(self, -1, "") self.cb15_4 = wx.CheckBox(self, -1, "") self.cb15_5 = wx.CheckBox(self, -1, "") self.cb15_6 = wx.CheckBox(self, -1, "") self.cb15_7 = wx.CheckBox(self, -1, "") self.cb15_8 = wx.CheckBox(self, -1, "") self.cb15_9 = wx.CheckBox(self, -1, "") self.cb15_10 = wx.CheckBox(self, -1, "") self.cb15_11 = wx.CheckBox(self, -1, "") self.cb15_12 = wx.CheckBox(self, -1, "") self.cb15_13 = wx.CheckBox(self, -1, "") self.cb15_14 = wx.CheckBox(self, -1, "") self.cb15_15 = wx.CheckBox(self, -1, "") self.cb15_16 = wx.CheckBox(self, -1, "") self.sc1_0.SetRange(0, 64000) self.sc2_0.SetRange(0, 64000) self.sc3_0.SetRange(0, 64000) self.sc4_0.SetRange(0, 64000) self.sc5_0.SetRange(0, 64000) self.sc6_0.SetRange(0, 64000) self.sc7_0.SetRange(0, 64000) self.sc8_0.SetRange(0, 64000) self.sc1_1.SetRange(0, 255) self.sc2_1.SetRange(0, 255) self.sc3_1.SetRange(0, 255) self.sc4_1.SetRange(0, 255) self.sc5_1.SetRange(0, 255) self.sc6_1.SetRange(0, 255) self.sc7_1.SetRange(0, 255) self.sc8_1.SetRange(0, 255) self.sc1_2.SetRange(0, 255) self.sc2_2.SetRange(0, 255) self.sc3_2.SetRange(0, 255) self.sc4_2.SetRange(0, 255) self.sc5_2.SetRange(0, 255) self.sc6_2.SetRange(0, 255) self.sc7_2.SetRange(0, 255) self.sc8_2.SetRange(0, 255) self.btn = wx.Button(self, wx.ID_REFRESH) self.btn1 = wx.Button(self, wx.ID_SAVE) p = wx.Panel(self) grid_sizer_1 = wx.FlexGridSizer(18, 20, 1, 0) grid_sizer_1.Add(self.head_0, 0, wx.ALL, 5) grid_sizer_1.Add(self.head_1, 0, wx.ALL, 5) grid_sizer_1.Add(self.head_2, 0, wx.ALL, 5) grid_sizer_1.Add(self.head_3, 0, wx.ALL, 5) grid_sizer_1.Add(self.head_4, 0, wx.ALL, 5) grid_sizer_1.Add(self.head_5, 0, wx.ALL, 5) grid_sizer_1.Add(self.head_6, 0, wx.ALL, 5) grid_sizer_1.Add(self.head_7, 0, wx.ALL, 5) grid_sizer_1.Add(self.head_8, 0, wx.ALL, 5) grid_sizer_1.Add(self.head_9, 0, wx.ALL, 5) grid_sizer_1.Add(self.head_10, 0, wx.ALL, 5) grid_sizer_1.Add(self.head_11, 0, wx.ALL, 5) grid_sizer_1.Add(self.head_12, 0, wx.ALL, 5) grid_sizer_1.Add(self.head_13, 0, wx.ALL, 5) grid_sizer_1.Add(self.head_14, 0, wx.ALL, 5) grid_sizer_1.Add(self.head_15, 0, wx.ALL, 5) grid_sizer_1.Add(self.head_16, 0, wx.ALL, 5) grid_sizer_1.Add(self.head_17, 0, wx.ALL, 5) grid_sizer_1.Add(self.head_18, 0, wx.ALL, 5) grid_sizer_1.Add(self.head_19, 0, wx.ALL, 5) grid_sizer_1.Add(self.head2_0, 0, wx.ALL, 5) grid_sizer_1.Add(self.head2_1, 0, wx.ALL, 5) grid_sizer_1.Add(self.head2_2, 0, wx.ALL, 5) grid_sizer_1.Add(self.head2_3, 0, wx.ALL, 5) grid_sizer_1.Add(self.head2_4, 0, wx.ALL, 5) grid_sizer_1.Add(self.head2_5, 0, wx.ALL, 5) grid_sizer_1.Add(self.head2_6, 0, wx.ALL, 5) grid_sizer_1.Add(self.head2_7, 0, wx.ALL, 5) grid_sizer_1.Add(self.head2_8, 0, wx.ALL, 5) grid_sizer_1.Add(self.head2_9, 0, wx.ALL, 5) grid_sizer_1.Add(self.head2_10, 0, wx.ALL, 5) grid_sizer_1.Add(self.head2_11, 0, wx.ALL, 5) grid_sizer_1.Add(self.head2_12, 0, wx.ALL, 5) grid_sizer_1.Add(self.head2_13, 0, wx.ALL, 5) grid_sizer_1.Add(self.head2_14, 0, wx.ALL, 5) grid_sizer_1.Add(self.head2_15, 0, wx.ALL, 5) grid_sizer_1.Add(self.head2_16, 0, wx.ALL, 5) grid_sizer_1.Add(self.head2_17, 0, wx.ALL, 5) grid_sizer_1.Add(self.head2_18, 0, wx.ALL, 5) grid_sizer_1.Add(self.head2_19, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_1, 0, wx.ALL, 5) grid_sizer_1.Add(self.sc1_0, 0, wx.ALL, 5) grid_sizer_1.Add(self.sc1_1, 0, wx.ALL, 5) grid_sizer_1.Add(self.sc1_2, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb1_1, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb1_2, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb1_3, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb1_4, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb1_5, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb1_6, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb1_7, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb1_8, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb1_9, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb1_10, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb1_11, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb1_12, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb1_13, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb1_14, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb1_15, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb1_16, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_2, 0, wx.ALL, 5) grid_sizer_1.Add(self.sc2_0, 0, wx.ALL, 5) grid_sizer_1.Add(self.sc2_1, 0, wx.ALL, 5) grid_sizer_1.Add(self.sc2_2, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb2_1, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb2_2, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb2_3, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb2_4, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb2_5, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb2_6, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb2_7, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb2_8, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb2_9, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb2_10, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb2_11, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb2_12, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb2_13, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb2_14, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb2_15, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb2_16, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_3, 0, wx.ALL, 5) grid_sizer_1.Add(self.sc3_0, 0, wx.ALL, 5) grid_sizer_1.Add(self.sc3_1, 0, wx.ALL, 5) grid_sizer_1.Add(self.sc3_2, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb3_1, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb3_2, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb3_3, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb3_4, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb3_5, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb3_6, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb3_7, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb3_8, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb3_9, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb3_10, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb3_11, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb3_12, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb3_13, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb3_14, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb3_15, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb3_16, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_4, 0, wx.ALL, 5) grid_sizer_1.Add(self.sc4_0, 0, wx.ALL, 5) grid_sizer_1.Add(self.sc4_1, 0, wx.ALL, 5) grid_sizer_1.Add(self.sc4_2, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb4_1, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb4_2, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb4_3, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb4_4, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb4_5, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb4_6, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb4_7, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb4_8, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb4_9, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb4_10, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb4_11, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb4_12, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb4_13, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb4_14, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb4_15, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb4_16, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_5, 0, wx.ALL, 5) grid_sizer_1.Add(self.sc5_0, 0, wx.ALL, 5) grid_sizer_1.Add(self.sc5_1, 0, wx.ALL, 5) grid_sizer_1.Add(self.sc5_2, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb5_1, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb5_2, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb5_3, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb5_4, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb5_5, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb5_6, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb5_7, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb5_8, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb5_9, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb5_10, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb5_11, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb5_12, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb5_13, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb5_14, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb5_15, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb5_16, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_6, 0, wx.ALL, 5) grid_sizer_1.Add(self.sc6_0, 0, wx.ALL, 5) grid_sizer_1.Add(self.sc6_1, 0, wx.ALL, 5) grid_sizer_1.Add(self.sc6_2, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb6_1, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb6_2, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb6_3, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb6_4, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb6_5, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb6_6, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb6_7, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb6_8, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb6_9, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb6_10, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb6_11, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb6_12, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb6_13, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb6_14, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb6_15, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb6_16, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_7, 0, wx.ALL, 5) grid_sizer_1.Add(self.sc7_0, 0, wx.ALL, 5) grid_sizer_1.Add(self.sc7_1, 0, wx.ALL, 5) grid_sizer_1.Add(self.sc7_2, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb7_1, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb7_2, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb7_3, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb7_4, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb7_5, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb7_6, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb7_7, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb7_8, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb7_9, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb7_10, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb7_11, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb7_12, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb7_13, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb7_14, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb7_15, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb7_16, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_8, 0, wx.ALL, 5) grid_sizer_1.Add(self.sc8_0, 0, wx.ALL, 5) grid_sizer_1.Add(self.sc8_1, 0, wx.ALL, 5) grid_sizer_1.Add(self.sc8_2, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb8_1, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb8_2, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb8_3, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb8_4, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb8_5, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb8_6, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb8_7, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb8_8, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb8_9, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb8_10, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb8_11, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb8_12, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb8_13, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb8_14, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb8_15, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb8_16, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_90, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_91, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_92, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_93, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb9_1, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb9_2, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb9_3, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb9_4, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb9_5, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb9_6, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb9_7, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb9_8, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb9_9, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb9_10, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb9_11, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb9_12, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb9_13, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb9_14, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb9_15, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb9_16, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_100, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_101, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_102, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_103, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb10_1, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb10_2, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb10_3, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb10_4, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb10_5, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb10_6, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb10_7, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb10_8, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb10_9, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb10_10, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb10_11, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb10_12, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb10_13, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb10_14, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb10_15, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb10_16, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_110, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_111, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_112, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_113, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb11_1, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb11_2, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb11_3, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb11_4, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb11_5, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb11_6, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb11_7, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb11_8, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb11_9, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb11_10, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb11_11, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb11_12, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb11_13, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb11_14, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb11_15, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb11_16, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_120, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_121, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_122, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_123, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb12_1, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb12_2, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb12_3, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb12_4, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb12_5, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb12_6, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb12_7, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb12_8, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb12_9, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb12_10, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb12_11, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb12_12, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb12_13, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb12_14, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb12_15, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb12_16, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_130, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_131, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_132, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_133, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb13_1, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb13_2, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb13_3, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb13_4, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb13_5, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb13_6, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb13_7, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb13_8, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb13_9, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb13_10, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb13_11, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb13_12, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb13_13, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb13_14, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb13_15, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb13_16, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_140, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_141, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_142, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_143, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb14_1, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb14_2, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb14_3, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb14_4, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb14_5, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb14_6, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb14_7, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb14_8, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb14_9, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb14_10, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb14_11, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb14_12, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb14_13, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb14_14, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb14_15, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb14_16, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_150, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_151, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_152, 0, wx.ALL, 5) grid_sizer_1.Add(self.left_153, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb15_1, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb15_2, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb15_3, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb15_4, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb15_5, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb15_6, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb15_7, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb15_8, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb15_9, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb15_10, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb15_11, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb15_12, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb15_13, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb15_14, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb15_15, 0, wx.ALL, 5) grid_sizer_1.Add(self.cb15_16, 0, wx.ALL, 5) grid_sizer_1.Add(self.btn, 0, wx.TOP | wx.ALIGN_RIGHT, 20) grid_sizer_1.Add(self.btn1, 0, wx.TOP | wx.ALIGN_LEFT, 20) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(grid_sizer_1, 0, wx.ALL | wx.ALIGN_LEFT, border=20) self.SetSizer(sizer) wx.CallAfter(self.Layout) self.Bind(wx.EVT_BUTTON, self.Read, self.btn) self.Bind(wx.EVT_BUTTON, self.Write, self.btn1)
def __init__(self, parent, gui_size, cfg): """Constructor""" wx.Panel.__init__(self, parent=parent) self.config = cfg self.datafile = "" self.video = "" self.manager = None self.viz = None # design the panel sizer = wx.GridBagSizer(5, 5) text = wx.StaticText( self, label="DeepLabCut - Tracklets: Extract and Refine") sizer.Add(text, pos=(0, 0), flag=wx.TOP | wx.LEFT | wx.BOTTOM, border=15) # Add logo of DLC icon = wx.StaticBitmap(self, bitmap=wx.Bitmap(logo)) sizer.Add(icon, pos=(0, 4), flag=wx.TOP | wx.RIGHT | wx.ALIGN_RIGHT, border=5) line1 = wx.StaticLine(self) sizer.Add(line1, pos=(1, 0), span=(1, 5), flag=wx.EXPAND | wx.BOTTOM, border=10) self.cfg_text = wx.StaticText(self, label="Select the config file") sizer.Add(self.cfg_text, pos=(2, 0), flag=wx.TOP | wx.LEFT, border=5) if sys.platform == "darwin": self.sel_config = wx.FilePickerCtrl( self, path="", style=wx.FLP_USE_TEXTCTRL, message="Choose the config.yaml file", wildcard="*.yaml", ) else: self.sel_config = wx.FilePickerCtrl( self, path="", style=wx.FLP_USE_TEXTCTRL, message="Choose the config.yaml file", wildcard="config.yaml", ) # self.sel_config = wx.FilePickerCtrl(self, path="",style=wx.FLP_USE_TEXTCTRL,message="Choose the config.yaml file", wildcard="config.yaml") sizer.Add(self.sel_config, pos=(2, 1), span=(1, 3), flag=wx.TOP | wx.EXPAND, border=5) self.sel_config.SetPath(self.config) self.sel_config.Bind(wx.EVT_FILEPICKER_CHANGED, self.select_config) self.video_text = wx.StaticText(self, label="Select the video") sizer.Add(self.video_text, pos=(3, 0), flag=wx.TOP | wx.LEFT, border=5) self.sel_video = wx.FilePickerCtrl(self, path="", style=wx.FLP_USE_TEXTCTRL, message="Open video") sizer.Add(self.sel_video, pos=(3, 1), span=(1, 3), flag=wx.TOP | wx.EXPAND, border=5) self.sel_video.Bind(wx.EVT_FILEPICKER_CHANGED, self.select_video) self.data_text = wx.StaticText(self, label="Select the tracklet data") sizer.Add(self.data_text, pos=(4, 0), flag=wx.TOP | wx.LEFT, border=5) self.sel_datafile = wx.FilePickerCtrl( self, path="", style=wx.FLP_USE_TEXTCTRL, message="Open tracklet data" ) # wildcard="Pickle files (*.pickle)|*.pickle") sizer.Add( self.sel_datafile, pos=(4, 1), span=(1, 3), flag=wx.TOP | wx.EXPAND, border=5, ) self.sel_datafile.Bind(wx.EVT_FILEPICKER_CHANGED, self.select_datafile) hbox = wx.BoxSizer(wx.HORIZONTAL) slider_swap_text = wx.StaticBox(self, label="Specify the min swap fraction") slider_swap_sizer = wx.StaticBoxSizer(slider_swap_text, wx.VERTICAL) self.slider_swap = wx.SpinCtrl(self, value="2") slider_swap_sizer.Add(self.slider_swap, 20, wx.EXPAND | wx.TOP | wx.BOTTOM, 10) hbox.Add(slider_swap_sizer, 10, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) slider_track_text = wx.StaticBox( self, label="Specify the min relative tracklet length") slider_track_sizer = wx.StaticBoxSizer(slider_track_text, wx.VERTICAL) self.slider_track = wx.SpinCtrl(self, value="2") slider_track_sizer.Add(self.slider_track, 20, wx.EXPAND | wx.TOP | wx.BOTTOM, 10) hbox.Add(slider_track_sizer, 10, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) sizer.Add(hbox, pos=(5, 0), flag=wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, border=10) hbox_ = wx.BoxSizer(wx.HORIZONTAL) slider_gap_text = wx.StaticBox( self, label= "Specify the max gap size to fill, in frames (initial pickle file only!)", ) slider_gap_sizer = wx.StaticBoxSizer(slider_gap_text, wx.VERTICAL) self.slider_gap = wx.SpinCtrl(self, value="5") slider_gap_sizer.Add(self.slider_gap, 20, wx.EXPAND | wx.TOP | wx.BOTTOM, 10) hbox_.Add(slider_gap_sizer, 10, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) traillength_text = wx.StaticBox(self, label="Trail Length (visualization)") traillength_sizer = wx.StaticBoxSizer(traillength_text, wx.VERTICAL) self.length_track = wx.SpinCtrl(self, value="25") traillength_sizer.Add(self.length_track, 20, wx.EXPAND | wx.TOP | wx.BOTTOM, 10) hbox_.Add(traillength_sizer, 10, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) sizer.Add(hbox_, pos=(6, 0), flag=wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, border=10) # NEW ROW: hbox2 = wx.BoxSizer(wx.HORIZONTAL) videotype_text = wx.StaticBox(self, label="Specify the videotype") videotype_text_boxsizer = wx.StaticBoxSizer(videotype_text, wx.VERTICAL) videotypes = [".avi", ".mp4", ".mov"] self.videotype = wx.ComboBox(self, choices=videotypes, style=wx.CB_READONLY) self.videotype.SetValue(".avi") videotype_text_boxsizer.Add(self.videotype, 1, wx.EXPAND | wx.TOP | wx.BOTTOM, 10) shuffle_text = wx.StaticBox(self, label="Specify the shuffle") shuffle_boxsizer = wx.StaticBoxSizer(shuffle_text, wx.VERTICAL) self.shuffle = wx.SpinCtrl(self, value="1", min=0, max=100) shuffle_boxsizer.Add(self.shuffle, 1, wx.EXPAND | wx.TOP | wx.BOTTOM, 10) trainingset = wx.StaticBox(self, label="Specify the trainingset index") trainingset_boxsizer = wx.StaticBoxSizer(trainingset, wx.VERTICAL) self.trainingset = wx.SpinCtrl(self, value="0", min=0, max=100) trainingset_boxsizer.Add(self.trainingset, 1, wx.EXPAND | wx.TOP | wx.BOTTOM, 10) filter_text = wx.StaticBox(self, label="filter type") filter_sizer = wx.StaticBoxSizer(filter_text, wx.VERTICAL) filtertypes = ["median"] self.filter_track = wx.ComboBox(self, choices=filtertypes, style=wx.CB_READONLY) self.filter_track.SetValue("median") filter_sizer.Add(self.filter_track, 20, wx.EXPAND | wx.TOP | wx.BOTTOM, 10) filterlength_text = wx.StaticBox(self, label="filter: window length") filterlength_sizer = wx.StaticBoxSizer(filterlength_text, wx.VERTICAL) self.filterlength_track = wx.SpinCtrl(self, value="5") filterlength_sizer.Add(self.filterlength_track, 20, wx.EXPAND | wx.TOP | wx.BOTTOM, 10) hbox2.Add(videotype_text_boxsizer, 5, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) hbox2.Add(shuffle_boxsizer, 5, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) hbox2.Add(trainingset_boxsizer, 5, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) hbox2.Add(filter_sizer, 5, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) hbox2.Add(filterlength_sizer, 5, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) sizer.Add(hbox2, pos=(7, 0), flag=wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, border=10) self.ok = wx.Button(self, label="Step1: Launch GUI") sizer.Add(self.ok, pos=(6, 3)) self.ok.Bind(wx.EVT_BUTTON, self.refine_tracklets) self.help_button = wx.Button(self, label="Help") sizer.Add(self.help_button, pos=(8, 0), flag=wx.LEFT, border=10) self.help_button.Bind(wx.EVT_BUTTON, self.help_function) self.reset = wx.Button(self, label="Reset") sizer.Add(self.reset, pos=(8, 1), flag=wx.BOTTOM | wx.RIGHT, border=10) self.reset.Bind(wx.EVT_BUTTON, self.reset_refine_tracklets) self.filter = wx.Button(self, label=" Step2: Filter Tracks") sizer.Add(self.filter, pos=(8, 3), flag=wx.BOTTOM | wx.RIGHT, border=10) self.filter.Bind(wx.EVT_BUTTON, self.filter_after_refinement) self.export = wx.Button(self, label="Optional: Merge refined data") sizer.Add(self.export, pos=(10, 3), flag=wx.BOTTOM | wx.RIGHT, border=10) self.export.Bind(wx.EVT_BUTTON, self.export_data) self.export.Disable() sizer.AddGrowableCol(2) self.SetSizer(sizer) sizer.Fit(self)
def _init_ctrls(self, prnt): # generated method, don't edit wx.Dialog.__init__(self, id=wxID_DLGPOSITIONINPUT, name=u'DlgPositionInput', parent=prnt, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=wx.DEFAULT_DIALOG_STYLE, title=_(u'Motion positions')) self.pnlHdr = PnlDlgHeader(id=wxID_DLGPOSITIONINPUTPNLHDR, name=u'pnlHdr', parent=self, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=wx.TAB_TRAVERSAL) self.stStartPos = wx.StaticText(id=wxID_DLGPOSITIONINPUTSTSTARTPOS, label=_(u'Start position'), name=u'stStartPos', parent=self, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=0) self.slStartPos = wx.StaticLine(id=wxID_DLGPOSITIONINPUTSLSTARTPOS, name=u'slStartPos', parent=self, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=0) self.stStartLocation = wx.StaticText( id=wxID_DLGPOSITIONINPUTSTSTARTLOCATION, label=_(u'Location:'), name=u'stStartLocation', parent=self, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=0) self.spinStartX = wx.SpinCtrl(id=wxID_DLGPOSITIONINPUTSPINSTARTX, initial=0, max=100, min=0, name=u'spinStartX', parent=self, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=wx.SP_ARROW_KEYS) self.spinStartX.Bind(wx.EVT_TEXT, self.OnSpinChange, id=wxID_DLGPOSITIONINPUTSPINSTARTX) self.spinStartY = wx.SpinCtrl(id=wxID_DLGPOSITIONINPUTSPINSTARTY, initial=0, max=100, min=0, name=u'spinStartY', parent=self, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=wx.SP_ARROW_KEYS) self.spinStartY.Bind(wx.EVT_TEXT, self.OnSpinChange, id=wxID_DLGPOSITIONINPUTSPINSTARTY) self.stStartSize = wx.StaticText(id=wxID_DLGPOSITIONINPUTSTSTARTSIZE, label=_(u'Size:'), name=u'stStartSize', parent=self, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=0) self.spinStartWidth = wx.SpinCtrl( id=wxID_DLGPOSITIONINPUTSPINSTARTWIDTH, initial=0, max=100, min=0, name=u'spinStartWidth', parent=self, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=wx.SP_ARROW_KEYS) self.spinStartWidth.Bind(wx.EVT_TEXT, self.OnSpinChange, id=wxID_DLGPOSITIONINPUTSPINSTARTWIDTH) self.spinStartHeight = wx.SpinCtrl( id=wxID_DLGPOSITIONINPUTSPINSTARTHEIGHT, initial=0, max=100, min=0, name=u'spinStartHeight', parent=self, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=wx.SP_ARROW_KEYS) self.spinStartHeight.Bind(wx.EVT_TEXT, self.OnSpinChange, id=wxID_DLGPOSITIONINPUTSPINSTARTHEIGHT) self.stEndPos = wx.StaticText(id=wxID_DLGPOSITIONINPUTSTENDPOS, label=_(u'End position'), name=u'stEndPos', parent=self, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=0) self.slEndPos = wx.StaticLine(id=wxID_DLGPOSITIONINPUTSLENDPOS, name=u'slEndPos', parent=self, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=0) self.stEndLocation = wx.StaticText( id=wxID_DLGPOSITIONINPUTSTENDLOCATION, label=_(u'Location:'), name=u'stEndLocation', parent=self, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=0) self.spinEndX = wx.SpinCtrl(id=wxID_DLGPOSITIONINPUTSPINENDX, initial=0, max=100, min=0, name=u'spinEndX', parent=self, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=wx.SP_ARROW_KEYS) self.spinEndX.Bind(wx.EVT_TEXT, self.OnSpinChange, id=wxID_DLGPOSITIONINPUTSPINENDX) self.spinEndY = wx.SpinCtrl(id=wxID_DLGPOSITIONINPUTSPINENDY, initial=0, max=100, min=0, name=u'spinEndY', parent=self, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=wx.SP_ARROW_KEYS) self.spinEndY.Bind(wx.EVT_TEXT, self.OnSpinChange, id=wxID_DLGPOSITIONINPUTSPINENDY) self.stEndSize = wx.StaticText(id=wxID_DLGPOSITIONINPUTSTENDSIZE, label=_(u'Size:'), name=u'stEndSize', parent=self, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=0) self.spinEndWidth = wx.SpinCtrl(id=wxID_DLGPOSITIONINPUTSPINENDWIDTH, initial=0, max=100, min=0, name=u'spinEndWidth', parent=self, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=wx.SP_ARROW_KEYS) self.spinEndWidth.Bind(wx.EVT_TEXT, self.OnSpinChange, id=wxID_DLGPOSITIONINPUTSPINENDWIDTH) self.spinEndHeight = wx.SpinCtrl(id=wxID_DLGPOSITIONINPUTSPINENDHEIGHT, initial=0, max=100, min=0, name=u'spinEndHeight', parent=self, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=wx.SP_ARROW_KEYS) self.spinEndHeight.Bind(wx.EVT_TEXT, self.OnSpinChange, id=wxID_DLGPOSITIONINPUTSPINENDHEIGHT) self.cmdReset = wx.Button(id=wxID_DLGPOSITIONINPUTCMDRESET, label=_(u'Reset'), name=u'cmdReset', parent=self, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=0) self.cmdReset.Bind(wx.EVT_BUTTON, self.OnCmdResetButton, id=wxID_DLGPOSITIONINPUTCMDRESET) self.cmdCancel = wx.Button(id=wx.ID_CANCEL, label=_(u'&Cancel'), name=u'cmdCancel', parent=self, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=0) self.cmdCancel.Bind(wx.EVT_BUTTON, self.OnCmdCancelButton, id=wx.ID_CANCEL) self.cmdOk = wx.Button(id=wx.ID_OK, label=_(u'&Ok'), name=u'cmdOk', parent=self, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=0) self._init_sizers()
def __init__( self, parent ): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.Size( 355,228 ), style = wx.CAPTION|wx.CLOSE_BOX|wx.SYSTEM_MENU|wx.TAB_TRAVERSAL ) self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) bSizerMain = wx.BoxSizer( wx.VERTICAL ) bSizerIconBar = wx.BoxSizer( wx.HORIZONTAL ) self.m_IconT0 = wx.StaticText( self, wx.ID_ANY, u"T0", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_IconT0.Wrap( -1 ) self.m_IconT0.SetFont( wx.Font( 12, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "Arial" ) ) bSizerIconBar.Add( self.m_IconT0, 0, wx.ALL, 5 ) self.m_IconT1 = wx.StaticText( self, wx.ID_ANY, u"T1", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_IconT1.Wrap( -1 ) self.m_IconT1.SetFont( wx.Font( 12, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, "Arial" ) ) bSizerIconBar.Add( self.m_IconT1, 0, wx.ALL, 5 ) bSizerIconBar.Add( ( 0, 0), 3, wx.EXPAND, 5 ) self.m_IconOverflow = wx.StaticText( self, wx.ID_ANY, u"Overflow", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_IconOverflow.Wrap( -1 ) self.m_IconOverflow.SetFont( wx.Font( 12, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "Arial" ) ) bSizerIconBar.Add( self.m_IconOverflow, 0, wx.ALL, 5 ) self.m_IconAlarm = wx.StaticText( self, wx.ID_ANY, u"Alarm", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_IconAlarm.Wrap( -1 ) self.m_IconAlarm.SetFont( wx.Font( 12, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "Arial" ) ) bSizerIconBar.Add( self.m_IconAlarm, 0, wx.ALL, 5 ) self.m_IconMode = wx.StaticText( self, wx.ID_ANY, u"Alt", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_IconMode.Wrap( -1 ) self.m_IconMode.SetFont( wx.Font( 12, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "Arial" ) ) bSizerIconBar.Add( self.m_IconMode, 0, wx.ALL, 5 ) bSizerMain.Add( bSizerIconBar, 1, wx.EXPAND, 5 ) self.m_panelTimer = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) self.m_panelTimer.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_HIGHLIGHTTEXT ) ) self.bSizerTimer = wx.BoxSizer( wx.HORIZONTAL ) self.bSizerTimer.Add( ( 0, 0), 3, wx.EXPAND, 5 ) self.m_spinEditHour = wx.SpinCtrl( self.m_panelTimer, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( -1,-1 ), wx.ALIGN_CENTER_HORIZONTAL|wx.SP_ARROW_KEYS|wx.SP_WRAP|wx.TE_PROCESS_ENTER, 0, 59, 10 ) self.m_spinEditHour.SetFont( wx.Font( 36, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "Arial" ) ) self.m_spinEditHour.Hide() self.bSizerTimer.Add( self.m_spinEditHour, 0, wx.ALL, 5 ) self.m_staticHour = wx.StaticText( self.m_panelTimer, wx.ID_ANY, u"00", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticHour.Wrap( -1 ) self.m_staticHour.SetFont( wx.Font( 36, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "Arial" ) ) self.bSizerTimer.Add( self.m_staticHour, 0, wx.ALL, 5 ) self.m_staticTimerColon1 = wx.StaticText( self.m_panelTimer, wx.ID_ANY, u":", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticTimerColon1.Wrap( -1 ) self.m_staticTimerColon1.SetFont( wx.Font( 36, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "Arial" ) ) self.bSizerTimer.Add( self.m_staticTimerColon1, 0, wx.ALL, 5 ) self.m_spinEditMinute = wx.SpinCtrl( self.m_panelTimer, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( -1,-1 ), wx.ALIGN_CENTER_HORIZONTAL|wx.SP_ARROW_KEYS|wx.SP_WRAP|wx.TE_PROCESS_ENTER, 0, 59, 10 ) self.m_spinEditMinute.SetFont( wx.Font( 36, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "Arial" ) ) self.m_spinEditMinute.Hide() self.bSizerTimer.Add( self.m_spinEditMinute, 0, wx.ALL, 5 ) self.m_staticMinute = wx.StaticText( self.m_panelTimer, wx.ID_ANY, u"00", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticMinute.Wrap( -1 ) self.m_staticMinute.SetFont( wx.Font( 36, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "Arial" ) ) self.bSizerTimer.Add( self.m_staticMinute, 0, wx.ALL, 5 ) self.m_staticTimerColon2 = wx.StaticText( self.m_panelTimer, wx.ID_ANY, u":", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticTimerColon2.Wrap( -1 ) self.m_staticTimerColon2.SetFont( wx.Font( 36, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "Arial" ) ) self.bSizerTimer.Add( self.m_staticTimerColon2, 0, wx.ALL, 5 ) self.m_spinEditSecond = wx.SpinCtrl( self.m_panelTimer, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( -1,-1 ), wx.ALIGN_CENTER_HORIZONTAL|wx.SP_ARROW_KEYS|wx.SP_WRAP|wx.TE_PROCESS_ENTER, 0, 59, 10 ) self.m_spinEditSecond.SetFont( wx.Font( 36, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "Arial" ) ) self.m_spinEditSecond.Hide() self.bSizerTimer.Add( self.m_spinEditSecond, 0, wx.ALL, 5 ) self.m_staticSecond = wx.StaticText( self.m_panelTimer, wx.ID_ANY, u"00", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticSecond.Wrap( -1 ) self.m_staticSecond.SetFont( wx.Font( 36, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "Arial" ) ) self.bSizerTimer.Add( self.m_staticSecond, 0, wx.ALL, 5 ) self.bSizerTimer.Add( ( 0, 0), 3, wx.EXPAND, 5 ) self.m_panelTimer.SetSizer( self.bSizerTimer ) self.m_panelTimer.Layout() self.bSizerTimer.Fit( self.m_panelTimer ) bSizerMain.Add( self.m_panelTimer, 9, wx.EXPAND |wx.ALL, 5 ) bSizerButtons = wx.BoxSizer( wx.HORIZONTAL ) self.m_btnStart = wx.Button( self, wx.ID_ANY, u"Start", wx.DefaultPosition, wx.DefaultSize, wx.BU_EXACTFIT|wx.BU_NOTEXT ) self.m_btnStart.SetDefault() bSizerButtons.Add( self.m_btnStart, 0, wx.ALL, 5 ) self.m_btnStop = wx.Button( self, wx.ID_ANY, u"Stop", wx.DefaultPosition, wx.DefaultSize, wx.BU_EXACTFIT|wx.BU_NOTEXT ) bSizerButtons.Add( self.m_btnStop, 0, wx.ALL, 5 ) self.m_btnClear = wx.Button( self, wx.ID_ANY, u"Clear", wx.DefaultPosition, wx.DefaultSize, wx.BU_EXACTFIT|wx.BU_NOTEXT ) bSizerButtons.Add( self.m_btnClear, 0, wx.ALL, 5 ) self.m_btnSet = wx.Button( self, wx.ID_ANY, u"Set", wx.DefaultPosition, wx.DefaultSize, wx.BU_EXACTFIT|wx.BU_NOTEXT ) bSizerButtons.Add( self.m_btnSet, 0, wx.ALL, 5 ) bSizerMain.Add( bSizerButtons, 1, wx.EXPAND, 5 ) self.SetSizer( bSizerMain ) self.Layout() self.Centre( wx.BOTH ) # Connect Events self.Bind( wx.EVT_CLOSE, self.OnClose ) self.m_IconT0.Bind( wx.EVT_LEFT_DCLICK, self.OnIconTnLeftDClick ) self.m_IconT1.Bind( wx.EVT_LEFT_DCLICK, self.OnIconTnLeftDClick ) self.m_spinEditHour.Bind( wx.EVT_KILL_FOCUS, self.OnExitEdit ) self.m_spinEditHour.Bind( wx.EVT_SPINCTRL, self.m_spinEditOnSpinCtrl ) self.m_spinEditHour.Bind( wx.EVT_TEXT_ENTER, self.OnExitEdit ) self.m_staticHour.Bind( wx.EVT_LEFT_DCLICK, self.m_staticHourOnLeftDClick ) self.m_spinEditMinute.Bind( wx.EVT_KILL_FOCUS, self.OnExitEdit ) self.m_spinEditMinute.Bind( wx.EVT_SPINCTRL, self.m_spinEditOnSpinCtrl ) self.m_spinEditMinute.Bind( wx.EVT_TEXT_ENTER, self.OnExitEdit ) self.m_staticMinute.Bind( wx.EVT_LEFT_DCLICK, self.m_staticMinuteOnLeftDClick ) self.m_spinEditSecond.Bind( wx.EVT_KILL_FOCUS, self.OnExitEdit ) self.m_spinEditSecond.Bind( wx.EVT_SPINCTRL, self.m_spinEditOnSpinCtrl ) self.m_spinEditSecond.Bind( wx.EVT_TEXT_ENTER, self.OnExitEdit ) self.m_staticSecond.Bind( wx.EVT_LEFT_DCLICK, self.m_staticSecondOnLeftDClick ) self.m_btnStart.Bind( wx.EVT_BUTTON, self.OnStart ) self.m_btnStop.Bind( wx.EVT_BUTTON, self.OnStop ) self.m_btnClear.Bind( wx.EVT_BUTTON, self.OnClear ) self.m_btnSet.Bind( wx.EVT_BUTTON, self.OnSet )
def __init__( self, parent ): wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Settings", pos = wx.DefaultPosition, size = wx.Size( 494,549 ), style = wx.DEFAULT_DIALOG_STYLE|wx.STAY_ON_TOP ) self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) bSizerDlgMain = wx.BoxSizer( wx.VERTICAL ) m_TimerMgrModeChoices = [ u"Standalone", u"Alternation" ] self.m_TimerMgrMode = wx.RadioBox( self, wx.ID_ANY, u"Mode", wx.DefaultPosition, wx.DefaultSize, m_TimerMgrModeChoices, 1, wx.RA_SPECIFY_ROWS ) self.m_TimerMgrMode.SetSelection( 0 ) bSizerDlgMain.Add( self.m_TimerMgrMode, 0, wx.ALL|wx.EXPAND, 5 ) sbSizerTimer0 = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Timer0" ), wx.VERTICAL ) bSizerTimerName0 = wx.BoxSizer( wx.HORIZONTAL ) self.m_staticTimerName0 = wx.StaticText( sbSizerTimer0.GetStaticBox(), wx.ID_ANY, u"Name:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticTimerName0.Wrap( -1 ) bSizerTimerName0.Add( self.m_staticTimerName0, 0, wx.ALL, 5 ) self.m_textTimerName0 = wx.TextCtrl( sbSizerTimer0.GetStaticBox(), wx.ID_ANY, u"Working", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_textTimerName0.SetMaxLength( 128 ) bSizerTimerName0.Add( self.m_textTimerName0, 1, wx.ALL, 5 ) sbSizerTimer0.Add( bSizerTimerName0, 1, wx.EXPAND, 5 ) bSizerTimerData0 = wx.BoxSizer( wx.HORIZONTAL ) self.m_spinHour0 = wx.SpinCtrl( sbSizerTimer0.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 60,-1 ), wx.ALIGN_RIGHT|wx.SP_ARROW_KEYS|wx.TE_PROCESS_ENTER, 0, 99, 0 ) bSizerTimerData0.Add( self.m_spinHour0, 0, wx.ALL, 5 ) self.m_staticColon01 = wx.StaticText( sbSizerTimer0.GetStaticBox(), wx.ID_ANY, u":", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticColon01.Wrap( -1 ) bSizerTimerData0.Add( self.m_staticColon01, 0, wx.ALL, 5 ) self.m_spinMinute0 = wx.SpinCtrl( sbSizerTimer0.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 60,-1 ), wx.ALIGN_RIGHT|wx.SP_ARROW_KEYS|wx.TE_PROCESS_ENTER, 0, 59, 0 ) bSizerTimerData0.Add( self.m_spinMinute0, 0, wx.ALL, 5 ) self.m_staticColon02 = wx.StaticText( sbSizerTimer0.GetStaticBox(), wx.ID_ANY, u":", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticColon02.Wrap( -1 ) bSizerTimerData0.Add( self.m_staticColon02, 0, wx.ALL, 5 ) self.m_spinSecond0 = wx.SpinCtrl( sbSizerTimer0.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 60,-1 ), wx.ALIGN_RIGHT|wx.SP_ARROW_KEYS|wx.TE_PROCESS_ENTER, 0, 59, 0 ) bSizerTimerData0.Add( self.m_spinSecond0, 0, wx.ALL, 5 ) self.m_chkCycling0 = wx.CheckBox( sbSizerTimer0.GetStaticBox(), wx.ID_ANY, u"Cycling", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizerTimerData0.Add( self.m_chkCycling0, 0, wx.ALL, 5 ) sbSizerTimer0.Add( bSizerTimerData0, 1, wx.EXPAND, 5 ) bSizerDlgMain.Add( sbSizerTimer0, 1, wx.EXPAND, 5 ) sbSizerTimer1 = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Timer1" ), wx.VERTICAL ) bSizerTimerName1 = wx.BoxSizer( wx.HORIZONTAL ) self.m_staticTimerName1 = wx.StaticText( sbSizerTimer1.GetStaticBox(), wx.ID_ANY, u"Name:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticTimerName1.Wrap( -1 ) bSizerTimerName1.Add( self.m_staticTimerName1, 0, wx.ALL, 5 ) self.m_textTimerName1 = wx.TextCtrl( sbSizerTimer1.GetStaticBox(), wx.ID_ANY, u"Break", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_textTimerName1.SetMaxLength( 128 ) bSizerTimerName1.Add( self.m_textTimerName1, 1, wx.ALL, 5 ) sbSizerTimer1.Add( bSizerTimerName1, 1, wx.EXPAND, 5 ) bSizerTimerData1 = wx.BoxSizer( wx.HORIZONTAL ) self.m_spinHour1 = wx.SpinCtrl( sbSizerTimer1.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 60,-1 ), wx.ALIGN_RIGHT|wx.SP_ARROW_KEYS|wx.TE_PROCESS_ENTER, 0, 99, 0 ) bSizerTimerData1.Add( self.m_spinHour1, 0, wx.ALL, 5 ) self.m_staticColon11 = wx.StaticText( sbSizerTimer1.GetStaticBox(), wx.ID_ANY, u":", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticColon11.Wrap( -1 ) bSizerTimerData1.Add( self.m_staticColon11, 0, wx.ALL, 5 ) self.m_spinMinute1 = wx.SpinCtrl( sbSizerTimer1.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 60,-1 ), wx.ALIGN_RIGHT|wx.SP_ARROW_KEYS|wx.TE_PROCESS_ENTER, 0, 59, 0 ) bSizerTimerData1.Add( self.m_spinMinute1, 0, wx.ALL, 5 ) self.m_staticColon12 = wx.StaticText( sbSizerTimer1.GetStaticBox(), wx.ID_ANY, u":", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticColon12.Wrap( -1 ) bSizerTimerData1.Add( self.m_staticColon12, 0, wx.ALL, 5 ) self.m_spinSecond1 = wx.SpinCtrl( sbSizerTimer1.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 60,-1 ), wx.ALIGN_RIGHT|wx.SP_ARROW_KEYS|wx.TE_PROCESS_ENTER, 0, 59, 0 ) bSizerTimerData1.Add( self.m_spinSecond1, 0, wx.ALL, 5 ) self.m_chkCycling1 = wx.CheckBox( sbSizerTimer1.GetStaticBox(), wx.ID_ANY, u"Cycling", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizerTimerData1.Add( self.m_chkCycling1, 0, wx.ALL, 5 ) sbSizerTimer1.Add( bSizerTimerData1, 1, wx.EXPAND, 5 ) bSizerDlgMain.Add( sbSizerTimer1, 1, wx.EXPAND, 5 ) sbSizerAlarm = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Alarm" ), wx.VERTICAL ) bSizerSound = wx.BoxSizer( wx.HORIZONTAL ) self.m_chkAlarmSound = wx.CheckBox( sbSizerAlarm.GetStaticBox(), wx.ID_ANY, u"Sound:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_chkAlarmSound.SetValue(True) bSizerSound.Add( self.m_chkAlarmSound, 0, wx.ALL, 5 ) self.m_staticSoundFile = wx.StaticText( sbSizerAlarm.GetStaticBox(), wx.ID_ANY, u"Sound File Path", wx.DefaultPosition, wx.DefaultSize, wx.ST_ELLIPSIZE_MIDDLE ) self.m_staticSoundFile.Wrap( -1 ) bSizerSound.Add( self.m_staticSoundFile, 2, wx.ALL, 5 ) self.m_btnSelSound = wx.Button( sbSizerAlarm.GetStaticBox(), wx.ID_ANY, u"...", wx.DefaultPosition, wx.Size( 25,25 ), wx.BU_BOTTOM ) bSizerSound.Add( self.m_btnSelSound, 0, wx.ALL, 5 ) sbSizerAlarm.Add( bSizerSound, 1, wx.EXPAND, 5 ) self.m_chkAlarmNotification = wx.CheckBox( sbSizerAlarm.GetStaticBox(), wx.ID_ANY, u"Notification", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_chkAlarmNotification.SetValue(True) sbSizerAlarm.Add( self.m_chkAlarmNotification, 0, wx.ALL, 5 ) self.m_chkAlarmBlinkIcon = wx.CheckBox( sbSizerAlarm.GetStaticBox(), wx.ID_ANY, u"Blink Taskbar Icon", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_chkAlarmBlinkIcon.SetValue(True) sbSizerAlarm.Add( self.m_chkAlarmBlinkIcon, 0, wx.ALL, 5 ) bSizerDuration = wx.BoxSizer( wx.HORIZONTAL ) self.m_staticDuration = wx.StaticText( sbSizerAlarm.GetStaticBox(), wx.ID_ANY, u"Duration:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticDuration.Wrap( -1 ) bSizerDuration.Add( self.m_staticDuration, 0, wx.ALL, 5 ) self.m_spinDuration = wx.SpinCtrl( sbSizerAlarm.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_RIGHT|wx.SP_ARROW_KEYS|wx.TE_PROCESS_ENTER, 1, 60, 5 ) bSizerDuration.Add( self.m_spinDuration, 0, wx.ALL, 5 ) self.m_staticText21 = wx.StaticText( sbSizerAlarm.GetStaticBox(), wx.ID_ANY, u"Second(s)", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText21.Wrap( -1 ) bSizerDuration.Add( self.m_staticText21, 0, wx.ALL, 5 ) sbSizerAlarm.Add( bSizerDuration, 1, wx.EXPAND, 5 ) bSizerDlgMain.Add( sbSizerAlarm, 1, wx.EXPAND, 5 ) bSizerButton = wx.BoxSizer( wx.HORIZONTAL ) bSizerButton.Add( ( 0, 0), 1, wx.EXPAND, 5 ) self.m_btnOK = wx.Button( self, wx.ID_OK, u"&OK", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_btnOK.SetDefault() bSizerButton.Add( self.m_btnOK, 0, wx.ALL, 5 ) self.m_btnReset = wx.Button( self, wx.ID_ANY, u"&Reset", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizerButton.Add( self.m_btnReset, 0, wx.ALL, 5 ) self.m_btnCancel = wx.Button( self, wx.ID_CANCEL, u"&Cancel", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizerButton.Add( self.m_btnCancel, 0, wx.ALL, 5 ) bSizerButton.Add( ( 0, 0), 1, wx.EXPAND, 5 ) bSizerDlgMain.Add( bSizerButton, 1, wx.EXPAND, 5 ) self.SetSizer( bSizerDlgMain ) self.Layout() self.Centre( wx.BOTH ) # Connect Events self.m_TimerMgrMode.Bind( wx.EVT_RADIOBOX, self.m_TimerMgrModeOnRadioBox ) self.m_btnSelSound.Bind( wx.EVT_BUTTON, self.m_btnSelSoundOnButtonClick ) self.m_btnOK.Bind( wx.EVT_BUTTON, self.m_btnOKOnButtonClick ) self.m_btnReset.Bind( wx.EVT_BUTTON, self.m_btnResetOnButtonClick )
def __init__(self, parent, initialvalues={}, title="", cells=True, procs=True, Min=True, Max=True, minmaxcell=False, **kwargs): wx.Panel.__init__(self, parent, **kwargs) #minmax version of cells or proces assert (cells or procs) != minmaxcell #Add title self.title = wx.StaticText(self, label=title, style=wx.ALIGN_CENTER | wx.SIMPLE_BORDER) font = wx.Font(18, wx.MODERN, wx.NORMAL, wx.NORMAL) self.title.SetFont(font) self.hbox = wx.BoxSizer(wx.HORIZONTAL) self.hbox.Add(self.title) #Add number of cells input if cells or minmaxcell: self.nxyz = wx.Panel(self) if cells: self.nxyz.label = wx.StaticText(self, label="Cells", size=(50, -1)) nx = initialvalues.get('nx', 8) ny = initialvalues.get('ny', 8) nz = initialvalues.get('nz', 8) elif minmaxcell: self.nxyz.label = wx.StaticText(self, label="Mincell", size=(50, -1)) nx = initialvalues.get('mincellx', 1) ny = initialvalues.get('mincelly', 1) nz = initialvalues.get('mincellz', 1) self.nxyz.nx = wx.SpinCtrl(self, value=str(nx)) self.nxyz.ny = wx.SpinCtrl(self, value=str(ny)) self.nxyz.nz = wx.SpinCtrl(self, value=str(nz)) self.nx = self.nxyz.nx self.ny = self.nxyz.ny self.nz = self.nxyz.nz #Add to sizer self.nhbox = wx.BoxSizer(wx.HORIZONTAL) self.nhbox.Add(self.nxyz.label, 0) self.nhbox.Add(self.nxyz.nx, 0) self.nhbox.Add(self.nxyz.ny, 0) self.nhbox.Add(self.nxyz.nz, 0) #Add number of processor input if procs or minmaxcell: self.pxyz = wx.Panel(self) if procs: self.pxyz.label = wx.StaticText(self, label="Procs", size=(50, -1)) px = initialvalues.get('px', 1) py = initialvalues.get('py', 1) pz = initialvalues.get('pz', 1) elif minmaxcell: self.pxyz.label = wx.StaticText(self, label="Maxcell", size=(50, -1)) px = initialvalues.get('maxcellx', 8) py = initialvalues.get('maxcelly', 3) pz = initialvalues.get('maxcellz', 8) self.pxyz.px = wx.SpinCtrl(self, value=str(px)) self.pxyz.py = wx.SpinCtrl(self, value=str(py)) self.pxyz.pz = wx.SpinCtrl(self, value=str(pz)) self.px = self.pxyz.px self.py = self.pxyz.py self.pz = self.pxyz.pz #Add to sizer self.phbox = wx.BoxSizer(wx.HORIZONTAL) self.phbox.Add(self.pxyz.label, 0) self.phbox.Add(self.pxyz.px, 0) self.phbox.Add(self.pxyz.py, 0) self.phbox.Add(self.pxyz.pz, 0) #Add minimum domain size input if Min: self.min_xyz = wx.Panel(self) self.min_xyz.label = wx.StaticText(self, label="Origin", size=(50, -1)) xmin = initialvalues.get('xmin', 0.) self.min_xyz.xmin = FS.FloatSpin(self, -1, value=str(xmin)) self.min_xyz.xmin.SetFormat("%f") self.min_xyz.xmin.SetDigits(2) ymin = initialvalues.get('ymin', 0.) self.min_xyz.ymin = FS.FloatSpin(self, -1, value=str(ymin)) self.min_xyz.ymin.SetFormat("%f") self.min_xyz.ymin.SetDigits(2) zmin = initialvalues.get('zmin', 0.) self.min_xyz.zmin = FS.FloatSpin(self, -1, value=str(zmin)) self.min_xyz.zmin.SetFormat("%f") self.min_xyz.zmin.SetDigits(2) self.xmin = self.min_xyz.xmin self.ymin = self.min_xyz.ymin self.zmin = self.min_xyz.zmin #Add to sizer self.minhbox = wx.BoxSizer(wx.HORIZONTAL) self.minhbox.Add(self.min_xyz.label, 0) self.minhbox.Add(self.min_xyz.xmin, 0) self.minhbox.Add(self.min_xyz.ymin, 0) self.minhbox.Add(self.min_xyz.zmin, 0) #Add maximum domain size input if Max: self.max_xyz = wx.Panel(self) self.max_xyz.label = wx.StaticText(self, label="Domain", size=(50, -1)) xmax = initialvalues.get('xmax', 1.) self.max_xyz.xmax = FS.FloatSpin(self, -1, value=str(xmax)) self.max_xyz.xmax.SetFormat("%f") self.max_xyz.xmax.SetDigits(2) ymax = initialvalues.get('ymax', 1.) self.max_xyz.ymax = FS.FloatSpin(self, -1, value=str(ymax)) self.max_xyz.ymax.SetFormat("%f") self.max_xyz.ymax.SetDigits(2) zmax = initialvalues.get('zmax', 1.) self.max_xyz.zmax = FS.FloatSpin(self, -1, value=str(zmax)) self.max_xyz.zmax.SetFormat("%f") self.max_xyz.zmax.SetDigits(2) self.xmax = self.max_xyz.xmax self.ymax = self.max_xyz.ymax self.zmax = self.max_xyz.zmax #Add to sizer self.maxhbox = wx.BoxSizer(wx.HORIZONTAL) self.maxhbox.Add(self.max_xyz.label, 0) self.maxhbox.Add(self.max_xyz.xmax, 0) self.maxhbox.Add(self.max_xyz.ymax, 0) self.maxhbox.Add(self.max_xyz.zmax, 0) #Split panels with a vertical sizer self.vbox = wx.BoxSizer(wx.VERTICAL) self.vbox.Add(self.hbox, 1, wx.ALL | wx.ALIGN_CENTER, 5) if cells or minmaxcell: self.vbox.Add(self.nhbox, 0) if procs or minmaxcell: self.vbox.Add(self.phbox, 0) if Min: self.vbox.Add(self.minhbox, 0) if Max: self.vbox.Add(self.maxhbox, 0) #When we set this sizer, causes a segfault self.SetAutoLayout(True) self.SetSizer(self.vbox) self.Layout()
def __init__(self, parent, id): global craft, slider, spin, gauge, combo, txt, lb wx.Frame.__init__(self, parent, id, "Craft Python SDK Sample", size=(800, 400)) panel = wx.Panel(self) lbl = wx.StaticText(panel, -1, label="text", pos=(10, 20), size=(50, -1)) lbl.SetLabel("Slider") slider = wx.Slider(panel, -1, 0, 1, 1000, (100, 20), (200, -1)) slider.Bind(wx.EVT_SET_FOCUS, self.sliderFocus) slider.Bind(wx.EVT_LEFT_UP, self.sliderFocus) lbl = wx.StaticText(panel, -1, label="text", pos=(10, 100), size=(50, -1)) lbl.SetLabel("SpinCtrl") spin = wx.SpinCtrl(panel, -1, "", pos=(100, 100), size=(200, -1), min=0, max=1000) spin.Bind(wx.EVT_CHILD_FOCUS, self.spinCtrlFocus) spin.Bind(wx.EVT_LEFT_UP, self.spinCtrlFocus) lbl = wx.StaticText(panel, -1, label="text", pos=(10, 180), size=(50, -1)) lbl.SetLabel("Gauge") gauge = wx.Gauge(panel, -1, range=500, pos=(100, 180), size=(200, 25)) gauge.Bind(wx.EVT_LEFT_UP, self.gaugeClick) lbl = wx.StaticText(panel, -1, label="text", pos=(10, 260), size=(50, -1)) lbl.SetLabel("ComboBox") l = [] for i in range(0, 1000): l.append(str(i)) combo = wx.ComboBox(panel, -1, "", pos=(100, 260), size=(200, 25), choices=l) combo.Bind(wx.EVT_SET_FOCUS, self.comboBoxFocus) combo.Bind(wx.EVT_LEFT_UP, self.comboBoxFocus) lbl = wx.StaticText(panel, -1, label="text", pos=(400, 20), size=(50, -1)) lbl.SetLabel("TextCtrl") vtxt = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque semper ut felis non bibendum. " \ "Suspendisse potenti. Mauris rhoncus auctor quam, non ullamcorper elit interdum a. Aliquam erat volutpat. " \ "Ut facilisis odio a enim facilisis, at porta lectus hendrerit. Curabitur et vulputate lectus, nec sollicitudin odio. " \ "Morbi tincidunt iaculis erat, eu bibendum sapien vehicula vel. Etiam sodales malesuada mauris, " \ "quis viverra eros imperdiet at. Vestibulum maximus dui dolor, sed laoreet arcu laoreet in. " txt = wx.TextCtrl(panel, -1, vtxt, pos=(480, 20), size=(100, -1), style=wx.TE_MULTILINE | wx.TE_READONLY) txt.Bind(wx.EVT_SET_FOCUS, self.textCtrlFocus) txt.Bind(wx.EVT_LEFT_UP, self.textCtrlFocus) lbl = wx.StaticText(panel, -1, label="text", pos=(400, 180), size=(50, -1)) lbl.SetLabel("ListBox") li = [] for i in range(0, 1000): li.append(str(i)) lb = wx.ListBox(panel, -1, pos=(480, 180), size=(100, -1), choices=li) lb.Bind(wx.EVT_SET_FOCUS, self.listBoxFocus) lb.Bind(wx.EVT_LEFT_UP, self.listBoxFocus)
def __init__(self, LIBRARIES, flag): wx.Dialog.__init__(self, None, -1, '词库设置', size=(400, 240), style=wx.CAPTION | wx.SYSTEM_MENU | wx.CLOSE_BOX) self.lib_id = -1 self.old_setting = [] panel = wx.Panel(self) v_box = wx.BoxSizer(wx.VERTICAL) h_box_combo = wx.BoxSizer(wx.HORIZONTAL) panel_combo = wx.Panel(panel) # global lib_index lib_items = ['请选择词库'] for index, element in enumerate(LIBRARIES): lib_items.append(LIBRARIES[element].decode('utf-8')) lib_text = wx.StaticText(panel_combo, -1, "选择设置词库:") lib_combo_box = wx.ComboBox(panel_combo, choices=lib_items, style=wx.CB_READONLY) # 逆转LIBRARIES字典,以便于根据词库名称获取词库的ID,避免访问数据库。 reverse_lib = {v: k for k, v in LIBRARIES.items()} self.Bind(wx.EVT_COMBOBOX, lambda evt, ob=lib_combo_box, lib=reverse_lib: self.test( evt, ob, lib), lib_combo_box) if flag == -1: lib_combo_box.SetSelection(0) else: lib_index = lib_items.index(LIBRARIES[flag].decode('utf-8')) lib_combo_box.SetSelection(lib_index) self.lib_id = str(flag).zfill(3) self.old_setting = self.fetch_setting(self.lib_id) h_box_combo.Add(lib_text, 0, wx.ALIGN_CENTER_VERTICAL) h_box_combo.Add(lib_combo_box, 0, wx.LEFT | wx.RIGHT, 10) panel_combo.SetSizer(h_box_combo) v_box.Add(panel_combo, 0, wx.EXPAND | wx.ALL, 10) line_1 = wx.StaticLine(panel, -1, size=(-1, -1), style=wx.LI_HORIZONTAL) v_box.Add(line_1, 0, wx.EXPAND) panel_top = wx.Panel(panel, -1, style=wx.BORDER_MASK) panel_top.SetBackgroundColour('white') v_box_t = wx.BoxSizer(wx.VERTICAL) h_box_g1 = wx.BoxSizer(wx.HORIZONTAL) h_box_g2 = wx.BoxSizer(wx.HORIZONTAL) self.show_rest = wx.CheckBox(panel_top, label='在复习的时候显示剩余卡片数', style=wx.CHK_3STATE) if self.old_setting: if self.old_setting[2] == 'True': self.show_rest.SetValue(True) elif self.old_setting[2] == 'False': self.show_rest.SetValue(False) else: self.show_rest.SetValue(True) text1 = wx.StaticText(panel_top, label="每日学习卡片上限(张)") text2 = wx.StaticText(panel_top, label="每日复习卡片上限(张)") self.study_limit = wx.SpinCtrl(panel_top, -1) self.study_limit.SetRange(1, 200) if self.old_setting: self.study_limit.SetValue(int(self.old_setting[1])) else: self.study_limit.SetValue(50) self.review_limit = wx.SpinCtrl(panel_top, -1) self.review_limit.SetRange(1, 200) if self.old_setting: self.review_limit.SetValue(int(self.old_setting[0])) else: self.review_limit.SetValue(50) h_box_g1.Add(text1, 0, wx.ALIGN_CENTER_VERTICAL) h_box_g1.Add(self.study_limit, 0, wx.LEFT, 15) h_box_g2.Add(text2, 0) h_box_g2.Add(self.review_limit, 0, wx.LEFT, 15) v_box_t.Add(self.show_rest, 0, wx.LEFT | wx.TOP, 10) v_box_t.Add(h_box_g1, 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 10) v_box_t.Add(h_box_g2, 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP | wx.BOTTOM, 10) panel_top.SetSizer(v_box_t) v_box.Add(panel_top, 0, wx.EXPAND | wx.ALL, 10) # ---------- h_box_btn = wx.BoxSizer(wx.HORIZONTAL) ok_button = buttons.GenButton(panel, -1, "确定") ok_button.SetBezelWidth(1) ok_button.SetBackgroundColour('white') close_button = buttons.GenButton(panel, -1, "关闭") close_button.SetBezelWidth(1) close_button.SetBackgroundColour('white') h_box_btn.Add(ok_button, 1) h_box_btn.Add(close_button, 1, wx.LEFT, 10) v_box.Add(h_box_btn, 0, wx.EXPAND | wx.BOTTOM | wx.LEFT | wx.RIGHT, border=10) ok_button.Bind(wx.EVT_BUTTON, self.OnSubmit) close_button.Bind(wx.EVT_BUTTON, self.on_close) panel.SetSizer(v_box) self.Centre()
def __init__(self, parent, id, title): wx.Dialog.__init__(self, parent, id, title) # Init some values config = wx.ConfigBase.Get() config.SetPath("/Scanning") use_meta4 = config.ReadBool("use_meta4_default", use_meta4_default) use_md5 = config.ReadBool("use_md5_checksums", use_md5_default) use_sha1 = config.ReadBool("use_sha1_checksums", use_sha1_default) use_sha256 = config.ReadBool("use_sha256_checksums", use_sha256_default) use_chunks = config.ReadBool("use_chunk_checksums", use_chunks_default) max_chunks = config.ReadInt("max_chunk_checksums", max_chunks_default) size_chunks = config.ReadInt("min_chunk_size", chunk_size_default) # Create controls txt_meta4 = wx.StaticText(self, -1, "Use Metalink 4 format by default?") self.checkbox_meta4 = wx.CheckBox(self, -1, "Enable") self.checkbox_meta4.SetValue(use_meta4) txt_md5 = wx.StaticText(self, -1, "Use MD5 checksums?") self.checkbox_md5 = wx.CheckBox(self, -1, "Enable") self.checkbox_md5.SetValue(use_md5) txt_sha1 = wx.StaticText(self, -1, "Use SHA-1 checksums?") self.checkbox_sha1 = wx.CheckBox(self, -1, "Enable") self.checkbox_sha1.SetValue(use_sha1) txt_sha256 = wx.StaticText(self, -1, "Use SHA-256 checksums?") self.checkbox_sha256 = wx.CheckBox(self, -1, "Enable") self.checkbox_sha256.SetValue(use_sha256) txt_chunks = wx.StaticText(self, -1, "Use chunk checksums?") self.checkbox_chunks = wx.CheckBox(self, -1, "Enable") self.checkbox_chunks.SetValue(use_chunks) txt_maxchunks = wx.StaticText(self, -1, "Maximum number of chunks:") self.txtctrl_maxchunks = wx.SpinCtrl(self, -1, min=2, max=10000) self.txtctrl_maxchunks.SetValue(max_chunks) txt_chunksize = wx.StaticText(self, -1, "Minimum chunk size (KiB):") self.txtctrl_chunksize = wx.SpinCtrl(self, -1, min=1, max=10240) self.txtctrl_chunksize.SetValue(size_chunks) # Sizers vbox = wx.BoxSizer(wx.VERTICAL) saveflex_sizer = wx.FlexGridSizer(0, 2) saveflex_sizer.AddGrowableCol(1) saveflex_sizer.Add(txt_meta4, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2) saveflex_sizer.Add(self.checkbox_meta4, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2) flex_sizer = wx.FlexGridSizer(0, 2) flex_sizer.AddGrowableCol(1) flex_sizer.Add(txt_md5, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2) flex_sizer.Add(self.checkbox_md5, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2) flex_sizer.Add(txt_sha1, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2) flex_sizer.Add(self.checkbox_sha1, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2) flex_sizer.Add(txt_sha256, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2) flex_sizer.Add(self.checkbox_sha256, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2) flex_sizer.Add(txt_chunks, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2) flex_sizer.Add(self.checkbox_chunks, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2) flex_sizer.Add(txt_maxchunks, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2) flex_sizer.Add(self.txtctrl_maxchunks, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2) flex_sizer.Add(txt_chunksize, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2) flex_sizer.Add(self.txtctrl_chunksize, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2) sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL) save_staticbox = wx.StaticBoxSizer( wx.StaticBox(self, -1, "Save settings"), wx.VERTICAL) save_staticbox.Add(saveflex_sizer, 1, wx.ALL | wx.EXPAND, 2) chunk_staticbox = wx.StaticBoxSizer( wx.StaticBox(self, -1, "Scan settings"), wx.VERTICAL) chunk_staticbox.Add(flex_sizer, 1, wx.ALL | wx.EXPAND, 2) vbox.Add(save_staticbox, 0, wx.ALL | wx.EXPAND, 5) vbox.Add(chunk_staticbox, 0, wx.ALL | wx.EXPAND, 5) vbox.Add(sizer, 0, wx.ALL | wx.EXPAND, 5) self.SetSizer(vbox) vbox.SetSizeHints(self) self.SetSize(wx.Size(300, -1)) # Binding events self.Bind(wx.EVT_BUTTON, self.OnOK, id=wx.ID_OK)
def __init__(self, app, parent, idx, n): TabPage.__init__(self, app, parent, "Input Data", idx, n, name="input") self._nvols = -1 # Cached to improve responsiveness self.section("Data contents") self.data_picker = self.file_picker("Input Image") self.ntis_int = self.integer("Number of PLDs", min=1, max=100, initial=1) self.repeats_choice = self.choice("Repeats", choices=["Fixed", "Variable"]) self.section("Data order") self.ibf_choice = self.choice("Volumes grouped by", choices=["Repeats", "TIs/PLDs"]) self.iaf_choice = self.choice("Label/Control pairing", choices=[ "Label then control", "Control then label", "Pre-subtracted" ]) self.section("Acquisition parameters") self.labelling_ch = self.choice("Labelling", choices=["pASL", "cASL/pcASL"], initial=1) self.bolus_dur_ch = wx.Choice(self, choices=["Constant", "Variable"]) self.bolus_dur_ch.SetSelection(0) self.bolus_dur_ch.Bind(wx.EVT_CHOICE, self.state_changed) self.bolus_dur_num = NumberChooser(self, minval=0, maxval=2.5, step=0.1, initial=1.8, changed_handler=self.state_changed) self.bolus_dur_num.span = 2 self.pack("Bolus duration (s)", self.bolus_dur_ch, self.bolus_dur_num) self.bolus_dur_list = NumberList(self, 1) self.bolus_dur_list.span = 3 self.bolus_dur_list.Bind(wx.grid.EVT_GRID_CELL_CHANGED, self.state_changed) self.pack("Bolus durations (s)", self.bolus_dur_list, enable=False) self.ti_list = NumberList(self, 1) self.ti_list.span = 3 self.ti_list.Bind(wx.grid.EVT_GRID_CELL_CHANGED, self.state_changed) self.pack("PLDs (s)", self.ti_list) self.nrepeats_list = NumberList(self, 1, default=1) self.nrepeats_list.span = 3 self.nrepeats_list.Bind(wx.grid.EVT_GRID_CELL_CHANGED, self.state_changed) self.pack("Repeats", self.nrepeats_list, enable=False) self.readout_ch = wx.Choice( self, choices=["3D (eg GRASE)", "2D multi-slice (eg EPI)"]) self.readout_ch.SetSelection(0) self.readout_ch.Bind(wx.EVT_CHOICE, self.state_changed) self.time_per_slice_num = NumberChooser( self, label="Time per slice (ms)", minval=0, maxval=50, step=1, initial=10.0, changed_handler=self.state_changed) self.time_per_slice_num.span = 2 self.pack("Readout", self.readout_ch, self.time_per_slice_num) self.time_per_slice_num.Enable(False) self.multiband_cb = wx.CheckBox(self, label="Multi-band") self.multiband_cb.Bind(wx.EVT_CHECKBOX, self.state_changed) self.slices_per_band_spin = wx.SpinCtrl(self, min=1, max=100, initial=5) self.slices_per_band_spin.Bind(wx.EVT_SPINCTRL, self.state_changed) self.slices_per_band_label = wx.StaticText(self, label="slices per band") self.pack("", self.multiband_cb, self.slices_per_band_spin, self.slices_per_band_label, enable=False) self.multiband_cb.Enable(False) self.sizer.AddGrowableCol(2, 1) self.SetSizer(self.sizer) self.add_next_prev_btn() self.Layout()
def __init__(self, *args, **kwds): # begin wxGlade: MyFrame.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) # Menu Bar self.frame_1_menubar = wx.MenuBar() self.SetMenuBar(self.frame_1_menubar) wxglade_tmp_menu = wx.Menu() self.Exit = wx.MenuItem(wxglade_tmp_menu, ID_EXIT, "Exit", "Exit", wx.ITEM_NORMAL) wxglade_tmp_menu.AppendItem(self.Exit) self.frame_1_menubar.Append(wxglade_tmp_menu, "File") # Menu Bar end self.panel_1 = wx.Panel(self, -1) self.button_1 = wx.Button(self, ID_BUTTON_1, "LSB") self.button_2 = wx.Button(self, ID_BUTTON_2, "USB") self.button_3 = wx.Button(self, ID_BUTTON_3, "AM") self.button_4 = wx.Button(self, ID_BUTTON_4, "CW") self.button_5 = wx.ToggleButton(self, ID_BUTTON_5, "Upper") self.slider_fcutoff_hi = wx.Slider(self, ID_SLIDER_1, 0, -15798, 15799, style=wx.SL_HORIZONTAL|wx.SL_LABELS) self.button_6 = wx.ToggleButton(self, ID_BUTTON_6, "Lower") self.slider_fcutoff_lo = wx.Slider(self, ID_SLIDER_2, 0, -15799, 15798, style=wx.SL_HORIZONTAL|wx.SL_LABELS) self.panel_5 = wx.Panel(self, -1) self.label_1 = wx.StaticText(self, -1, " Band\nCenter") self.text_ctrl_1 = wx.TextCtrl(self, ID_TEXT_1, "") self.panel_6 = wx.Panel(self, -1) self.panel_7 = wx.Panel(self, -1) self.panel_2 = wx.Panel(self, -1) self.button_7 = wx.ToggleButton(self, ID_BUTTON_7, "Freq") self.slider_3 = wx.Slider(self, ID_SLIDER_3, 3000, 0, 6000) self.spin_ctrl_1 = wx.SpinCtrl(self, ID_SPIN_1, "", min=0, max=100) self.button_8 = wx.ToggleButton(self, ID_BUTTON_8, "Vol") self.slider_4 = wx.Slider(self, ID_SLIDER_4, 0, 0, 500) self.slider_5 = wx.Slider(self, ID_SLIDER_5, 0, 0, 20) self.button_9 = wx.ToggleButton(self, ID_BUTTON_9, "Time") self.button_11 = wx.Button(self, ID_BUTTON_11, "Rew") self.button_10 = wx.Button(self, ID_BUTTON_10, "Fwd") self.panel_3 = wx.Panel(self, -1) self.label_2 = wx.StaticText(self, -1, "PGA ") self.panel_4 = wx.Panel(self, -1) self.panel_8 = wx.Panel(self, -1) self.panel_9 = wx.Panel(self, -1) self.label_3 = wx.StaticText(self, -1, "AM Sync\nCarrier") self.slider_6 = wx.Slider(self, ID_SLIDER_6, 50, 0, 200, style=wx.SL_HORIZONTAL|wx.SL_LABELS) self.label_4 = wx.StaticText(self, -1, "Antenna Tune") self.slider_7 = wx.Slider(self, ID_SLIDER_7, 1575, 950, 2200, style=wx.SL_HORIZONTAL|wx.SL_LABELS) self.panel_10 = wx.Panel(self, -1) self.button_12 = wx.ToggleButton(self, ID_BUTTON_12, "Auto Tune") self.button_13 = wx.Button(self, ID_BUTTON_13, "Calibrate") self.button_14 = wx.Button(self, ID_BUTTON_14, "Reset") self.panel_11 = wx.Panel(self, -1) self.panel_12 = wx.Panel(self, -1) self.__set_properties() self.__do_layout() # end wxGlade parser = OptionParser (option_class=eng_option) parser.add_option("", "--address", type="string", default="addr=192.168.10.2", help="Address of UHD device, [default=%default]") parser.add_option ("-c", "--ddc-freq", type="eng_float", default=3.9e6, help="set Rx DDC frequency to FREQ", metavar="FREQ") parser.add_option ("-s", "--samp-rate", type="eng_float", default=256e3, help="set sample rate (bandwidth) [default=%default]") parser.add_option ("-a", "--audio_file", default="", help="audio output file", metavar="FILE") parser.add_option ("-r", "--radio_file", default="", help="radio output file", metavar="FILE") parser.add_option ("-i", "--input_file", default="", help="radio input file", metavar="FILE") parser.add_option ("-O", "--audio-output", type="string", default="", help="audio output device name. E.g., hw:0,0, /dev/dsp, or pulse") (options, args) = parser.parse_args () self.usrp_center = options.ddc_freq input_rate = options.samp_rate self.slider_range = input_rate * 0.9375 self.f_lo = self.usrp_center - (self.slider_range/2) self.f_hi = self.usrp_center + (self.slider_range/2) self.af_sample_rate = 32000 fir_decim = long (input_rate / self.af_sample_rate) # data point arrays for antenna tuner self.xdata = [] self.ydata = [] self.tb = gr.top_block() # radio variables, initial conditions self.frequency = self.usrp_center # these map the frequency slider (0-6000) to the actual range self.f_slider_offset = self.f_lo self.f_slider_scale = 10000 self.spin_ctrl_1.SetRange(self.f_lo,self.f_hi) self.text_ctrl_1.SetValue(str(int(self.usrp_center))) self.slider_5.SetValue(0) self.AM_mode = False self.slider_3.SetValue((self.frequency-self.f_slider_offset)/self.f_slider_scale) self.spin_ctrl_1.SetValue(int(self.frequency)) POWERMATE = True try: self.pm = powermate.powermate(self) except: sys.stderr.write("Unable to find PowerMate or Contour Shuttle\n") POWERMATE = False if POWERMATE: powermate.EVT_POWERMATE_ROTATE(self, self.on_rotate) powermate.EVT_POWERMATE_BUTTON(self, self.on_pmButton) self.active_button = 7 # command line options if options.audio_file == "": SAVE_AUDIO_TO_FILE = False else: SAVE_AUDIO_TO_FILE = True if options.radio_file == "": SAVE_RADIO_TO_FILE = False else: SAVE_RADIO_TO_FILE = True if options.input_file == "": self.PLAY_FROM_USRP = True else: self.PLAY_FROM_USRP = False if self.PLAY_FROM_USRP: self.src = uhd.usrp_source(device_addr=options.address, io_type=uhd.io_type.COMPLEX_FLOAT32, num_channels=1) self.src.set_samp_rate(input_rate) input_rate = self.src.get_samp_rate() self.src.set_center_freq(self.usrp_center, 0) self.tune_offset = 0 else: self.src = gr.file_source (gr.sizeof_short,options.input_file) self.tune_offset = 2200 # 2200 works for 3.5-4Mhz band # convert rf data in interleaved short int form to complex s2ss = gr.stream_to_streams(gr.sizeof_short,2) s2f1 = gr.short_to_float() s2f2 = gr.short_to_float() src_f2c = gr.float_to_complex() self.tb.connect(self.src,s2ss) self.tb.connect((s2ss,0),s2f1) self.tb.connect((s2ss,1),s2f2) self.tb.connect(s2f1,(src_f2c,0)) self.tb.connect(s2f2,(src_f2c,1)) # save radio data to a file if SAVE_RADIO_TO_FILE: radio_file = gr.file_sink(gr.sizeof_short, options.radio_file) self.tb.connect (self.src, radio_file) # 2nd DDC xlate_taps = gr.firdes.low_pass ( \ 1.0, input_rate, 16e3, 4e3, gr.firdes.WIN_HAMMING ) self.xlate = gr.freq_xlating_fir_filter_ccf ( \ fir_decim, xlate_taps, self.tune_offset, input_rate ) # Complex Audio filter audio_coeffs = gr.firdes.complex_band_pass ( 1.0, # gain self.af_sample_rate, # sample rate -3000, # low cutoff 0, # high cutoff 100, # transition gr.firdes.WIN_HAMMING) # window self.slider_fcutoff_hi.SetValue(0) self.slider_fcutoff_lo.SetValue(-3000) self.audio_filter = gr.fir_filter_ccc(1, audio_coeffs) # Main +/- 16Khz spectrum display self.fft = fftsink2.fft_sink_c(self.panel_2, fft_size=512, sample_rate=self.af_sample_rate, average=True, size=(640,240)) # AM Sync carrier if AM_SYNC_DISPLAY: self.fft2 = fftsink.fft_sink_c(self.tb, self.panel_9, y_per_div=20, fft_size=512, sample_rate=self.af_sample_rate, average=True, size=(640,240)) c2f = gr.complex_to_float() # AM branch self.sel_am = gr.multiply_const_cc(0) # the following frequencies turn out to be in radians/sample # gr.pll_refout_cc(alpha,beta,min_freq,max_freq) # suggested alpha = X, beta = .25 * X * X pll = gr.pll_refout_cc(.5,.0625,(2.*math.pi*7.5e3/self.af_sample_rate), (2.*math.pi*6.5e3/self.af_sample_rate)) self.pll_carrier_scale = gr.multiply_const_cc(complex(10,0)) am_det = gr.multiply_cc() # these are for converting +7.5kHz to -7.5kHz # for some reason gr.conjugate_cc() adds noise ?? c2f2 = gr.complex_to_float() c2f3 = gr.complex_to_float() f2c = gr.float_to_complex() phaser1 = gr.multiply_const_ff(1) phaser2 = gr.multiply_const_ff(-1) # filter for pll generated carrier pll_carrier_coeffs = gr.firdes.complex_band_pass ( 2.0, # gain self.af_sample_rate, # sample rate 7400, # low cutoff 7600, # high cutoff 100, # transition gr.firdes.WIN_HAMMING) # window self.pll_carrier_filter = gr.fir_filter_ccc (1, pll_carrier_coeffs) self.sel_sb = gr.multiply_const_ff(1) combine = gr.add_ff() #AGC sqr1 = gr.multiply_ff() intr = gr.iir_filter_ffd ( [.004, 0], [0, .999] ) offset = gr.add_const_ff(1) agc = gr.divide_ff() self.scale = gr.multiply_const_ff(0.00001) dst = audio.sink(long(self.af_sample_rate), options.audio_output) if self.PLAY_FROM_USRP: self.tb.connect(self.src, self.xlate, self.fft) else: self.tb.connect(src_f2c, self.xlate, self.fft) self.tb.connect(self.xlate,self.audio_filter,self.sel_am,(am_det,0)) self.tb.connect(self.sel_am,pll,self.pll_carrier_scale, self.pll_carrier_filter,c2f3) self.tb.connect((c2f3,0),phaser1,(f2c,0)) self.tb.connect((c2f3,1),phaser2,(f2c,1)) self.tb.connect(f2c,(am_det,1)) self.tb.connect(am_det,c2f2,(combine,0)) self.tb.connect(self.audio_filter,c2f, self.sel_sb,(combine,1)) if AM_SYNC_DISPLAY: self.tb.connect(self.pll_carrier_filter,self.fft2) self.tb.connect(combine,self.scale) self.tb.connect(self.scale,(sqr1,0)) self.tb.connect(self.scale,(sqr1,1)) self.tb.connect(sqr1, intr, offset, (agc, 1)) self.tb.connect(self.scale,(agc, 0)) self.tb.connect(agc,dst) if SAVE_AUDIO_TO_FILE: f_out = gr.file_sink(gr.sizeof_short,options.audio_file) sc1 = gr.multiply_const_ff(64000) f2s1 = gr.float_to_short() self.tb.connect(agc,sc1,f2s1,f_out) self.tb.start() # for mouse position reporting on fft display self.fft.win.Bind(wx.EVT_LEFT_UP, self.Mouse) # and left click to re-tune self.fft.win.Bind(wx.EVT_LEFT_DOWN, self.Click) # start a timer to check for web commands if WEB_CONTROL: self.timer = UpdateTimer(self, 1000) # every 1000 mSec, 1 Sec wx.EVT_BUTTON(self,ID_BUTTON_1,self.set_lsb) wx.EVT_BUTTON(self,ID_BUTTON_2,self.set_usb) wx.EVT_BUTTON(self,ID_BUTTON_3,self.set_am) wx.EVT_BUTTON(self,ID_BUTTON_4,self.set_cw) wx.EVT_BUTTON(self,ID_BUTTON_10,self.fwd) wx.EVT_BUTTON(self,ID_BUTTON_11,self.rew) wx.EVT_BUTTON(self, ID_BUTTON_13, self.AT_calibrate) wx.EVT_BUTTON(self, ID_BUTTON_14, self.AT_reset) wx.EVT_TOGGLEBUTTON(self,ID_BUTTON_5,self.on_button) wx.EVT_TOGGLEBUTTON(self,ID_BUTTON_6,self.on_button) wx.EVT_TOGGLEBUTTON(self,ID_BUTTON_7,self.on_button) wx.EVT_TOGGLEBUTTON(self,ID_BUTTON_8,self.on_button) wx.EVT_TOGGLEBUTTON(self,ID_BUTTON_9,self.on_button) wx.EVT_SLIDER(self,ID_SLIDER_1,self.set_filter) wx.EVT_SLIDER(self,ID_SLIDER_2,self.set_filter) wx.EVT_SLIDER(self,ID_SLIDER_3,self.slide_tune) wx.EVT_SLIDER(self,ID_SLIDER_4,self.set_volume) wx.EVT_SLIDER(self,ID_SLIDER_5,self.set_pga) wx.EVT_SLIDER(self,ID_SLIDER_6,self.am_carrier) wx.EVT_SLIDER(self,ID_SLIDER_7,self.antenna_tune) wx.EVT_SPINCTRL(self,ID_SPIN_1,self.spin_tune) wx.EVT_MENU(self, ID_EXIT, self.TimeToQuit)
def __init__( self, parent ): wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Calibration", pos = wx.DefaultPosition, size = wx.Size( 640,800 ), style = wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER ) self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize ) fgSizer7 = wx.FlexGridSizer( 0, 1, 0, 0 ) fgSizer7.AddGrowableCol( 0 ) fgSizer7.AddGrowableRow( 0 ) fgSizer7.SetFlexibleDirection( wx.BOTH ) fgSizer7.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.m_notebook1 = wx.Notebook( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_panel1 = wx.Panel( self.m_notebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) fgSizer8 = wx.FlexGridSizer( 0, 1, 0, 0 ) fgSizer8.AddGrowableCol( 0 ) fgSizer8.AddGrowableRow( 0 ) fgSizer8.SetFlexibleDirection( wx.BOTH ) fgSizer8.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.CompassCalibration = wx.glcanvas.GLCanvas(self.m_panel1, attribList=[ wx.glcanvas.WX_GL_RGBA, wx.glcanvas.WX_GL_DOUBLEBUFFER, wx.glcanvas.WX_GL_DEPTH_SIZE, 16, wx.glcanvas.WX_GL_STENCIL_SIZE, 8, 0 ]) fgSizer8.Add( self.CompassCalibration, 0, wx.ALL|wx.EXPAND, 5 ) fgSizer191 = wx.FlexGridSizer( 0, 3, 0, 0 ) fgSizer191.AddGrowableCol( 0 ) fgSizer191.SetFlexibleDirection( wx.BOTH ) fgSizer191.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) fgSizer10 = wx.FlexGridSizer( 0, 2, 0, 0 ) fgSizer10.AddGrowableCol( 1 ) fgSizer10.SetFlexibleDirection( wx.BOTH ) fgSizer10.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.m_staticText10 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"Calibration", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText10.Wrap( -1 ) fgSizer10.Add( self.m_staticText10, 0, wx.ALL, 5 ) self.stCompassCal = wx.StaticText( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) self.stCompassCal.Wrap( -1 ) fgSizer10.Add( self.stCompassCal, 0, wx.ALL|wx.EXPAND, 5 ) self.m_staticText12 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"Deviation", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText12.Wrap( -1 ) fgSizer10.Add( self.m_staticText12, 0, wx.ALL, 5 ) self.stCompassCalDeviation = wx.StaticText( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) self.stCompassCalDeviation.Wrap( -1 ) fgSizer10.Add( self.stCompassCalDeviation, 0, wx.ALL|wx.EXPAND, 5 ) self.m_staticText14 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"Calibration Age", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText14.Wrap( -1 ) fgSizer10.Add( self.m_staticText14, 0, wx.ALL, 5 ) self.stCompassCalAge = wx.StaticText( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) self.stCompassCalAge.Wrap( -1 ) fgSizer10.Add( self.stCompassCalAge, 0, wx.ALL|wx.EXPAND, 5 ) fgSizer191.Add( fgSizer10, 1, wx.EXPAND, 5 ) fgSizer27 = wx.FlexGridSizer( 0, 1, 0, 0 ) fgSizer27.SetFlexibleDirection( wx.BOTH ) fgSizer27.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.m_button10 = wx.Button( self.m_panel1, wx.ID_ANY, u"Clear", wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer27.Add( self.m_button10, 0, wx.ALL, 5 ) self.cbCompassCalibrationLocked = wx.CheckBox( self.m_panel1, wx.ID_ANY, u"calibratiion locked", wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer27.Add( self.cbCompassCalibrationLocked, 0, wx.ALL, 5 ) fgSizer191.Add( fgSizer27, 1, wx.EXPAND, 5 ) m_sdbSizer1 = wx.StdDialogButtonSizer() self.m_sdbSizer1OK = wx.Button( self.m_panel1, wx.ID_OK ) m_sdbSizer1.AddButton( self.m_sdbSizer1OK ) m_sdbSizer1.Realize(); fgSizer191.Add( m_sdbSizer1, 1, wx.EXPAND, 5 ) fgSizer8.Add( fgSizer191, 1, wx.EXPAND, 5 ) self.m_panel1.SetSizer( fgSizer8 ) self.m_panel1.Layout() fgSizer8.Fit( self.m_panel1 ) self.m_notebook1.AddPage( self.m_panel1, u"compass", True ) self.m_panel3 = wx.Panel( self.m_notebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) fgSizer12 = wx.FlexGridSizer( 0, 1, 0, 0 ) fgSizer12.AddGrowableCol( 0 ) fgSizer12.AddGrowableRow( 0 ) fgSizer12.SetFlexibleDirection( wx.BOTH ) fgSizer12.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.m_splitter1 = wx.SplitterWindow( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.SP_3D|wx.SP_LIVE_UPDATE ) self.m_splitter1.SetSashGravity( 1 ) self.m_splitter1.SetMinimumPaneSize( 220 ) self.m_panel4 = wx.Panel( self.m_splitter1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) fgSizer22 = wx.FlexGridSizer( 0, 2, 0, 0 ) fgSizer22.AddGrowableCol( 0 ) fgSizer22.AddGrowableRow( 0 ) fgSizer22.SetFlexibleDirection( wx.BOTH ) fgSizer22.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.BoatPlot = wx.glcanvas.GLCanvas(self.m_panel3, attribList=[ wx.glcanvas.WX_GL_RGBA, wx.glcanvas.WX_GL_DOUBLEBUFFER, wx.glcanvas.WX_GL_DEPTH_SIZE, 16, wx.glcanvas.WX_GL_STENCIL_SIZE, 8, 0 ]) fgSizer22.Add( self.BoatPlot, 0, wx.ALL|wx.EXPAND, 5 ) self.m_panel4.SetSizer( fgSizer22 ) self.m_panel4.Layout() fgSizer22.Fit( self.m_panel4 ) self.m_panel5 = wx.Panel( self.m_splitter1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) fgSizer31 = wx.FlexGridSizer( 0, 2, 0, 0 ) fgSizer31.AddGrowableCol( 0 ) fgSizer31.AddGrowableRow( 0 ) fgSizer31.SetFlexibleDirection( wx.BOTH ) fgSizer31.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) fgSizer29 = wx.FlexGridSizer( 0, 1, 0, 0 ) fgSizer29.AddGrowableCol( 0 ) fgSizer29.SetFlexibleDirection( wx.BOTH ) fgSizer29.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) fgSizer18 = wx.FlexGridSizer( 1, 0, 0, 0 ) fgSizer18.SetFlexibleDirection( wx.BOTH ) fgSizer18.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.m_staticText16 = wx.StaticText( self.m_panel5, wx.ID_ANY, u"Alignment", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText16.Wrap( -1 ) fgSizer18.Add( self.m_staticText16, 0, wx.ALL, 5 ) self.bReset = wx.Button( self.m_panel5, wx.ID_ANY, u"Reset", wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer18.Add( self.bReset, 0, wx.ALL, 5 ) self.stAlignment = wx.StaticText( self.m_panel5, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) self.stAlignment.Wrap( -1 ) fgSizer18.Add( self.stAlignment, 0, wx.ALL|wx.EXPAND, 5 ) fgSizer29.Add( fgSizer18, 1, wx.EXPAND, 5 ) fgSizer19 = wx.FlexGridSizer( 1, 0, 0, 0 ) fgSizer19.AddGrowableCol( 2 ) fgSizer19.SetFlexibleDirection( wx.BOTH ) fgSizer19.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.m_staticText19 = wx.StaticText( self.m_panel5, wx.ID_ANY, u"Pitch", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText19.Wrap( -1 ) fgSizer19.Add( self.m_staticText19, 0, wx.ALL, 5 ) self.stPitch = wx.StaticText( self.m_panel5, wx.ID_ANY, u"N/A", wx.DefaultPosition, wx.DefaultSize, 0 ) self.stPitch.Wrap( -1 ) fgSizer19.Add( self.stPitch, 0, wx.ALL, 5 ) self.gAlignment = wx.Gauge( self.m_panel5, wx.ID_ANY, 100, wx.DefaultPosition, wx.DefaultSize, wx.GA_HORIZONTAL ) self.gAlignment.SetValue( 0 ) fgSizer19.Add( self.gAlignment, 0, wx.ALIGN_RIGHT|wx.ALL, 5 ) fgSizer29.Add( fgSizer19, 1, wx.EXPAND, 5 ) fgSizer13 = wx.FlexGridSizer( 1, 0, 0, 0 ) fgSizer13.SetFlexibleDirection( wx.BOTH ) fgSizer13.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.m_staticText34 = wx.StaticText( self.m_panel5, wx.ID_ANY, u"Roll", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText34.Wrap( -1 ) fgSizer13.Add( self.m_staticText34, 0, wx.ALL, 5 ) self.stRoll = wx.StaticText( self.m_panel5, wx.ID_ANY, u" N/A ", wx.DefaultPosition, wx.DefaultSize, 0 ) self.stRoll.Wrap( -1 ) fgSizer13.Add( self.stRoll, 0, wx.ALL, 5 ) self.m_staticText18 = wx.StaticText( self.m_panel5, wx.ID_ANY, u"Heel", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText18.Wrap( -1 ) fgSizer13.Add( self.m_staticText18, 0, wx.ALL, 5 ) self.stHeel = wx.StaticText( self.m_panel5, wx.ID_ANY, u" N/A ", wx.DefaultPosition, wx.DefaultSize, 0 ) self.stHeel.Wrap( -1 ) fgSizer13.Add( self.stHeel, 0, wx.ALL, 5 ) self.bLevel = wx.Button( self.m_panel5, wx.ID_ANY, u"Boat is level", wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer13.Add( self.bLevel, 0, wx.ALL, 5 ) fgSizer29.Add( fgSizer13, 1, wx.EXPAND, 5 ) fgSizer14 = wx.FlexGridSizer( 1, 0, 0, 0 ) fgSizer14.SetFlexibleDirection( wx.BOTH ) fgSizer14.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.m_staticText22 = wx.StaticText( self.m_panel5, wx.ID_ANY, u"Heading", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText22.Wrap( -1 ) fgSizer14.Add( self.m_staticText22, 0, wx.ALL, 5 ) self.stHeading = wx.StaticText( self.m_panel5, wx.ID_ANY, u" N/A ", wx.DefaultPosition, wx.DefaultSize, 0 ) self.stHeading.Wrap( -1 ) fgSizer14.Add( self.stHeading, 0, wx.ALL, 5 ) self.m_staticText25 = wx.StaticText( self.m_panel5, wx.ID_ANY, u"Offset", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText25.Wrap( -1 ) fgSizer14.Add( self.m_staticText25, 0, wx.ALL, 5 ) self.sHeadingOffset = wx.SpinCtrl( self.m_panel5, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, -180, 180, 0 ) fgSizer14.Add( self.sHeadingOffset, 0, wx.ALL, 5 ) fgSizer29.Add( fgSizer14, 1, wx.EXPAND, 5 ) fgSizer31.Add( fgSizer29, 1, wx.EXPAND, 5 ) fgSizer23 = wx.FlexGridSizer( 0, 1, 0, 0 ) fgSizer23.SetFlexibleDirection( wx.BOTH ) fgSizer23.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) sbSizer3 = wx.StaticBoxSizer( wx.StaticBox( self.m_panel5, wx.ID_ANY, u"Model" ), wx.VERTICAL ) cModelChoices = [] self.cModel = wx.Choice( self.m_panel5, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, cModelChoices, 0 ) self.cModel.SetSelection( 0 ) sbSizer3.Add( self.cModel, 0, wx.ALL, 5 ) fgSizer23.Add( sbSizer3, 1, wx.EXPAND, 5 ) sbSizer4 = wx.StaticBoxSizer( wx.StaticBox( self.m_panel5, wx.ID_ANY, u"Coords" ), wx.VERTICAL ) cCoordsChoices = [ u"Sea", u"Boat", u"Compass" ] self.cCoords = wx.Choice( self.m_panel5, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, cCoordsChoices, 0 ) self.cCoords.SetSelection( 0 ) sbSizer4.Add( self.cCoords, 0, wx.ALL, 5 ) fgSizer23.Add( sbSizer4, 1, wx.EXPAND, 5 ) self.cbTextureCompass = wx.CheckBox( self.m_panel5, wx.ID_ANY, u"tex compass", wx.DefaultPosition, wx.DefaultSize, 0 ) self.cbTextureCompass.SetValue(True) fgSizer23.Add( self.cbTextureCompass, 0, wx.ALL, 5 ) fgSizer31.Add( fgSizer23, 1, wx.EXPAND, 5 ) self.m_panel5.SetSizer( fgSizer31 ) self.m_panel5.Layout() fgSizer31.Fit( self.m_panel5 ) self.m_splitter1.SplitHorizontally( self.m_panel4, self.m_panel5, -1 ) fgSizer12.Add( self.m_splitter1, 1, wx.EXPAND, 5 ) fgSizer181 = wx.FlexGridSizer( 0, 2, 0, 0 ) fgSizer181.AddGrowableCol( 1 ) fgSizer181.SetFlexibleDirection( wx.BOTH ) fgSizer181.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.bIMUScope = wx.Button( self.m_panel3, wx.ID_ANY, u"Scope", wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer181.Add( self.bIMUScope, 0, wx.ALL, 5 ) m_sdbSizer2 = wx.StdDialogButtonSizer() self.m_sdbSizer2OK = wx.Button( self.m_panel3, wx.ID_OK ) m_sdbSizer2.AddButton( self.m_sdbSizer2OK ) m_sdbSizer2.Realize(); fgSizer181.Add( m_sdbSizer2, 1, wx.ALIGN_RIGHT|wx.EXPAND, 5 ) fgSizer12.Add( fgSizer181, 1, wx.EXPAND, 5 ) self.m_panel3.SetSizer( fgSizer12 ) self.m_panel3.Layout() fgSizer12.Fit( self.m_panel3 ) self.m_notebook1.AddPage( self.m_panel3, u"imu", False ) self.m_panel2 = wx.Panel( self.m_notebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) fgSizer9 = wx.FlexGridSizer( 0, 1, 0, 0 ) fgSizer9.AddGrowableCol( 0 ) fgSizer9.AddGrowableRow( 1 ) fgSizer9.SetFlexibleDirection( wx.BOTH ) fgSizer9.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) sbSizer1 = wx.StaticBoxSizer( wx.StaticBox( self.m_panel2, wx.ID_ANY, u"Calibration" ), wx.VERTICAL ) self.stServoCalibration = wx.StaticText( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) self.stServoCalibration.Wrap( 400 ) sbSizer1.Add( self.stServoCalibration, 0, wx.ALL|wx.EXPAND, 5 ) fgSizer9.Add( sbSizer1, 1, wx.EXPAND, 5 ) self.m_scrolledWindow1 = wx.ScrolledWindow( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.HSCROLL|wx.VSCROLL ) self.m_scrolledWindow1.SetScrollRate( 5, 5 ) fgSizer16 = wx.FlexGridSizer( 0, 2, 0, 0 ) fgSizer16.AddGrowableCol( 0 ) fgSizer16.AddGrowableRow( 0 ) fgSizer16.SetFlexibleDirection( wx.BOTH ) fgSizer16.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.stServoCalibrationConsole = wx.StaticText( self.m_scrolledWindow1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) self.stServoCalibrationConsole.Wrap( -1 ) fgSizer16.Add( self.stServoCalibrationConsole, 0, wx.ALL|wx.EXPAND, 5 ) self.m_scrolledWindow1.SetSizer( fgSizer16 ) self.m_scrolledWindow1.Layout() fgSizer16.Fit( self.m_scrolledWindow1 ) fgSizer9.Add( self.m_scrolledWindow1, 1, wx.EXPAND |wx.ALL, 5 ) fgSizer17 = wx.FlexGridSizer( 0, 2, 0, 0 ) fgSizer17.AddGrowableCol( 1 ) fgSizer17.SetFlexibleDirection( wx.BOTH ) fgSizer17.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.m_staticText36 = wx.StaticText( self.m_panel2, wx.ID_ANY, u"Calibration Mode", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText36.Wrap( -1 ) fgSizer17.Add( self.m_staticText36, 0, wx.ALL, 5 ) self.stServoCalibrationMode = wx.StaticText( self.m_panel2, wx.ID_ANY, u"N/A", wx.DefaultPosition, wx.DefaultSize, 0 ) self.stServoCalibrationMode.Wrap( -1 ) fgSizer17.Add( self.stServoCalibrationMode, 0, wx.ALL|wx.EXPAND, 5 ) fgSizer9.Add( fgSizer17, 1, wx.EXPAND, 5 ) fgSizer15 = wx.FlexGridSizer( 1, 0, 0, 0 ) fgSizer15.SetFlexibleDirection( wx.BOTH ) fgSizer15.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.bCalibrateServo = wx.Button( self.m_panel2, wx.ID_ANY, u"Calibrate Servo", wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer15.Add( self.bCalibrateServo, 0, wx.ALL, 5 ) self.m_staticText30 = wx.StaticText( self.m_panel2, wx.ID_ANY, u"Max Current", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText30.Wrap( -1 ) fgSizer15.Add( self.m_staticText30, 0, wx.ALL, 5 ) self.dsServoMaxCurrent = wx.SpinCtrlDouble(self.m_panel2) self.dsServoMaxCurrent.SetMinSize( wx.Size( 60,30 ) ) fgSizer15.Add( self.dsServoMaxCurrent, 0, wx.ALL, 5 ) self.m_staticText32 = wx.StaticText( self.m_panel2, wx.ID_ANY, u"Amps", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText32.Wrap( -1 ) fgSizer15.Add( self.m_staticText32, 0, wx.ALL, 5 ) fgSizer9.Add( fgSizer15, 1, wx.EXPAND, 5 ) m_sdbSizer3 = wx.StdDialogButtonSizer() self.m_sdbSizer3OK = wx.Button( self.m_panel2, wx.ID_OK ) m_sdbSizer3.AddButton( self.m_sdbSizer3OK ) m_sdbSizer3.Realize(); fgSizer9.Add( m_sdbSizer3, 1, wx.EXPAND, 5 ) self.m_panel2.SetSizer( fgSizer9 ) self.m_panel2.Layout() fgSizer9.Fit( self.m_panel2 ) self.m_notebook1.AddPage( self.m_panel2, u"servo", False ) fgSizer7.Add( self.m_notebook1, 1, wx.EXPAND |wx.ALL, 5 ) self.SetSizer( fgSizer7 ) self.Layout() self.Centre( wx.BOTH ) # Connect Events self.CompassCalibration.Bind( wx.EVT_KEY_DOWN, self.onKeyPressCompass ) self.CompassCalibration.Bind( wx.EVT_LEFT_DOWN, self.onMouseEventsCompass ) self.CompassCalibration.Bind( wx.EVT_LEFT_UP, self.onMouseEventsCompass ) self.CompassCalibration.Bind( wx.EVT_MIDDLE_DOWN, self.onMouseEventsCompass ) self.CompassCalibration.Bind( wx.EVT_MIDDLE_UP, self.onMouseEventsCompass ) self.CompassCalibration.Bind( wx.EVT_RIGHT_DOWN, self.onMouseEventsCompass ) self.CompassCalibration.Bind( wx.EVT_RIGHT_UP, self.onMouseEventsCompass ) self.CompassCalibration.Bind( wx.EVT_MOTION, self.onMouseEventsCompass ) self.CompassCalibration.Bind( wx.EVT_LEFT_DCLICK, self.onMouseEventsCompass ) self.CompassCalibration.Bind( wx.EVT_MIDDLE_DCLICK, self.onMouseEventsCompass ) self.CompassCalibration.Bind( wx.EVT_RIGHT_DCLICK, self.onMouseEventsCompass ) self.CompassCalibration.Bind( wx.EVT_LEAVE_WINDOW, self.onMouseEventsCompass ) self.CompassCalibration.Bind( wx.EVT_ENTER_WINDOW, self.onMouseEventsCompass ) self.CompassCalibration.Bind( wx.EVT_MOUSEWHEEL, self.onMouseEventsCompass ) self.CompassCalibration.Bind( wx.EVT_PAINT, self.onPaintGLCompass ) self.CompassCalibration.Bind( wx.EVT_SIZE, self.onSizeGLCompass ) self.m_button10.Bind( wx.EVT_BUTTON, self.onClearCompass ) self.cbCompassCalibrationLocked.Bind( wx.EVT_CHECKBOX, self.onCompassCalibrationLocked ) self.BoatPlot.Bind( wx.EVT_KEY_DOWN, self.onKeyPressBoatPlot ) self.BoatPlot.Bind( wx.EVT_LEFT_DOWN, self.onMouseEventsBoatPlot ) self.BoatPlot.Bind( wx.EVT_LEFT_UP, self.onMouseEventsBoatPlot ) self.BoatPlot.Bind( wx.EVT_MIDDLE_DOWN, self.onMouseEventsBoatPlot ) self.BoatPlot.Bind( wx.EVT_MIDDLE_UP, self.onMouseEventsBoatPlot ) self.BoatPlot.Bind( wx.EVT_RIGHT_DOWN, self.onMouseEventsBoatPlot ) self.BoatPlot.Bind( wx.EVT_RIGHT_UP, self.onMouseEventsBoatPlot ) self.BoatPlot.Bind( wx.EVT_MOTION, self.onMouseEventsBoatPlot ) self.BoatPlot.Bind( wx.EVT_LEFT_DCLICK, self.onMouseEventsBoatPlot ) self.BoatPlot.Bind( wx.EVT_MIDDLE_DCLICK, self.onMouseEventsBoatPlot ) self.BoatPlot.Bind( wx.EVT_RIGHT_DCLICK, self.onMouseEventsBoatPlot ) self.BoatPlot.Bind( wx.EVT_LEAVE_WINDOW, self.onMouseEventsBoatPlot ) self.BoatPlot.Bind( wx.EVT_ENTER_WINDOW, self.onMouseEventsBoatPlot ) self.BoatPlot.Bind( wx.EVT_MOUSEWHEEL, self.onMouseEventsBoatPlot ) self.BoatPlot.Bind( wx.EVT_PAINT, self.onPaintGLBoatPlot ) self.BoatPlot.Bind( wx.EVT_SIZE, self.onSizeGLBoatPlot ) self.bReset.Bind( wx.EVT_BUTTON, self.onResetAlignment ) self.bLevel.Bind( wx.EVT_BUTTON, self.onLevel ) self.sHeadingOffset.Bind( wx.EVT_SPINCTRL, self.onIMUHeadingOffset ) self.cbTextureCompass.Bind( wx.EVT_CHECKBOX, self.onTextureCompass ) self.bIMUScope.Bind( wx.EVT_BUTTON, self.onIMUScope ) self.bCalibrateServo.Bind( wx.EVT_BUTTON, self.onCalibrateServo )
def _create_control(self, parent): """ Create the toolkit-specific control that represents the widget. """ control = wx.SpinCtrl(parent, style=wx.TE_PROCESS_ENTER) return control
def __init__(self, parent, *args, **kwargs): wx.Panel.__init__(self, parent, *args, **kwargs) self.parent = parent self.VariogramSizer = wx.StaticBoxSizer( wx.StaticBox(self, id=wx.ID_ANY, label=_("Variogram fitting")), wx.HORIZONTAL) self.LeftSizer = wx.BoxSizer(wx.VERTICAL) self.RightSizer = wx.BoxSizer(wx.VERTICAL) self.ParametersSizer = wx.GridBagSizer(vgap=5, hgap=5) self.VariogramSizer.Add(self.LeftSizer, proportion=0, flag=wx.EXPAND | wx.ALL, border=parent.border) self.VariogramSizer.Add(self.RightSizer, proportion=0, flag=wx.EXPAND | wx.ALL, border=parent.border) # left side of Variogram fitting. The checkboxes and spinctrls. self.PlotButton = wx.Button( self, id=wx.ID_ANY, label=_("Plot/refresh variogram")) # no stock ID for Run button.. self.PlotButton.Bind(wx.EVT_BUTTON, self.OnPlotButton) self.PlotButton.Enable( False) # grey it out until a suitable layer is available self.LeftSizer.Add(self.PlotButton, proportion=0, flag=wx.ALL, border=parent.border) self.LeftSizer.Add(self.ParametersSizer, proportion=0, flag=wx.EXPAND | wx.ALL, border=parent.border) self.ParametersList = ["Sill", "Nugget", "Range"] MinValues = [0, 0, 1] for n in self.ParametersList: setattr( self, n + "ChextBox", wx.CheckBox(self, id=self.ParametersList.index(n), label=_(n + ":"))) setattr(self, n + "Ctrl", (wx.SpinCtrl(self, id=wx.ID_ANY, min=MinValues[self.ParametersList.index(n)], max=maxint))) getattr(self, n + "ChextBox").Bind(wx.EVT_CHECKBOX, self.UseValue, id=self.ParametersList.index(n)) setattr(self, n + "Sizer", (wx.BoxSizer(wx.HORIZONTAL))) self.ParametersSizer.Add(getattr(self, n + "ChextBox"), flag=wx.ALIGN_CENTER_VERTICAL, pos=(self.ParametersList.index(n), 0)) self.ParametersSizer.Add(getattr(self, n + "Ctrl"), flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, pos=(self.ParametersList.index(n), 1)) # right side of the Variogram fitting. The plot area. #Plot = wx.StaticText(self, id= wx.ID_ANY, label = "Check Plot Variogram to interactively fit model.") #PlotPanel = wx.Panel(self) #self.PlotArea = plot.PlotCanvas(PlotPanel) #self.PlotArea.SetInitialSize(size = (250,250)) #self.RightSizer.Add(PlotPanel, proportion=0, flag= wx.EXPAND|wx.ALL, border=parent.border) self.KrigingSizer = wx.StaticBoxSizer( wx.StaticBox(self, id=wx.ID_ANY, label=_("Kriging techniques")), wx.VERTICAL) KrigingList = ["Ordinary kriging", "Block kriging" ] #, "Universal kriging"] #@FIXME: i18n on the list? self.KrigingRadioBox = wx.RadioBox(self, id=wx.ID_ANY, choices=KrigingList, majorDimension=1, style=wx.RA_SPECIFY_COLS) self.KrigingRadioBox.Bind(wx.EVT_RADIOBOX, self.HideBlockOptions) self.KrigingSizer.Add(self.KrigingRadioBox, proportion=0, flag=wx.EXPAND | wx.ALL, border=parent.border) # block kriging parameters. Size. BlockSizer = wx.BoxSizer(wx.HORIZONTAL) BlockLabel = wx.StaticText(self, id=wx.ID_ANY, label=_("Block size:")) self.BlockSpinBox = wx.SpinCtrl(self, id=wx.ID_ANY, min=1, max=maxint) self.BlockSpinBox.Enable( False ) # default choice is Ordinary kriging so block param is disabled BlockSizer.Add(BlockLabel, flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=parent.border) BlockSizer.Add(self.BlockSpinBox, flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=parent.border) self.KrigingSizer.Add(BlockSizer, flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=parent.border) self.Sizer = wx.BoxSizer(wx.VERTICAL) self.Sizer.Add(self.VariogramSizer, proportion=0, flag=wx.EXPAND | wx.ALL, border=parent.border) self.Sizer.Add(self.KrigingSizer, proportion=0, flag=wx.EXPAND | wx.ALL, border=parent.border)
def __init__(self, parent, frame): wx.Panel.__init__(self, parent, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize) self._frame = frame vert = wx.BoxSizer(wx.VERTICAL) s1 = wx.BoxSizer(wx.HORIZONTAL) self._border_size = wx.SpinCtrl(self, ID_PaneBorderSize, "", wx.DefaultPosition, wx.Size(50, 20)) s1.Add((1, 1), 1, wx.EXPAND) s1.Add(wx.StaticText(self, -1, "Pane Border Size:")) s1.Add(self._border_size) s1.Add((1, 1), 1, wx.EXPAND) s1.SetItemMinSize(1, (180, 20)) #vert.Add(s1, 0, wx.EXPAND | wxLEFT | wxBOTTOM, 5) s2 = wx.BoxSizer(wx.HORIZONTAL) self._sash_size = wx.SpinCtrl(self, ID_SashSize, "", wx.DefaultPosition, wx.Size(50, 20)) s2.Add((1, 1), 1, wx.EXPAND) s2.Add(wx.StaticText(self, -1, "Sash Size:")) s2.Add(self._sash_size) s2.Add((1, 1), 1, wx.EXPAND) s2.SetItemMinSize(1, (180, 20)) #vert.Add(s2, 0, wx.EXPAND | wxLEFT | wxBOTTOM, 5) s3 = wx.BoxSizer(wx.HORIZONTAL) self._caption_size = wx.SpinCtrl(self, ID_CaptionSize, "", wx.DefaultPosition, wx.Size(50, 20)) s3.Add((1, 1), 1, wx.EXPAND) s3.Add(wx.StaticText(self, -1, "Caption Size:")) s3.Add(self._caption_size) s3.Add((1, 1), 1, wx.EXPAND) s3.SetItemMinSize(1, (180, 20)) #vert.Add(s3, 0, wx.EXPAND | wxLEFT | wxBOTTOM, 5) #vert.Add(1, 1, 1, wx.EXPAND) b = self.CreateColorBitmap(wx.BLACK) s4 = wx.BoxSizer(wx.HORIZONTAL) self._background_color = wx.BitmapButton(self, ID_BackgroundColor, b, wx.DefaultPosition, wx.Size(50, 25)) s4.Add((1, 1), 1, wx.EXPAND) s4.Add(wx.StaticText(self, -1, "Background Color:")) s4.Add(self._background_color) s4.Add((1, 1), 1, wx.EXPAND) s4.SetItemMinSize(1, (180, 20)) s5 = wx.BoxSizer(wx.HORIZONTAL) self._sash_color = wx.BitmapButton(self, ID_SashColor, b, wx.DefaultPosition, wx.Size(50, 25)) s5.Add((1, 1), 1, wx.EXPAND) s5.Add(wx.StaticText(self, -1, "Sash Color:")) s5.Add(self._sash_color) s5.Add((1, 1), 1, wx.EXPAND) s5.SetItemMinSize(1, (180, 20)) s6 = wx.BoxSizer(wx.HORIZONTAL) self._inactive_caption_color = wx.BitmapButton( self, ID_InactiveCaptionColor, b, wx.DefaultPosition, wx.Size(50, 25)) s6.Add((1, 1), 1, wx.EXPAND) s6.Add(wx.StaticText(self, -1, "Normal Caption:")) s6.Add(self._inactive_caption_color) s6.Add((1, 1), 1, wx.EXPAND) s6.SetItemMinSize(1, (180, 20)) s7 = wx.BoxSizer(wx.HORIZONTAL) self._inactive_caption_gradient_color = wx.BitmapButton( self, ID_InactiveCaptionGradientColor, b, wx.DefaultPosition, wx.Size(50, 25)) s7.Add((1, 1), 1, wx.EXPAND) s7.Add(wx.StaticText(self, -1, "Normal Caption Gradient:")) s7.Add(self._inactive_caption_gradient_color) s7.Add((1, 1), 1, wx.EXPAND) s7.SetItemMinSize(1, (180, 20)) s8 = wx.BoxSizer(wx.HORIZONTAL) self._inactive_caption_text_color = wx.BitmapButton( self, ID_InactiveCaptionTextColor, b, wx.DefaultPosition, wx.Size(50, 25)) s8.Add((1, 1), 1, wx.EXPAND) s8.Add(wx.StaticText(self, -1, "Normal Caption Text:")) s8.Add(self._inactive_caption_text_color) s8.Add((1, 1), 1, wx.EXPAND) s8.SetItemMinSize(1, (180, 20)) s9 = wx.BoxSizer(wx.HORIZONTAL) self._active_caption_color = wx.BitmapButton(self, ID_ActiveCaptionColor, b, wx.DefaultPosition, wx.Size(50, 25)) s9.Add((1, 1), 1, wx.EXPAND) s9.Add(wx.StaticText(self, -1, "Active Caption:")) s9.Add(self._active_caption_color) s9.Add((1, 1), 1, wx.EXPAND) s9.SetItemMinSize(1, (180, 20)) s10 = wx.BoxSizer(wx.HORIZONTAL) self._active_caption_gradient_color = wx.BitmapButton( self, ID_ActiveCaptionGradientColor, b, wx.DefaultPosition, wx.Size(50, 25)) s10.Add((1, 1), 1, wx.EXPAND) s10.Add(wx.StaticText(self, -1, "Active Caption Gradient:")) s10.Add(self._active_caption_gradient_color) s10.Add((1, 1), 1, wx.EXPAND) s10.SetItemMinSize(1, (180, 20)) s11 = wx.BoxSizer(wx.HORIZONTAL) self._active_caption_text_color = wx.BitmapButton( self, ID_ActiveCaptionTextColor, b, wx.DefaultPosition, wx.Size(50, 25)) s11.Add((1, 1), 1, wx.EXPAND) s11.Add(wx.StaticText(self, -1, "Active Caption Text:")) s11.Add(self._active_caption_text_color) s11.Add((1, 1), 1, wx.EXPAND) s11.SetItemMinSize(1, (180, 20)) s12 = wx.BoxSizer(wx.HORIZONTAL) self._border_color = wx.BitmapButton(self, ID_BorderColor, b, wx.DefaultPosition, wx.Size(50, 25)) s12.Add((1, 1), 1, wx.EXPAND) s12.Add(wx.StaticText(self, -1, "Border Color:")) s12.Add(self._border_color) s12.Add((1, 1), 1, wx.EXPAND) s12.SetItemMinSize(1, (180, 20)) s13 = wx.BoxSizer(wx.HORIZONTAL) self._gripper_color = wx.BitmapButton(self, ID_GripperColor, b, wx.DefaultPosition, wx.Size(50, 25)) s13.Add((1, 1), 1, wx.EXPAND) s13.Add(wx.StaticText(self, -1, "Gripper Color:")) s13.Add(self._gripper_color) s13.Add((1, 1), 1, wx.EXPAND) s13.SetItemMinSize(1, (180, 20)) grid_sizer = wx.GridSizer(cols=2) grid_sizer.SetHGap(5) grid_sizer.Add(s1) grid_sizer.Add(s4) grid_sizer.Add(s2) grid_sizer.Add(s5) grid_sizer.Add(s3) grid_sizer.Add(s13) grid_sizer.Add((1, 1)) grid_sizer.Add(s12) grid_sizer.Add(s6) grid_sizer.Add(s9) grid_sizer.Add(s7) grid_sizer.Add(s10) grid_sizer.Add(s8) grid_sizer.Add(s11) cont_sizer = wx.BoxSizer(wx.VERTICAL) cont_sizer.Add(grid_sizer, 1, wx.EXPAND | wx.ALL, 5) self.SetSizer(cont_sizer) self.GetSizer().SetSizeHints(self) self._border_size.SetValue(frame.GetDockArt().GetMetric( aui.AUI_DOCKART_PANE_BORDER_SIZE)) self._sash_size.SetValue(frame.GetDockArt().GetMetric( aui.AUI_DOCKART_SASH_SIZE)) self._caption_size.SetValue(frame.GetDockArt().GetMetric( aui.AUI_DOCKART_CAPTION_SIZE)) self.UpdateColors() self.Bind(wx.EVT_SPINCTRL, self.OnPaneBorderSize, id=ID_PaneBorderSize) self.Bind(wx.EVT_SPINCTRL, self.OnSashSize, id=ID_SashSize) self.Bind(wx.EVT_SPINCTRL, self.OnCaptionSize, id=ID_CaptionSize) self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_BackgroundColor) self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_SashColor) self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_InactiveCaptionColor) self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_InactiveCaptionGradientColor) self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_InactiveCaptionTextColor) self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_ActiveCaptionColor) self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_ActiveCaptionGradientColor) self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_ActiveCaptionTextColor) self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_BorderColor) self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_GripperColor)
def build(self, parent): wx.Dialog.__init__(self, parent, title='Scan or Sample') self.mainsizer=wx.BoxSizer(wx.VERTICAL) self.npoints=wxbasics.input_output_pair(self) self.npoints.set_label('Number of points:') self.npoints.configure(int, (0,10000), int(qy.settings.get('scan_npoints'))) self.mainsizer.Add(self.npoints, 0, wx.EXPAND|wx.ALL, 5) self.nloops=wxbasics.input_output_pair(self) self.nloops.set_label('Number of loops:') self.nloops.configure(int, (0,10000), int(qy.settings.get('scan_nloops'))) self.mainsizer.Add(self.nloops, 0, wx.EXPAND|wx.ALL, 5) self.integration_time=wxbasics.input_output_pair(self) self.integration_time.set_label('Integration time (s) :') self.integration_time.configure(int, (1,10000), int(qy.settings.get('scan_integration_time'))) self.mainsizer.Add(self.integration_time, 0, wx.EXPAND|wx.ALL, 5) self.close_shutter=wx.CheckBox(self, label='Close shutter at end of scan') self.close_shutter.SetValue(int(qy.settings.get('scan_close_shutter'))) self.mainsizer.Add((0,5), 0) self.mainsizer.Add(self.close_shutter, 0, wx.EXPAND|wx.ALL, 5) self.mainsizer.Add((0,5), 0) self.dont_move=wx.CheckBox(self, label='Sample counts without moving') self.dont_move.SetValue(int(qy.settings.get('scan_dont_move'))) self.dont_move.Bind(wx.EVT_CHECKBOX, self.show_hide) self.mainsizer.Add((0,5), 0) self.mainsizer.Add(self.dont_move, 0, wx.EXPAND|wx.ALL, 5) self.mainsizer.Add((0,5), 0) self.start_position=wxbasics.input_output_pair(self) self.start_position.set_label('Start position (mm) :') self.start_position.configure(float, (0,50), qy.settings.get('scan_start_position')) self.mainsizer.Add(self.start_position, 0, wx.EXPAND|wx.ALL, 5) self.stop_position=wxbasics.input_output_pair(self) self.stop_position.set_label('Stop position (mm) :') self.stop_position.configure(float, (0,50), qy.settings.get('scan_stop_position')) self.mainsizer.Add(self.stop_position, 0, wx.EXPAND|wx.ALL, 5) q=wx.BoxSizer(wx.HORIZONTAL) l=wx.StaticText(self, label='Motor Controller:') q.Add(l, 1, wx.EXPAND) self.motor_controller=wx.SpinCtrl(self, style=wx.SIMPLE_BORDER, size=(60, 24)) self.motor_controller.SetRange(1, int(qy.settings.get('motors_count'))) self.motor_controller.SetValue(int(qy.settings.get('scan_motor_controller'))) q.Add((0,0), 1, wx.EXPAND) q.Add(self.motor_controller, 0, wx.EXPAND) self.mainsizer.Add(q, 0, wx.EXPAND|wx.ALL, 5) self.scan_label=wx.TextCtrl(self, style=wx.SIMPLE_BORDER|wx.TE_MULTILINE) self.scan_label.SetBackgroundColour(wx.Colour(255,255,225)) self.mainsizer.Add(self.scan_label, 1, wx.EXPAND|wx.ALL, 5) self.time_display=wxbasics.output_box(self, border=True) self.mainsizer.Add(self.time_display, 0, wx.EXPAND|wx.ALL, 5) bsizer=wx.BoxSizer(wx.HORIZONTAL) self.start_button=wx.Button(self, label='Start') self.start_button.Bind(wx.EVT_BUTTON, self.start) bsizer.Add(self.start_button, 0, wx.EXPAND|wx.RIGHT, 5) self.cancel_button=wx.Button(self, label='Cancel') self.cancel_button.Bind(wx.EVT_BUTTON, self.cancel) bsizer.Add(self.cancel_button, 0, wx.EXPAND) self.mainsizer.Add(bsizer, 0, wx.EXPAND|wx.ALL, 5) self.SetSizerAndFit(self.mainsizer) self.SetMinSize((400,500)) self.SetSize((300,500)) self.show_hide() self.build_timer()
def __init__(self, parent, cfg, values, entry, internalname, name, location, type, typename, typevalues, itemtypes): if entry == {}: title = _('Creating new %s') % name self.wasempty = True else: title = _('Editing %(name)s %(location)s') % { 'name': name, 'location': location } self.wasempty = False wx.Dialog.__init__(self, parent, -1, title, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) self.rows = 0 self.entry = entry self.values = values self.type = type self.cfg = cfg self.internalname = internalname self.itemtypes = itemtypes self.sizer = wx.GridBagSizer(5, 5) self.sizer.SetCols(6) self.sizer.AddGrowableCol(2) self.sizer.AddGrowableCol(5) if self.wasempty: entry['Location'] = 0 entry[type] = self.cfg.Read('/Defaults/Type-%s-%s' % (internalname, type)) self.sizer.Add(wx.StaticText(self, -1, _('Location (0=auto):')), (0, 0), (1, 4)) # there used to be sys.maxint on following line, but it's too large on amd64 (or there is bug in wxPython) self.locationedit = wx.SpinCtrl(self, -1, str(entry['Location']), style=wx.SP_WRAP | wx.SP_ARROW_KEYS, min=0, max=2147483647, initial=entry['Location']) self.sizer.Add(self.locationedit, (0, 4), (1, 4)) self.sizer.Add(wx.StaticText(self, -1, typename), (1, 0), (1, 4)) self.typeedit = wx.ComboBox(self, -1, entry[type], choices=typevalues, style=wx.CB_READONLY) self.sizer.Add(self.typeedit, (1, 4), (1, 4)) self.rowoffset = 2 self.Bind(wx.EVT_TEXT, self.OnTypeChange, self.typeedit) self.edits = {} self.types = {} self.fulltypes = {} x = 0 if self.wasempty: for x in range(self.cfg.ReadInt('/Wammu/DefaultEntries')): entrytype = self.cfg.Read('/Defaults/Entry-%s-%d' % (self.internalname, x)) if entrytype != '': self.AddEdit( x, { 'Type': entrytype, 'Value': '', 'VoiceTag': 0, 'AddError': 0 }) else: self.AddEdit(x) else: for i in range(len(entry['Entries'])): self.AddEdit(i, entry['Entries'][i]) self.more = wx.Button(self, wx.ID_ADD) self.more.SetToolTipString(_('Add one more field.')) self.button_sizer = wx.StdDialogButtonSizer() self.button_sizer.AddButton(wx.Button(self, wx.ID_OK)) self.button_sizer.AddButton(wx.Button(self, wx.ID_CANCEL)) self.button_sizer.SetNegativeButton(self.more) self.button_sizer.Realize() self.Bind(wx.EVT_BUTTON, self.Okay, id=wx.ID_OK) self.Bind(wx.EVT_BUTTON, self.More, self.more) self.SetAutoLayout(True) self.SetSizer(self.sizer) self.AddButtons()
def set_map_coeffs(self, array): assert (array.is_complex_array()) self.map_txt.SetLabel(str(array.info().label_string())) self._current_array = array map = array.fft_map(resolution_factor=0.25) self._current_map = map self.info_panel = wx.Panel(self.panel, -1) self.panel_sizer.Add(self.info_panel, 1, wx.ALL | wx.EXPAND) szr = wx.BoxSizer(wx.VERTICAL) self.info_panel.SetSizer(szr) box = wx.StaticBox(self.info_panel, -1, "Map info:") box_szr = wx.StaticBoxSizer(box, wx.VERTICAL) szr.Add(box_szr, 1, wx.EXPAND | wx.ALL, 5) grid = wx.FlexGridSizer(cols=2) box_szr.Add(grid, 0, wx.EXPAND) import iotbx.map_tools info_list = iotbx.map_tools.get_map_summary(map) for label, value in info_list: txt1 = wx.StaticText(self.info_panel, -1, label + ":") font = txt1.GetFont() font.SetWeight(wx.FONTWEIGHT_BOLD) txt1.SetFont(font) grid.Add(txt1, 0, ALN_FLAGS, 5) str_value = to_str(value) alert = False if (str_value.endswith("***")): str_value = re.sub("\s*\*\*\*", "", str_value) alert = True txt2 = wx.StaticText(self.info_panel, -1, str_value) font2 = txt2.GetFont() font2.SetFamily(wx.FONTFAMILY_MODERN) if (alert): font2.SetWeight(wx.FONTWEIGHT_BOLD) txt2.SetForegroundColour((200, 0, 0)) txt1.SetForegroundColour((200, 0, 0)) txt2.SetFont(font2) grid.Add(txt2, 0, ALN_FLAGS, 5) self.histogram = wxtbx.plots.histogram(self.info_panel, figure_size=(6, 4)) self.draw_plot(n_bins=20, log_scale=False) box_szr.Add(self.histogram, 1, wx.EXPAND, 5) hbox = wx.BoxSizer(wx.HORIZONTAL) box_szr.Add(hbox, 0, wx.TOP, 5) ip = self.info_panel btn = wx.Button(ip, -1, "Save plot to file...") self.Bind(wx.EVT_BUTTON, lambda evt: self.histogram.save_image(), btn) hbox.Add(btn, 0, ALN_FLAGS, 5) hbox.Add(wx.StaticText(ip, label="Number of bins:"), 0, ALN_FLAGS, 5) self.n_bins_ctrl = wx.SpinCtrl(ip, value="20", min=10, max=50, initial=20) self.Bind(wx.EVT_SPINCTRL, self.OnRedraw, self.n_bins_ctrl) hbox.Add(self.n_bins_ctrl, 0, ALN_FLAGS, 5) self.log_scale_box = wx.CheckBox(ip, label="Use log scale for Y-axis") hbox.Add(self.log_scale_box, 0, ALN_FLAGS, 5) self.Bind(wx.EVT_CHECKBOX, self.OnRedraw, self.log_scale_box) szr.Fit(self.info_panel) self.panel.Layout() self.panel_sizer.Fit(self.panel) self.Fit()
def __init__(self, parent, title, vectorName, query = None, cats = None, style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER, **kwargs): """!Dialog used to display/modify categories of vector objects @param parent @param title dialog title @param query {coordinates, qdist} - used by v.edit/v.what @param cats directory of lines (layer/categories) - used by vdigit @param style dialog style """ self.parent = parent # mapdisplay.BufferedWindow class instance self.digit = parent.digit # map name self.vectorName = vectorName # line : {layer: [categories]} self.cats = {} # do not display dialog if no line is found (-> self.cats) if cats is None: if self._getCategories(query[0], query[1]) == 0 or not self.line: Debug.msg(3, "VDigitCategoryDialog(): nothing found!") else: self.cats = cats for line in cats.keys(): for layer in cats[line].keys(): self.cats[line][layer] = list(cats[line][layer]) layers = [] for layer in self.digit.GetLayers(): layers.append(str(layer)) # make copy of cats (used for 'reload') self.cats_orig = copy.deepcopy(self.cats) wx.Dialog.__init__(self, parent = self.parent, id = wx.ID_ANY, title = title, style = style, **kwargs) # list of categories box = wx.StaticBox(parent = self, id = wx.ID_ANY, label = " %s " % _("List of categories - right-click to delete")) listSizer = wx.StaticBoxSizer(box, wx.VERTICAL) self.list = CategoryListCtrl(parent = self, id = wx.ID_ANY, style = wx.LC_REPORT | wx.BORDER_NONE | wx.LC_SORT_ASCENDING | wx.LC_HRULES | wx.LC_VRULES) # sorter self.fid = self.cats.keys()[0] self.itemDataMap = self.list.Populate(self.cats[self.fid]) listmix.ColumnSorterMixin.__init__(self, 2) self.fidMulti = wx.Choice(parent = self, id = wx.ID_ANY, size = (150, -1)) self.fidMulti.Bind(wx.EVT_CHOICE, self.OnFeature) self.fidText = wx.StaticText(parent = self, id = wx.ID_ANY) if len(self.cats.keys()) == 1: self.fidMulti.Show(False) self.fidText.SetLabel(str(self.fid)) else: self.fidText.Show(False) choices = [] for fid in self.cats.keys(): choices.append(str(fid)) self.fidMulti.SetItems(choices) self.fidMulti.SetSelection(0) listSizer.Add(item = self.list, proportion = 1, flag = wx.EXPAND) # add new category box = wx.StaticBox(parent = self, id = wx.ID_ANY, label = " %s " % _("Add new category")) addSizer = wx.StaticBoxSizer(box, wx.VERTICAL) flexSizer = wx.FlexGridSizer (cols = 5, hgap = 5, vgap = 5) flexSizer.AddGrowableCol(3) layerNewTxt = wx.StaticText(parent = self, id = wx.ID_ANY, label = "%s:" % _("Layer")) self.layerNew = wx.Choice(parent = self, id = wx.ID_ANY, size = (75, -1), choices = layers) if len(layers) > 0: self.layerNew.SetSelection(0) catNewTxt = wx.StaticText(parent = self, id = wx.ID_ANY, label = "%s:" % _("Category")) try: newCat = max(self.cats[self.fid][1]) + 1 except KeyError: newCat = 1 self.catNew = wx.SpinCtrl(parent = self, id = wx.ID_ANY, size = (75, -1), initial = newCat, min = 0, max = 1e9) btnAddCat = wx.Button(self, wx.ID_ADD) flexSizer.Add(item = layerNewTxt, proportion = 0, flag = wx.FIXED_MINSIZE | wx.ALIGN_CENTER_VERTICAL) flexSizer.Add(item = self.layerNew, proportion = 0, flag = wx.FIXED_MINSIZE | wx.ALIGN_CENTER_VERTICAL) flexSizer.Add(item = catNewTxt, proportion = 0, flag = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.LEFT, border = 10) flexSizer.Add(item = self.catNew, proportion = 0, flag = wx.FIXED_MINSIZE | wx.ALIGN_CENTER_VERTICAL) flexSizer.Add(item = btnAddCat, proportion = 0, flag = wx.EXPAND | wx.ALIGN_RIGHT | wx.FIXED_MINSIZE) addSizer.Add(item = flexSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5) # buttons btnApply = wx.Button(self, wx.ID_APPLY) btnApply.SetToolTipString(_("Apply changes")) btnCancel = wx.Button(self, wx.ID_CANCEL) btnCancel.SetToolTipString(_("Ignore changes and close dialog")) btnOk = wx.Button(self, wx.ID_OK) btnOk.SetToolTipString(_("Apply changes and close dialog")) btnOk.SetDefault() # sizers btnSizer = wx.StdDialogButtonSizer() btnSizer.AddButton(btnCancel) #btnSizer.AddButton(btnReload) #btnSizer.SetNegativeButton(btnReload) btnSizer.AddButton(btnApply) btnSizer.AddButton(btnOk) btnSizer.Realize() mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(item = listSizer, proportion = 1, flag = wx.EXPAND | wx.ALL | wx.ALIGN_CENTER, border = 5) mainSizer.Add(item = addSizer, proportion = 0, flag = wx.EXPAND | wx.ALIGN_CENTER | wx.LEFT | wx.RIGHT | wx.BOTTOM, border = 5) fidSizer = wx.BoxSizer(wx.HORIZONTAL) fidSizer.Add(item = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Feature id:")), proportion = 0, border = 5, flag = wx.ALIGN_CENTER_VERTICAL) fidSizer.Add(item = self.fidMulti, proportion = 0, flag = wx.EXPAND | wx.ALL, border = 5) fidSizer.Add(item = self.fidText, proportion = 0, flag = wx.EXPAND | wx.ALL, border = 5) mainSizer.Add(item = fidSizer, proportion = 0, flag = wx.EXPAND | wx.ALL, border = 5) mainSizer.Add(item = btnSizer, proportion = 0, flag = wx.EXPAND | wx.ALL | wx.ALIGN_CENTER, border = 5) self.SetSizer(mainSizer) mainSizer.Fit(self) self.SetAutoLayout(True) # set min size for dialog self.SetMinSize(self.GetBestSize()) # bindings btnApply.Bind(wx.EVT_BUTTON, self.OnApply) btnOk.Bind(wx.EVT_BUTTON, self.OnOK) btnAddCat.Bind(wx.EVT_BUTTON, self.OnAddCat) btnCancel.Bind(wx.EVT_BUTTON, self.OnCancel) # list self.list.Bind(wx.EVT_COMMAND_RIGHT_CLICK, self.OnRightUp) #wxMSW self.list.Bind(wx.EVT_RIGHT_UP, self.OnRightUp) #wxGTK self.Bind(wx.EVT_LIST_BEGIN_LABEL_EDIT, self.OnBeginEdit, self.list) self.Bind(wx.EVT_LIST_END_LABEL_EDIT, self.OnEndEdit, self.list) self.Bind(wx.EVT_LIST_COL_CLICK, self.OnColClick, self.list)
def __init__(self, parent, title, style): super().__init__(parent, title=title, size=(500, 380), style=style) panel = wx.Panel(self) vbox = wx.BoxSizer(wx.VERTICAL) f_box = wx.BoxSizer(wx.HORIZONTAL) s_box = wx.BoxSizer(wx.HORIZONTAL) t_box = wx.BoxSizer(wx.HORIZONTAL) fo_box = wx.BoxSizer(wx.HORIZONTAL) fi_box = wx.BoxSizer(wx.VERTICAL) si_box = wx.BoxSizer(wx.HORIZONTAL) self.st_string = wx.StaticText(panel, label='Строка:') self.tc_string = wx.TextCtrl(panel) f_box.Add(self.st_string, flag=wx.LEFT, border=10) f_box.Add(self.tc_string, proportion=1, flag=wx.LEFT, border=40) self.cb_del = wx.CheckBox(panel, label='Удалить слова размером меньше') self.cb_del.SetValue(True) s_box.Add(self.cb_del) self.sc_len = wx.SpinCtrl(panel, value='5', min=0, max=100) s_box.Add(self.sc_len, flag=wx.LEFT, border=10) self.Bind(wx.EVT_CHECKBOX, self.check_cb_del, self.cb_del) self.cb_change = wx.CheckBox(panel, label='Заменить все цифры на *') self.cb_change.SetValue(True) t_box.Add(self.cb_change, flag=wx.TOP, border=10) self.cb_spaces = wx.CheckBox( panel, label='Вставить по пробелу между символами') self.cb_spaces.SetValue(True) fo_box.Add(self.cb_spaces, flag=wx.TOP, border=10) self.cb_sort = wx.CheckBox(panel, label='Сортировать слова в строке') self.cb_sort.SetValue(True) fi_box.Add(self.cb_sort, flag=wx.TOP, border=10) self.rb_len = wx.RadioButton(panel, label='По размеру', style=wx.RB_GROUP) self.rb_lex = wx.RadioButton(panel, label='Лексикографически') self.but_format = wx.Button(panel, size=(400, 30), label='Форматировать') fi_box.Add(self.rb_len, flag=wx.LEFT, border=30) fi_box.Add(self.rb_lex, flag=wx.LEFT, border=30) fi_box.Add(self.but_format, flag=wx.EXPAND | wx.RIGHT | wx.TOP, border=20) self.but_format.Bind(wx.EVT_BUTTON, self.format) self.Bind(wx.EVT_CHECKBOX, self.check_cb_sort, self.cb_sort) self.st_res = wx.StaticText(panel, label='Результат:') self.tc_res = wx.TextCtrl(panel, style=wx.TE_READONLY) si_box.Add(self.st_res, flag=wx.LEFT, border=10) si_box.Add(self.tc_res, proportion=1, flag=wx.LEFT, border=20) vbox.Add(f_box, flag=wx.EXPAND | wx.TOP | wx.BOTTOM | wx.RIGHT, border=20) vbox.Add(s_box, flag=wx.LEFT, border=95) vbox.Add(t_box, flag=wx.LEFT, border=95) vbox.Add(fo_box, flag=wx.LEFT, border=95) vbox.Add(fi_box, flag=wx.LEFT, border=95) vbox.Add(si_box, flag=wx.EXPAND | wx.TOP | wx.RIGHT, border=20) panel.SetSizer(vbox) self.Show()
def __init__(self, parent, filename): wx.Dialog.__init__ (self, parent, id = wx.ID_ANY, title = u"Parse Tables in ", pos = defPos, size = defSiz, style = wx.CAPTION|wx.CLOSE_BOX|wx.DEFAULT_DIALOG_STYLE) #====================================================================== # display an icon top left of dialog, append filename to title #====================================================================== if show_icon: self.SetIcon(ico_pdf.img.GetIcon()) # set a screen icon self.SetBackgroundColour(khaki) self.SetTitle(self.Title + filename) self.set_rectangle = False #====================================================================== # open the document with MuPDF when dialog gets created #====================================================================== self.doc = fitz.Document(filename) if self.doc.needsPass: self.decrypt_doc() if self.doc.isEncrypted: self.Destroy() return #====================================================================== # forward button #====================================================================== self.BtnNext = wx.Button(self, wx.ID_ANY, "Forward", defPos, defSiz, wx.BU_EXACTFIT) #====================================================================== # backward button #====================================================================== self.BtnPrev = wx.Button(self, wx.ID_ANY, "Backward", defPos, defSiz, wx.BU_EXACTFIT) #====================================================================== # text field for entering a target page. wx.TE_PROCESS_ENTER is # required to get data entry fired as events. #====================================================================== self.TextToPage = wx.TextCtrl(self, wx.ID_ANY, u"1", defPos, wx.Size(40, -1), wx.TE_PROCESS_ENTER|wx.TE_RIGHT) #====================================================================== # displays total pages #====================================================================== self.statPageMax = wx.StaticText(self, wx.ID_ANY, "of " + str(self.doc.pageCount) + " pages.", defPos, defSiz, 0) #====================================================================== # displays page format #====================================================================== self.paperform = wx.StaticText(self, wx.ID_ANY, "", defPos, defSiz, 0) #====================================================================== # activate rectangle drawing #====================================================================== self.BtnRect = wx.Button(self, wx.ID_ANY, u"New Rect", defPos, defSiz, wx.BU_EXACTFIT) #====================================================================== # "Left" literal #====================================================================== self.statLeft = wx.StaticText(self, wx.ID_ANY, "Left:", defPos, wx.Size(50, -1), 0) #====================================================================== # modify rectangle left #====================================================================== self.CtrlLeft = wx.SpinCtrl( self, wx.ID_ANY, "0", defPos, wx.Size(50, -1), wx.SP_ARROW_KEYS|wx.TE_PROCESS_ENTER, 0, 999, 0 ) #====================================================================== # "Top" literal #====================================================================== self.statTop = wx.StaticText(self, wx.ID_ANY, "Top:", defPos, wx.Size(50, -1), 0) #====================================================================== # modify rectangle top #====================================================================== self.CtrlTop = wx.SpinCtrl( self, wx.ID_ANY, "0", defPos, wx.Size(50, -1), wx.SP_ARROW_KEYS|wx.TE_PROCESS_ENTER, 0, 999, 0 ) #====================================================================== # "Height" literal #====================================================================== self.statHeight = wx.StaticText(self, wx.ID_ANY, "Height:", defPos, wx.Size(50, -1), 0) #====================================================================== # modify rectangle Height #====================================================================== self.CtrlHeight = wx.SpinCtrl( self, wx.ID_ANY, "0", defPos, wx.Size(50, -1), wx.SP_ARROW_KEYS|wx.TE_PROCESS_ENTER, 0, 999, 0 ) #====================================================================== # "Width" literal #====================================================================== self.statWidth = wx.StaticText(self, wx.ID_ANY, "Width:", defPos, wx.Size(50, -1), 0) #====================================================================== # modify rectangle Width #====================================================================== self.CtrlWidth = wx.SpinCtrl( self, wx.ID_ANY, "0", defPos, wx.Size(50, -1), wx.SP_ARROW_KEYS|wx.TE_PROCESS_ENTER, 0, 999, 0 ) #====================================================================== # parse table within rectangle #====================================================================== self.BtnMatrix = wx.Button(self, wx.ID_ANY, "Get Table", defPos, defSiz, wx.BU_EXACTFIT) #====================================================================== # column controls #====================================================================== self.BtnNewCol = wx.Button(self, wx.ID_ANY, "New Col", defPos, defSiz, wx.BU_EXACTFIT) self.col_coords = {} self.ColList = wx.Choice( self, wx.ID_ANY, defPos, wx.Size(50, -1)) self.CtrlCols = wx.SpinCtrl( self, wx.ID_ANY, "0", defPos, wx.Size(50, -1), wx.SP_ARROW_KEYS|wx.TE_PROCESS_ENTER, 0, 999, 0) #====================================================================== # image of document page #====================================================================== self.bitmap = self.pdf_show(1) self.PDFimage = wx.StaticBitmap(self, wx.ID_ANY, self.bitmap, defPos, self.bitmap.Size, wx.NO_BORDER) #====================================================================== # horizonzal lines #====================================================================== l1 = wx.StaticLine(self, wx.ID_ANY, defPos, defSiz, wx.LI_HORIZONTAL) l2 = wx.StaticLine(self, wx.ID_ANY, defPos, defSiz, wx.LI_HORIZONTAL) l3 = wx.StaticLine(self, wx.ID_ANY, defPos, defSiz, wx.LI_HORIZONTAL) ''' ======================================================================= Overall Dialog Structure: ------------------------- szr10 (main sizer for the whole dialog - vertical orientation) +-> szr20 (sizer for buttons etc. - horizontal orientation) +-> button forward +-> button backward +-> field for page number to jump to +-> field displaying total pages +-> fields for controlling the rectangle +-> szr30 (sizer for columns) +-> button "New Column" +-> fields for controlling a column +-> button to extract selected table +-> PDF image area ======================================================================= ''' #====================================================================== # sizers #====================================================================== szr10 = wx.BoxSizer(wx.VERTICAL) # main sizer szr20 = wx.BoxSizer(wx.HORIZONTAL) # paging controls szr30 = wx.BoxSizer(wx.HORIZONTAL) # rect & col controls & image szr40 = wx.BoxSizer(wx.VERTICAL) # rect & col controls # szr20: navigation controls szr20.Add(self.BtnNext, 0, wx.ALL, 5) szr20.Add(self.BtnPrev, 0, wx.ALL, 5) szr20.Add(self.TextToPage, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szr20.Add(self.statPageMax, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szr20.Add(self.paperform, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szr20.Fit(self) # szr40: rectangle & column controls szr40.Add(self.BtnRect, 0,wx.ALL, 5) szr40.Add(self.statLeft, 0, wx.ALL, 5) szr40.Add(self.CtrlLeft, 0, wx.ALL, 5) szr40.Add(self.statTop, 0, wx.ALL, 5) szr40.Add(self.CtrlTop, 0, wx.ALL, 5) szr40.Add(self.statHeight, 0, wx.ALL, 5) szr40.Add(self.CtrlHeight, 0, wx.ALL, 5) szr40.Add(self.statWidth, 0, wx.ALL, 5) szr40.Add(self.CtrlWidth, 0, wx.ALL, 5) szr40.Add(l2, 0, wx.EXPAND|wx.ALL, 5) szr40.Add(self.BtnNewCol, 0, wx.ALL, 5) szr40.Add(self.ColList, 0, wx.ALL, 5) szr40.Add(self.CtrlCols, 0, wx.ALL, 5) szr40.Add(l3, 0, wx.EXPAND|wx.ALL, 5) szr40.Add(self.BtnMatrix, 0, wx.ALL, 5) szr40.Fit(self) # szr30: document image szr30.Add(szr40, 0, wx.EXPAND, 5) szr30.Add(self.PDFimage, 0, wx.ALL, 5) szr30.Fit(self) # szr10: main sizer szr10.Add(szr20, 0, wx.EXPAND, 5) szr10.Add(l1, 0, wx.EXPAND|wx.ALL, 5) szr10.Add(szr30, 0, wx.EXPAND, 5) szr10.Fit(self) self.SetSizer(szr10) self.Layout() self.Centre(wx.BOTH) #====================================================================== # Bind event handlers #====================================================================== self.BtnNewCol.Bind(wx.EVT_BUTTON, self.AddCol) self.BtnNext.Bind(wx.EVT_BUTTON, self.NextPage) self.BtnPrev.Bind(wx.EVT_BUTTON, self.PreviousPage) self.TextToPage.Bind(wx.EVT_TEXT_ENTER, self.GotoPage) self.BtnRect.Bind(wx.EVT_BUTTON, self.ActivateRect) self.BtnMatrix.Bind(wx.EVT_BUTTON, self.GetMatrix) self.CtrlTop.Bind(wx.EVT_SPINCTRL, self.resize_rect) self.CtrlHeight.Bind(wx.EVT_SPINCTRL, self.resize_rect) self.CtrlLeft.Bind(wx.EVT_SPINCTRL, self.resize_rect) self.CtrlWidth.Bind(wx.EVT_SPINCTRL, self.resize_rect) self.CtrlCols.Bind(wx.EVT_SPINCTRL, self.UpdateCol) self.ColList.Bind(wx.EVT_CHOICE, self.OnColSelect) self.PDFimage.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown) self.PDFimage.Bind(wx.EVT_LEFT_UP, self.OnLeftUp) self.PDFimage.Bind(wx.EVT_MOTION, self.move_mouse) self.PDFimage.Bind(wx.EVT_MOUSEWHEEL, self.OnMouseWheel) self.disable_fields()
def __init__(self, parent=None, id=wx.ID_ANY): wx.Frame.__init__(self, parent, id, 'Turing Machine', size=(660,440), style=wx.SYSTEM_MENU|wx.CAPTION|wx.CLOSE_BOX) #style used to disable window resizing #the frame's sizer divides it into the top part, used for controls, #and the bottom one, used for the tapes and the program. self.SetSizer(wx.BoxSizer(wx.VERTICAL)) #===Top section (with controls)=== controls_panel = make_layout_panel(self, wx.HORIZONTAL) self.Sizer.Add(controls_panel, 0, wx.EXPAND) program_label = wx.StaticText(controls_panel, label="Program: ") controls_panel.Sizer.Add(program_label, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, BORDER) program_chooser = wx.Choice(controls_panel) for program in programs.plist: program_chooser.Append(program.name) controls_panel.Sizer.Add(program_chooser, 0, wx.EXPAND|wx.ALL, BORDER) speed_label = wx.StaticText(controls_panel, label="Simulation speed (steps/sec): ") controls_panel.Sizer.Add(speed_label, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, BORDER) speed_input = wx.SpinCtrl(controls_panel, min=1, initial=8, value='8', size=(60,-1)) controls_panel.Sizer.Add(speed_input, 0, wx.EXPAND|wx.ALL, BORDER) run_pause_button = wx.Button(controls_panel, label="Run") run_pause_button.Enable(False) controls_panel.Sizer.Add(run_pause_button, 0, wx.EXPAND|wx.ALL, BORDER) reset_button = wx.Button(controls_panel, label="Reset") reset_button.Enable(False) controls_panel.Sizer.Add(reset_button, 0, wx.EXPAND|wx.ALL, BORDER) #===End of top section=== #===Main section (tapes and program)=== main_panel = make_layout_panel(self, wx.HORIZONTAL) self.Sizer.Add(main_panel, 1, wx.EXPAND) #the tapes are added dinamically, so here we only define the support panel tapes_panel = make_layout_panel(main_panel, wx.VERTICAL, size=(230,-1), style=wx.BORDER_SIMPLE) main_panel.Sizer.Add(tapes_panel, 0, wx.EXPAND) program_table = wx.ListCtrl(main_panel, style=wx.LC_REPORT|wx.LC_SINGLE_SEL) program_table.InsertColumn(0, "State") program_table.InsertColumn(1, "Read") program_table.InsertColumn(2, "To Write") program_table.InsertColumn(3, "Move") program_table.InsertColumn(4, "Next State") main_panel.Sizer.Add(program_table, 1, wx.EXPAND) #===End of main section=== self.Bind(wx.EVT_CHOICE, self.change_program, program_chooser) self.Bind(wx.EVT_BUTTON, self.run_pause, run_pause_button) self.Bind(wx.EVT_BUTTON, self.reset, reset_button) #for simplicity, we defined all elements locally, without using self, #and then we export only those that are needed self.program_chooser = program_chooser self.speed_input = speed_input self.run_pause_button = run_pause_button self.reset_button = reset_button self.tapes_panel = tapes_panel self.program_table = program_table self.tape_panels = list()
def __init__(self, parent): HardwareGUIControl.__init__(self, parent) sizer = wx.BoxSizer(wx.VERTICAL) # List of positions of channels sizer.Add(wx.StaticText( self, label="Channel number with pure samples for learning"), flag=wx.LEFT, border=5) self.chanel_odd_experiment_ctrl = wx.TextCtrl(self, value="", style=wx.TE_MULTILINE | wx.EXPAND) self.chanel_odd_experiment_ctrl.__label__ = "channels" sizer.Add(self.chanel_odd_experiment_ctrl, flag=wx.EXPAND, border=5) sizer.Add(wx.StaticText(self, label="\nMax amplitude (ND filter)"), flag=wx.LEFT, border=5) max_ampl_ctrl = wxFloatSpin(self, min_val=0, max_val=1, increment=0.01, value=1., digits=3) max_ampl_ctrl.__label__ = "max_ampl" sizer.Add(max_ampl_ctrl, flag=wx.EXPAND, border=5) ################ Parameters of reference mask #################### sb_sizer = wx.StaticBoxSizer( wx.StaticBox(self, label="Reference mask parameters: "), wx.VERTICAL) # Min value of coefficient sb_sizer.Add(wx.StaticText(self, label="min coefficient"), flag=wx.LEFT, border=5) coeff_min_ctrl = wxFloatSpin(self, min_val=-10, max_val=10, increment=0.01, value=-0.9, digits=3) coeff_min_ctrl.__label__ = "coeff_min" sb_sizer.Add(coeff_min_ctrl, flag=wx.EXPAND, border=5) # Max value of coefficient sb_sizer.Add(wx.StaticText(self, label="max coefficient"), flag=wx.LEFT, border=5) coeff_max_ctrl = wxFloatSpin(self, min_val=0, max_val=10, increment=0.01, value=0.9, digits=3) coeff_max_ctrl.__label__ = "coeff_max" sb_sizer.Add(coeff_max_ctrl, flag=wx.EXPAND, border=5) # Number of coeff scans sb_sizer.Add(wx.StaticText(self, label="number of scans"), flag=wx.LEFT, border=5) coeff_num_ctrl = wx.SpinCtrl(self, value="20", min=10, max=100000) coeff_num_ctrl.__label__ = "coeff_num" sb_sizer.Add(coeff_num_ctrl, flag=wx.EXPAND, border=5) # Polynomial basis type sb_sizer.Add(wx.StaticText(self, label="\nPolynomial basis type"), flag=wx.LEFT, border=5) self.polynomial_bases = { "Chebyshev": np.polynomial.chebyshev.Chebyshev, "Legendre": np.polynomial.legendre.Legendre, "Laguerre": np.polynomial.laguerre.Laguerre, "Hermite": np.polynomial.hermite.Hermite, "Monomials": np.polynomial.polynomial.Polynomial } choices = self.polynomial_bases.keys() polynomial_bais_ctrl = wx.ComboBox(self, choices=choices, value=choices[0], style=wx.CB_READONLY) polynomial_bais_ctrl.__label__ = "polynomial_basis" sb_sizer.Add(polynomial_bais_ctrl, flag=wx.EXPAND, border=5) # Polynomial order sb_sizer.Add(wx.StaticText(self, label="\npolynomial order"), flag=wx.LEFT, border=5) poly_order_ctrl = wx.SpinCtrl(self, value="2", min=0, max=100000) poly_order_ctrl.__label__ = "polynomial_order" sb_sizer.Add(poly_order_ctrl, flag=wx.EXPAND, border=5) sizer.Add(sb_sizer, flag=wx.EXPAND, border=10) ################################################ # Scan button self.get_coeff_scan_btn = wx.Button(self) self.get_coeff_scan_btn._start_label = "Scan polynomial coefficient" self.get_coeff_scan_btn._start_method = self.DoScannning self.get_coeff_scan_btn._stop_label = "STOP scanning" self.get_coeff_scan_btn._stop_method = self.StopScannning self.get_coeff_scan_btn.SetLabel(self.get_coeff_scan_btn._start_label) self.get_coeff_scan_btn.Bind(wx.EVT_BUTTON, self.get_coeff_scan_btn._start_method) sizer.Add(self.get_coeff_scan_btn, flag=wx.EXPAND, border=5) # Separator sizer.Add(wx.StaticText(self), border=5) # Record background signal background_signal_button = wx.Button(self, label="Record background") background_signal_button.Bind(wx.EVT_BUTTON, self.RecordBackground) sizer.Add(background_signal_button, flag=wx.EXPAND, border=5) self.SetSizer(sizer) ############### GUI is created, now generate settings ###################### self.CreateSettingsDict()
def __init__(self, parent): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"pypilot Scope", pos=wx.DefaultPosition, size=wx.Size(1024, 600), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) fgSizer3 = wx.FlexGridSizer(0, 1, 0, 0) fgSizer3.AddGrowableCol(0) fgSizer3.AddGrowableRow(0) fgSizer3.SetFlexibleDirection(wx.BOTH) fgSizer3.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.m_splitter1 = wx.SplitterWindow(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.SP_3D) self.m_splitter1.Bind(wx.EVT_IDLE, self.m_splitter1OnIdle) self.m_panel2 = wx.Panel(self.m_splitter1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) fgSizer51 = wx.FlexGridSizer(0, 2, 0, 0) fgSizer51.AddGrowableCol(0) fgSizer51.AddGrowableRow(0) fgSizer51.SetFlexibleDirection(wx.BOTH) fgSizer51.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) clValuesChoices = [] self.clValues = wx.CheckListBox(self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, clValuesChoices, 0) fgSizer51.Add(self.clValues, 0, wx.ALL | wx.EXPAND, 5) self.m_panel2.SetSizer(fgSizer51) self.m_panel2.Layout() fgSizer51.Fit(self.m_panel2) self.glpanel = wx.Panel(self.m_splitter1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) fgSizer41 = wx.FlexGridSizer(0, 2, 0, 0) fgSizer41.AddGrowableCol(0) fgSizer41.AddGrowableRow(0) fgSizer41.SetFlexibleDirection(wx.BOTH) fgSizer41.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.glArea = wx.glcanvas.GLCanvas(self.glpanel) fgSizer41.Add(self.glArea, 0, wx.ALL | wx.EXPAND, 5) self.glpanel.SetSizer(fgSizer41) self.glpanel.Layout() fgSizer41.Fit(self.glpanel) self.m_splitter1.SplitVertically(self.m_panel2, self.glpanel, 250) fgSizer3.Add(self.m_splitter1, 1, wx.EXPAND, 5) fgSizer5 = wx.FlexGridSizer(1, 0, 0, 0) fgSizer5.SetFlexibleDirection(wx.BOTH) fgSizer5.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.bZero = wx.Button(self, wx.ID_ANY, u"Zero", wx.DefaultPosition, wx.DefaultSize, 0) fgSizer5.Add(self.bZero, 0, wx.ALL, 5) self.bCenter = wx.Button(self, wx.ID_ANY, u"Center", wx.DefaultPosition, wx.DefaultSize, 0) fgSizer5.Add(self.bCenter, 0, wx.ALL, 5) self.bScalePlus = wx.Button(self, wx.ID_ANY, u"Scale +", wx.DefaultPosition, wx.DefaultSize, 0) fgSizer5.Add(self.bScalePlus, 0, wx.ALL, 5) self.bScaleMinus = wx.Button(self, wx.ID_ANY, u"Scale -", wx.DefaultPosition, wx.DefaultSize, 0) fgSizer5.Add(self.bScaleMinus, 0, wx.ALL, 5) self.bOffsetPlus = wx.Button(self, wx.ID_ANY, u"Offset /\\", wx.DefaultPosition, wx.DefaultSize, 0) fgSizer5.Add(self.bOffsetPlus, 0, wx.ALL, 5) self.bOffsetMinus = wx.Button(self, wx.ID_ANY, u"Offset \\/", wx.DefaultPosition, wx.DefaultSize, 0) fgSizer5.Add(self.bOffsetMinus, 0, wx.ALL, 5) self.tbFreeze = wx.ToggleButton(self, wx.ID_ANY, u"Freeze", wx.DefaultPosition, wx.DefaultSize, 0) fgSizer5.Add(self.tbFreeze, 0, wx.ALL, 5) self.bReset = wx.Button(self, wx.ID_ANY, u"Reset", wx.DefaultPosition, wx.DefaultSize, 0) fgSizer5.Add(self.bReset, 0, wx.ALL, 5) self.cbfftw = wx.CheckBox(self, wx.ID_ANY, u"fftw", wx.DefaultPosition, wx.DefaultSize, 0) fgSizer5.Add(self.cbfftw, 0, wx.ALL, 5) self.m_staticText1 = wx.StaticText(self, wx.ID_ANY, u"Time", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText1.Wrap(-1) fgSizer5.Add(self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.sTime = wx.SpinCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(60, -1), wx.SP_ARROW_KEYS, 1, 3600, 0) fgSizer5.Add(self.sTime, 0, wx.ALL, 5) self.bClose = wx.Button(self, wx.ID_ANY, u"Close", wx.DefaultPosition, wx.DefaultSize, 0) fgSizer5.Add(self.bClose, 0, wx.ALL, 5) fgSizer3.Add(fgSizer5, 1, wx.EXPAND, 5) self.SetSizer(fgSizer3) self.Layout() self.Centre(wx.BOTH) # Connect Events self.clValues.Bind(wx.EVT_LISTBOX, self.onValueSelected) self.clValues.Bind(wx.EVT_CHECKLISTBOX, self.onValueToggled) self.glArea.Bind(wx.EVT_KEY_DOWN, self.onKeyPress) self.glArea.Bind(wx.EVT_LEFT_DOWN, self.onMouseEvents) self.glArea.Bind(wx.EVT_LEFT_UP, self.onMouseEvents) self.glArea.Bind(wx.EVT_MIDDLE_DOWN, self.onMouseEvents) self.glArea.Bind(wx.EVT_MIDDLE_UP, self.onMouseEvents) self.glArea.Bind(wx.EVT_RIGHT_DOWN, self.onMouseEvents) self.glArea.Bind(wx.EVT_RIGHT_UP, self.onMouseEvents) self.glArea.Bind(wx.EVT_MOTION, self.onMouseEvents) self.glArea.Bind(wx.EVT_LEFT_DCLICK, self.onMouseEvents) self.glArea.Bind(wx.EVT_MIDDLE_DCLICK, self.onMouseEvents) self.glArea.Bind(wx.EVT_RIGHT_DCLICK, self.onMouseEvents) self.glArea.Bind(wx.EVT_LEAVE_WINDOW, self.onMouseEvents) self.glArea.Bind(wx.EVT_ENTER_WINDOW, self.onMouseEvents) self.glArea.Bind(wx.EVT_MOUSEWHEEL, self.onMouseEvents) self.glArea.Bind(wx.EVT_PAINT, self.onPaintGL) self.glArea.Bind(wx.EVT_SIZE, self.onSizeGL) self.bZero.Bind(wx.EVT_BUTTON, self.onZero) self.bCenter.Bind(wx.EVT_BUTTON, self.onCenter) self.bScalePlus.Bind(wx.EVT_BUTTON, self.onScalePlus) self.bScaleMinus.Bind(wx.EVT_BUTTON, self.onScaleMinus) self.bOffsetPlus.Bind(wx.EVT_BUTTON, self.onOffsetPlus) self.bOffsetMinus.Bind(wx.EVT_BUTTON, self.onOffsetMinus) self.tbFreeze.Bind(wx.EVT_TOGGLEBUTTON, self.onFreeze) self.bReset.Bind(wx.EVT_BUTTON, self.onReset) self.sTime.Bind(wx.EVT_SPINCTRL, self.onTime) self.bClose.Bind(wx.EVT_BUTTON, self.onClose)
def __init__(self, parent = None, ident = -1, title = ANAGAPOS): style = wx.MINIMIZE_BOX | wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX wx.Frame.__init__(self, parent, ident, title, style = style) self.state = State() self.rule_set = None self.rule_name = None self.signature = None # Create the radio buttons to select between lambda calculus and TRS. self.radio_lambda = wx.RadioButton(self, -1, 'lambda-calculus', style = wx.RB_GROUP) self.radio_trs = wx.RadioButton(self, -1, 'TRS') self.Bind(wx.EVT_RADIOBUTTON, self.SetRadioVal, id = self.radio_lambda.GetId()) self.Bind(wx.EVT_RADIOBUTTON, self.SetRadioVal, id = self.radio_trs.GetId()) radio_box = wx.BoxSizer(wx.HORIZONTAL) radio_box.Add(self.radio_lambda, 0, wx.ALIGN_LEFT, 10) radio_box.Add(self.radio_trs, 0, wx.ALIGN_LEFT | wx.LEFT, 10) self.radio_lambda.SetValue(True) # Lambda is by default active operation.set_mode("lambda") self.radio_lambda.SetToolTip(wx.ToolTip("lambda-beta-calculus")) self.radio_trs.SetToolTip(wx.ToolTip("Opens file dialog to select TRS")) self.active_rule_file_text \ = wx.StaticText(self, -1, RULE_SET_TEXT + BETA_REDUCTION) # Sizes for the various buttons and text fields width = 200 spinner_width = 60 button_size = (width, -1) spinner_size = (spinner_width, -1) step_size = (width - spinner_width, -1) # Term text field self.term_input = wx.TextCtrl(self, 0, style = wx.TE_MULTILINE, size = (width, 100)) self.term_input.Bind(wx.EVT_TEXT, self.TextChange) # Buttons draw_button = wx.Button(self, 0, "Reset Graph", size = button_size) random_button = wx.Button(self, 0, "Random Term", size = button_size) forward_button = wx.Button(self, 0, "Forward", size = step_size) backward_button = wx.Button(self, 0, "Backward", size = step_size) self.start_checkbox = wx.CheckBox(self, -1, "Color initial term") self.new_checkbox = wx.CheckBox(self, -1, "Color latest term") # Spinners (for choosing step size) self.forward_spinner = wx.SpinCtrl(self, -1, "1", min = 1, max = 999, initial = 1, size = spinner_size) forward_box = wx.BoxSizer(wx.HORIZONTAL) forward_box.Add(forward_button, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 10) forward_box.Add(self.forward_spinner, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 10) self.backward_spinner = wx.SpinCtrl(self, -1, "1", min = 1, max = 999, initial = 1, size = spinner_size) backward_box = wx.BoxSizer(wx.HORIZONTAL) backward_box.Add(backward_button, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 10) backward_box.Add(self.backward_spinner, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 10) # Button/spinner actions draw_button.Bind(wx.EVT_BUTTON, self.ResetGraph) random_button.Bind(wx.EVT_BUTTON, self.Generate) forward_button.Bind(wx.EVT_BUTTON, self.Forward) backward_button.Bind(wx.EVT_BUTTON, self.Backward) self.start_checkbox.Bind(wx.EVT_CHECKBOX, self.StartCheck) self.new_checkbox.Bind(wx.EVT_CHECKBOX, self.NewCheck) # Status information self.disp_terms = wx.StaticText(self, -1, DISP_TERMS_TEXT + "-") self.disp_steps = wx.StaticText(self, -1, DISP_STEPS_TEXT + "-") # Layout the control panel bts = wx.BoxSizer(wx.VERTICAL) bts.Add(radio_box, 0, wx.ALIGN_LEFT | wx.ALL, 10) bts.Add(self.active_rule_file_text, 0, wx.ALIGN_LEFT | wx.LEFT, 10) bts.Add(self.term_input, 0, wx.ALIGN_CENTER | wx.ALL, 10) bts.Add(random_button, 0, wx.ALIGN_CENTER | wx.LEFT | wx.BOTTOM, 3) bts.Add(draw_button, 0, wx.ALIGN_CENTER | wx.LEFT | wx.BOTTOM, 3) bts.Add(forward_box, 0, wx.ALIGN_CENTER | wx.LEFT | wx.BOTTOM, 3) bts.Add(backward_box, 0, wx.ALIGN_CENTER | wx.LEFT | wx.BOTTOM, 3) bts.Add(self.start_checkbox, 0, wx.ALIGN_LEFT | wx.LEFT, 10) bts.Add(self.new_checkbox, 0, wx.ALIGN_LEFT | wx.LEFT | wx.BOTTOM, 10) bts.Add(self.disp_terms, 0, wx.ALIGN_LEFT | wx.LEFT | wx.BOTTOM, 10) bts.Add(self.disp_steps, 0, wx.ALIGN_LEFT | wx.LEFT | wx.BOTTOM, 10) # Layout the whole window frame box = wx.BoxSizer(wx.HORIZONTAL) box.Add(bts, 0, wx.ALIGN_TOP, 15) self.SetAutoLayout(True) self.SetSizer(box) self.Layout() self.CreateStatusBar() # Menus filemenu = wx.Menu() # Menu actions menuitem = filemenu.Append(-1, "&Open Rule Set\tCtrl+O", "Load TRS rule set") self.Bind(wx.EVT_MENU, self.OnLoadRuleSet, menuitem) filemenu.AppendSeparator() menuitem = filemenu.Append(wx.ID_ABOUT) self.Bind(wx.EVT_MENU, self.OnAbout, menuitem) menuitem = filemenu.Append(wx.ID_CLOSE) self.Bind(wx.EVT_MENU, self.OnExit, menuitem) # Menubar, containg the menu(s) created above menubar = wx.MenuBar() menubar.Append(filemenu, "&File") self.SetMenuBar(menubar) # Give window its proper size self.Fit()
def __init__(self, frame: wx.Frame, parent: wx.Notebook, tab_idx: int): super().__init__(frame, parent, tab_idx) self.convert_smooth_worker = None self.header_sizer = wx.BoxSizer(wx.VERTICAL) self.description_txt = wx.StaticText(self, wx.ID_ANY, u"指定されたVMDファイルに対して、キーを分割し、滑らかな補間曲線で繋いで、再出力します。\n" \ + "スムージング回数1回で、全打ちとなり、2回目以降はフィルタリングした後に補間曲線で繋ぎます。", wx.DefaultPosition, wx.DefaultSize, 0) self.header_sizer.Add(self.description_txt, 0, wx.ALL, 5) self.static_line01 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) self.header_sizer.Add(self.static_line01, 0, wx.EXPAND | wx.ALL, 5) # 対象VMDファイルコントロール self.smooth_vmd_file_ctrl = HistoryFilePickerCtrl(self.frame, self, u"対象モーションVMD", u"対象モーションVMDファイルを開く", ("vmd"), wx.FLP_DEFAULT_STYLE, \ u"調整したい対象モーションのVMDパスを指定してください。\nD&Dでの指定、開くボタンからの指定、履歴からの選択ができます。", \ file_model_spacer=0, title_parts_ctrl=None, title_parts2_ctrl=None, file_histories_key="smooth_vmd", is_change_output=True, \ is_aster=False, is_save=False, set_no=1) self.header_sizer.Add(self.smooth_vmd_file_ctrl.sizer, 1, wx.EXPAND, 0) # 対象PMXファイルコントロール self.smooth_model_file_ctrl = HistoryFilePickerCtrl(self.frame, self, u"適用モデルPMX", u"適用モデルPMXファイルを開く", ("pmx"), wx.FLP_DEFAULT_STYLE, \ u"モーションを適用したいモデルのPMXパスを指定してください。\n人体モデル以外にも適用可能です。\nD&Dでの指定、開くボタンからの指定、履歴からの選択ができます。", \ file_model_spacer=0, title_parts_ctrl=None, title_parts2_ctrl=None, file_histories_key="smooth_pmx", \ is_change_output=True, is_aster=False, is_save=False, set_no=1) self.header_sizer.Add(self.smooth_model_file_ctrl.sizer, 1, wx.EXPAND, 0) # 出力先VMDファイルコントロール self.output_smooth_vmd_file_ctrl = BaseFilePickerCtrl(frame, self, u"出力対象VMD", u"出力対象VMDファイルを開く", ("vmd"), wx.FLP_OVERWRITE_PROMPT | wx.FLP_SAVE | wx.FLP_USE_TEXTCTRL, \ u"調整結果の対象VMD出力パスを指定してください。\n対象VMDファイル名に基づいて自動生成されますが、任意のパスに変更することも可能です。", \ is_aster=False, is_save=True, set_no=1) self.header_sizer.Add(self.output_smooth_vmd_file_ctrl.sizer, 1, wx.EXPAND, 0) self.sizer.Add(self.header_sizer, 0, wx.EXPAND | wx.ALL, 5) self.setting_sizer = wx.BoxSizer(wx.HORIZONTAL) # 処理回数 self.loop_cnt_txt = wx.StaticText(self, wx.ID_ANY, u"処理回数", wx.DefaultPosition, wx.DefaultSize, 0) self.setting_sizer.Add(self.loop_cnt_txt, 0, wx.ALL, 5) self.loop_cnt_ctrl = wx.SpinCtrl(self, id=wx.ID_ANY, size=wx.Size(60, -1), value="2", min=1, max=99999999, initial=2) self.loop_cnt_ctrl.SetToolTip( u"スムージングを行う回数を指定してください。\n1回だと全打ちになります。\n2回目以降はフィルタをかけた上で間引きします。\n回数が増えると、変化が遅く、弱くなります。" ) self.loop_cnt_ctrl.Bind(wx.EVT_SPINCTRL, self.on_change_file) self.setting_sizer.Add(self.loop_cnt_ctrl, 0, wx.ALL, 5) # 補間 self.interpolation_txt = wx.StaticText(self, wx.ID_ANY, u"補間方法", wx.DefaultPosition, wx.DefaultSize, 0) self.setting_sizer.Add(self.interpolation_txt, 0, wx.ALL, 5) self.interpolation_ctrl = wx.Choice( self, id=wx.ID_ANY, choices=["補間曲線に従う", "補間曲線無視(円形)", "補間曲線無視(曲線)"]) self.interpolation_ctrl.SetSelection(0) self.interpolation_ctrl.SetToolTip(u"キーとキーの補間方法を指定してください。\n「補間曲線に従う」は、補間曲線に従って繋ぎます。" \ + "\n「補間曲線無視(円形)」は、補間曲線を無視して、\n3つのキーを円周上に置いた円になるように補間します。" \ + "\n「補間曲線無視(曲線)」は、補間曲線を無視して、\nキーを滑らかな曲線(カトマル曲線)で繋いで補間します。") self.interpolation_ctrl.Bind(wx.EVT_CHOICE, self.on_change_file) self.setting_sizer.Add(self.interpolation_ctrl, 0, wx.ALL, 5) self.sizer.Add(self.setting_sizer, 0, wx.EXPAND | wx.ALL, 5) btn_sizer = wx.BoxSizer(wx.HORIZONTAL) # スムージング変換実行ボタン self.smooth_btn_ctrl = wx.Button(self, wx.ID_ANY, u"スムージング実行", wx.DefaultPosition, wx.Size(200, 50), 0) self.smooth_btn_ctrl.SetToolTip(u"VMDを滑らかに繋いだモーションを再生成します。") self.smooth_btn_ctrl.Bind(wx.EVT_BUTTON, self.on_convert_smooth) btn_sizer.Add(self.smooth_btn_ctrl, 0, wx.ALL, 5) self.sizer.Add(btn_sizer, 0, wx.ALIGN_CENTER | wx.SHAPED, 5) # コンソール self.console_ctrl = ConsoleCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(-1, 420), \ wx.TE_MULTILINE | wx.TE_READONLY | wx.BORDER_NONE | wx.HSCROLL | wx.VSCROLL | wx.WANTS_CHARS) self.console_ctrl.SetBackgroundColour( wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DLIGHT)) self.console_ctrl.Bind( wx.EVT_CHAR, lambda event: MFormUtils.on_select_all(event, self.console_ctrl)) self.sizer.Add(self.console_ctrl, 1, wx.ALL | wx.EXPAND, 5) # ゲージ self.gauge_ctrl = wx.Gauge(self, wx.ID_ANY, 100, wx.DefaultPosition, wx.DefaultSize, wx.GA_HORIZONTAL) self.gauge_ctrl.SetValue(0) self.sizer.Add(self.gauge_ctrl, 0, wx.ALL | wx.EXPAND, 5) self.Layout() self.fit() # フレームに変換完了処理バインド self.frame.Bind(EVT_SMOOTH_THREAD, self.on_convert_smooth_result)