def init_toolbar(self): """Initialize and populate toolbar. Icons taken from https://material.io/resources/icons/?style=baseline. """ # add port, baud comboboxes self.AddControl( wx.StaticText(self, wx.ID_ANY, 'Port', style=wx.ALIGN_LEFT)) self.port_cb = wx.ComboBox(self, wx.ID_ANY, choices=[], style=wx.CB_READONLY, size=(75, -1)) self.Bind(wx.EVT_COMBOBOX, self.on_select_port, self.AddControl(self.port_cb, label='Port combobox')) self.AddSpacer(10) self.AddControl( wx.StaticText(self, wx.ID_ANY, 'Baud', style=wx.ALIGN_LEFT)) self.baud_cb = wx.ComboBox(self, wx.ID_ANY, choices=[], style=wx.CB_READONLY, size=(75, -1)) self.Bind(wx.EVT_COMBOBOX, self.on_select_baud, self.AddControl(self.baud_cb, label='Baud combobox')) self.AddSpacer(10) self.Bind( wx.EVT_BUTTON, self.on_connect, self.AddControl( wx.Button(self, wx.ID_ANY, label='Connect', size=(75, -1)))) self.AddSeparator() # add play, pause, stop tools _bmp = create_scaled_bitmap('play_arrow', 24) self.AddTool(ToolIds.PLAY.value, 'Play', _bmp, _bmp, aui.ITEM_NORMAL, short_help_string='Play simulation') _bmp = create_scaled_bitmap('pause', 24) self.AddTool(ToolIds.PAUSE.value, 'Pause', _bmp, _bmp, aui.ITEM_NORMAL, short_help_string='Pause simulation') _bmp = create_scaled_bitmap('stop', 24) self.AddTool(ToolIds.STOP.value, 'Stop', _bmp, _bmp, aui.ITEM_NORMAL, short_help_string='Stop and reset simulation') self.AddSeparator() # add settings tool _bmp = create_scaled_bitmap('settings', 24) self.AddTool(ToolIds.SETTINGS.value, 'Settings', _bmp, _bmp, aui.ITEM_NORMAL, short_help_string='Edit simulation settings')
def __init__(self, *args, **kwargs): wx.Frame.__init__(self, *args, **kwargs) ## Creating Menubar menubar = wx.MenuBar() filemenu = wx.Menu() file1 = filemenu.Append(wx.ID_NEW, 'New', 'New File') file2 = filemenu.Append(wx.ID_OPEN, 'Open', 'Open File') edit_submenu = wx.Menu() edit_submenu.Append(wx.ID_ANY, 'Select') edit_submenu.Append(wx.ID_ANY, 'Copy') edit_submenu.Append(wx.ID_ANY, 'Paste') filemenu.Append(wx.ID_EDIT, '&Edit', edit_submenu) file4 = filemenu.Append(wx.ID_SAVE, 'Save', 'Save File') file5 = filemenu.Append(wx.ID_SAVEAS, 'Save As', 'Save As File') file6 = filemenu.Append(wx.ID_CLOSE, 'Close', 'Close File') menubar.Append(filemenu, '&File') network_menu = wx.Menu() net1 = network_menu.Append(wx.ID_NETWORK, 'net1', 'Network1') net2 = network_menu.Append(wx.ID_PREVIEW, 'net2', 'Network2') net3 = network_menu.Append(wx.ID_SELECT_COLOR, 'net3', 'Network3') menubar.Append(network_menu, '&Network') netisch_menu = wx.Menu() netisch1 = netisch_menu.Append(wx.ID_VIEW_DETAILS, 'view', 'View NeTisch') netisch2 = netisch_menu.Append(wx.ID_VIEW_LIST, 'netisch2', 'List NeTisch') menubar.Append(netisch_menu, '&NeTisch') help_menu = wx.Menu() aboutmenu = help_menu.Append(wx.ID_ABOUT, 'About NeTisch', 'About NeTisch') menubar.Append(help_menu, '&Help') self.SetMenuBar(menubar) self.SetSize(900, 900) self.Centre() ## Creating Iconbar toolbar1 = self.CreateToolBar() toolbar1.AddTool(wx.ID_OPEN, 'Open/Load', wx.Bitmap('open.png')) toolbar1.AddTool(wx.ID_PREVIEW, 'Run', wx.Bitmap('play.png')) toolbar1.AddTool(wx.ID_VIEW_DETAILS, 'ViewCQ', wx.Bitmap('viewcq.png')) toolbar1.AddTool(wx.ID_VIEW_LARGEICONS, 'ViewOpt-top', wx.Bitmap('viewopttop.png')) toolbar1.AddTool(wx.ID_VIEW_SMALLICONS, 'VisSchedule', wx.Bitmap('visschedule.png')) toolbar1.EnableTool(wx.ID_REDO, False) toolbar1.AddSeparator() toolbar1.Realize() self.splitter_window = wx.SplitterWindow(self, id=wx.ID_ANY, style=wx.SP_3D) self.nav_canvas = FloatCanvas.FloatCanvas(self.splitter_window, size=(600, 600), BackgroundColor="IVORY") self.nav_canvas.InitAll() self.properties_panel = wx.Panel(self.splitter_window, id=wx.ID_ANY) self.splitter_window.SplitVertically(self.nav_canvas, self.properties_panel) self.CreateStatusBar() self.nav_canvas.Draw() # Creating Panel-Network Design attributes sizer = wx.GridBagSizer() text1 = wx.StaticText(self.properties_panel, -1, label="Network Design ::") sizer.Add(text1, pos=(0, 0), flag=wx.LEFT | wx.TOP, border=10) line = wx.StaticLine(self.properties_panel) sizer.Add(line, pos=(1, 0), span=(1, 12), flag=wx.EXPAND | wx.BOTTOM, border=10) text2 = wx.StaticText(self.properties_panel, -1, "Load:") sizer.Add(text2, pos=(2, 0), flag=wx.LEFT | wx.TOP, border=10) path = wx.TextCtrl(self.properties_panel, -1, style=wx.ALIGN_LEFT) sizer.Add(path, pos=(2, 1), span=(1, 7), flag=wx.EXPAND | wx.LEFT, border=5) button1 = wx.Button(self.properties_panel, label="Browse...") sizer.Add(button1, pos=(2, 9), flag=wx.TOP | wx.RIGHT, border=5) self.Bind(wx.EVT_BUTTON, self.OnClickBrowse, button1) line1 = wx.StaticLine(self.properties_panel) sizer.Add(line1, pos=(4, 0), span=(1, 12), flag=wx.EXPAND | wx.BOTTOM, border=10) staticbox = wx.StaticBox(self.properties_panel, label="Gen C.Q:") staticboxsizer = wx.StaticBoxSizer(staticbox, wx.VERTICAL) combo1 = wx.ComboBox(self.properties_panel, -1, "Select: ", pos=(7, 0), size=(150, 30), choices=drop1, style=wx.CB_DROPDOWN) staticboxsizer.Add(combo1, 0, wx.ALL | wx.LEFT, 10) sizer.Add(staticboxsizer, pos=(6, 0), span=(1, 12), flag=wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, border=10) sbox = wx.StaticBox(self.properties_panel, label="Optimize:") sboxsizer = wx.StaticBoxSizer(sbox, wx.VERTICAL) combo2 = wx.ComboBox(self.properties_panel, -1, "Select: ", pos=(11, 0), size=(150, 30), choices=drop2, style=wx.CB_DROPDOWN) sboxsizer.Add(combo2, 0, wx.ALL | wx.LEFT, 10) sizer.Add(sboxsizer, pos=(10, 0), span=(1, 12), flag=wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, border=10) sb = wx.StaticBox(self.properties_panel, label="Schedule:") sbsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) combo4 = wx.ComboBox(self.properties_panel, -1, "Select: ", pos=(15, 0), size=(150, 30), choices=drop3, style=wx.CB_DROPDOWN) sbsizer.Add(combo4, 0, wx.ALL | wx.LEFT, 10) sizer.Add(sbsizer, pos=(14, 0), span=(1, 12), flag=wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, border=10) self.properties_panel.SetSizerAndFit(sizer) self.Show(True) ## self.panel_list.Bind(wx.EVT_LISTBOX, self.OnListBox) self.nav_canvas.Bind(FloatCanvas.EVT_LEFT_DOWN, self.OnLeftDown)
def __init__(self, parent, level_view_ref): super(HeaderEditor, self).__init__(parent, title="Level Header Editor") self.level_view_ref = level_view_ref self.level_ref: Level = self.level_view_ref.level self.SetId(ID_HEADER_EDITOR) self.config_sizer = wx.FlexGridSizer(2, 0, 0) self.config_sizer.AddGrowableCol(0, 1) self.config_sizer.AddGrowableCol(1, 2) self.length_dropdown = wx.ComboBox(self, wx.ID_ANY, choices=STR_LEVEL_LENGTHS) self.music_dropdown = wx.ComboBox(self, wx.ID_ANY, choices=MUSIC_ITEMS) self.time_dropdown = wx.ComboBox(self, wx.ID_ANY, choices=TIMES) self.v_scroll_direction_dropdown = wx.ComboBox( self, wx.ID_ANY, choices=SCROLL_DIRECTIONS ) self.level_is_vertical_cb = wx.CheckBox(self) self.pipe_ends_level_cb = wx.CheckBox(self) self.x_position_dropdown = wx.ComboBox(self, wx.ID_ANY, choices=STR_X_POSITIONS) self.y_position_dropdown = wx.ComboBox(self, wx.ID_ANY, choices=STR_Y_POSITIONS) self.action_dropdown = wx.ComboBox(self, wx.ID_ANY, choices=ACTIONS) self.object_palette_spinner = wx.SpinCtrl(self, wx.ID_ANY, max=7) self.enemy_palette_spinner = wx.SpinCtrl(self, wx.ID_ANY, max=3) self.graphic_set_dropdown = wx.ComboBox(self, wx.ID_ANY, choices=GRAPHIC_SETS) self.level_pointer_spinner = wx.SpinCtrl(self, min=0, max=SPINNER_MAX_VALUE) self.level_pointer_spinner.SetBase(16) self.enemy_pointer_spinner = wx.SpinCtrl(self, min=0, max=SPINNER_MAX_VALUE) self.enemy_pointer_spinner.SetBase(16) self.next_area_object_set_dropdown = wx.ComboBox( self, wx.ID_ANY, choices=OBJECT_SET_ITEMS ) self._add_label("Level Settings") self._add_widget(" Level length: ", self.length_dropdown) self._add_widget(" Music: ", self.music_dropdown) self._add_widget(" Time: ", self.time_dropdown) self._add_widget(" Scroll direction: ", self.v_scroll_direction_dropdown) self._add_widget(" Is Vertical: ", self.level_is_vertical_cb) self._add_widget(" Pipe ends level: ", self.pipe_ends_level_cb) self._add_label("Player Settings") self._add_widget(" Starting X: ", self.x_position_dropdown) self._add_widget(" Starting Y: ", self.y_position_dropdown) self._add_widget(" Action: ", self.action_dropdown) self._add_label("Graphical Settings") self._add_widget(" Object Palette: ", self.object_palette_spinner) self._add_widget(" Enemy Palette: ", self.enemy_palette_spinner) self._add_widget(" Graphic Set: ", self.graphic_set_dropdown) self._add_label("Next Area") self._add_widget(" Address of Objects: ", self.level_pointer_spinner) self._add_widget(" Address of Enemies: ", self.enemy_pointer_spinner) self._add_widget(" Object Set: ", self.next_area_object_set_dropdown) self.SetSizerAndFit(self.config_sizer) self._fill_widgets() self.Bind(wx.EVT_SPINCTRL, self.on_spin) self.Bind(wx.EVT_COMBOBOX, self.on_combo) self.Bind(wx.EVT_CHECKBOX, self.on_check_box) self.Bind(wx.EVT_CLOSE, self.on_exit)
def __init__(self, parent, gui_size, cfg): """Constructor""" wx.Panel.__init__(self, parent=parent) # variable initilization self.filelist = [] self.config = cfg self.bodyparts = [] self.draw = False self.slow = False # design the panel self.sizer = wx.GridBagSizer(5, 5) text = wx.StaticText(self, label="DeepLabCut - Create Labeled Videos") self.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_PATH)) self.sizer.Add(icon, pos=(0, 4), flag=wx.TOP | wx.RIGHT | wx.ALIGN_RIGHT, border=5) line1 = wx.StaticLine(self) 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") self.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.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.vids = wx.StaticText(self, label="Choose the videos") self.sizer.Add(self.vids, pos=(3, 0), flag=wx.TOP | wx.LEFT, border=10) self.sel_vids = wx.Button(self, label="Select videos") self.sizer.Add(self.sel_vids, pos=(3, 1), flag=wx.TOP | wx.EXPAND, border=10) self.sel_vids.Bind(wx.EVT_BUTTON, self.select_videos) sb = wx.StaticBox(self, label="Additional Attributes") boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) hbox1 = wx.BoxSizer(wx.HORIZONTAL) hbox2 = wx.BoxSizer(wx.HORIZONTAL) hbox3 = wx.BoxSizer(wx.HORIZONTAL) hbox4 = 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, 1) 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, 1) 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, 1) hbox1.Add(videotype_text_boxsizer, 1, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) hbox1.Add(shuffle_boxsizer, 1, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) hbox1.Add(trainingset_boxsizer, 1, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) boxsizer.Add(hbox1, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) self.sizer.Add( boxsizer, pos=(4, 0), span=(1, 5), flag=wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, border=5, ) self.cfg = auxiliaryfunctions.read_config(self.config) if self.cfg.get("multianimalproject", False): self.plot_idv = wx.RadioBox( self, label="Create video with animal ID colored?", choices=["Yes", "No"], majorDimension=1, style=wx.RA_SPECIFY_COLS, ) self.plot_idv.SetSelection(1) hbox3.Add(self.plot_idv, 3, wx.EXPAND | wx.TOP | wx.BOTTOM, 3) self.draw_skeleton = wx.RadioBox( self, label="Include the skeleton in the video?", choices=["Yes", "No"], majorDimension=1, style=wx.RA_SPECIFY_COLS, ) self.draw_skeleton.Bind(wx.EVT_RADIOBOX, self.choose_draw_skeleton_options) self.draw_skeleton.SetSelection(1) self.filter = wx.RadioBox( self, label="Use filtered predictions?", choices=["Yes", "No"], majorDimension=1, style=wx.RA_SPECIFY_COLS, ) self.filter.SetSelection(1) self.video_slow = wx.RadioBox( self, label="Create a higher quality video? (slow)", choices=["Yes", "No"], majorDimension=1, style=wx.RA_SPECIFY_COLS, ) self.video_slow.Bind(wx.EVT_RADIOBOX, self.choose_video_slow_options) self.video_slow.SetSelection(1) self.trail_points_text = wx.StaticBox( self, label="Specify the number of trail points") trail_pointsboxsizer = wx.StaticBoxSizer(self.trail_points_text, wx.VERTICAL) self.trail_points = wx.SpinCtrl(self, value="0") trail_pointsboxsizer.Add(self.trail_points, 3, wx.EXPAND | wx.TOP | wx.BOTTOM, 3) self.bodypart_choice = wx.RadioBox( self, label="Plot all bodyparts?", choices=["Yes", "No"], majorDimension=1, style=wx.RA_SPECIFY_COLS, ) self.bodypart_choice.Bind(wx.EVT_RADIOBOX, self.chooseOption) config_file = auxiliaryfunctions.read_config(self.config) if config_file.get("multianimalproject", False): bodyparts = config_file["multianimalbodyparts"] else: bodyparts = config_file["bodyparts"] self.bodyparts_to_compare = wx.CheckListBox( self, choices=bodyparts, style=0, name="Select the bodyparts") self.bodyparts_to_compare.Bind(wx.EVT_CHECKLISTBOX, self.getbp) self.bodyparts_to_compare.Hide() hbox2.Add(self.draw_skeleton, 3, wx.EXPAND | wx.TOP | wx.BOTTOM, 3) hbox2.Add(trail_pointsboxsizer, 3, wx.EXPAND | wx.TOP | wx.BOTTOM, 3) hbox2.Add(self.video_slow, 3, wx.EXPAND | wx.TOP | wx.BOTTOM, 3) boxsizer.Add(hbox2, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 10) hbox3.Add(self.filter, 3, wx.EXPAND | wx.TOP | wx.BOTTOM, 3) hbox4.Add(self.bodypart_choice, 3, wx.EXPAND | wx.TOP | wx.BOTTOM, 3) hbox4.Add(self.bodyparts_to_compare, 3, wx.EXPAND | wx.TOP | wx.BOTTOM, 3) if self.cfg.get("multianimalproject", False): tracker_text = wx.StaticBox(self, label="Specify the Tracker Method!") tracker_text_boxsizer = wx.StaticBoxSizer(tracker_text, wx.VERTICAL) trackertypes = ["skeleton", "box", "ellipse"] self.trackertypes = wx.ComboBox(self, choices=trackertypes, style=wx.CB_READONLY) self.trackertypes.SetValue("ellipse") tracker_text_boxsizer.Add(self.trackertypes, 1, wx.EXPAND | wx.TOP | wx.BOTTOM, 10) self.trajectory = wx.RadioBox( self, label="Want to plot the trajectories?", choices=["Yes", "No"], majorDimension=1, style=wx.RA_SPECIFY_COLS, ) hbox4.Add(self.trajectory, 5, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) hbox4.Add(tracker_text_boxsizer, 5, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) boxsizer.Add(hbox3, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 10) boxsizer.Add(hbox4, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 10) self.help_button = wx.Button(self, label="Help") self.sizer.Add(self.help_button, pos=(5, 0), flag=wx.LEFT, border=10) self.help_button.Bind(wx.EVT_BUTTON, self.help_function) self.ok = wx.Button(self, label="RUN") self.sizer.Add(self.ok, pos=(5, 4)) self.ok.Bind(wx.EVT_BUTTON, self.create_videos) self.reset = wx.Button(self, label="Reset") self.sizer.Add(self.reset, pos=(5, 1), span=(1, 1), flag=wx.BOTTOM | wx.RIGHT, border=10) self.reset.Bind(wx.EVT_BUTTON, self.reset_create_videos) self.sizer.AddGrowableCol(3) self.SetSizer(self.sizer) self.sizer.Fit(self)
def MyPanel4(self): #wx.Panel.MyPanel21 ( self, id = -1, pos = wx.DefaultPosition, size = wx.Size( 500,300 ), style = wx.TAB_TRAVERSAL ) self.mypanel4_panel = wx.Panel(self, pos=(0, 0), size=(500, 400)) self.panelNum = 5 font1 = wx.Font(16, wx.DEFAULT, wx.NORMAL, wx.LIGHT) font2 = wx.Font(16, wx.ROMAN, wx.ITALIC, wx.LIGHT) font3 = wx.Font(12, wx.ROMAN, wx.ITALIC, wx.LIGHT) bSizer5 = wx.BoxSizer(wx.VERTICAL) self.panel4_la = wx.StaticText(self, wx.ID_ANY, u" Please choose the picture", pos=(100, 100), size=(50, 50)) self.panel4_la.SetFont(font2) self.panel4_la.SetForegroundColour("#F7F7F7") bSizer5.Add(self.panel4_la, 0, wx.ALL | wx.EXPAND, 5) gSizer6 = wx.GridSizer(1, 2, 0, 0) self.de_la = wx.StaticText(self, wx.ID_ANY, u" 请选择图片文件:", pos=(0, 0), size=(250, 100)) self.de_la.SetFont(font3) self.de_la.SetForegroundColour("#F7F7F7") self.de_la.Wrap(-1) gSizer6.Add(self.de_la, 0, wx.ALL, 5) m_comboBox2Choices = [ u"2px_黑体", u"2px_宋体", u"醉翁亭记", u"小石潭记", u"放鹤亭记", u"石钟山记", u"口技", u"前赤壁赋", u"岳阳楼记", u"核舟记" ] self.m_comboBox2 = wx.ComboBox(self, -1, u"请选择文件", wx.DefaultPosition, wx.DefaultSize, m_comboBox2Choices, 0) gSizer6.Add(self.m_comboBox2, 0, wx.ALL, 5) bSizer5.Add(gSizer6, 1, wx.EXPAND, 5) self.out_la = wx.StaticText(self, -1, u" 正在解密中......", pos=(100, 100), size=(300, 20)) self.out_la.SetFont(font3) #self.out_la.SetForegroundColour("#F7F7F7") self.out_la.Wrap(-1) bSizer5.Add(self.out_la, 0, wx.ALL, 5) gSizer7 = wx.GridSizer(1, 2, 0, 0) self.button7 = wx.Button(self, -1, u"<-返回", wx.DefaultPosition, wx.DefaultSize, 0) gSizer7.Add(self.button7, 0, wx.ALL | wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT, 5) self.button8 = wx.Button(self, -1, u"提取", wx.DefaultPosition, wx.DefaultSize, 0) gSizer7.Add(self.button8, 0, wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT | wx.ALL, 5) bSizer5.Add(gSizer7, 1, wx.EXPAND, 5) self.SetSizer(bSizer5) self.Layout() #绑定事件 self.mypanel4_panel.Bind(wx.EVT_ERASE_BACKGROUND, self.login_background) self.m_comboBox2.Bind(wx.EVT_COMBOBOX, self.OnCombo1) self.button7.Bind(wx.EVT_BUTTON, self.back_click) self.button8.Bind(wx.EVT_BUTTON, self.click_sure)
def __init__(self, parent): wx.Dialog.__init__(self, parent, wx.ID_ANY, name='update_event') #set some frame properties self.Bind(wx.EVT_CLOSE, self.OnExit) self.SetIcon(wx.Icon(wx.GetApp().engine.icon, wx.BITMAP_TYPE_ICO)) p = wx.Panel(self) #widgets self.stSupplier = wx.StaticText(p, wx.ID_ANY, 'Company') self.cbSuppliers = wx.ComboBox(p, ID_SUPPLIERS, size=(wx.GetApp().engine.get_font() * 20, -1), style=wx.CB_READONLY) self.cbSuppliers.SetToolTipString('Select a supplier.') self.stCategory = wx.StaticText(p, wx.ID_ANY, 'Category') self.cbCategories = wx.ComboBox(p, ID_CATEGORIES, size=(wx.GetApp().engine.get_font() * 20, -1), style=wx.CB_READONLY) self.cbCategories.SetToolTipString('Select a category.') self.stReference = wx.StaticText(p, wx.ID_ANY, 'Reference') self.txReference = wx.TextCtrl(p, wx.ID_ANY, 'No', size=(wx.GetApp().engine.get_font() * 20, -1)) self.txReference.SetMaxLength(30) message = 'Insert reference.\nMax 30 chars.' self.txReference.SetToolTipString(message) #to fix...in debian 8 jessie i get an error with wx.Color call try: self.txReference.SetForegroundColour(wx.Color(255, 0, 0)) except: pass self.stDescription = wx.StaticText(p, wx.ID_ANY, 'Description') self.txDescription = wx.TextCtrl(p, wx.ID_ANY, 'No', size=(wx.GetApp().engine.get_font() * 20, -1)) self.stBill = wx.StaticText(p, wx.ID_ANY, 'Bill') self.txBill = masked.NumCtrl(p, wx.ID_ANY, integerWidth=4, fractionWidth=2, size=(wx.GetApp().engine.get_font() * 12, -1)) self.txBill.SetToolTipString('Price.') self.stIssued = wx.StaticText(p, wx.ID_ANY, "Issued") self.dpcIssued = wx.DatePickerCtrl( p, size=(wx.GetApp().engine.get_font() * 12, -1), style=wx.DP_DROPDOWN | wx.DP_SHOWCENTURY) self.dpcIssued.SetToolTipString('Issued date!') self.stExpiration = wx.StaticText(p, -1, "Expiration") self.dpcExpiration = wx.DatePickerCtrl( p, wx.ID_ANY, size=(wx.GetApp().engine.get_font() * 12, -1), style=wx.DP_DROPDOWN | wx.DP_SHOWCENTURY) self.dpcExpiration.SetToolTipString('Expiration date!') self.stFlow = wx.StaticText(p, wx.ID_ANY, 'Flow') self.ckFlow = wx.CheckBox(p, wx.ID_ANY) self.ckFlow.SetToolTipString('Select = In\nDeselect = Out') self.stSettled = wx.StaticText(p, wx.ID_ANY, 'Settled') self.ckSettled = wx.CheckBox(p, wx.ID_ANY) self.ckSettled.SetToolTipString( 'Select = settled\nDeselect = unsettle') self.stEnable = wx.StaticText(p, wx.ID_ANY, 'Enable') self.ckEnable = wx.CheckBox(p, wx.ID_ANY) sbb = wx.StaticBox(p, wx.ID_ANY, "") bts = [ (wx.ID_SAVE, '&Save', 'save data!'), (wx.ID_CLOSE, '&Close', 'close frame'), ] for (id, label, help_text) in bts: b = wx.Button( p, id, label, ) b.SetToolTipString(help_text) b.Bind(wx.EVT_BUTTON, self.OnClick) #sizers s0 = wx.BoxSizer(wx.HORIZONTAL) s1 = wx.FlexGridSizer(cols=2, hgap=5, vgap=5) s2 = wx.StaticBoxSizer(sbb, wx.VERTICAL) w = ( self.stSupplier, self.cbSuppliers, self.stCategory, self.cbCategories, self.stReference, self.txReference, self.stDescription, self.txDescription, self.stBill, self.txBill, self.stIssued, self.dpcIssued, self.stExpiration, self.dpcExpiration, self.stFlow, self.ckFlow, self.stSettled, self.ckSettled, self.stEnable, self.ckEnable, ) for i in w: s1.Add(i, 0, wx.ALL, 1) for i in p.GetChildren(): if type(i) in (wx.Button, ): s2.Add(i, 0, wx.EXPAND | wx.ALL, 5) w = (s1, s2) for i in w: s0.Add(i, 0, wx.ALL, 10) p.SetSizer(s0) s0.Fit(self) s0.SetSizeHints(self)
def __init__(self, parent): wx.Panel.__init__(self, parent) self.boldFont = wx.Font(18, wx.DEFAULT, wx.BOLD, wx.NORMAL) #Identifiers self.nameTitle = wx.StaticText(self, label="Name", pos=(20, 30)) self.matchNumTitle = wx.StaticText(self, label="Match #", pos=(20, 50)) self.teamNumTitle = wx.StaticText(self, label="Team #", pos=(230, 50)) self.nameInput = wx.TextCtrl(self, pos=(120, 30), size=(100, 20)) self.matchNumInput = wx.TextCtrl(self, pos=(120, 50), size=(100, 20)) self.teamNumInput = wx.ComboBox(self, pos=(290, 50), size=(100, 25), style=wx.CB_READONLY) self.label = wx.StaticText(self, label="Dead robot / no show?", pos=(230, 30)) self.deadRobot = wx.CheckBox(self, pos=(380, 30)) #Autons self.autonTitle = wx.StaticText(self, label="Auton", pos=(20, 100)) self.autonTitle.SetFont(self.boldFont) self.baselineTitle = wx.StaticText(self, label="Baseline", pos=(20, 120)) self.baselineInput = wx.CheckBox(self, pos=(100, 120)) self.autonSwitchTitle = wx.StaticText(self, label="SWITCH Cubes", pos=(20, 140)) self.autonSwitchInput = wx.TextCtrl(self, pos=(220, 140), size=(30, 20)) self.autonSwitchInput.AppendText("0") self.autonSwitchInputUp = wx.Button(self, label="+", pos=(270, 137.5), size=(25, 25), name="autonSwitchInputUp") self.autonSwitchInputDown = wx.Button(self, label="-", pos=(300, 137.5), size=(25, 25), name="autonSwitchInputDown") self.autonSwitchColor = wx.RadioBox(self, pos=(680, 130), choices=["Yes", "No", "9"]) self.label = wx.StaticText(self, label="CORRECT COLORED SIDE of the SWITCH?", pos=(410, 140)) self.autonSwitchColor.ShowItem(2, False) self.autonSwitchColor.SetSelection(2) self.autonSwitchColor.Enable(False) self.autonScaleTitle = wx.StaticText(self, label="SCALE Cubes", pos=(20, 160)) self.autonScaleInput = wx.TextCtrl(self, pos=(220, 160), size=(30, 20)) self.autonScaleInput.AppendText("0") self.autonScaleInputUp = wx.Button(self, label="+", pos=(270, 157.5), size=(25, 25), name="autonScaleInputUp") self.autonScaleInputDown = wx.Button(self, label="-", pos=(300, 157.5), size=(25, 25), name="autonScaleInputDown") self.label = wx.StaticText(self, label="CORRECT COLORED SIDE of the SCALE?", pos=(410, 160)) self.autonScaleColor = wx.RadioBox(self, pos=(680, 155), choices=["Yes", "No", "9"]) self.autonScaleColor.ShowItem(2, False) self.autonScaleColor.SetSelection(2) self.autonScaleColor.Enable(False) self.autonPlatformTitle = wx.StaticText(self, label="PLATFORM Zone Cubes", pos=(20, 220)) self.autonPlatformInput = wx.TextCtrl(self, pos=(220, 220), size=(30, 20)) self.autonPlatformInput.AppendText("0") self.autonPlatformInputUp = wx.Button(self, label="+", pos=(270, 217.5), size=(25, 25), name="autonPlatformInputUp") self.autonPlatformInputDown = wx.Button(self, label="-", pos=(300, 217.5), size=(25, 25), name="autonPlatformInputDown") self.autonPowerCubeTitle = wx.StaticText(self, label="POWER CUBE Zone Cubes", pos=(20, 200)) self.autonPowerCubeInput = wx.TextCtrl(self, pos=(220, 200), size=(30, 20)) self.autonPowerCubeInput.AppendText("0") self.autonPowerCubeInputUp = wx.Button(self, label="+", pos=(270, 197.5), size=(25, 25), name="autonPowerCubeInputUp") self.autonPowerCubeInputDown = wx.Button( self, label="-", pos=(300, 197.5), size=(25, 25), name="autonPowerCubeInputDown") self.autonExchangeTitle = wx.StaticText(self, label="EXCHANGE Cubes", pos=(20, 180)) self.autonExchangeInput = wx.TextCtrl(self, pos=(220, 180), size=(30, 20)) self.autonExchangeInput.AppendText("0") self.autonExchangeInputUp = wx.Button(self, label="+", pos=(270, 177.5), size=(25, 25), name="autonExchangeInputUp") self.autonExchangeInputDown = wx.Button(self, label="-", pos=(300, 177.5), size=(25, 25), name="autonExchangeInputDown") self.title = wx.StaticText(self, label="ROBOT STARTING FIELD POSITION?", pos=(430, 35)) self.robotPosition = wx.RadioBox( self, pos=(420, 30), majorDimension=2, choices=[ "9", "9", "Red far ", "Blue far", "Red mid", "Blue mid", "Red near", "Blue near" ], style=wx.RA_SPECIFY_COLS) self.robotPosition.ShowItem(0, False) self.robotPosition.ShowItem(1, False) self.robotPosition.SetSelection(0) self.switchlabel = wx.StaticText(self, label="Switch Alliance sides", pos=(700, 60)) self.switchlabel.Wrap(80) # self.switchlabel.Show(False) self.redRight = wx.CheckBox(self, pos=(740, 95)) # self.redRight.Show(False) # img = wx.EmptyImage(200,200) # self.imageCtrl = wx.StaticBitmap(self, (690,120), wx.ID_ANY, wx.BitmapFromImage(img)) png = wx.Image(myPath + "/FieldPic.png", wx.BITMAP_TYPE_ANY).ConvertToBitmap() png.SetSize((170, 170)) wx.StaticBitmap(self, -1, png, (430, 200), ((png.GetWidth()), (png.GetHeight()))) self.question = wx.StaticText( self, label="Where was the robot when it was placing the cube?", pos=(420, 190)) self.plat = wx.CheckBox(self, pos=(540, 290)) self.null = wx.CheckBox(self, pos=(575, 315)) #TeleOp self.teleOpTitle = wx.StaticText(self, label="TeleOperation", pos=(20, 270)) self.teleOpTitle.SetFont(self.boldFont) self.teleOpSwitchTitle = wx.StaticText(self, label="SWITCH Cubes", pos=(20, 290)) self.teleOpSwitchInput = wx.TextCtrl(self, pos=(220, 290), size=(30, 20)) self.teleOpSwitchInput.AppendText("0") self.teleOpSwitchInputUp = wx.Button(self, label="+", pos=(270, 287.5), size=(25, 25), name="teleOpSwitchInputUp") self.teleOpSwitchInputDown = wx.Button(self, label="-", pos=(300, 287.5), size=(25, 25), name="teleOpSwitchInputDown") self.teleOpScaleTitle = wx.StaticText(self, label="SCALE Cubes", pos=(20, 310)) self.teleOpScaleInput = wx.TextCtrl(self, pos=(220, 310), size=(30, 20)) self.teleOpScaleInput.AppendText("0") self.teleOpScaleInputUp = wx.Button(self, label="+", pos=(270, 307.5), size=(25, 25), name="teleOpScaleInputUp") self.teleOpScaleInputDown = wx.Button(self, label="-", pos=(300, 307.5), size=(25, 25), name="teleOpScaleInputDown") self.teleOpExchangeTitle = wx.StaticText(self, label="EXCHANGE Cubes", pos=(20, 330)) self.teleOpExchangeInput = wx.TextCtrl(self, pos=(220, 330), size=(30, 20)) self.teleOpExchangeInput.AppendText("0") self.teleOpExchangeInputUp = wx.Button(self, label="+", pos=(270, 327.5), size=(25, 25), name="teleOpExchangeInputUp") self.teleOpExchangeInputDown = wx.Button( self, label="-", pos=(300, 327.5), size=(25, 25), name="teleOpExchangeInputDown") self.teleOpOppoSwitchTitle = wx.StaticText( self, label="Cubes on OPPONENT's Switch", pos=(20, 350)) # self.teleOpExchangeTitle.Wrap(200) self.teleOpOppoSwitchInput = wx.TextCtrl(self, pos=(220, 350), size=(30, 20)) self.teleOpOppoSwitchInput.AppendText("0") self.teleOpOppoSwitchInputUp = wx.Button( self, label="+", pos=(270, 347.5), size=(25, 25), name="teleOpOppoSwitchInputUp") self.teleOpOppoSwitchInputDown = wx.Button( self, label="-", pos=(300, 347.5), size=(25, 25), name="teleOpOppoSwitchInputDown") # self.teleOpFromExchangeTitle = wx.StaticText(self, label="Cubes acquired from the Exchange", pos=(350, 290)) # self.teleOpFromExchangeInput = wx.TextCtrl(self, pos=(640, 290), size=(30,20)) # self.teleOpFromExchangeInput.AppendText("0") # self.teleOpFromExchangeInputUp = wx.Button(self, label="+", pos=(690, 287.5), size=(25,25), name="teleOpFromExchangeInputUp") # self.teleOpFromExchangeInputDown = wx.Button(self, label="-", pos=(720, 287.5), size=(25,25), name="teleOpFromExchangeInputDown") # # self.teleOpFromPlatformTitle = wx.StaticText(self, label="Cubes acquired from the Platform Zone", pos=(350, 310)) # self.teleOpFromPlatformInput = wx.TextCtrl(self, pos=(640, 310), size=(30,20)) # self.teleOpFromPlatformInput.AppendText("0") # self.teleOpFromPlatformInputUp = wx.Button(self, label="+", pos=(690, 307.5), size=(25,25), name="teleOpFromPlatformInputUp") # self.teleOpFromPlatformInputDown = wx.Button(self, label="-", pos=(720, 307.5), size=(25,25), name="teleOpFromPlatformInputDown") # # self.teleOpFromPowerCubeTitle = wx.StaticText(self, label="Cubes acquired from the Power Cube Zone", pos=(350, 330)) # self.teleOpFromPowerCubeInput = wx.TextCtrl(self, pos=(640, 330), size=(30,20)) # self.teleOpFromPowerCubeInput.AppendText("0") # self.teleOpFromPowerCubeInputUp = wx.Button(self, label="+", pos=(690, 327.5), size=(25,25), name="teleOpFromPowerCubeInputUp") # self.teleOpFromPowerCubeInputDown = wx.Button(self, label="-", pos=(720, 327.5), size=(25,25), name="teleOpFromPowerCubeInputDown") # self.teleOpCubesAcquiredTitle = wx.StaticText(self, label="Cubes acquired in total", pos=(20, 380)) self.teleOpParked = wx.RadioBox(self, label="Robot parked on the Platform?", pos=(20, 380), choices=["Yes", "Attempted", "No"]) self.teleOpClimbed = wx.RadioBox(self, label="Robot successfully climbed?", pos=(320, 380), choices=["Yes", "Attempted", "No"]) self.teleOpTeamwork = wx.RadioBox( self, label="Robot helped others to climb?", pos=(20, 430), choices=["1", "2", "None"]) self.teleOpParked.SetSelection(2) self.teleOpClimbed.SetSelection(2) self.teleOpTeamwork.SetSelection(2) #Post-Match questions self.postMatchTitle = wx.StaticText(self, label="Post-Match Questions", pos=(20, 480)) self.strategyTitle = wx.StaticText( self, label="Any specific defensive strategies?", pos=(20, 500)) self.strategyInput = wx.TextCtrl(self, pos=(300, 500), size=(300, 20)) self.penaltyTitle = wx.StaticText(self, label="Any fouls or penalties?", pos=(20, 520)) self.penaltyInput = wx.TextCtrl(self, pos=(300, 520), size=(300, 20)) self.robotCommentsTitle = wx.StaticText( self, label= "What did the robot spend the most time on during this match?", pos=(20, 540)) self.isRobotScale = wx.CheckBox(self, label="Scale", pos=(20, 560)) self.isRobotSwitch = wx.CheckBox(self, label="Switch", pos=(100, 560)) self.isRobotClimb = wx.CheckBox(self, label="Climb", pos=(180, 560)) self.isRobotExchange = wx.CheckBox(self, label="Exchange", pos=(260, 560)) self.isRobotDefense = wx.CheckBox(self, label="Defense", pos=(340, 560)) self.isRobotHelpingOthers = wx.CheckBox(self, label="Helping others climb", pos=(420, 560)) self.isRobotOthers = wx.CheckBox(self, label="Others", pos=(580, 560)) self.isRobotOthersInput = wx.TextCtrl(self, pos=(650, 560), size=(100, 20)) self.isRobotOthersInput.Enable(False) self.commentsTitle = wx.StaticText(self, label="Any comments for the robot?", pos=(20, 580)) self.commentsInput = wx.TextCtrl(self, pos=(20, 600), size=(400, 20)) self.submitButton = wx.Button(self, 10, "Submit Match Data!", pos=(600, 700)) self.submitButton.Enable(False) self.matchNumInput.Bind(wx.EVT_TEXT, self.Team_Match) self.autonSwitchInput.Bind(wx.EVT_TEXT, self.Switch_Enable) self.autonScaleInput.Bind(wx.EVT_TEXT, self.Scale_Enable) self.isRobotOthers.Bind(wx.EVT_CHECKBOX, self.Others_Enable) self.redRight.Bind(wx.EVT_CHECKBOX, self.Red_Right) #Setups self.autonSwitchInputUp.Bind(wx.EVT_BUTTON, self.Number_Change) self.autonSwitchInputDown.Bind(wx.EVT_BUTTON, self.Number_Change) self.autonScaleInputUp.Bind(wx.EVT_BUTTON, self.Number_Change) self.autonScaleInputDown.Bind(wx.EVT_BUTTON, self.Number_Change) self.autonPlatformInputUp.Bind(wx.EVT_BUTTON, self.Number_Change) self.autonPlatformInputDown.Bind(wx.EVT_BUTTON, self.Number_Change) self.autonPowerCubeInputUp.Bind(wx.EVT_BUTTON, self.Number_Change) self.autonPowerCubeInputDown.Bind(wx.EVT_BUTTON, self.Number_Change) self.autonExchangeInputUp.Bind(wx.EVT_BUTTON, self.Number_Change) self.autonExchangeInputDown.Bind(wx.EVT_BUTTON, self.Number_Change) self.teleOpSwitchInputUp.Bind(wx.EVT_BUTTON, self.Number_Change) self.teleOpSwitchInputDown.Bind(wx.EVT_BUTTON, self.Number_Change) self.teleOpScaleInputUp.Bind(wx.EVT_BUTTON, self.Number_Change) self.teleOpScaleInputDown.Bind(wx.EVT_BUTTON, self.Number_Change) self.teleOpExchangeInputUp.Bind(wx.EVT_BUTTON, self.Number_Change) self.teleOpExchangeInputDown.Bind(wx.EVT_BUTTON, self.Number_Change) self.teleOpOppoSwitchInputUp.Bind(wx.EVT_BUTTON, self.Number_Change) self.teleOpOppoSwitchInputDown.Bind(wx.EVT_BUTTON, self.Number_Change) # self.teleOpFromExchangeInputUp.Bind(wx.EVT_BUTTON, self.Number_Change) # self.teleOpFromExchangeInputDown.Bind(wx.EVT_BUTTON, self.Number_Change) # self.teleOpFromPlatformInputUp.Bind(wx.EVT_BUTTON, self.Number_Change) # self.teleOpFromPlatformInputDown.Bind(wx.EVT_BUTTON, self.Number_Change) # self.teleOpFromPowerCubeInputUp.Bind(wx.EVT_BUTTON, self.Number_Change) # self.teleOpFromPowerCubeInputDown.Bind(wx.EVT_BUTTON, self.Number_Change) self.submitButton.Bind(wx.EVT_BUTTON, self.CSV_OUTPUT) self.nameInput.Bind(wx.EVT_TEXT, self.Enable_Submit) self.matchNumInput.Bind(wx.EVT_TEXT, self.Enable_Submit) self.teamNumInput.Bind(wx.EVT_TEXT, self.Enable_Submit) # self.teamNumInput.Bind(wx.EVT_COMBOBOX, self.Enable_Submit) self.robotPosition.Bind(wx.EVT_RADIOBOX, self.Enable_Submit) self.deadRobot.Bind(wx.EVT_CHECKBOX, self.Enable_Submit)
def __init__(self, parent, log): self.log = log wx.Panel.__init__(self, parent, -1) R.panel = self y = R.frameSize[1] - 70 x = 5 choices = [ str(port) for port, desc, hwid in sorted(list_ports.comports()) ] comName = "" if len(choices) == 0 else choices[0] self.nameListBox = wx.ComboBox(self, -1, value=comName, choices=choices, pos=(x, y + 1), size=(80, -1), style=wx.CB_DROPDOWN) x += 80 + 5 self.startServerBtn = wx.Button(self, -1, u"运行", pos=(x, y), size=(60, 28), style=wx.TE_MULTILINE) x += 60 + 5 self.saveParaBtn = wx.Button(self, -1, u"设置参数", pos=(x, y), size=(60, 28), style=wx.TE_MULTILINE) x += 60 + 5 self.logCheckBox = wx.CheckBox(self, -1, u"日志", pos=(x, y + 5), size=(60, -1), style=wx.NO_BORDER) self.Bind(wx.EVT_COMBOBOX_DROPDOWN, self.comScanHandler, self.nameListBox) self.Bind(wx.EVT_BUTTON, self.startServerBtnHandler, self.startServerBtn) self.Bind(wx.EVT_CHECKBOX, self.logCheckBoxHandler, self.logCheckBox) self.Bind(wx.EVT_BUTTON, self.saveParaBtnHandler, self.saveParaBtn) ##------------------------------------------------------------------------------ ##添加可选项 x = 5 y = 5 wx.StaticText(self, -1, u"执行器", pos=(x, y + 4)) y += 30 x += 40 wx.StaticText(self, -1, u"日配注", pos=(x, y + 4)) self.valueBox1 = wx.TextCtrl(self, -1, "", pos=(x + 40, y), size=(70, -1), style=wx.TE_READONLY) x += 110 + 10 wx.StaticText(self, -1, u"调节精度", pos=(x, y + 4)) self.valueBox2 = wx.TextCtrl(self, -1, "", pos=(x + 55, y), size=(70, -1), style=wx.TE_READONLY) x += 125 + 10 wx.StaticText(self, -1, u"自动调节", pos=(x, y + 4)) self.valueBox3 = wx.TextCtrl(self, -1, "", pos=(x + 55, y), size=(40, -1), style=wx.TE_READONLY) x += 95 + 10 wx.StaticText(self, -1, u"起始计算时间", pos=(x, y + 4)) self.valueBox4 = wx.TextCtrl(self, -1, "", pos=(x + 75, y), size=(40, -1), style=wx.TE_READONLY) x = 45 y += 30 wx.StaticText(self, -1, u"总流量", pos=(x, y + 4)) self.valueBox5 = wx.TextCtrl(self, -1, "1", pos=(x + 40, y), size=(70, -1)) x += 110 + 10 wx.StaticText(self, -1, u"瞬时流量", pos=(x, y + 4)) self.valueBox6 = wx.TextCtrl(self, -1, "1", pos=(x + 55, y), size=(70, -1)) x += 125 + 10 wx.StaticText(self, -1, u"单向连续调节次数", pos=(x, y + 4)) self.valueBox7 = wx.TextCtrl(self, -1, "1", pos=(x + 100, y), size=(50, -1)) x += 150 + 10 wx.StaticText(self, -1, u"流量计通信状态", pos=(x, y + 4)) self.valueBox8 = wx.TextCtrl(self, -1, "1", pos=(x + 90, y), size=(50, -1)) x = 45 y += 30 wx.StaticText(self, -1, u"流量计型号", pos=(x, y + 4)) self.valueBox9 = wx.TextCtrl(self, -1, "1", pos=(x + 70, y), size=(50, -1)) x += 120 + 10 wx.StaticText(self, -1, u"当前角度", pos=(x, y + 4)) self.valueBox10 = wx.TextCtrl(self, -1, "1", pos=(x + 50, y), size=(50, -1)) x += 100 + 10 wx.StaticText(self, -1, u"版本号", pos=(x, y + 4)) self.valueBox11 = wx.TextCtrl(self, -1, "1.1.1.1", pos=(x + 40, y), size=(100, -1)) x += 140 + 10 wx.StaticText(self, -1, u"当前累计调节次数", pos=(x, y + 4)) self.valueBox12 = wx.TextCtrl(self, -1, "1", pos=(x + 100, y), size=(50, -1)) x = 45 y += 30 wx.StaticText(self, -1, u"自动调节标志位", pos=(x, y + 4)) self.valueBox13 = wx.TextCtrl(self, -1, "1", pos=(x + 90, y), size=(50, -1)) x += 140 + 10 wx.StaticText(self, -1, u"阀门关闭状态标志", pos=(x, y + 4)) self.valueBox14 = wx.TextCtrl(self, -1, "1", pos=(x + 100, y), size=(50, -1)) x += 150 + 10 wx.StaticText(self, -1, u"单向连续调节角度", pos=(x, y + 4)) self.valueBox15 = wx.TextCtrl(self, -1, "1", pos=(x + 110, y), size=(80, -1)) x = 45 y += 30 wx.StaticText(self, -1, u"系统累计上电时间", pos=(x, y + 4)) self.valueBox16 = wx.TextCtrl(self, -1, "1", pos=(x + 100, y), size=(100, -1)) x += 210 wx.StaticText(self, -1, u"下发时间", pos=(x, y + 4)) self.valueBox17 = wx.TextCtrl(self, -1, "1", pos=(x + 60, y), size=(100, -1), style=wx.TE_READONLY) ########################-------------电参 x = 5 y += 30 #wx.StaticText(self, -1, u"有线电参 : 使用modbus修改(30写1保存)", pos=(x, y + 4)) wx.StaticText(self, -1, u"有线电参", pos=(x, y + 4)) ############第一列 y += 30 x += 40 wx.StaticText(self, -1, u"电压量程", pos=(x, y + 4)) x += 55 self.valueBox31 = wx.TextCtrl(self, -1, "10", pos=(x, y), size=(70, -1)) x += 70 + 10 wx.StaticText(self, -1, u"电流量程", pos=(x, y + 4)) x += 55 self.valueBox32 = wx.TextCtrl(self, -1, "10", pos=(x, y), size=(70, -1)) x += 70 + 10 wx.StaticText(self, -1, u"正向有功功耗", pos=(x, y + 4)) x += 78 self.valueBox33 = wx.TextCtrl(self, -1, "10", pos=(x, y), size=(70, -1)) x += 70 + 10 wx.StaticText(self, -1, u"反向有功功耗", pos=(x, y + 4)) x += 78 self.valueBox34 = wx.TextCtrl(self, -1, "10", pos=(x, y), size=(70, -1)) ############第二列 y += 30 x = 45 wx.StaticText(self, -1, u"A相电压", pos=(x, y + 4)) x += 55 self.valueBox35 = wx.TextCtrl(self, -1, "10", pos=(x, y), size=(70, -1)) x += 70 + 10 wx.StaticText(self, -1, u"B相电压", pos=(x, y + 4)) x += 55 self.valueBox36 = wx.TextCtrl(self, -1, "10", pos=(x, y), size=(70, -1)) x += 70 + 10 wx.StaticText(self, -1, u"C相电压", pos=(x, y + 4)) x += 55 self.valueBox37 = wx.TextCtrl(self, -1, "10", pos=(x, y), size=(70, -1)) x += 70 + 10 wx.StaticText(self, -1, u"A相电流", pos=(x, y + 4)) x += 55 self.valueBox38 = wx.TextCtrl(self, -1, "10", pos=(x, y), size=(70, -1)) x += 70 + 10 wx.StaticText(self, -1, u"B相电流", pos=(x, y + 4)) x += 55 self.valueBox39 = wx.TextCtrl(self, -1, "10", pos=(x, y), size=(70, -1)) ############第三列 y += 30 x = 45 wx.StaticText(self, -1, u"C相电流", pos=(x, y + 4)) x += 55 self.valueBox40 = wx.TextCtrl(self, -1, "10", pos=(x, y), size=(70, -1)) x += 70 + 10 wx.StaticText(self, -1, u"总有功功率", pos=(x, y + 4)) x += 65 self.valueBox41 = wx.TextCtrl(self, -1, "10", pos=(x, y), size=(70, -1)) x += 70 + 10 wx.StaticText(self, -1, u"总无功功率", pos=(x, y + 4)) x += 65 self.valueBox42 = wx.TextCtrl(self, -1, "10", pos=(x, y), size=(70, -1)) x += 70 + 10 wx.StaticText(self, -1, u"总视在功率", pos=(x, y + 4)) x += 65 self.valueBox43 = wx.TextCtrl(self, -1, "10", pos=(x, y), size=(70, -1)) ############第四列 y += 30 x = 45 wx.StaticText(self, -1, u"功率因数", pos=(x, y + 4)) self.valueBox44 = wx.TextCtrl(self, -1, "10", pos=(x + 55, y), size=(70, -1)) x += 125 + 10 wx.StaticText(self, -1, u"A项有功功率", pos=(x, y + 4)) x += 75 self.valueBox45 = wx.TextCtrl(self, -1, "10", pos=(x, y), size=(70, -1)) x += 70 + 10 wx.StaticText(self, -1, u"B项有功功率", pos=(x, y + 4)) x += 75 self.valueBox46 = wx.TextCtrl(self, -1, "10", pos=(x, y), size=(70, -1)) x += 70 + 10 wx.StaticText(self, -1, u"C项有功功率", pos=(x, y + 4)) x += 75 self.valueBox47 = wx.TextCtrl(self, -1, "10", pos=(x, y), size=(70, -1))
def __init__(self, *args, **kwds): # begin wxGlade: MyFrame.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.statusbar = self.CreateStatusBar(5, wx.ST_SIZEGRIP) self.SplitterWindow = wx.SplitterWindow(self, wx.ID_ANY, style=wx.SP_3D | wx.SP_BORDER | wx.SP_LIVE_UPDATE) self.window_1_pane_1 = wx.ScrolledWindow(self.SplitterWindow, wx.ID_ANY, style=wx.SIMPLE_BORDER | wx.TAB_TRAVERSAL) self.pnlSettingBar = wx.Panel(self.window_1_pane_1, wx.ID_ANY) self.btnHideBar = wx.Button(self.pnlSettingBar, wx.ID_ANY, "Hide") self.btnEnumPorts = wx.Button(self.pnlSettingBar, wx.ID_ANY, "EnumPorts") self.label_1 = wx.StaticText(self.pnlSettingBar, wx.ID_ANY, "Port") self.cmbPort = wx.ComboBox(self.pnlSettingBar, wx.ID_ANY, choices=[], style=wx.CB_DROPDOWN) self.label_2 = wx.StaticText(self.pnlSettingBar, wx.ID_ANY, "Baud Rate") self.cmbBaudRate = wx.ComboBox( self.pnlSettingBar, wx.ID_ANY, choices=[ "300", "600", "1200", "1800", "2400", "4800", "9600", "19200", "38400", "57600", "115200", "230400", "460800", "500000", "576000", "921600", "1000000", "1152000", "1500000", "2000000", "2500000", "3000000", "3500000", "4000000" ], style=wx.CB_DROPDOWN) self.label_3 = wx.StaticText(self.pnlSettingBar, wx.ID_ANY, "Data Bits") self.choiceDataBits = wx.Choice(self.pnlSettingBar, wx.ID_ANY, choices=["5", "6", "7", "8"]) self.label_4 = wx.StaticText(self.pnlSettingBar, wx.ID_ANY, "Parity") self.choiceParity = wx.Choice( self.pnlSettingBar, wx.ID_ANY, choices=["None", "Even", "Odd", "Mark", "Space"]) self.label_5 = wx.StaticText(self.pnlSettingBar, wx.ID_ANY, "Stop Bits") self.choiceStopBits = wx.Choice(self.pnlSettingBar, wx.ID_ANY, choices=["1", "1.5", "2"]) self.chkboxrtscts = wx.CheckBox(self.pnlSettingBar, wx.ID_ANY, "RTS/CTS") self.chkboxxonxoff = wx.CheckBox(self.pnlSettingBar, wx.ID_ANY, "Xon/Xoff") self.sizer_6_staticbox = wx.StaticBox(self.pnlSettingBar, wx.ID_ANY, "HandShake") self.btnOpen = wx.Button(self.pnlSettingBar, wx.ID_ANY, "Open") self.btnClear = wx.Button(self.pnlSettingBar, wx.ID_ANY, "Clear Screen") self.window_1_pane_2 = wx.Panel(self.SplitterWindow, wx.ID_ANY) self.pnlData = wx.Panel(self.window_1_pane_2, wx.ID_ANY) self.txtctlMain = wx.TextCtrl( self.pnlData, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_RICH | wx.TE_RICH2 | wx.TE_AUTO_URL | wx.TE_LINEWRAP | wx.TE_WORDWRAP | wx.NO_BORDER) self.pnlTransmitHex = wx.Panel(self.pnlData, wx.ID_ANY, style=wx.SIMPLE_BORDER | wx.TAB_TRAVERSAL) self.label_6 = wx.StaticText(self.pnlTransmitHex, wx.ID_ANY, "Transmit Hex") self.btnTransmitHex = wx.Button(self.pnlTransmitHex, wx.ID_ANY, "Transmit") self.txtctlHex = wx.TextCtrl(self.pnlTransmitHex, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_RICH | wx.TE_RICH2 | wx.TE_LINEWRAP | wx.TE_WORDWRAP | wx.NO_BORDER) self.__set_properties() self.__do_layout()
def __init__(self, *args, **kwds): # begin wxGlade: All_Widgets_Frame.__init__ kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.SetSize((800, 417)) self.SetTitle(_("All Widgets")) _icon = wx.NullIcon _icon.CopyFromBitmap(wx.ArtProvider.GetBitmap(wx.ART_TIP, wx.ART_OTHER, (32, 32))) self.SetIcon(_icon) # Menu Bar self.All_Widgets_menubar = wx.MenuBar() global mn_IDUnix; mn_IDUnix = wx.NewId() global mn_IDWindows; mn_IDWindows = wx.NewId() wxglade_tmp_menu = wx.Menu() wxglade_tmp_menu.Append(wx.ID_OPEN, _("&Open"), _("Open an existing document")) wxglade_tmp_menu.Append(wx.ID_CLOSE, _("&Close file"), _("Close current document")) wxglade_tmp_menu.AppendSeparator() wxglade_tmp_menu.Append(wx.ID_EXIT, _("E&xit"), _("Finish program")) self.All_Widgets_menubar.Append(wxglade_tmp_menu, _("&File")) wxglade_tmp_menu = wx.Menu() self.All_Widgets_menubar.mn_Unix = wxglade_tmp_menu.Append(mn_IDUnix, _("Unix"), _("Use Unix line endings"), wx.ITEM_RADIO) self.Bind(wx.EVT_MENU, self.onSelectUnix, id=mn_IDUnix) self.All_Widgets_menubar.mn_Windows = wxglade_tmp_menu.Append(mn_IDWindows, _("Windows"), _("Use Windows line endings"), wx.ITEM_RADIO) self.Bind(wx.EVT_MENU, self.onSelectWindows, id=mn_IDWindows) wxglade_tmp_menu.AppendSeparator() self.All_Widgets_menubar.mn_RemoveTabs = wxglade_tmp_menu.Append(wx.ID_ANY, _("Remove Tabs"), _("Remove all leading tabs"), wx.ITEM_CHECK) self.Bind(wx.EVT_MENU, self.onRemoveTabs, id=self.All_Widgets_menubar.mn_RemoveTabs.GetId()) self.All_Widgets_menubar.Append(wxglade_tmp_menu, _("&Edit")) wxglade_tmp_menu = wx.Menu() wxglade_tmp_menu.Append(wx.ID_HELP, _("Manual"), _("Show the application manual")) self.Bind(wx.EVT_MENU, self.onShowManual, id=wx.ID_HELP) wxglade_tmp_menu.AppendSeparator() wxglade_tmp_menu.Append(wx.ID_ABOUT, _("About"), _("Show the About dialog")) self.All_Widgets_menubar.Append(wxglade_tmp_menu, _("&Help")) self.SetMenuBar(self.All_Widgets_menubar) # Menu Bar end self.All_Widgets_statusbar = self.CreateStatusBar(1, wx.ST_SIZEGRIP) self.All_Widgets_statusbar.SetStatusWidths([-1]) # statusbar fields All_Widgets_statusbar_fields = [_("All Widgets statusbar")] for i in range(len(All_Widgets_statusbar_fields)): self.All_Widgets_statusbar.SetStatusText(All_Widgets_statusbar_fields[i], i) # Tool Bar self.All_Widgets_toolbar = wx.ToolBar(self, -1) self.All_Widgets_toolbar.AddTool(wx.ID_UP, _("UpDown"), wx.ArtProvider.GetBitmap(wx.ART_GO_UP, wx.ART_OTHER, (32, 32)), wx.ArtProvider.GetBitmap(wx.ART_GO_DOWN, wx.ART_OTHER, (32, 32)), wx.ITEM_CHECK, _("Up or Down"), _("Up or Down")) self.All_Widgets_toolbar.AddTool(wx.ID_OPEN, _("Open"), wx.Bitmap(32, 32), wx.NullBitmap, wx.ITEM_NORMAL, _("Open a new file"), _("Open a new file")) self.All_Widgets_toolbar.Realize() self.SetToolBar(self.All_Widgets_toolbar) # Tool Bar end sizer_1 = wx.FlexGridSizer(3, 1, 0, 0) self.notebook_1 = wx.Notebook(self, wx.ID_ANY, style=wx.NB_BOTTOM) sizer_1.Add(self.notebook_1, 1, wx.EXPAND, 0) self.notebook_1_wxBitmapButton = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxBitmapButton, _("wxBitmapButton")) sizer_13 = wx.FlexGridSizer(2, 2, 0, 0) self.bitmap_button_icon1 = wx.BitmapButton(self.notebook_1_wxBitmapButton, wx.ID_ANY, wx.Bitmap("icon.xpm", wx.BITMAP_TYPE_ANY)) self.bitmap_button_icon1.SetSize(self.bitmap_button_icon1.GetBestSize()) self.bitmap_button_icon1.SetDefault() sizer_13.Add(self.bitmap_button_icon1, 1, wx.ALL | wx.EXPAND, 5) self.bitmap_button_empty1 = wx.BitmapButton(self.notebook_1_wxBitmapButton, wx.ID_ANY, wx.Bitmap(10, 10)) self.bitmap_button_empty1.SetSize(self.bitmap_button_empty1.GetBestSize()) self.bitmap_button_empty1.SetDefault() sizer_13.Add(self.bitmap_button_empty1, 1, wx.ALL | wx.EXPAND, 5) self.bitmap_button_icon2 = wx.BitmapButton(self.notebook_1_wxBitmapButton, wx.ID_ANY, wx.Bitmap("icon.xpm", wx.BITMAP_TYPE_ANY), style=wx.BORDER_NONE | wx.BU_BOTTOM) self.bitmap_button_icon2.SetBitmapDisabled(wx.Bitmap(20, 20)) self.bitmap_button_icon2.SetSize(self.bitmap_button_icon2.GetBestSize()) self.bitmap_button_icon2.SetDefault() sizer_13.Add(self.bitmap_button_icon2, 1, wx.ALL | wx.EXPAND, 5) self.bitmap_button_art = wx.BitmapButton(self.notebook_1_wxBitmapButton, wx.ID_ANY, wx.ArtProvider.GetBitmap(wx.ART_GO_UP, wx.ART_OTHER, (32, 32)), style=wx.BORDER_NONE | wx.BU_BOTTOM) self.bitmap_button_art.SetSize(self.bitmap_button_art.GetBestSize()) self.bitmap_button_art.SetDefault() sizer_13.Add(self.bitmap_button_art, 1, wx.ALL | wx.EXPAND, 5) self.notebook_1_wxButton = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxButton, _("wxButton")) sizer_28 = wx.BoxSizer(wx.HORIZONTAL) self.button_3 = wx.Button(self.notebook_1_wxButton, wx.ID_BOLD, "") sizer_28.Add(self.button_3, 0, wx.ALL, 5) self.notebook_1_wxCalendarCtrl = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxCalendarCtrl, _("wxCalendarCtrl")) sizer_12 = wx.BoxSizer(wx.HORIZONTAL) self.calendar_ctrl_1 = wx.adv.CalendarCtrl(self.notebook_1_wxCalendarCtrl, wx.ID_ANY, style=wx.adv.CAL_MONDAY_FIRST | wx.adv.CAL_SEQUENTIAL_MONTH_SELECTION | wx.adv.CAL_SHOW_SURROUNDING_WEEKS) sizer_12.Add(self.calendar_ctrl_1, 1, wx.ALL | wx.EXPAND, 5) self.notebook_1_wxCheckBox = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxCheckBox, _("wxCheckBox")) sizer_21 = wx.GridSizer(2, 3, 0, 0) self.checkbox_1 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY, _("one (unchecked)")) sizer_21.Add(self.checkbox_1, 0, wx.EXPAND, 0) self.checkbox_2 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY, _("two (checked)")) self.checkbox_2.SetValue(1) sizer_21.Add(self.checkbox_2, 0, wx.EXPAND, 0) self.checkbox_3 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY, _("three"), style=wx.CHK_2STATE) sizer_21.Add(self.checkbox_3, 0, wx.EXPAND, 0) self.checkbox_4 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY, _("four (unchecked)"), style=wx.CHK_3STATE) self.checkbox_4.Set3StateValue(wx.CHK_UNCHECKED) sizer_21.Add(self.checkbox_4, 0, wx.EXPAND, 0) self.checkbox_5 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY, _("five (checked)"), style=wx.CHK_3STATE | wx.CHK_ALLOW_3RD_STATE_FOR_USER) self.checkbox_5.Set3StateValue(wx.CHK_CHECKED) sizer_21.Add(self.checkbox_5, 0, wx.EXPAND, 0) self.checkbox_6 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY, _("six (undetermined)"), style=wx.CHK_3STATE | wx.CHK_ALLOW_3RD_STATE_FOR_USER) self.checkbox_6.Set3StateValue(wx.CHK_UNDETERMINED) sizer_21.Add(self.checkbox_6, 0, wx.EXPAND, 0) self.notebook_1_wxCheckListBox = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxCheckListBox, _("wxCheckListBox")) sizer_26 = wx.BoxSizer(wx.HORIZONTAL) self.check_list_box_1 = wx.CheckListBox(self.notebook_1_wxCheckListBox, wx.ID_ANY, choices=[_("one"), _("two"), _("three"), _("four")]) self.check_list_box_1.SetSelection(2) sizer_26.Add(self.check_list_box_1, 1, wx.ALL | wx.EXPAND, 5) self.notebook_1_wxChoice = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxChoice, _("wxChoice")) sizer_5 = wx.BoxSizer(wx.HORIZONTAL) self.choice_empty = wx.Choice(self.notebook_1_wxChoice, wx.ID_ANY, choices=[]) sizer_5.Add(self.choice_empty, 1, wx.ALL, 5) self.choice_filled = wx.Choice(self.notebook_1_wxChoice, wx.ID_ANY, choices=[_("Item 1"), _("Item 2 (pre-selected)")]) self.choice_filled.SetSelection(1) sizer_5.Add(self.choice_filled, 1, wx.ALL, 5) self.notebook_1_wxComboBox = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxComboBox, _("wxComboBox")) sizer_6 = wx.BoxSizer(wx.VERTICAL) sizer_7 = wx.BoxSizer(wx.HORIZONTAL) sizer_6.Add(sizer_7, 1, wx.EXPAND, 0) self.combo_box_empty = wx.ComboBox(self.notebook_1_wxComboBox, wx.ID_ANY, choices=[], style=0) sizer_7.Add(self.combo_box_empty, 1, wx.ALL, 5) self.combo_box_filled = wx.ComboBox(self.notebook_1_wxComboBox, wx.ID_ANY, choices=[_("Item 1 (pre-selected)"), _("Item 2")], style=0) self.combo_box_filled.SetSelection(0) sizer_7.Add(self.combo_box_filled, 1, wx.ALL, 5) self.notebook_1_wxDatePickerCtrl = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxDatePickerCtrl, _("wxDatePickerCtrl")) sizer_17 = wx.BoxSizer(wx.HORIZONTAL) self.datepicker_ctrl_1 = wx.adv.DatePickerCtrl(self.notebook_1_wxDatePickerCtrl, wx.ID_ANY, style=wx.adv.DP_SHOWCENTURY) sizer_17.Add(self.datepicker_ctrl_1, 1, wx.ALIGN_CENTER | wx.ALL, 5) self.notebook_1_wxGauge = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxGauge, _("wxGauge")) sizer_15 = wx.BoxSizer(wx.HORIZONTAL) self.gauge_1 = wx.Gauge(self.notebook_1_wxGauge, wx.ID_ANY, 20) sizer_15.Add(self.gauge_1, 1, wx.ALL, 5) self.notebook_1_wxGrid = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxGrid, _("wxGrid")) sizer_19 = wx.BoxSizer(wx.HORIZONTAL) self.grid_1 = wx.grid.Grid(self.notebook_1_wxGrid, wx.ID_ANY, size=(1, 1)) self.grid_1.CreateGrid(10, 3) self.grid_1.SetSelectionMode(wx.grid.Grid.SelectRows) sizer_19.Add(self.grid_1, 1, wx.EXPAND, 0) self.notebook_1_wxHyperlinkCtrl = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxHyperlinkCtrl, _("wxHyperlinkCtrl")) sizer_20 = wx.BoxSizer(wx.HORIZONTAL) self.hyperlink_1 = wx.adv.HyperlinkCtrl(self.notebook_1_wxHyperlinkCtrl, wx.ID_ANY, _("Homepage wxGlade"), _("http://wxglade.sf.net")) sizer_20.Add(self.hyperlink_1, 0, wx.ALL, 5) self.notebook_1_wxListBox = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxListBox, _("wxListBox")) sizer_4 = wx.BoxSizer(wx.VERTICAL) self.list_box_empty = wx.ListBox(self.notebook_1_wxListBox, wx.ID_ANY, choices=[], style=0) sizer_4.Add(self.list_box_empty, 1, wx.ALL | wx.EXPAND, 5) self.list_box_filled = wx.ListBox(self.notebook_1_wxListBox, wx.ID_ANY, choices=[_("Item 1"), _("Item 2 (pre-selected)")], style=wx.LB_MULTIPLE | wx.LB_SORT) self.list_box_filled.SetSelection(1) sizer_4.Add(self.list_box_filled, 1, wx.ALL | wx.EXPAND, 5) self.notebook_1_wxListCtrl = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxListCtrl, _("wxListCtrl")) sizer_3 = wx.BoxSizer(wx.HORIZONTAL) self.list_ctrl_1 = wx.ListCtrl(self.notebook_1_wxListCtrl, wx.ID_ANY, style=wx.BORDER_SUNKEN | wx.LC_REPORT) sizer_3.Add(self.list_ctrl_1, 1, wx.ALL | wx.EXPAND, 5) self.notebook_1_wxRadioBox = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxRadioBox, _("wxRadioBox")) grid_sizer_1 = wx.GridSizer(2, 2, 0, 0) self.radio_box_empty1 = wx.RadioBox(self.notebook_1_wxRadioBox, wx.ID_ANY, _("radio_box_empty1"), choices=[""], majorDimension=1, style=wx.RA_SPECIFY_ROWS) grid_sizer_1.Add(self.radio_box_empty1, 1, wx.ALL | wx.EXPAND, 5) self.radio_box_filled1 = wx.RadioBox(self.notebook_1_wxRadioBox, wx.ID_ANY, _("radio_box_filled1"), choices=[_("choice 1"), _("choice 2 (pre-selected)"), _("choice 3")], majorDimension=0, style=wx.RA_SPECIFY_ROWS) self.radio_box_filled1.SetSelection(1) grid_sizer_1.Add(self.radio_box_filled1, 1, wx.ALL | wx.EXPAND, 5) self.radio_box_empty2 = wx.RadioBox(self.notebook_1_wxRadioBox, wx.ID_ANY, _("radio_box_empty2"), choices=[""], majorDimension=1, style=wx.RA_SPECIFY_COLS) grid_sizer_1.Add(self.radio_box_empty2, 1, wx.ALL | wx.EXPAND, 5) self.radio_box_filled2 = wx.RadioBox(self.notebook_1_wxRadioBox, wx.ID_ANY, _("radio_box_filled2"), choices=[_("choice 1"), _("choice 2 (pre-selected)")], majorDimension=0, style=wx.RA_SPECIFY_COLS) self.radio_box_filled2.SetSelection(1) grid_sizer_1.Add(self.radio_box_filled2, 1, wx.ALL | wx.EXPAND, 5) self.notebook_1_wxRadioButton = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxRadioButton, _("wxRadioButton")) sizer_8 = wx.StaticBoxSizer(wx.StaticBox(self.notebook_1_wxRadioButton, wx.ID_ANY, _("My RadioButton Group")), wx.HORIZONTAL) grid_sizer_2 = wx.FlexGridSizer(3, 2, 0, 0) sizer_8.Add(grid_sizer_2, 1, wx.EXPAND, 0) self.radio_btn_1 = wx.RadioButton(self.notebook_1_wxRadioButton, wx.ID_ANY, _("Alice"), style=wx.RB_GROUP) grid_sizer_2.Add(self.radio_btn_1, 1, wx.ALL | wx.EXPAND, 5) self.text_ctrl_1 = wx.TextCtrl(self.notebook_1_wxRadioButton, wx.ID_ANY, "") grid_sizer_2.Add(self.text_ctrl_1, 1, wx.ALL | wx.EXPAND, 5) self.radio_btn_2 = wx.RadioButton(self.notebook_1_wxRadioButton, wx.ID_ANY, _("Bob")) grid_sizer_2.Add(self.radio_btn_2, 1, wx.ALL | wx.EXPAND, 5) self.text_ctrl_2 = wx.TextCtrl(self.notebook_1_wxRadioButton, wx.ID_ANY, "") grid_sizer_2.Add(self.text_ctrl_2, 1, wx.ALL | wx.EXPAND, 5) self.radio_btn_3 = wx.RadioButton(self.notebook_1_wxRadioButton, wx.ID_ANY, _("Malroy")) grid_sizer_2.Add(self.radio_btn_3, 1, wx.ALL | wx.EXPAND, 5) self.text_ctrl_3 = wx.TextCtrl(self.notebook_1_wxRadioButton, wx.ID_ANY, "") grid_sizer_2.Add(self.text_ctrl_3, 1, wx.ALL | wx.EXPAND, 5) self.notebook_1_wxSlider = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxSlider, _("wxSlider")) sizer_22 = wx.BoxSizer(wx.HORIZONTAL) self.slider_1 = wx.Slider(self.notebook_1_wxSlider, wx.ID_ANY, 5, 0, 10, style=0) sizer_22.Add(self.slider_1, 1, wx.ALL | wx.EXPAND, 5) self.notebook_1_wxSpinButton = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxSpinButton, _("wxSpinButton (with wxTextCtrl)")) sizer_16 = wx.BoxSizer(wx.HORIZONTAL) self.tc_spin_button = wx.TextCtrl(self.notebook_1_wxSpinButton, wx.ID_ANY, _("1"), style=wx.TE_RIGHT) sizer_16.Add(self.tc_spin_button, 1, wx.ALL, 5) self.spin_button = wx.SpinButton(self.notebook_1_wxSpinButton, wx.ID_ANY ) sizer_16.Add(self.spin_button, 1, wx.ALL, 5) self.notebook_1_wxSpinCtrl = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxSpinCtrl, _("wxSpinCtrl")) sizer_14 = wx.BoxSizer(wx.HORIZONTAL) self.spin_ctrl_1 = wx.SpinCtrl(self.notebook_1_wxSpinCtrl, wx.ID_ANY, "4", min=0, max=100) sizer_14.Add(self.spin_ctrl_1, 1, wx.ALL, 5) self.notebook_1_wxSplitterWindow_horizontal = wx.ScrolledWindow(self.notebook_1, wx.ID_ANY, style=wx.TAB_TRAVERSAL) self.notebook_1_wxSplitterWindow_horizontal.SetScrollRate(10, 10) self.notebook_1.AddPage(self.notebook_1_wxSplitterWindow_horizontal, _("wxSplitterWindow (horizontally)")) sizer_29 = wx.BoxSizer(wx.HORIZONTAL) self.splitter_1 = wx.SplitterWindow(self.notebook_1_wxSplitterWindow_horizontal, wx.ID_ANY, style=0) self.splitter_1.SetMinimumPaneSize(20) sizer_29.Add(self.splitter_1, 1, wx.ALL | wx.EXPAND, 5) self.splitter_1_pane_1 = wx.Panel(self.splitter_1, wx.ID_ANY) sizer_30 = wx.BoxSizer(wx.HORIZONTAL) self.label_top_pane = wx.StaticText(self.splitter_1_pane_1, wx.ID_ANY, _("top pane")) sizer_30.Add(self.label_top_pane, 1, wx.ALL | wx.EXPAND, 5) self.splitter_1_pane_2 = wx.Panel(self.splitter_1, wx.ID_ANY) sizer_31 = wx.BoxSizer(wx.HORIZONTAL) self.label_buttom_pane = wx.StaticText(self.splitter_1_pane_2, wx.ID_ANY, _("bottom pane")) sizer_31.Add(self.label_buttom_pane, 1, wx.ALL | wx.EXPAND, 5) self.notebook_1_wxSplitterWindow_vertical = wx.ScrolledWindow(self.notebook_1, wx.ID_ANY, style=wx.TAB_TRAVERSAL) self.notebook_1_wxSplitterWindow_vertical.SetScrollRate(10, 10) self.notebook_1.AddPage(self.notebook_1_wxSplitterWindow_vertical, _("wxSplitterWindow (vertically)")) sizer_25 = wx.BoxSizer(wx.HORIZONTAL) self.splitter_2 = wx.SplitterWindow(self.notebook_1_wxSplitterWindow_vertical, wx.ID_ANY, style=0) self.splitter_2.SetMinimumPaneSize(20) sizer_25.Add(self.splitter_2, 1, wx.ALL | wx.EXPAND, 5) self.splitter_2_pane_1 = wx.Panel(self.splitter_2, wx.ID_ANY) sizer_32 = wx.BoxSizer(wx.VERTICAL) self.label_left_pane = wx.StaticText(self.splitter_2_pane_1, wx.ID_ANY, _("left pane")) sizer_32.Add(self.label_left_pane, 1, wx.ALL | wx.EXPAND, 5) self.splitter_2_pane_2 = wx.Panel(self.splitter_2, wx.ID_ANY) sizer_33 = wx.BoxSizer(wx.VERTICAL) self.label_right_pane = wx.StaticText(self.splitter_2_pane_2, wx.ID_ANY, _("right pane")) sizer_33.Add(self.label_right_pane, 1, wx.ALL | wx.EXPAND, 5) self.notebook_1_wxStaticBitmap = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxStaticBitmap, _("wxStaticBitmap")) sizer_11 = wx.BoxSizer(wx.VERTICAL) self.bitmap_empty = wx.StaticBitmap(self.notebook_1_wxStaticBitmap, wx.ID_ANY, wx.Bitmap(32, 32)) sizer_11.Add(self.bitmap_empty, 1, wx.ALIGN_CENTER | wx.ALL | wx.EXPAND, 5) self.bitmap_file = wx.StaticBitmap(self.notebook_1_wxStaticBitmap, wx.ID_ANY, wx.Bitmap("icon.xpm", wx.BITMAP_TYPE_ANY)) sizer_11.Add(self.bitmap_file, 1, wx.ALIGN_CENTER | wx.ALL | wx.EXPAND, 5) self.bitmap_nofile = wx.StaticBitmap(self.notebook_1_wxStaticBitmap, wx.ID_ANY, wx.Bitmap("non-existing.bmp", wx.BITMAP_TYPE_ANY)) sizer_11.Add(self.bitmap_nofile, 1, wx.ALIGN_CENTER | wx.ALL | wx.EXPAND, 5) self.bitmap_art = wx.StaticBitmap(self.notebook_1_wxStaticBitmap, wx.ID_ANY, wx.ArtProvider.GetBitmap(wx.ART_PRINT, wx.ART_OTHER, (32, 32))) sizer_11.Add(self.bitmap_art, 1, wx.ALIGN_CENTER | wx.ALL | wx.EXPAND, 5) self.notebook_1_wxStaticLine = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxStaticLine, _("wxStaticLine")) sizer_9 = wx.BoxSizer(wx.VERTICAL) sizer_10 = wx.BoxSizer(wx.HORIZONTAL) sizer_9.Add(sizer_10, 1, wx.EXPAND, 0) self.static_line_2 = wx.StaticLine(self.notebook_1_wxStaticLine, wx.ID_ANY, style=wx.LI_VERTICAL) sizer_10.Add(self.static_line_2, 1, wx.ALL | wx.EXPAND, 5) self.static_line_3 = wx.StaticLine(self.notebook_1_wxStaticLine, wx.ID_ANY, style=wx.LI_VERTICAL) sizer_10.Add(self.static_line_3, 1, wx.ALL | wx.EXPAND, 5) self.static_line_4 = wx.StaticLine(self.notebook_1_wxStaticLine, wx.ID_ANY) sizer_9.Add(self.static_line_4, 1, wx.ALL | wx.EXPAND, 5) self.static_line_5 = wx.StaticLine(self.notebook_1_wxStaticLine, wx.ID_ANY) sizer_9.Add(self.static_line_5, 1, wx.ALL | wx.EXPAND, 5) self.notebook_1_wxStaticText = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxStaticText, _("wxStaticText")) grid_sizer_3 = wx.FlexGridSizer(1, 3, 0, 0) self.label_1 = wx.StaticText(self.notebook_1_wxStaticText, wx.ID_ANY, _("red text (RGB)"), style=wx.ALIGN_CENTER) self.label_1.SetForegroundColour(wx.Colour(255, 0, 0)) grid_sizer_3.Add(self.label_1, 1, wx.ALL | wx.EXPAND, 5) self.label_4 = wx.StaticText(self.notebook_1_wxStaticText, wx.ID_ANY, _("black on red (RGB)"), style=wx.ALIGN_CENTER) self.label_4.SetBackgroundColour(wx.Colour(255, 0, 0)) self.label_4.SetToolTipString(_("Background colour won't show, check documentation for more details")) grid_sizer_3.Add(self.label_4, 1, wx.ALL | wx.EXPAND, 5) self.label_5 = wx.StaticText(self.notebook_1_wxStaticText, wx.ID_ANY, _("green on pink (RGB)"), style=wx.ALIGN_CENTER) self.label_5.SetBackgroundColour(wx.Colour(255, 0, 255)) self.label_5.SetForegroundColour(wx.Colour(0, 255, 0)) self.label_5.SetToolTipString(_("Background colour won't show, check documentation for more details")) grid_sizer_3.Add(self.label_5, 1, wx.ALL | wx.EXPAND, 5) self.notebook_1_Spacer = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_Spacer, _("Spacer")) grid_sizer_4 = wx.FlexGridSizer(1, 3, 0, 0) self.label_3 = wx.StaticText(self.notebook_1_Spacer, wx.ID_ANY, _("Two labels with a")) grid_sizer_4.Add(self.label_3, 1, wx.ALL | wx.EXPAND, 5) grid_sizer_4.Add((60, 20), 1, wx.ALL | wx.EXPAND, 5) self.label_2 = wx.StaticText(self.notebook_1_Spacer, wx.ID_ANY, _("spacer between")) grid_sizer_4.Add(self.label_2, 1, wx.ALL | wx.EXPAND, 5) self.notebook_1_wxTextCtrl = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxTextCtrl, _("wxTextCtrl")) sizer_18 = wx.BoxSizer(wx.HORIZONTAL) self.text_ctrl = wx.TextCtrl(self.notebook_1_wxTextCtrl, wx.ID_ANY, _("This\nis\na\nmultiline\nwxTextCtrl"), style=wx.TE_CHARWRAP | wx.TE_MULTILINE | wx.TE_WORDWRAP) sizer_18.Add(self.text_ctrl, 1, wx.ALL | wx.EXPAND, 5) self.notebook_1_wxToggleButton = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxToggleButton, _("wxToggleButton")) sizer_23 = wx.BoxSizer(wx.HORIZONTAL) self.button_2 = wx.ToggleButton(self.notebook_1_wxToggleButton, wx.ID_ANY, _("Toggle Button 1")) sizer_23.Add(self.button_2, 1, wx.ALL, 5) self.button_4 = wx.ToggleButton(self.notebook_1_wxToggleButton, wx.ID_ANY, _("Toggle Button 2"), style=wx.BU_BOTTOM | wx.BU_EXACTFIT) sizer_23.Add(self.button_4, 1, wx.ALL, 5) self.notebook_1_wxTreeCtrl = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxTreeCtrl, _("wxTreeCtrl")) sizer_24 = wx.BoxSizer(wx.HORIZONTAL) self.tree_ctrl_1 = wx.TreeCtrl(self.notebook_1_wxTreeCtrl, wx.ID_ANY, style=0) sizer_24.Add(self.tree_ctrl_1, 1, wx.ALL | wx.EXPAND, 5) self.static_line_1 = wx.StaticLine(self, wx.ID_ANY) sizer_1.Add(self.static_line_1, 0, wx.ALL | wx.EXPAND, 5) sizer_2 = wx.FlexGridSizer(1, 2, 0, 0) sizer_1.Add(sizer_2, 0, wx.ALIGN_RIGHT, 0) self.button_5 = wx.Button(self, wx.ID_CLOSE, "") sizer_2.Add(self.button_5, 0, wx.ALIGN_RIGHT | wx.ALL, 5) self.button_1 = wx.Button(self, wx.ID_OK, "", style=wx.BU_TOP) sizer_2.Add(self.button_1, 0, wx.ALIGN_RIGHT | wx.ALL, 5) self.notebook_1_wxTreeCtrl.SetSizer(sizer_24) self.notebook_1_wxToggleButton.SetSizer(sizer_23) self.notebook_1_wxTextCtrl.SetSizer(sizer_18) self.notebook_1_Spacer.SetSizer(grid_sizer_4) self.notebook_1_wxStaticText.SetSizer(grid_sizer_3) self.notebook_1_wxStaticLine.SetSizer(sizer_9) self.notebook_1_wxStaticBitmap.SetSizer(sizer_11) self.splitter_2_pane_2.SetSizer(sizer_33) self.splitter_2_pane_1.SetSizer(sizer_32) self.splitter_2.SplitVertically(self.splitter_2_pane_1, self.splitter_2_pane_2) self.notebook_1_wxSplitterWindow_vertical.SetSizer(sizer_25) self.splitter_1_pane_2.SetSizer(sizer_31) self.splitter_1_pane_1.SetSizer(sizer_30) self.splitter_1.SplitHorizontally(self.splitter_1_pane_1, self.splitter_1_pane_2) self.notebook_1_wxSplitterWindow_horizontal.SetSizer(sizer_29) self.notebook_1_wxSpinCtrl.SetSizer(sizer_14) self.notebook_1_wxSpinButton.SetSizer(sizer_16) self.notebook_1_wxSlider.SetSizer(sizer_22) self.notebook_1_wxRadioButton.SetSizer(sizer_8) self.notebook_1_wxRadioBox.SetSizer(grid_sizer_1) self.notebook_1_wxListCtrl.SetSizer(sizer_3) self.notebook_1_wxListBox.SetSizer(sizer_4) self.notebook_1_wxHyperlinkCtrl.SetSizer(sizer_20) self.notebook_1_wxGrid.SetSizer(sizer_19) self.notebook_1_wxGauge.SetSizer(sizer_15) self.notebook_1_wxDatePickerCtrl.SetSizer(sizer_17) self.notebook_1_wxComboBox.SetSizer(sizer_6) self.notebook_1_wxChoice.SetSizer(sizer_5) self.notebook_1_wxCheckListBox.SetSizer(sizer_26) self.notebook_1_wxCheckBox.SetSizer(sizer_21) self.notebook_1_wxCalendarCtrl.SetSizer(sizer_12) self.notebook_1_wxButton.SetSizer(sizer_28) sizer_13.AddGrowableRow(0) sizer_13.AddGrowableRow(1) sizer_13.AddGrowableCol(0) sizer_13.AddGrowableCol(1) self.notebook_1_wxBitmapButton.SetSizer(sizer_13) sizer_1.AddGrowableRow(0) sizer_1.AddGrowableCol(0) self.SetSizer(sizer_1) sizer_1.SetSizeHints(self) self.Layout() self.Centre() self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.OnNotebookPageChanged, self.notebook_1) self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGING, self.OnNotebookPageChanging, self.notebook_1) self.Bind(wx.EVT_BUTTON, self.onStartConverting, self.button_1)
def _create_gui(self): paramsPreviewSizer = wx.FlexGridSizer(cols=1) paramsPreviewSizer.AddGrowableRow(0, 1) paramsPreviewSizer.AddGrowableRow(1, 2) paramsPreviewSizer.AddGrowableCol(0) paramsSizer = wx.FlexGridSizer(cols=1) paramsSizer.AddGrowableCol(0) paramsSizer.AddGrowableRow(4) # Style name style_names = sorted(self._styles.keys()) style_names.insert(0, self.NONE_STYLE) style_name_label = wx.StaticText(self, label=_('Style name')) self._style_name_combo = wx.ComboBox(self, choices=style_names) self._style_name_combo.SetSelection(0) style_name_sizer = wx.FlexGridSizer(cols=2) style_name_sizer.AddGrowableCol(1) style_name_sizer.Add(style_name_label, flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=4) style_name_sizer.Add(self._style_name_combo, flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND | wx.ALL, border=4) paramsSizer.Add(style_name_sizer, flag=wx.EXPAND) # Text color self._text_color_check = wx.CheckBox(self, label=_('Text color')) self._text_color_picker = ColorPicker(self) text_color_sizer = wx.FlexGridSizer(cols=2) text_color_sizer.AddGrowableCol(1) text_color_sizer.Add(self._text_color_check, flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, border=4) text_color_sizer.Add(self._text_color_picker, flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.ALL, border=4) paramsSizer.Add(text_color_sizer, flag=wx.EXPAND) # Text background self._text_background_check = wx.CheckBox(self, label=_('Text background')) self._text_background_picker = ColorPicker(self, colour=wx.WHITE) text_background_sizer = wx.FlexGridSizer(cols=2) text_background_sizer.AddGrowableCol(1) text_background_sizer.Add(self._text_background_check, flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, border=4) text_background_sizer.Add(self._text_background_picker, flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.ALL, border=4) paramsSizer.Add(text_background_sizer, flag=wx.EXPAND) # Custom CSS self._custom_CSS_check = wx.CheckBox(self, label=_('Custom CSS')) self._custom_CSS_editor = CSSEditor(self) self._custom_CSS_editor.SetMinSize((-1, 100)) paramsSizer.Add(self._custom_CSS_check, flag=wx.ALIGN_CENTER_VERTICAL) paramsSizer.Add(self._custom_CSS_editor, flag=wx.EXPAND | wx.LEFT, border=16) paramsPreviewSizer.Add(paramsSizer, flag=wx.EXPAND | wx.ALL, border=4) # HTML browser self._browser = getOS().getHtmlRender(self) paramsPreviewSizer.Add(self._browser, flag=wx.EXPAND | wx.ALL, border=4) # Ok / Cancel buttons okCancel = self.CreateButtonSizer(wx.OK | wx.CANCEL) paramsPreviewSizer.Add(okCancel, flag=wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_BOTTOM, border=4) self.SetSizer(paramsPreviewSizer)
def __init__(self, *args, **kwds): # begin wxGlade: MyFrame2.__init__ #-----------------Special Vars to conjugate---------- self.verb = u"" self.root = u"" self.future_type = FATHA self.transitive = True self.bab_sarf = 0 self.verb_obj = None self.listetenses = [] #----------------------------------------- kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.myTitle = wx.StaticText(self, -1, _("Arabic Verb Conjugtion"), style=wx.ALIGN_CENTRE) self.BConjugate = wx.Button(self, -1, _("Conjugate")) self.BoxVerb = wx.TextCtrl(self, -1, u"رَجَعَ") #self.BoxVerb.Value=u"رَجَعَ"; self.label_1 = wx.StaticText(self, -1, _("Verb"), style=wx.ALIGN_CENTRE) self.RTransitive = wx.RadioBox( self, -1, _("Transitive"), choices=[_("Transitive"), _("Intransitive")], majorDimension=0, style=wx.RA_SPECIFY_COLS) self.CActiveFuture = wx.CheckBox(self, -1, _("Active Future Tense")) self.CActivePast = wx.CheckBox(self, -1, _("Active Past Tense")) self.label_2 = wx.StaticText(self, -1, _("Root")) self.TRoot = wx.TextCtrl(self, -1, u"رجع") self.CPassiveFuture = wx.CheckBox(self, -1, _("Passive Future Tense")) self.CPassivePast = wx.CheckBox(self, -1, _("Passive Past Tense")) self.TFutureMode = wx.StaticText(self, -1, _("Conjugation future Mode")) self.ListFutureMode = wx.ComboBox( self, -1, choices=[_("FATHA"), _("DAMMA"), _("KASRA"), _("SUKUN")], style=wx.CB_DROPDOWN) self.CImperative = wx.CheckBox(self, -1, _("ImperativeTense")) self.CAllTense = wx.CheckBox(self, -1, _("All Tense")) self.TConjugation = wx.TextCtrl(self, -1, "", style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH | wx.TE_RICH2) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.ConjugateOneVerb, self.BConjugate) self.Bind(wx.EVT_RADIOBOX, self.SetTransitive, self.RTransitive) self.Bind(wx.EVT_CHECKBOX, self.SetActiveFuture, self.CActiveFuture) self.Bind(wx.EVT_CHECKBOX, self.SetActivePaste, self.CActivePast) self.Bind(wx.EVT_TEXT_ENTER, self.SetRoot, self.TRoot) self.Bind(wx.EVT_TEXT, self.SetRoot, self.TRoot) self.Bind(wx.EVT_CHECKBOX, self.SetPassiveFuture, self.CPassiveFuture) self.Bind(wx.EVT_CHECKBOX, self.SetPassivePast, self.CPassivePast) self.Bind(wx.EVT_CHECKBOX, self.SetImperative, self.CImperative) self.Bind(wx.EVT_CHECKBOX, self.SetAllTense, self.CAllTense)
def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title, wx.DefaultPosition, wx.Size(self.AppSettings.MainWindowWidth, self.AppSettings.MainWindowHeight)) # CONTROL: Main Panel (Panel), # PARENT: DictionaryWindowView (wx.Frame) # LAYOUT: Box Sizer (Vertical) mainPanel = wx.Panel( parent = self, id = wx.ID_ANY, ) mainPanelVBoxSizer = wx.BoxSizer(orient = wx.VERTICAL) mainPanel.SetSizer(sizer = mainPanelVBoxSizer) # CONTROL: Toolbar Panel (wx.Panel) # PARENT: Main Panel (wx.Panel) # LAYOUT: Box Sizer (Horizontal) toolBarPanel = wx.Panel( parent = mainPanel, id = wx.ID_ANY ) mainPanelVBoxSizer.Add( item = toolBarPanel, proportion = 0, flag = wx.EXPAND | wx.LEFT | wx.TOP | wx.RIGHT | wx.BOTTOM, border = self.AppSettings.BorderThickness * 2 ) toolBarPanelHBoxSizer = wx.BoxSizer(orient = wx.HORIZONTAL) toolBarPanel.SetSizer(sizer = toolBarPanelHBoxSizer) # CONTROL: Back Button (wx.BitmapButton) # PARENT: Toolbar Panel (wx.Panel) # PURPOSE: To show previous word that, user looked up before self._backButton = wx.BitmapButton( parent = toolBarPanel, id = wx.ID_ANY, bitmap = wx.Bitmap(name = self.AppSettings.IconLocation + "go-previous.png") ) self._backButton.SetToolTip(tip = wx.ToolTip( tip = self.AppSettings.ToolTip_BackButton) ) toolBarPanelHBoxSizer.Add( item = self._backButton, proportion = 0, flag = wx.LEFT ) # CONTROL: Next Button (wx.BitmapButton) # PARENT: Toolbar Panel (wx.Panel) # PURPOSE: To show next word that, user searched already self._nextButton = wx.BitmapButton( parent = toolBarPanel, id = wx.ID_ANY, bitmap = wx.Bitmap(name = self.AppSettings.IconLocation + "go-next.png") ) self._nextButton.SetToolTip(tip = wx.ToolTip( tip = self.AppSettings.ToolTip_NextButton) ) toolBarPanelHBoxSizer.Add( item = self._nextButton, proportion = 0, flag = wx.LEFT ) # CONTROL: From Static Text (wx.TextCtrl) # PARENT: Toolbar Panel (wx.Panel) fromStaticText = wx.StaticText( parent = toolBarPanel, id = wx.ID_ANY, label = self.AppSettings.StaticText_From ) toolBarPanelHBoxSizer.Add( item = fromStaticText, proportion = 0, flag = wx.LEFT | wx.CENTER, border = self.AppSettings.BorderThickness * 3 ) # CONTROL: From Language ComboBox (wx.ComboBox) # PARENT: ToolBar Panel (wx.Panel) # PURPOSE: To select a language for searching word self._fromComboBox = wx.ComboBox( parent = toolBarPanel, id = wx.ID_ANY, value = self.AppSettings.Language[self.AppSettings.CurrentlySelectedLanguage[0]], choices = self.AppSettings.Language, style = wx.CB_READONLY ) toolBarPanelHBoxSizer.Add( item = self._fromComboBox, proportion = 0, flag = wx.LEFT | wx.CENTER, border = self.AppSettings.BorderThickness ) # CONTROL: To Static Text (wx.TextCtrl) # PARENT: Toolbar Panel (wx.Panel) toStaticText = wx.StaticText( parent = toolBarPanel, id = wx.ID_ANY, label = self.AppSettings.StaticText_To ) toolBarPanelHBoxSizer.Add( item = toStaticText, proportion = 0, flag = wx.LEFT | wx.CENTER, border = self.AppSettings.BorderThickness * 2 ) # CONTROL: From Language ComboBox (wx.ComboBox) # PARENT: ToolBar Panel (wx.Panel) # PURPOSE: To select a language for getting the meaning of word self._toComboBox = wx.ComboBox( parent = toolBarPanel, id = wx.ID_ANY, value = self.AppSettings.Language[self.AppSettings.CurrentlySelectedLanguage[1]], choices = self.AppSettings.Language, style = wx.CB_READONLY ) toolBarPanelHBoxSizer.Add( item = self._toComboBox, proportion = 0, flag = wx.LEFT | wx.CENTER, border = self.AppSettings.BorderThickness ) # CONTROL: Click and Type Button (wx.BitmapButton) # PARENT: Toolbar Panel (wx.Panel) # PURPOSE: To type bengali word by mouse click self._clickAndTypeButton = wx.BitmapButton( parent = toolBarPanel, id = wx.ID_ANY, bitmap = wx.Bitmap(name = self.AppSettings.IconLocation + "keyboard.png") ) self._clickAndTypeButton.SetToolTip(tip = wx.ToolTip( tip = self.AppSettings.ToolTip_ClickANdTypeButton) ) toolBarPanelHBoxSizer.Add( item = self._clickAndTypeButton, proportion = 0, flag = wx.LEFT, border = self.AppSettings.BorderThickness * 3 ) # CONTROL: About Button (wx.BitmapButton) # PARENT: Toolbar Panel (wx.Panel) # PURPOSE: To show Application Version, License and Credits self._aboutButton = wx.BitmapButton( parent = toolBarPanel, id = wx.ID_ANY, bitmap = wx.Bitmap(name = self.AppSettings.IconLocation + "help-about.png") ) self._aboutButton.SetToolTip(tip = wx.ToolTip( tip = self.AppSettings.ToolTip_AboutButton) ) toolBarPanelHBoxSizer.Add( item = self._aboutButton, proportion = 0, flag = wx.LEFT ) # CONTROL: Main Body Splitter (Proportional Splitter) # LAYOUT: Vertical self._mainBodySplitter = ProportionalSplitter( parent = mainPanel, id = wx.ID_ANY, proportion = self.AppSettings.SplitterProportion ) mainPanelVBoxSizer.Add( item = self._mainBodySplitter, proportion = 1, flag = wx.EXPAND | wx.LEFT | wx.TOP | wx.RIGHT | wx.BOTTOM, border = self.AppSettings.BorderThickness * 2 ) # CONTROL: Word List Panel (wx.Panel) # PARENT: Main Body Splitter (Proportional Splitter) # LAYOUT: Box Layout (Vertical) wordListPanel = wx.Panel( parent = self._mainBodySplitter, id = wx.ID_ANY ) wordListPanelVBoxSizer = wx.BoxSizer(orient = wx.VERTICAL) wordListPanel.SetSizer(sizer = wordListPanelVBoxSizer) # CONTROL: Word Meaning Rich TextCtrl (wx.richtext.RichTextCtrl) # PARENT: Main Body Splitter (ProportionalSplitter) # PURPOSE: To show word meaning that was searched self._wordMeaningRichTextCtrl = rt.RichTextCtrl( parent = self._mainBodySplitter, id = wx.ID_ANY ) self._wordMeaningRichTextCtrl.SetEditable(editable = False) self._mainBodySplitter.SplitVertically( win1 = wordListPanel, win2 = self._wordMeaningRichTextCtrl ) # CONTROL: Word Search Ctrl (wx.SearhCtrl) # PARENT: Word List Panel # PURPOSE: For searching word self._wordSearchCtrl = wx.SearchCtrl( parent = wordListPanel, id = wx.ID_ANY ) self._wordSearchCtrl.SetFocus() wordListPanelVBoxSizer.Add( item = self._wordSearchCtrl, proportion = 0, flag = wx.EXPAND | wx.BOTTOM, border = self.AppSettings.BorderThickness * 2 ) # CONTROL: Word List Ctrl (wx.ListBox) # PARENT: Word List Panel # PURPOSE: To show word list self._wordListBox = wx.ListBox( parent = wordListPanel, id = wx.ID_ANY ) wordListPanelVBoxSizer.Add( item = self._wordListBox, proportion = 1, flag = wx.EXPAND | wx.ALL ) # Initializing self._defaultFont = self._wordListBox.GetFont() self.LoadLibrary() # Loading Library self._backButton.Enable(enable = False) self._nextButton.Enable(enable = False) # Retrieving word that was searched last time when application was closed if (self.AppSettings.LastWordIndex != None): self._wordListBox.SetSelection(self.AppSettings.LastWordIndex) self._wordListBox.EnsureVisible(self.AppSettings.LastWordIndex) self.GetWordDefinition() # Adding that last word to history CurrentWordSearchHistory.append( WordSearchHistory( wordIndex = self.AppSettings.LastWordIndex, originLanguage = self.AppSettings.CurrentlySelectedLanguage[0], translatedLanguage = self.AppSettings.CurrentlySelectedLanguage[1] ) ) # EVENT: # EVENT FOR: DictionaryWindow self.Bind( event = wx.EVT_CLOSE, handler = self.OnDictionaryWindowClosed, id = self.GetId() ) # EVENT FOR: Back Button self.Bind( event = wx.EVT_BUTTON, handler = self.OnBackButtonClicked, id = self._backButton.GetId() ) # EVENT FOR: Next Button self.Bind( event = wx.EVT_BUTTON, handler = self.OnNextButtonClicked, id = self._nextButton.GetId() ) # EVENT FOR: FromComboBox self.Bind( event = wx.EVT_COMBOBOX, handler = self.OnFromComboBoxSelectionChanged, id = self._fromComboBox.GetId() ) # EVENT FOR: ToComboBox self.Bind( event = wx.EVT_COMBOBOX, handler = self.OnToComboBoxSelectionChanged, id = self._toComboBox.GetId() ) # EVENT FOR: AboutButton self.Bind( event = wx.EVT_BUTTON, handler = self.OnAboutButtonClicked, id = self._aboutButton.GetId() ) # EVENT FOR: WordListBox self.Bind( event = wx.EVT_LISTBOX, handler = self.OnWordListBoxSelectionChanged, id = self._wordListBox.GetId() ) # EVENT FOR: WordSearchCtrl (while typing) self.Bind( event = wx.EVT_TEXT, handler = self.OnSearching, id = self._wordSearchCtrl.GetId() ) # EVENT FOR: ClickAndTypeButton self.Bind( event = wx.EVT_BUTTON, handler = self.OnClickAndTypeButtonClicked, id = self._clickAndTypeButton.GetId() )
def __init__(self, parent, size=wx.DefaultSize): wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY, size=size) self.parent = parent self.status = STATUS_DISABLED self.killedAlreadyFlag = False self.command = None sizer = wx.BoxSizer(wx.HORIZONTAL) self.devices = [DEVICE_NONE_SELECTED ] + [device['name'] for device in self.parent.devices] self.numDevices = ['1', '2', '3', '4', '5', '6'] self.deviceLabel = wx.ToggleButton(self, -1, label=parent.deviceLabel, size=(68, -1)) self.deviceLabel.SetFont( wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD)) #self.deviceLabel.SetDefaultStyle(wx.TextAttr("BLACK", wx.NullColour, wx.Font(10, wx.TELETYPE, wx.NORMAL, wx.NORMAL, False))) self.deviceLabel.Bind(wx.EVT_TOGGLEBUTTON, self.onDeviceToggle) self.deviceCombo = wx.ComboBox(self, size=(200, 26), choices=self.devices, style=wx.CB_READONLY) self.deviceCombo.Bind(wx.EVT_COMBOBOX, self.onDeviceSelected) self.deviceNum = wx.ComboBox(self, size=(30, 26), choices=self.numDevices, style=wx.CB_READONLY) self.deviceNum.Bind(wx.EVT_COMBOBOX, self.onNumDeviceSelected) if self.parent.activeDevice and self.parent.activeDevice != DEVICE_NONE_SELECTED: self.deviceCombo.SetValue(self.parent.activeDevice) self.enableDevice(True) else: self.deviceCombo.SetValue(DEVICE_NONE_SELECTED) self.enableDevice(False) if self.parent.numDevice: self.deviceNum.SetValue(self.parent.numDevice) else: self.deviceNum.SetValue(self.numDevices[0]) devEditor = wx.Button(self, wx.ID_ANY, size=(34, -1)) devEditor.SetBitmap( wx.Bitmap(FrameMYR.FrameMYRClass.RESOURCE_PATH + 'img/edit16.ico')) devEditor.SetToolTip( wx.ToolTip("Edit " + parent.deviceLabel + " parameters")) devEditor.Bind(wx.EVT_BUTTON, self.onDeviceEdit) sizer.Add(self.deviceLabel, 0, wx.EXPAND | wx.TOP, -1) sizer.Add(wx.StaticText(self, wx.ID_ANY, size=(34, -1)), 0, wx.EXPAND, 0) sizer.Add(self.deviceCombo, 10, wx.EXPAND | wx.BOTTOM | wx.ALIGN_BOTTOM, 1) sizer.Add(wx.StaticText(self, id=wx.ID_ANY, size=(6, -1)), 1, wx.EXPAND, 0) sizer.Add( wx.StaticText(self, label=" x ", id=wx.ID_ANY, size=(-1, -1)), 0, wx.TOP, 4) sizer.Add(self.deviceNum, 0, wx.EXPAND | wx.BOTTOM | wx.ALIGN_BOTTOM, 1) sizer.Add(wx.StaticText(self, wx.ID_ANY, size=(34, -1)), 1, wx.EXPAND, 0) sizer.Add(devEditor, 0, wx.EXPAND | wx.TOP, -1) sizer.Add(wx.StaticText(self, wx.ID_ANY, size=(80, -1)), 1, wx.EXPAND, 0) self.SetSizer(sizer)
def MainToolbar(root, parentpanel = None, use_wrapsizer = False): if not parentpanel: parentpanel = root.panel if root.settings.lockbox: root.locker = wx.CheckBox(parentpanel, label = _("Lock") + " ") root.locker.Bind(wx.EVT_CHECKBOX, root.lock) root.locker.SetToolTip(wx.ToolTip(_("Lock graphical interface"))) glob = wx.BoxSizer(wx.HORIZONTAL) parentpanel = root.newPanel(parentpanel) glob.Add(parentpanel, 1, flag = wx.EXPAND) glob.Add(root.locker, 0, flag = wx.ALIGN_CENTER) ToolbarSizer = wx.WrapSizer if use_wrapsizer else wx.BoxSizer self = ToolbarSizer(wx.HORIZONTAL) root.rescanbtn = make_autosize_button(parentpanel, _("Port"), root.rescanports, _("Communication Settings\nClick to rescan ports")) self.Add(root.rescanbtn, 0, wx.TOP | wx.LEFT, 0) root.serialport = wx.ComboBox(parentpanel, -1, choices = root.scanserial(), style = wx.CB_DROPDOWN) root.serialport.SetToolTip(wx.ToolTip(_("Select Port Printer is connected to"))) root.rescanports() self.Add(root.serialport) self.Add(wx.StaticText(parentpanel, -1, "@"), 0, wx.RIGHT | wx.ALIGN_CENTER, 0) root.baud = wx.ComboBox(parentpanel, -1, choices = ["2400", "9600", "19200", "38400", "57600", "115200", "250000"], style = wx.CB_DROPDOWN, size = (110, -1)) root.baud.SetToolTip(wx.ToolTip(_("Select Baud rate for printer communication"))) try: root.baud.SetValue("115200") root.baud.SetValue(str(root.settings.baudrate)) except: pass self.Add(root.baud) if not hasattr(root, "connectbtn"): root.connectbtn = make_autosize_button(parentpanel, _("Connect"), root.connect, _("Connect to the printer")) root.statefulControls.append(root.connectbtn) else: root.connectbtn.Reparent(parentpanel) self.Add(root.connectbtn) if not hasattr(root, "resetbtn"): root.resetbtn = make_autosize_button(parentpanel, _("Reset"), root.reset, _("Reset the printer")) root.statefulControls.append(root.resetbtn) else: root.resetbtn.Reparent(parentpanel) self.Add(root.resetbtn) if not hasattr(root, "shutdownbtn"): root.shutdownbtn = make_autosize_button(parentpanel, _("Auto off"), root.toggleautoshutdown, _("Shutdown printer after print")) root.statefulControls.append(root.shutdownbtn) else: root.shutdownbtn.Reparent(parentpanel) self.Add(root.shutdownbtn) self.AddStretchSpacer(prop = 1) root.loadbtn = make_autosize_button(parentpanel, _("Load file"), root.loadfile, _("Load a 3D model file"), self) root.sdbtn = make_autosize_button(parentpanel, _("SD"), root.sdmenu, _("SD Card Printing"), self) root.sdbtn.Reparent(parentpanel) root.printerControls.append(root.sdbtn) if not hasattr(root, "printbtn"): root.printbtn = make_autosize_button(parentpanel, _("Print"), root.printfile, _("Start Printing Loaded File")) root.statefulControls.append(root.printbtn) else: root.printbtn.Reparent(parentpanel) self.Add(root.printbtn) if not hasattr(root, "pausebtn"): root.pausebtn = make_autosize_button(parentpanel, _("Pause"), root.pause, _("Pause Current Print")) root.statefulControls.append(root.pausebtn) else: root.pausebtn.Reparent(parentpanel) self.Add(root.pausebtn) root.offbtn = make_autosize_button(parentpanel, _("Off"), root.off, _("Turn printer off"), self) root.printerControls.append(root.offbtn) self.AddStretchSpacer(prop = 4) if root.settings.lockbox: parentpanel.SetSizer(self) return glob else: return self
def _buidUISizer(self): """ Build the main UI Sizer. """ flagsR = wx.RIGHT | wx.ALIGN_CENTER_VERTICAL mSizer = wx.BoxSizer(wx.HORIZONTAL) gs = wx.FlexGridSizer(13, 2, 5, 5) gs.Add(wx.StaticText(self, label=' Frequency : '), flag=flagsR, border=2) self.genFieldlList['Freq'] = wx.TextCtrl(self, -1, "0.0") gs.Add(self.genFieldlList['Freq'], flag=flagsR, border=2) gs.Add(wx.StaticText(self, label=' Voltage : '), flag=flagsR, border=2) self.genFieldlList['Volt'] = wx.TextCtrl(self, -1, "0.0") gs.Add(self.genFieldlList['Volt'], flag=flagsR, border=2) gs.Add(wx.StaticText(self, label=' Frequency LED : '), flag=flagsR, border=2) self.genFieldlList['Fled'] = wx.ComboBox( self, -1, choices=['green', 'amber', 'red']) self.genFieldlList['Fled'].SetSelection(0) gs.Add(self.genFieldlList['Fled'], flag=flagsR, border=2) gs.Add(wx.StaticText(self, label=' Voltage LED : '), flag=flagsR, border=2) self.genFieldlList['Vled'] = wx.ComboBox( self, -1, choices=['green', 'amber', 'red']) self.genFieldlList['Vled'].SetSelection(0) gs.Add(self.genFieldlList['Vled'], flag=flagsR, border=2) gs.Add(wx.StaticText(self, label=' Motor LED : '), flag=flagsR, border=2) self.genFieldlList['Mled'] = wx.ComboBox( self, -1, choices=['green', 'amber', 'red']) self.genFieldlList['Mled'].SetSelection(0) gs.Add(self.genFieldlList['Mled'], flag=flagsR, border=2) gs.Add(wx.StaticText(self, label=' Pump LED : '), flag=flagsR, border=2) self.genFieldlList['Pled'] = wx.ComboBox( self, -1, choices=['green', 'amber', 'red']) self.genFieldlList['Pled'].SetSelection(0) gs.Add(self.genFieldlList['Pled'], flag=flagsR, border=2) gs.Add(wx.StaticText(self, label=' Smoke : '), flag=flagsR, border=2) self.genFieldlList['Smok'] = wx.ComboBox( self, -1, choices=['slow', 'fast', 'off']) self.genFieldlList['Smok'].SetSelection(0) gs.Add(self.genFieldlList['Smok'], flag=flagsR, border=2) gs.Add(wx.StaticText(self, label=' Siren : '), flag=flagsR, border=2) self.genFieldlList['Sirn'] = wx.ComboBox(self, -1, choices=['on', 'off']) self.genFieldlList['Sirn'].SetSelection(0) gs.Add(self.genFieldlList['Sirn'], flag=flagsR, border=2) gs.Add(wx.StaticText(self, label=' Pump speed : '), flag=flagsR, border=2) self.plcFieldList['Pspd'] = wx.ComboBox(self, -1, choices=['off', 'low', 'high']) self.plcFieldList['Pspd'].SetSelection(0) gs.Add(self.plcFieldList['Pspd'], flag=flagsR, border=2) gs.Add(wx.StaticText(self, label=' Moto speed : '), flag=flagsR, border=2) self.plcFieldList['Mspd'] = wx.ComboBox(self, -1, choices=['off', 'low', 'high']) self.plcFieldList['Mspd'].SetSelection(0) gs.Add(self.plcFieldList['Mspd'], flag=flagsR, border=2) gs.Add(wx.StaticText(self, label=' All sensor control : '), flag=flagsR, border=2) self.plcFieldList['Spwr'] = wx.ComboBox(self, -1, choices=['on', 'off']) self.plcFieldList['Spwr'].SetSelection(0) gs.Add(self.plcFieldList['Spwr'], flag=flagsR, border=2) gs.Add(wx.StaticText(self, label=' All power control : '), flag=flagsR, border=2) self.plcFieldList['Mpwr'] = wx.ComboBox(self, -1, choices=['on', 'off']) self.plcFieldList['Mpwr'].SetSelection(0) gs.Add(self.plcFieldList['Mpwr'], flag=flagsR, border=2) gs.AddSpacer(5) self.sendBt = wx.Button(self, label='Set') self.sendBt.Bind(wx.EVT_BUTTON, self.onSend) gs.Add(self.sendBt, flag=flagsR, border=2) mSizer.Add(gs, flag=flagsR, border=2) return mSizer
def __init__(self, parent, config, phoneid=0, *args, **kwds): # begin wxGlade: TalkbackDialog.__init__ kwds[ "style"] = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.THICK_FRAME wx.Dialog.__init__(self, parent, *args, **kwds) self.main_panel = wx.Panel(self, -1) self.info_label = wx.StaticText( self, -1, _("Please share your experiences with Wammu and Gammu which is backend library. When you fill in following form, other users can benefit from your experiences in Gammu Phone Database. Only information you see here will be submited." )) self.top_static_line = wx.StaticLine(self, -1) self.manufacturer_label = wx.StaticText(self.main_panel, -1, _("Manufacturer:"), style=wx.ALIGN_CENTRE) self.manufacturer_choice = wx.Choice(self.main_panel, -1, choices=[]) self.model_label = wx.StaticText(self.main_panel, -1, _("Phone model:")) self.model_text_ctrl = wx.TextCtrl(self.main_panel, -1, "") self.connection_label = wx.StaticText(self.main_panel, -1, _("Connection type:")) self.connection_combo_box = wx.ComboBox(self.main_panel, -1, choices=[], style=wx.CB_DROPDOWN) self.gammu_model_label = wx.StaticText( self.main_panel, -1, _("Model in gammu configuration:")) self.model_combo_box = wx.ComboBox(self.main_panel, -1, choices=[], style=wx.CB_DROPDOWN) self.features_label = wx.StaticText(self.main_panel, -1, _("Working features:")) self.features_button = wx.Button(self.main_panel, -1, _("Please select features...")) self.gammu_version_text_label = wx.StaticText(self.main_panel, -1, _("Gammu version:")) self.gammu_version_label = wx.StaticText(self.main_panel, -1, "") self.note_label = wx.StaticText(self.main_panel, -1, _("Note:")) self.note_text_ctrl = wx.TextCtrl(self.main_panel, -1, "", style=wx.TE_MULTILINE) self.name_label = wx.StaticText(self.main_panel, -1, _("Your name:")) self.name_text_ctrl = wx.TextCtrl(self.main_panel, -1, "") self.email_label = wx.StaticText(self.main_panel, -1, _("Your email:")) self.email_text_ctrl = wx.TextCtrl(self.main_panel, -1, "") self.mangle_label = wx.StaticText(self.main_panel, -1, _("Email displaying:"), style=wx.ALIGN_CENTRE) self.mangle_choice = wx.Choice( self.main_panel, -1, choices=[ _("Use [at] and [dot]"), _("Insert NOSPAM text at random position"), _("Display it normally"), _("Don't show email at all") ]) self.bottom_static_line = wx.StaticLine(self, -1) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.OnFeatures, self.features_button) # end wxGlade self.ns_string = '<%s>' % _('Not supported') self.connection_combo_box.Append(self.ns_string) for x in Wammu.Data.Connections: self.connection_combo_box.Append(x) for x in Wammu.Data.Models: self.model_combo_box.Append(x) for x in Wammu.Data.ManufacturerMap.keys(): self.manufacturer_choice.Append(x) self.wammu_cfg = config self.phoneid = phoneid self.features = [] self.gammu_version_label.SetLabel(gammu.Version()[0]) self.note_text_ctrl.SetValue( 'Report has been created using Wammu %s.\n' % Wammu.__version__) # Read phone name and manufacturer manufacturer = self.wammu_cfg.Read('/Phone-%d/Manufacturer' % phoneid) self.manufacturer_choice.SetStringSelection(manufacturer) model = self.wammu_cfg.Read('/Phone-%d/Model' % phoneid) self.model_text_ctrl.SetValue(model) # Set connection type which is being used section = self.wammu_cfg.ReadInt('/Gammu/Section') config = self.wammu_cfg.gammu.GetConfig(section) self.connection_combo_box.SetValue(config['Connection']) self.model_combo_box.SetValue(config['Model']) self.name_text_ctrl.SetValue(self.wammu_cfg.Read('/User/Name')) self.email_text_ctrl.SetValue(self.wammu_cfg.Read('/User/Email'))
def __init__(self, parent, title): self.log = logging.getLogger("FrmSettings") self.callbacks = { "on_apply": {}, "on_save": {}, "on_cancel": {}, } self.parent = parent self.title = title w, h = (250, 250) wx.Frame.__init__(self, self.parent, -1, self.title, wx.DefaultPosition, wx.Size(w, h)) self.CreateStatusBar() self.sizer = wx.GridBagSizer(8, 3) self.Connect(-1, -1, EVT_RESULT_CONNECTED_ID, self.OnConnected) self.Connect(-1, -1, EVT_RESULT_PLAYERS_ID, self.OnConnected) self.Connect(-1, -1, EVT_RESULT_CONNECTION_ID, self.OnConnected) self.BtnApply = wx.Button(self, -1, "Apply") self.BtnCancel = wx.Button(self, -1, "Cancel") self.BtnSave = wx.Button(self, -1, "Save") self.Bind(wx.EVT_BUTTON, self.OnCancel, id=self.BtnCancel.GetId()) self.Bind(wx.EVT_BUTTON, self.OnSave, id=self.BtnSave.GetId()) self.Bind(wx.EVT_BUTTON, self.OnApply, id=self.BtnApply.GetId()) self.sizer.Add(self.BtnApply, (8, 0), wx.DefaultSpan, wx.EXPAND) self.sizer.Add(self.BtnCancel, (8, 1), wx.DefaultSpan, wx.EXPAND) self.sizer.Add(self.BtnSave, (8, 2), wx.DefaultSpan, wx.EXPAND) label1 = wx.StaticText(self, -1, 'Host:') self.sizer.Add(label1, (0, 0), wx.DefaultSpan, wx.EXPAND) self.tcHost = wx.TextCtrl(self, -1) self.sizer.Add(self.tcHost, (0, 1), (1, 2), wx.EXPAND) label2 = wx.StaticText(self, -1, 'Port:') self.sizer.Add(label2, (1, 0), wx.DefaultSpan, wx.EXPAND) label3 = wx.StaticText(self, -1, 'Player:') self.sizer.Add(label3, (2, 0), wx.DefaultSpan, wx.EXPAND) self.scPort = wx.SpinCtrl(self, -1, unicode(9000), min=1, max=99999) self.sizer.Add(self.scPort, (1, 1), wx.DefaultSpan, wx.EXPAND) #self.statusbar = self.CreateStatusBar() #self.sizer.Add(self.statusbar, (9, 0),(2,9), wx.EXPAND) self.cbPlayer = wx.ComboBox(self, -1, style=wx.CB_READONLY) self.sizer.Add(self.cbPlayer, (2, 1), (1, 2), wx.EXPAND) self.sizer.AddGrowableRow(8) self.sizer.AddGrowableCol(0) self.sizer.AddGrowableCol(1) self.sizer.AddGrowableCol(2) self.SetSizerAndFit(self.sizer) self.icon = wxIcons.trayDefault.getIcon() self.SetIcon(self.icon) self.IconStatus = None self.IconSize = None self.model = None self.GuiModel = mdlFrmSettings() self.GuiModel.statusText.addCallback(self.onStatusText) self.GuiModel.host.addCallback(self.onHost) self.GuiModel.port.addCallback(self.onPort) self.CurrentStatusText = None
def __init__(self, parent, universe): wx.Panel.__init__(self, parent) self.universe = universe self.lblcentral_body_name = wx.StaticText(self, -1, "Universe name") self.lblcentral_body_SPICE_ID = wx.StaticText(self, -1, "Central body SPICE ID") self.lblcentral_body_radius = wx.StaticText(self, -1, "Central body radius (km)") self.lblcentral_body_J2 = wx.StaticText(self, -1, "Central body J2") self.lblmu = wx.StaticText(self, -1, "mu (km^3/s^2)") self.lblLU = wx.StaticText(self, -1, "characteristic length unit (km)") self.lblr_SOI = wx.StaticText(self, -1, "sphere of influence radius (km)") self.lblminimum_safe_distance = wx.StaticText(self, -1, "minimum safe distance from origin (km)") self.lblalpha0 = wx.StaticText(self, -1, "alpha0") self.lblalphadot = wx.StaticText(self, -1, "alphadot") self.lbldelta0 = wx.StaticText(self, -1, "delta0") self.lbldeltadot = wx.StaticText(self, -1, "deltadot") self.lblW0 = wx.StaticText(self, -1, "W0") self.lblWdot = wx.StaticText(self, -1, "Wdot") self.lblreference_frame = wx.StaticText(self, -1, "Reference frame for body orbit elements") self.txtcentral_body_name = wx.TextCtrl(self, -1, "Universe name", size = (300,-1)) self.txtcentral_body_SPICE_ID = wx.TextCtrl(self, -1, "Central body SPICE ID", size = (300,-1)) self.txtcentral_body_radius = wx.TextCtrl(self, -1, "Central body radius (km)", size = (300,-1)) self.txtcentral_body_J2 = wx.TextCtrl(self, -1, "central body J2", size = (300, -1)) self.txtmu = wx.TextCtrl(self, -1, "mu (km^3/s^2)", size = (300,-1)) self.txtLU = wx.TextCtrl(self, -1, "characteristic length unit (km)", size = (300,-1)) self.txtr_SOI = wx.TextCtrl(self, -1, "sphere of influence radius (km)", size = (300,-1)) self.txtminimum_safe_distance = wx.TextCtrl(self, -1, "minimum safe distance from origin (km)", size = (300,-1)) self.txtalpha0 = wx.TextCtrl(self, -1, "alpha0", size = (300,-1)) self.txtalphadot = wx.TextCtrl(self, -1, "alphadot", size = (300,-1)) self.txtdelta0 = wx.TextCtrl(self, -1, "delta0", size = (300,-1)) self.txtdeltadot = wx.TextCtrl(self, -1, "deltadot", size = (300,-1)) self.txtW0 = wx.TextCtrl(self, -1, "W0", size = (300,-1)) self.txtWdot = wx.TextCtrl(self, -1, "Wdot", size = (300,-1)) reference_frame_choices = ["ICRF", "Universe local frame"] self.cmbreference_frame = wx.ComboBox(self, -1, style=wx.CB_READONLY, choices=reference_frame_choices) maingrid = wx.FlexGridSizer(16, 2, 5, 5) maingrid.SetFlexibleDirection(wx.VERTICAL) maingrid.AddMany([self.lblcentral_body_name, self.txtcentral_body_name, self.lblcentral_body_SPICE_ID, self.txtcentral_body_SPICE_ID, self.lblcentral_body_radius, self.txtcentral_body_radius, self.lblcentral_body_J2, self.txtcentral_body_J2, self.lblmu, self.txtmu, self.lblLU, self.txtLU, self.lblr_SOI, self.txtr_SOI, self.lblminimum_safe_distance, self.txtminimum_safe_distance, self.lblalpha0, self.txtalpha0, self.lblalphadot, self.txtalphadot, self.lbldelta0, self.txtdelta0, self.lbldeltadot, self.txtdeltadot, self.lblW0, self.txtW0, self.lblWdot, self.txtWdot, self.lblreference_frame, self.cmbreference_frame]) #bind text fields to functions self.txtcentral_body_name.Bind(wx.EVT_KILL_FOCUS, self.Changecentralbodyname) self.txtcentral_body_SPICE_ID.Bind(wx.EVT_KILL_FOCUS, self.Changecentral_body_SPICE_ID) self.txtcentral_body_radius.Bind(wx.EVT_KILL_FOCUS, self.Changecentral_body_radius) self.txtcentral_body_radius.Bind(wx.EVT_KILL_FOCUS, self.Changecentral_body_J2) self.txtmu.Bind(wx.EVT_KILL_FOCUS, self.Changemu) self.txtLU.Bind(wx.EVT_KILL_FOCUS, self.ChangeLU) self.txtr_SOI.Bind(wx.EVT_KILL_FOCUS, self.Changer_SOI) self.txtminimum_safe_distance.Bind(wx.EVT_KILL_FOCUS, self.Changeminimum_safe_distance) self.txtalpha0.Bind(wx.EVT_KILL_FOCUS, self.Changealpha0) self.txtalphadot.Bind(wx.EVT_KILL_FOCUS, self.Changealphadot) self.txtdelta0.Bind(wx.EVT_KILL_FOCUS, self.Changedelta0) self.txtdeltadot.Bind(wx.EVT_KILL_FOCUS, self.Changedeltadot) self.txtW0.Bind(wx.EVT_KILL_FOCUS, self.ChangeW0) self.txtWdot.Bind(wx.EVT_KILL_FOCUS, self.ChangeWdot) self.cmbreference_frame.Bind(wx.EVT_COMBOBOX, self.Changereference_frame) #populate all fields self.UpdateUniversePanel() self.SetSizer(maingrid)
def __init__(self, parent): wx.Dialog.__init__(self, parent, title="Open URL") self.resetValue = None self.parent = parent panel = wx.Panel(self) sizer = wx.BoxSizer(wx.VERTICAL) sbox = wx.StaticBox(panel, label="") sboxSizer = wx.StaticBoxSizer(sbox, wx.VERTICAL) gridListBoxes = wx.GridBagSizer(2, 1) sboxSizer.Add(gridListBoxes, 1, wx.ALL | wx.EXPAND, 5) row = 0 for n, name in enumerate(["browser", "url"]): hSizerBtns = wx.BoxSizer(wx.HORIZONTAL) labels = ["add", "up", "down", "edit", "delete"] if name == "browser": labels.append("open") for label in labels: img = wx.Image("icons/{0}.png".format(label.lower().replace( " ", ""))) img = img.Rescale(32, 32, wx.IMAGE_QUALITY_HIGH) bmp = wx.Bitmap(img) btn = wx.Button(panel, label=label, name=name, style=wx.BU_EXACTFIT | wx.BU_NOTEXT) btn.Bind(wx.EVT_BUTTON, self.OnButton) btn.SetBitmap(bmp) hSizerBtns.Add(btn, 0, wx.ALL | wx.EXPAND, 5) gridListBoxes.Add(hSizerBtns, pos=(row, n), flag=wx.ALL | wx.EXPAND, border=5) row += 1 self.browserList = base.BaseList(panel) self.browserList.SetSingleStyle(wx.LC_EDIT_LABELS) self.browserList.SetSingleStyle(wx.LC_SINGLE_SEL, add=False) self.browserList.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnListItemActivated) self.browserList.InsertColumn(0, "Browsers") gridListBoxes.Add(self.browserList, pos=(row, 0), flag=wx.ALL | wx.EXPAND, border=5) self.urlPresetList = base.BaseList(panel) self.urlPresetList.SetSingleStyle(wx.LC_EDIT_LABELS) self.urlPresetList.SetSingleStyle(wx.LC_SINGLE_SEL, add=False) self.urlPresetList.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnListItemActivated) self.urlPresetList.InsertColumn(0, "URLs") gridListBoxes.Add(self.urlPresetList, pos=(row, 1), flag=wx.ALL | wx.EXPAND, border=5) gridListBoxes.AddGrowableRow(1) gridListBoxes.AddGrowableCol(0) gridListBoxes.AddGrowableCol(1) row += 1 for n, label in enumerate(["Set Browser Path", "Set URL Path"]): btn = wx.Button(panel, label=label) btn.Bind(wx.EVT_BUTTON, self.OnButton) gridListBoxes.Add(btn, pos=(row, n), flag=wx.ALL | wx.ALIGN_RIGHT, border=5) grid = wx.GridBagSizer(5, 5) row = 0 lbl = wx.StaticText(panel, label="Browser Path:") self.textBrowser = wx.TextCtrl(panel) btnAdd = wx.Button(panel, label="Add To Browsers") btnAdd.Bind(wx.EVT_BUTTON, self.OnButton) self.chkNewWin = wx.CheckBox(panel, label="New Window") self.chkAutoraise = wx.CheckBox(panel, label="Autoraise") self.chkAutoraise.SetValue(1) grid.Add(lbl, pos=(row, 0), flag=wx.ALL | wx.ALIGN_CENTRE, border=5) grid.Add(self.textBrowser, pos=(row, 1), flag=wx.ALL | wx.EXPAND, border=5) grid.Add(btnAdd, pos=(row, 2), flag=wx.ALL | wx.EXPAND, border=5) grid.Add(self.chkNewWin, pos=(row, 3), flag=wx.ALL | wx.EXPAND, border=5) grid.Add(self.chkAutoraise, pos=(row, 4), flag=wx.ALL | wx.EXPAND, border=5) row += 1 lbl = wx.StaticText(panel, label="Browser Type:") browsers = [b for b in advwebbrowser.klasses.keys()] self.cboxBrowserClass = wx.ComboBox(panel, choices=browsers, style=wx.CB_READONLY) self.cboxBrowserClass.Select(0) grid.Add(lbl, pos=(row, 0), flag=wx.ALL | wx.ALIGN_CENTRE, border=5) grid.Add(self.cboxBrowserClass, pos=(row, 1), flag=wx.ALL | wx.EXPAND, border=5) row += 1 lblCmd = wx.StaticText(panel, label="URL:") self.textUrl = wx.TextCtrl(panel) btnAdd = wx.Button(panel, label="Add To URL") btnAdd.Bind(wx.EVT_BUTTON, self.OnButton) btnReset = wx.Button(panel, label="Reset") btnReset.Bind(wx.EVT_BUTTON, self.OnButton) btnClear = wx.Button(panel, label="Clear") btnClear.Bind(wx.EVT_BUTTON, self.OnButton) grid.Add(lblCmd, pos=(row, 0), flag=wx.ALL | wx.ALIGN_CENTRE, border=5) grid.Add(self.textUrl, pos=(row, 1), flag=wx.ALL | wx.EXPAND, border=5) grid.Add(btnAdd, pos=(row, 2), flag=wx.ALL | wx.EXPAND, border=5) grid.Add(btnReset, pos=(row, 3), flag=wx.ALL | wx.EXPAND, border=5) grid.Add(btnClear, pos=(row, 4), flag=wx.ALL, border=5) grid.AddGrowableCol(1) sboxSizer.AddSpacer(10) sboxSizer.Add(grid, 0, wx.ALL | wx.EXPAND, 2) #----- hsizer = wx.BoxSizer(wx.HORIZONTAL) hsizer.AddStretchSpacer() btnCancel = wx.Button(panel, label="Cancel", id=wx.ID_CANCEL) btnCancel.Bind(wx.EVT_BUTTON, self.OnButton) self.btnAdd = wx.Button(panel, label="Ok", id=wx.ID_OK) self.btnAdd.Bind(wx.EVT_BUTTON, self.OnButton) # self.btnAdd.Disable() hsizer.Add(btnCancel, 0, wx.ALL | wx.EXPAND, 5) hsizer.Add(self.btnAdd, 0, wx.ALL | wx.EXPAND, 5) #add to main sizer sizer.Add(sboxSizer, 1, wx.ALL | wx.EXPAND, 5) sizer.Add(hsizer, 0, wx.ALL | wx.EXPAND, 5) panel.SetSizer(sizer) w, h = sizer.Fit(self) self.SetMinSize((w * 2, h * 1.5)) self.SetSize((w * 2, h * 1.5)) try: icon = wx.Icon("images/openurl.png") self.SetIcon(icon) except Exception as e: print(e)
def __init__(self, parent, log): wx.Frame.__init__(self, parent, -1, 'Test ToolBar', size=(600, 400)) self.log = log self.timer = None self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) client = wx.Panel(self) client.SetBackgroundColour(wx.WHITE) if FRAMETB: # Use the wxFrame internals to create the toolbar and # associate it all in one tidy method call. By using # CreateToolBar or SetToolBar the "client area" of the # frame will be adjusted to exclude the toolbar. tb = self.CreateToolBar(TBFLAGS) # Here's a 'simple' toolbar example, and how to bind it using SetToolBar() #tb = wx.ToolBarSimple(self, -1, wx.DefaultPosition, wx.DefaultSize, # wx.TB_HORIZONTAL | wx.NO_BORDER | wx.TB_FLAT) #self.SetToolBar(tb) # But we're doing it a different way here. else: # The toolbar can also be a child of another widget, and # be managed by a sizer, although there may be some # implications of doing this on some platforms. tb = wx.ToolBar(client, style=TBFLAGS) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(tb, 0, wx.EXPAND) client.SetSizer(sizer) log.write("Default toolbar tool size: %s\n" % tb.GetToolBitmapSize()) self.CreateStatusBar() tsize = (24, 24) new_bmp = wx.ArtProvider.GetBitmap(wx.ART_NEW, wx.ART_TOOLBAR, tsize) open_bmp = wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN, wx.ART_TOOLBAR, tsize) copy_bmp = wx.ArtProvider.GetBitmap(wx.ART_COPY, wx.ART_TOOLBAR, tsize) paste_bmp = wx.ArtProvider.GetBitmap(wx.ART_PASTE, wx.ART_TOOLBAR, tsize) tb.SetToolBitmapSize(tsize) #tb.AddTool(10, new_bmp, "New", "Long help for 'New'") tb.AddTool(10, "New", new_bmp, wx.NullBitmap, wx.ITEM_NORMAL, "New", "Long help for 'New'", None) self.Bind(wx.EVT_TOOL, self.OnToolClick, id=10) self.Bind(wx.EVT_TOOL_RCLICKED, self.OnToolRClick, id=10) #tb.AddTool(20, open_bmp, "Open", "Long help for 'Open'") tb.AddTool(20, "Open", open_bmp, wx.NullBitmap, wx.ITEM_NORMAL, "Open", "Long help for 'Open'", None) self.Bind(wx.EVT_TOOL, self.OnToolClick, id=20) self.Bind(wx.EVT_TOOL_RCLICKED, self.OnToolRClick, id=20) tb.AddSeparator() tb.AddTool(30, "Copy", copy_bmp, wx.NullBitmap, wx.ITEM_NORMAL, "Copy", "Long help for 'Copy'", None) self.Bind(wx.EVT_TOOL, self.OnToolClick, id=30) self.Bind(wx.EVT_TOOL_RCLICKED, self.OnToolRClick, id=30) tb.AddTool(40, "Paste", paste_bmp, wx.NullBitmap, wx.ITEM_NORMAL, "Paste", "Long help for 'Paste'", None) self.Bind(wx.EVT_TOOL, self.OnToolClick, id=40) self.Bind(wx.EVT_TOOL_RCLICKED, self.OnToolRClick, id=40) tb.AddSeparator() #tool = tb.AddCheckTool(50, images.Tog1.GetBitmap(), shortHelp="Toggle this") tool = tb.AddTool(50, "Checkable", images.Tog1.GetBitmap(), shortHelp="Toggle this", kind=wx.ITEM_CHECK) self.Bind(wx.EVT_TOOL, self.OnToolClick, id=50) self.Bind(wx.EVT_TOOL_ENTER, self.OnToolEnter) self.Bind(wx.EVT_TOOL_RCLICKED, self.OnToolRClick) # Match all self.Bind(wx.EVT_TIMER, self.OnClearSB) tb.AddSeparator() cbID = wx.Window.NewControlId() tb.AddControl( wx.ComboBox(tb, cbID, "", choices=["", "This", "is a", "wx.ComboBox"], size=(150, -1), style=wx.CB_DROPDOWN)) self.Bind(wx.EVT_COMBOBOX, self.OnCombo, id=cbID) tb.AddStretchableSpace() search = TestSearchCtrl(tb, size=(150, -1), doSearch=self.DoSearch) tb.AddControl(search) # Final thing to do for a toolbar is call the Realize() method. This # causes it to render (more or less, that is). tb.Realize()
def __init__(self, parent): wx.Frame.__init__(self, parent, size=wxSize(400, 650), title="RTL TOOL KIT") self.panel = wx.Panel(self, size=wxSize(400, 600), style=wx.RAISED_BORDER) file = open("at_cmds.txt") temparray = [] for line in file: line = line.rstrip('\n').rstrip('\r') temparray = line.split('#') at_cmds_array.append(temparray[0]) at_cmds_array_info.append(temparray[1]) file.close() #***************TIMERS************************ # timers #sms timer to send out msgs every X secound and how many to send by count value self.smstimer = wx.Timer(self) self.timerStartRtl = wx.Timer(self) self.timerKillRtl = wx.Timer(self) self.timerFetchTmsi = wx.Timer(self) self.sms_single_timer = wx.Timer(self) self.delivery_report_wait_timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.timerSendPDU, self.smstimer) self.Bind(wx.EVT_TIMER, self.timerStopRtl, self.timerKillRtl) self.Bind(wx.EVT_TIMER, self.timerSingleSendPDU, self.sms_single_timer) self.Bind(wx.EVT_TIMER, self.filterTmsiTimestampMode, self.delivery_report_wait_timer) #********************************************* #***************ARRAYS************************ gsm_scan_range = ['GSM900', 'GSM850', 'GSM-R', 'EGSM', 'DCS', 'PCS'] #********************************************* #***************BUTTONS*********************** self.btnautomode = wx.Button(self.panel, label="Automode", pos=(145, 55), size=(80, 25)) self.btnexttmsi = wx.Button(self.panel, label="Fetch", pos=(225, 55), size=(40, 25)) self.btncleardata = wx.Button(self.panel, label="Clean", pos=(225, 80), size=(40, 25)) #buttons self.btnreload = wx.Button(self.panel, label="reload", pos=(5, 15), size=(40, 20)) self.btn2g = wx.Button(self.panel, label="2G MODE", pos=(5, 40), size=(65, 25)) self.btngetinfo = wx.Button(self.panel, label="<GET INFO", pos=(215, 460), size=(60, 25)) self.btnkal = wx.Button(self.panel, label="KAL", pos=(5, 65), size=(65, 25)) self.btngqrx = wx.Button(self.panel, label="GQRX", pos=(70, 40), size=(65, 25)) self.btngetgqrxfreq = wx.Button(self.panel, label="Get Freq", pos=(70, 65), size=(65, 25)) self.btnwireshark = wx.Button(self.panel, label="wireshark", pos=(70, 90), size=(65, 25)) self.button = wx.Button(self.panel, label="Send>>", pos=(235, 5), size=(60, 25)) self.btntesting = wx.Button(self.panel, label="Testing", pos=(295, 5), size=(60, 25)) self.btnsms = wx.Button(self.panel, label="Send", pos=(255, 144), size=(40, 25)) self.btnrtl = wx.Button(self.panel, label="Start", pos=(295, 370), size=(45, 25)) self.btnrtlstop = wx.Button(self.panel, label="Stop", pos=(340, 370), size=(45, 25)) #gsm btns self.btngsmstart = wx.Button(self.panel, label="Start", pos=(295, 405), size=(45, 25)) self.btngsmstop = wx.Button(self.panel, label="Stop", pos=(340, 405), size=(45, 25)) self.btnpdusend = wx.Button(self.panel, label="Send", pos=(300, 515), size=(45, 25)) self.btnatstart = wx.Button(self.panel, label="Send Cmd", pos=(185, 562), size=(65, 25)) #********************************************* #***************EDIT FIELDS******************* #self.editcomport = wx.TextCtrl(self.panel,value="/dev/ttyUSB0",size=(90,25),pos=(45,600)) self.editname = wx.TextCtrl(self.panel, value="AT", size=(90, 25), pos=(145, 5)) self.editpingrange1 = wx.TextCtrl(self.panel, value="3", size=(25, 25), pos=(215, 30)) self.editpingrange2 = wx.TextCtrl(self.panel, value="8", size=(25, 25), pos=(270, 30)) self.editoffsetrange1 = wx.TextCtrl(self.panel, value="3", size=(25, 25), pos=(270, 95)) self.editoffsetrange2 = wx.TextCtrl(self.panel, value="6", size=(25, 25), pos=(325, 95)) self.editdebugtmsi = wx.TextCtrl(self.panel, size=(80, 65), value="", pos=(145, 80), style=wx.TE_MULTILINE) self.gsm_imsi = wx.TextCtrl(self.panel, value="", size=(160, 25), pos=(50, 460)) self.gsm_tmsi = wx.TextCtrl(self.panel, value="", size=(160, 25), pos=(50, 485)) self.gsm_key = wx.TextCtrl(self.panel, value="", size=(160, 25), pos=(50, 510)) #text boxes self.editnumber = wx.TextCtrl(self.panel, size=(140, -1), value="*+*+*+*+*+*", pos=(5, 140)) self.editsms = wx.TextCtrl(self.panel, size=(110, -1), value="message", pos=(145, 145)) self.editdebug = wx.TextCtrl(self.panel, size=(380, 150), value="Debug Data", pos=(5, 185), style=wx.TE_MULTILINE) #rtl textboxes self.editrtl_filename = wx.TextCtrl(self.panel, value="/tmp/capture.bin", size=(135, 25), pos=(5, 370)) self.editrtl_samplerate = wx.TextCtrl(self.panel, value="1.0", size=(45, 25), pos=(140, 370)) self.editrtl_freq = wx.TextCtrl(self.panel, value="927.55", size=(65, 25), pos=(185, 370)) self.editrtl_gain = wx.TextCtrl(self.panel, value="43", size=(45, 25), pos=(250, 370)) #gsm-receiver textboxes # self.editgsm_receiver = wx.TextCtrl(self.panel,value="/tmp/capture.bin",size=(140,25),pos=(5,440)) self.editgsm_samplerate = wx.TextCtrl(self.panel, value="1.0", size=(45, 25), pos=(5, 430)) self.editgsm_freq = wx.TextCtrl(self.panel, value="927.55", size=(65, 25), pos=(50, 430)) self.editgsm_gain = wx.TextCtrl(self.panel, value="43", size=(45, 25), pos=(115, 430)) self.editgsm_channel = wx.TextCtrl(self.panel, value="0B", size=(45, 25), pos=(160, 430)) self.editgsm_key = wx.TextCtrl(self.panel, value="0000000000000000", size=(160, 25), pos=(205, 430)) self.editpdu_NO = wx.TextCtrl(self.panel, value="123456789012", pos=(275, 475), size=(120, 20)) self.editpdu_PDU_SMS = wx.TextCtrl(self.panel, value="Hello", pos=(275, 495), size=(120, 20)) self.editpdu_MC = wx.TextCtrl(self.panel, value="2", pos=(275, 515), size=(25, 25)) self.editpdu_MD = wx.TextCtrl(self.panel, value="15", pos=(275, 540), size=(25, 25)) self.editpdu_MDR = wx.TextCtrl(self.panel, value="15", pos=(355, 540), size=(25, 25)) self.editat_cmds = wx.TextCtrl(self.panel, value="43", size=(65, 25), pos=(120, 562)) self.lbl_at_data = wx.TextCtrl(self.panel, value="", pos=(5, 593), size=(350, 50), style=wx.TE_MULTILINE) #********************************************* #***************LABELS************************ self.comporttext = wx.StaticText(self.panel, label="Com Port:", pos=(5, 5)) self.result = wx.StaticText(self.panel, label="", pos=(75, 5)) self.lblname = wx.StaticText(self.panel, label="Send Text:", pos=(5, 125)) self.lbdebugoutput = wx.StaticText(self.panel, label="Debug output", pos=(5, 170)) #ping counter data self.lbltmsi_sms_count = wx.StaticText(self.panel, label="Tmsi Counter:", pos=(145, 30)) self.lblpingrange = wx.StaticText(self.panel, label="Ping count:", pos=(145, 40)) self.lblpingrange3 = wx.StaticText(self.panel, label=">= <=", pos=(240, 35)) self.lbloffset = wx.StaticText(self.panel, label="Offsets", pos=(290, 80)) self.lbloffsetrange3 = wx.StaticText(self.panel, label=">= <=", pos=(297, 100)) self.lb_smsendcount_text = wx.StaticText(self.panel, label="Sent:", pos=(355, 520)) #rtl text self.lblrtl = wx.StaticText(self.panel, label="RTL Record:", pos=(5, 335)) self.lblrtlfile = wx.StaticText(self.panel, label="Filename", pos=(5, 350)) self.lblrtlsamplerate = wx.StaticText(self.panel, label="SR", pos=(145, 350)) self.lblrtlfreq = wx.StaticText(self.panel, label="Freq", pos=(195, 350)) self.lblrtlgain = wx.StaticText(self.panel, label="Gain", pos=(255, 350)) #gsm-receiver text self.lblgsm = wx.StaticText(self.panel, label="Gsm Receiver:", pos=(5, 395)) self.lblgsmsamplerate = wx.StaticText(self.panel, label="S", pos=(15, 410)) self.lblgsmfreq = wx.StaticText(self.panel, label="F", pos=(60, 410)) self.lblgsmgain = wx.StaticText(self.panel, label="G", pos=(125, 410)) self.lblgsmchannel = wx.StaticText(self.panel, label="C", pos=(170, 410)) self.lblgsmkey = wx.StaticText(self.panel, label="Key", pos=(215, 410)) #TMSI/IMSI/KEY self.lblgsmsamplerate = wx.StaticText(self.panel, label="IMSI:", pos=(5, 465)) self.lblgsmsamplerate = wx.StaticText(self.panel, label="TMSI:", pos=(5, 490)) self.lblgsmsamplerate = wx.StaticText(self.panel, label=" KEY:", pos=(5, 515)) self.lbpdu_NO = wx.StaticText(self.panel, label="Number:", pos=(215, 485)) self.lbpdu_FLASH = wx.StaticText(self.panel, label="Msg Data:", pos=(215, 500)) self.lbpdu_MSGCOUNT = wx.StaticText(self.panel, label="Msg Count:", pos=(215, 520)) self.lbpdu_MSGDELAY = wx.StaticText(self.panel, label="Sms Send\nDelay:", pos=(215, 543)) self.lbpdu_MSG_DEL_DELAY = wx.StaticText(self.panel, label="Del Report\nDelay:", pos=(305, 543)) self.lbl_at_cmd = wx.StaticText(self.panel, label="Misc AT Commands", pos=(5, 543)) #********************************************* #**************CHECKBOX + COMBOBOX************ tested_ports = getOpenSerialPorts() if len(tested_ports) < 1: tested_ports.append("NO PORTS") self.combo_serial_ports = wx.ComboBox(self.panel, size=(95, 30), pos=(45, 5), choices=tested_ports, style=wx.CB_READONLY) self.combo_serial_ports.SetSelection(0) self.cbkalrange = wx.ComboBox(self.panel, size=(65, 30), pos=(5, 90), choices=gsm_scan_range, style=wx.CB_READONLY) self.cbkalrange.SetSelection(0) self.cbk_at_cmds = wx.ComboBox(self.panel, size=(115, 30), pos=(5, 560), choices=at_cmds_array, style=wx.CB_READONLY) self.cbk_at_cmds.SetSelection(0) #pdu boxes self.cbsilent = wx.CheckBox(self.panel, -1, 'Silent', pos=(280, 455)) self.cbsilent.SetValue(True) self.cbflash = wx.CheckBox(self.panel, -1, 'Flash', pos=(340, 455)) self.cbkey = wx.CheckBox(self.panel, -1, '', pos=(365, 430)) self.cb_fetch_manual = wx.CheckBox(self.panel, -1, 'Manual Mode', pos=(265, 55)) #********************************************* #**************BINDS************************** self.btnexttmsi.Bind(wx.EVT_BUTTON, self.whichTimestamp) self.button.Bind(wx.EVT_BUTTON, self.SendCommand) self.btn2g.Bind(wx.EVT_BUTTON, self.On2gold) #self.btnsms.Bind(wx.EVT_BUTTON, self.debugData) self.btnrtl.Bind(wx.EVT_BUTTON, self.StartRtl) self.btnrtlstop.Bind(wx.EVT_BUTTON, self.StopRtl) self.btnkal.Bind(wx.EVT_BUTTON, self.startKal) self.btngqrx.Bind(wx.EVT_BUTTON, self.startStopGqrx) self.btnwireshark.Bind(wx.EVT_BUTTON, self.startWireshark) self.btnpdusend.Bind(wx.EVT_BUTTON, self.onToggle) self.btngetgqrxfreq.Bind(wx.EVT_BUTTON, self.getGqrxFreq) self.btncleardata.Bind(wx.EVT_BUTTON, self.clearData) self.cbk_at_cmds.Bind(wx.EVT_COMBOBOX, self.atCommandList) self.btnatstart.Bind(wx.EVT_BUTTON, self.SendCommandAtCombo) self.btntesting.Bind(wx.EVT_BUTTON, self.TestingFuction) self.btngetinfo.Bind(wx.EVT_BUTTON, self.GetKeyBtnPress) self.btngsmstart.Bind(wx.EVT_BUTTON, self.StartGsmRec) self.btngsmstop.Bind(wx.EVT_BUTTON, self.StopGsmRec) self.btnautomode.Bind(wx.EVT_BUTTON, self.autoMode) self.btnreload.Bind(wx.EVT_BUTTON, self.reloadSerialPorts) #********************************************* #*****SET FONT SIZE*************************** font = wx.Font(7, wx.DECORATIVE, wx.ITALIC, wx.NORMAL) self.comporttext.SetFont(font) self.result.SetFont(font) self.btnsms.SetFont(font) self.lbltmsi_sms_count.SetFont(font) self.lblpingrange.SetFont(font) self.lblpingrange3.SetFont(font) self.lbloffset.SetFont(font) self.lbloffsetrange3.SetFont(font) self.lb_smsendcount_text.SetFont(font) self.lbpdu_FLASH.SetFont(font) self.lbpdu_NO.SetFont(font) self.lbpdu_MSGCOUNT.SetFont(font) self.lb_smsendcount_text.SetFont(font) self.cbkalrange.SetFont(font) self.btn2g.SetFont(font) self.btngetinfo.SetFont(font) self.btnkal.SetFont(font) self.btngqrx.SetFont(font) self.btngetgqrxfreq.SetFont(font) self.btnwireshark.SetFont(font) self.button.SetFont(font) self.lbdebugoutput.SetFont(font) self.lblname.SetFont(font) self.comporttext.SetFont(font) self.lbpdu_MSGDELAY.SetFont(font) self.lbpdu_MSG_DEL_DELAY.SetFont(font) self.btnexttmsi.SetFont(font) self.btncleardata.SetFont(font) self.cb_fetch_manual.SetFont(font) self.lbl_at_data.SetFont(font) self.btnatstart.SetFont(font) self.btnreload.SetFont(font) #********************************************* self.result.SetForegroundColour(wx.RED)
def MyPanel2(self): #wx.Panel.MyPanel2 ( self, id = -1, pos = wx.DefaultPosition, size = wx.Size( 500,300 ), style = wx.TAB_TRAVERSAL ) self.panelNum = 3 self.mypanel2_panel = wx.Panel(self, pos=(0, 0), size=(500, 400)) font1 = wx.Font(16, wx.DEFAULT, wx.NORMAL, wx.LIGHT) font2 = wx.Font(16, wx.ROMAN, wx.ITALIC, wx.LIGHT) font3 = wx.Font(12, wx.ROMAN, wx.ITALIC, wx.LIGHT) bSizer3 = wx.BoxSizer(wx.VERTICAL) self.panel2_la = wx.StaticText(self, wx.ID_ANY, u" Please choose the picture", pos=(100, 100), size=(50, 50)) self.panel2_la.SetFont(font2) self.panel2_la.SetForegroundColour("#F7F7F7") bSizer3.Add(self.panel2_la, 0, wx.ALL | wx.EXPAND, 5) gSizer3 = wx.GridSizer(1, 2, 0, 0) self.docu_la = wx.StaticText(self, wx.ID_ANY, u" 请选择图片文件:", pos=(0, 0), size=(250, 100)) self.docu_la.SetFont(font3) self.docu_la.SetForegroundColour("#F7F7F7") self.docu_la.Wrap(-1) gSizer3.Add(self.docu_la, 0, wx.ALL, 5) m_comboBox1Choices = [ u"2px_黑体", u"2px_宋体", u"醉翁亭记", u"小石潭记", u"放鹤亭记", u"石钟山记", u"口技", u"前赤壁赋", u"岳阳楼记", u"核舟记" ] self.m_comboBox1 = wx.ComboBox(self, -1, u"请选择文件", wx.DefaultPosition, wx.DefaultSize, m_comboBox1Choices, 0) gSizer3.Add(self.m_comboBox1, 0, wx.ALL, 5) bSizer3.Add(gSizer3, 1, wx.EXPAND, 5) self.in_la = wx.StaticText(self, -1, u" 请输入嵌入信息", pos=(100, 100), size=(300, 20)) self.in_la.Wrap(-1) bSizer3.Add(self.in_la, 0, wx.ALL, 5) self.en_txt = wx.TextCtrl(self, -1, wx.EmptyString, pos=(100, 100), size=(350, 130), style=wx.TE_MULTILINE | wx.TE_PROCESS_ENTER) bSizer3.Add(self.en_txt, 1, wx.EXPAND | wx.ALL, 5) gSizer4 = wx.GridSizer(1, 2, 0, 0) self.button3 = wx.Button(self, -1, u"<-返回", wx.DefaultPosition, wx.DefaultSize, 0) gSizer4.Add(self.button3, 0, wx.ALL | wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT, 5) self.button4 = wx.Button(self, -1, u"确定", wx.DefaultPosition, wx.DefaultSize, 0) gSizer4.Add(self.button4, 0, wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT | wx.ALL, 5) bSizer3.Add(gSizer4, 1, wx.EXPAND, 5) self.SetSizer(bSizer3) self.Layout() self.m_comboBox1.Bind(wx.EVT_COMBOBOX, self.OnCombo) self.en_txt.Bind(wx.EVT_TEXT, self.input_info) self.button3.Bind(wx.EVT_BUTTON, self.back_click) self.button4.Bind(wx.EVT_BUTTON, self.click_next2) #self.bro = wx.StaticText( self.mypanel2_panel, -1, u"浏览文件夹", pos=(100,100), size=(100,30),style = wx.TE_MULTILINE) #self.btn_bro = wx.Button(self.mypanel2_panel,label = "Open a File") #self.btn_bro.SetForegroundColour("#F7F7F7") #self.btn_bro.SetFont(font2) #gSizer3.Add(self.btn_bro,0,wx.ALL,5) #绑定事件 self.mypanel2_panel.Bind(wx.EVT_ERASE_BACKGROUND, self.login_background)
def __init__(self, *args, **kw): super(ExamplePanelWithSizer, self).__init__(*args, **kw) # create some sizers mainSizer = wx.BoxSizer(wx.VERTICAL) grid = wx.GridBagSizer(hgap=5, vgap=5) hSizer = wx.BoxSizer(wx.HORIZONTAL) self.quote = wx.StaticText(self, label="Your quote: ") grid.Add(self.quote, pos=(0, 0)) # a multiline TextCtrl to show how events work self.logger = wx.TextCtrl(self, pos=(400, 20), size=(200, 300), style=wx.TE_MULTILINE | wx.TE_READONLY) # A button self.button = wx.Button(self, label="Save", pos=(200, 325)) self.Bind(wx.EVT_BUTTON, self.OnClick, self.button) # The edit control self.lblName = wx.StaticText(self, label="Your name: ", pos=(20, 60)) grid.Add(self.lblName, pos=(1, 0)) self.editName = wx.TextCtrl(self, value="Enter here your name", size=(140, -1)) grid.Add(self.editName, pos=(1, 1)) self.Bind(wx.EVT_TEXT, self.OnChange, self.editName) self.Bind(wx.EVT_CHAR, self.OnKeyPress, self.editName) # The combox control self.sampleList = [ 'friends', 'advertising', 'web search', 'Yellow Pages' ] self.lblHear = wx.StaticText(self, label="How did you year from us?", pos=(20, 90)) grid.Add(self.lblHear, pos=(3, 0)) self.editHear = wx.ComboBox(self, pos=(200, 90), size=(140, -1), choices=self.sampleList, style=wx.CB_DROPDOWN) grid.Add(self.editHear, pos=(3, 1)) self.Bind(wx.EVT_COMBOBOX, self.EvtComboBox, self.editHear) self.Bind(wx.EVT_TEXT, self.EvtText, self.editHear) grid.Add((10, 40), pos=(2, 0)) # Checkbox self.insure = wx.CheckBox(self, label="Do you want Insured Shipment?", pos=(20, 180)) grid.Add(self.insure, pos=(4, 0), span=(1, 2), flag=wx.BOTTOM, border=5) self.Bind(wx.EVT_CHECKBOX, self.EvtCheckBox, self.insure) # Radio Boxes radioList = [ 'blue', 'red', 'yellow', 'orange', 'green', 'purple', 'navy blue', 'black', 'gray' ] self.rb = wx.RadioBox(self, label="What color would you like?", pos=(20, 210), choices=radioList, majorDimension=3, style=wx.RA_SPECIFY_COLS) grid.Add(self.rb, pos=(5, 0), span=(1, 2)) self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, self.rb) hSizer.Add(grid, 0, wx.ALL, 5) hSizer.Add(self.logger) mainSizer.Add(hSizer, 0, wx.ALL, 5) mainSizer.Add(self.button, 0, wx.CENTER) self.SetSizerAndFit(mainSizer)
def __init__(self): wx.Dialog.__init__(self, None, id=wx.ID_ANY, title=u"Zarządzanie Autorami", pos=wx.DefaultPosition, size=wx.Size(350, 330), style=wx.DEFAULT_DIALOG_STYLE) self.session = cDatabase.connectDatabase() ico = wx.Icon('icon/autor.ico', wx.BITMAP_TYPE_ICO) self.SetIcon(ico) self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) bSizer1 = wx.BoxSizer(wx.VERTICAL) bSizer2 = wx.BoxSizer(wx.VERTICAL) # self.st1 = self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"Dodawanie Autora", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE | wx.ST_NO_AUTORESIZE) self.m_staticText1.Wrap(-1) bSizer2.Add(self.m_staticText1, 0, wx.EXPAND | wx.ALL, 5) bSizer1.Add(bSizer2, 0, wx.EXPAND, 5) bSizer3 = wx.BoxSizer(wx.VERTICAL) bSizer9 = wx.BoxSizer(wx.HORIZONTAL) self.m_staticText2 = wx.StaticText(self, wx.ID_ANY, u"Edytuj Autora:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText2.Wrap(-1) bSizer9.Add(self.m_staticText2, 1, wx.ALL, 5) self.m_choice1Choices = cDatabase.getUserName(self.session) self.m_choice1 = wx.Choice(self, wx.ID_ANY, wx.DefaultPosition, wx.Size(220, -1), self.m_choice1Choices, 0) # self.m_choice1.SetSelection( 0 ) bSizer9.Add(self.m_choice1, 0, wx.BOTTOM | wx.RIGHT | wx.LEFT, 5) bSizer3.Add(bSizer9, 1, wx.EXPAND, 5) # bSizer111 = wx.BoxSizer( wx.VERTICAL ) # # self.m_button6 = wx.Button( self, wx.ID_ANY, u"Wybierz", wx.DefaultPosition, wx.DefaultSize, 0 ) # bSizer111.Add( self.m_button6, 0, wx.ALIGN_RIGHT|wx.BOTTOM|wx.RIGHT|wx.LEFT, 5 ) # # # bSizer3.Add( bSizer111, 1, wx.EXPAND, 5 ) bSizer1.Add(bSizer3, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 5) bSizer13 = wx.BoxSizer(wx.HORIZONTAL) self.m_staticText6 = wx.StaticText(self, wx.ID_ANY, u"Afiliacja:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText6.Wrap(-1) bSizer13.Add(self.m_staticText6, 1, wx.ALL, 5) m_comboBox1Choices = cDatabase.getCollegeName(self.session) self.m_comboBox1 = wx.ComboBox(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(220, -1), m_comboBox1Choices, 0) bSizer13.Add(self.m_comboBox1, 0, wx.BOTTOM | wx.RIGHT | wx.LEFT, 5) bSizer1.Add(bSizer13, 0, wx.EXPAND, 5) bSizer16 = wx.BoxSizer(wx.HORIZONTAL) self.m_staticText7 = wx.StaticText(self, wx.ID_ANY, u"Wydział/Dział:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText7.Wrap(-1) bSizer16.Add(self.m_staticText7, 1, wx.ALL, 5) m_comboBox2Choices = cDatabase.getFacultyName(self.session) self.m_comboBox2 = wx.ComboBox(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(220, -1), m_comboBox2Choices, 0) bSizer16.Add(self.m_comboBox2, 0, wx.BOTTOM | wx.RIGHT | wx.LEFT, 5) bSizer1.Add(bSizer16, 0, wx.EXPAND, 5) bSizer17 = wx.BoxSizer(wx.HORIZONTAL) self.m_staticText8 = wx.StaticText(self, wx.ID_ANY, u"Instytut/Stanowisko:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText8.Wrap(-1) bSizer17.Add(self.m_staticText8, 1, wx.ALL, 5) m_comboBox3Choices = cDatabase.getInstituteName(self.session) self.m_comboBox3 = wx.ComboBox(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(220, -1), m_comboBox3Choices, 0) bSizer17.Add(self.m_comboBox3, 0, wx.BOTTOM | wx.RIGHT | wx.LEFT, 5) bSizer1.Add(bSizer17, 0, wx.EXPAND, 5) bSizer4 = wx.BoxSizer(wx.HORIZONTAL) self.m_staticText3 = wx.StaticText(self, wx.ID_ANY, u"Imię:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText3.Wrap(-1) bSizer4.Add(self.m_staticText3, 1, wx.ALL, 5) self.m_textCtrl3 = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(220, -1), 0) bSizer4.Add(self.m_textCtrl3, 0, wx.BOTTOM | wx.RIGHT | wx.LEFT, 5) bSizer1.Add(bSizer4, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND, 5) bSizer5 = wx.BoxSizer(wx.HORIZONTAL) self.m_staticText4 = wx.StaticText(self, wx.ID_ANY, u"Nazwisko:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText4.Wrap(-1) bSizer5.Add(self.m_staticText4, 1, wx.ALL, 5) self.m_textCtrl4 = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(220, -1), 0) bSizer5.Add(self.m_textCtrl4, 0, wx.BOTTOM | wx.RIGHT | wx.LEFT, 5) bSizer1.Add(bSizer5, 0, wx.EXPAND, 5) bSizer12 = wx.BoxSizer(wx.HORIZONTAL) self.m_staticText5 = wx.StaticText(self, wx.ID_ANY, u"Filtr:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText5.Wrap(-1) bSizer12.Add(self.m_staticText5, 1, wx.ALL, 5) self.m_textCtrl41 = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(220, -1), 0) self.m_textCtrl41.SetToolTipString( u"Format filtru: A Wójcik, A Wojcik, A WOJCIK") bSizer12.Add(self.m_textCtrl41, 0, wx.BOTTOM | wx.RIGHT | wx.LEFT, 5) bSizer1.Add(bSizer12, 0, wx.EXPAND, 5) bSizer55 = wx.BoxSizer(wx.HORIZONTAL) # self.m_staticText55 = wx.StaticText( self, wx.ID_ANY, u"Notatki:", wx.DefaultPosition, wx.DefaultSize, 0 ) # self.m_staticText55.Wrap( -1 ) # bSizer55.Add( self.m_staticText55, 1, wx.ALL, 5 ) self.m_textCtrl2 = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(-1, 50), wx.TE_MULTILINE) self.m_textCtrl2.SetToolTipString(u"Notatki do autora") bSizer55.Add(self.m_textCtrl2, 1, wx.ALL | wx.EXPAND, 5) bSizer1.Add(bSizer55, 0, wx.EXPAND, 5) bSizer11 = wx.BoxSizer(wx.HORIZONTAL) self.m_button2 = wx.Button(self, wx.ID_ANY, u"Dodaj", wx.DefaultPosition, wx.DefaultSize, 0) bSizer11.Add(self.m_button2, 0, wx.EXPAND | wx.ALL, 5) self.m_button1 = wx.Button(self, wx.ID_ANY, u"Zatwierdź", wx.DefaultPosition, wx.DefaultSize, 0) bSizer11.Add(self.m_button1, 0, wx.EXPAND | wx.ALL, 5) self.m_button7 = wx.Button(self, wx.ID_ANY, u"Usuń", wx.DefaultPosition, wx.DefaultSize, 0) bSizer11.Add(self.m_button7, 0, wx.RIGHT | wx.ALL, 5) self.m_button4 = wx.Button(self, wx.ID_ANY, u"Anuluj", wx.DefaultPosition, wx.DefaultSize, 0) bSizer11.Add(self.m_button4, 0, wx.RIGHT | wx.ALL, 5) bSizer1.Add(bSizer11, 0, wx.ALIGN_RIGHT, 5) self.SetSizer(bSizer1) self.Layout() self.Centre(wx.BOTH) self.m_button1.Hide() self.m_button7.Hide() ################################################### ## Bind ################################################### # self.m_button6.Bind(wx.EVT_BUTTON, self.getPersonID) self.m_button1.Bind(wx.EVT_BUTTON, self.editPersonID) self.m_button2.Bind(wx.EVT_BUTTON, self.getUserData) self.m_button4.Bind(wx.EVT_BUTTON, self.cancel) self.m_button7.Bind(wx.EVT_BUTTON, self.deletePerson) self.m_choice1.Bind(wx.EVT_CHOICE, self.getPersonID)
def InitUI(self): #---------------------------------------------------- # Build menu bar and submenus menubar = wx.MenuBar() # file menu containing quit menu item fileMenu = wx.Menu() #fileMenu = wx.Menu() open_file = wx.MenuItem(fileMenu, 1, 'Open Image\tCTRL+O') fileMenu.AppendItem(open_file) self.Bind(wx.EVT_MENU, self.OnOpen, open_file) save_file = wx.MenuItem(fileMenu, wx.ID_ANY, 'Save Image\tCTRL+S') fileMenu.AppendItem(save_file) self.Bind(wx.EVT_MENU, self.OnSave, save_file) save_file = wx.MenuItem(fileMenu, wx.ID_ANY, 'Export selection Image\tCTRL+SHIFT+S') fileMenu.AppendItem(save_file) self.Bind(wx.EVT_MENU, self.selectExport, save_file) menubar.Append(fileMenu, '&File') # edit menu editMenu = wx.Menu() action = wx.MenuItem(editMenu, wx.ID_ANY, 'Put Ladder\tCTRL+L') editMenu.AppendItem(action) self.Bind(wx.EVT_MENU, self.PutLadder, action) action = wx.MenuItem(editMenu, wx.ID_ANY, 'Move Image\tCTRL+M') editMenu.AppendItem(action) self.Bind(wx.EVT_MENU, self.MoveImage, action) action = wx.MenuItem(editMenu, wx.ID_ANY, 'Invert Image\tCTRL+I') editMenu.AppendItem(action) self.Bind(wx.EVT_MENU, self.invertImage, action) action = wx.MenuItem(editMenu, wx.ID_ANY, 'Set Image to grayscale\tCTRL+G') editMenu.AppendItem(action) self.Bind(wx.EVT_MENU, self.grayScale, action) action = wx.MenuItem(editMenu, wx.ID_ANY, 'Rotate Image\tCTRL+R') editMenu.AppendItem(action) self.Bind(wx.EVT_MENU, self.rotateImage, action) action = wx.MenuItem(editMenu, wx.ID_ANY, 'Crop Image\tCTRL+K') editMenu.AppendItem(action) self.Bind(wx.EVT_MENU, self.crop, action) action = wx.MenuItem(editMenu, wx.ID_ANY, 'Label lanes\tCTRL+J') editMenu.AppendItem(action) self.Bind(wx.EVT_MENU, self.labelLanes, action) menubar.Append(editMenu, 'Edit') # help menu containing about menu item helpMenu = wx.Menu() about_item = wx.MenuItem(helpMenu, wx.ID_ABOUT, '&About\tCtrl+A') helpMenu.AppendItem(about_item) menubar.Append(helpMenu, '&Help') self.SetMenuBar(menubar) #---------------------------------------------------- # Build window layout self.drawingPanel = wx.Panel(self) vbox = wx.BoxSizer(wx.HORIZONTAL) sizer_v = wx.BoxSizer(wx.HORIZONTAL) control = wx.Panel(self.drawingPanel) hbox2 = wx.BoxSizer(wx.VERTICAL) # add controls:# font = wx.Font(9, wx.DEFAULT, wx.NORMAL, wx.BOLD) # text ladder: self.txtLadder = wx.StaticText(control, -1, 'select ladder:') self.txtLadder.SetFont(font) self.laddersSel = [] for l in self.ladders: self.laddersSel.append(l) self.LadderSelect = wx.ComboBox(control, size=wx.DefaultSize, choices=self.laddersSel, style=wx.CB_READONLY) self.LadderSelect.Bind(wx.EVT_COMBOBOX, self.onLadSelect) self.LadderSelect.SetStringSelection(self.laddersSel[0]) self.infos["ladder"] = self.laddersSel[0] # unit: self.txtUnit = wx.StaticText(control, -1, 'select unit:') self.txtUnit.SetFont(font) self.unitSelect = wx.ComboBox(control, size=wx.DefaultSize, choices=self.units, style=wx.CB_READONLY) self.unitSelect.Bind(wx.EVT_COMBOBOX, self.onUnitSelect) self.unitSelect.SetStringSelection(self.units[0]) self.infos["unit"] = self.unitSelect.GetStringSelection() self.removeLadders = wx.Button(control, -1, "remove Ladders") # add enzyme self.removeLadders.Bind(wx.EVT_BUTTON, self.remLadder) # label type: self.txtLabel = wx.StaticText(control, -1, 'select label type:') self.txtLabel.SetFont(font) self.labelSelect = wx.ComboBox(control, size=wx.DefaultSize, choices=["ABC", "abc", "123", "custom"], style=wx.CB_READONLY) self.labelSelect.Bind(wx.EVT_COMBOBOX, self.onLabelSelect) self.labelSelect.SetStringSelection("ABC") self.infos["marks"] = self.labelSelect.GetStringSelection() self.removeLabels = wx.Button(control, -1, "remove Labels") # add enzyme self.removeLabels.Bind(wx.EVT_BUTTON, self.remLabels) # font dialog self.changeFont = wx.Button(control, -1, "change Font") # add enzyme self.changeFont.Bind(wx.EVT_BUTTON, self.selectFont) # custom labeling: self.customlabels = wx.TextCtrl(control, -1, "", wx.Point(20, 20), wx.Size(200, 70), wx.TE_MULTILINE) self.customlabels.Bind(wx.EVT_TEXT, self.customLabelChange) rotateSizer = wx.BoxSizer(wx.HORIZONTAL) self.rotateLabel = wx.Slider(control, value=0, minValue=-90, maxValue=90, size=(200, -1), style=wx.SL_HORIZONTAL) self.rotateLabel.Bind(wx.EVT_SCROLL, self.OnSliderScroll) self.rotateTxt = wx.StaticText(control, label='0 degree') rotateSizer.Add(self.rotateLabel) rotateSizer.AddSpacer(10) rotateSizer.Add(self.rotateTxt) ### add elements to control pannel # ladder hbox2.Add(self.txtLadder) hbox2.Add(self.LadderSelect) #unit hbox2.Add(self.txtUnit) hbox2.Add(self.unitSelect) hbox2.Add(self.removeLadders) hbox2.AddSpacer(20) # labels hbox2.Add(self.txtLabel) hbox2.Add(self.labelSelect) hbox2.Add(self.customlabels) hbox2.Add(rotateSizer) #font face hbox2.Add(self.changeFont) # fontsize: #hbox2.Add(self.txtFontsize) #hbox2.Add(self.labelFontsize) hbox2.Add(self.removeLabels) # color font #hbox2.Add(self.txtcolorFront) #hbox2.Add(self.colorFront) self.cairo = DrawingArea(self.drawingPanel, "drawing pannel", self.infos, self.ladders) #drawingbox = wx.BoxSizer(wx.HORIZONTAL) #drawingbox2 = wx.BoxSizer() #drawingbox.Add(self.cairo,1, wx.EXPAND) #drawingbox2.Add(drawingbox,wx.EXPAND) control.SetSizer(hbox2) gridsizer = wx.FlexGridSizer(rows=1, cols=2, vgap=3, hgap=10) #gridsizer.AddGrowableCol(0) # make cols growable gridsizer.AddGrowableCol(1) gridsizer.AddGrowableRow(0) gridsizer.Add(control, 0, wx.EXPAND | wx.ALL, 0) gridsizer.Add(self.cairo, 0, wx.EXPAND | wx.ALL, 0) vbox.Add(gridsizer, 1, wx.EXPAND | wx.ALL, 15) self.drawingPanel.SetSizer(vbox) self.Maximize() self.SetTitle('gelImage') self.Centre()
def __init__(self, name, magn, sk, rate, offset): self.platform = platform.Platform() title = _('Edit') + (' ' + name + ' - ' + magn) wx.Dialog.__init__(self, None, title=title, size=(500, 250)) panel = wx.Panel(self) titl = wx.StaticText(panel, label=_('Signal K key')) self.SKkey = wx.TextCtrl(panel) self.SKkey.SetValue(sk) self.edit_skkey = wx.Button(panel, label=_('Edit')) self.edit_skkey.Bind(wx.EVT_BUTTON, self.onEditSkkey) if not self.platform.skDir: self.SKkey.Disable() self.edit_skkey.Disable() hline1 = wx.StaticLine(panel) self.rate_list = [ '0.1', '0.25', '0.5', '0.75', '1.0', '5.0', '30.0', '60.0', '300.0' ] self.rate_label = wx.StaticText(panel, label=_('Rate (seconds)')) self.rate = wx.ComboBox(panel, choices=self.rate_list, style=wx.CB_READONLY) self.rate.SetValue(rate) self.offset_label = wx.StaticText(panel, label=_('Offset')) self.offset = wx.TextCtrl(panel) self.offset.SetValue(offset) cancelBtn = wx.Button(panel, wx.ID_CANCEL) okBtn = wx.Button(panel, wx.ID_OK) hbox2 = wx.BoxSizer(wx.HORIZONTAL) hbox2.Add(self.SKkey, 1, wx.RIGHT | wx.LEFT | wx.EXPAND, 5) hbox2.Add(self.edit_skkey, 0, wx.RIGHT | wx.EXPAND, 5) hbox3 = wx.BoxSizer(wx.HORIZONTAL) hbox3.Add(self.rate_label, 0, wx.ALL | wx.EXPAND, 5) hbox3.Add(self.rate, 0, wx.RIGHT | wx.LEFT | wx.EXPAND, 5) hbox4 = wx.BoxSizer(wx.HORIZONTAL) hbox4.Add(self.offset_label, 0, wx.ALL | wx.EXPAND, 5) hbox4.Add(self.offset, 0, wx.RIGHT | wx.LEFT | wx.EXPAND, 5) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.AddStretchSpacer(1) hbox.Add(cancelBtn, 0, wx.EXPAND, 0) hbox.Add(okBtn, 0, wx.LEFT | wx.EXPAND, 10) vbox = wx.BoxSizer(wx.VERTICAL) vbox.AddSpacer(5) vbox.Add(titl, 0, wx.RIGHT | wx.LEFT | wx.EXPAND, 10) vbox.Add(hbox2, 0, wx.RIGHT | wx.LEFT | wx.EXPAND, 5) vbox.AddSpacer(10) vbox.Add(hbox3, 0, wx.RIGHT | wx.LEFT | wx.EXPAND, 5) vbox.AddSpacer(10) vbox.Add(hbox4, 0, wx.RIGHT | wx.LEFT | wx.EXPAND, 5) vbox.AddStretchSpacer(1) vbox.Add(hline1, 0, wx.RIGHT | wx.LEFT | wx.EXPAND, 5) vbox.Add(hbox, 0, wx.ALL | wx.EXPAND, 10) panel.SetSizer(vbox) self.panel = panel self.Centre()
def __init__(self, parent, drug, model): wx.Panel.__init__(self, parent=parent, style=wx.NO_BORDER | wx.TAB_TRAVERSAL) self.form = Formulas() self.drugmodel = drug self.boxlabel = wx.StaticBoxSizer( wx.StaticBox(parent=self, label='Kinetic Parameters'), wx.VERTICAL) self.midsizer = wx.FlexGridSizer(4, 3, vgap=10) self.boxlabel.Add(self.midsizer) self.SetSizer(self.boxlabel) #create some widgets for the midpanel self.sexlabel = wx.StaticText(parent=self, label='Sex: ') self.sexinputmale = wx.RadioButton(parent=self, label='Male', style=wx.RB_GROUP) self.sexinputfemale = wx.RadioButton(parent=self, label='Female') self.agelabel = wx.StaticText(self, label='Age: ') self.ageinput = wx.SpinCtrl(parent=self, size=(50, -1), style=wx.SP_WRAP | wx.SP_ARROW_KEYS) self.ageinput.SetRange(0, 400) self.ageinput.SetValue(65) self.weightlabel = wx.StaticText(parent=self, label='Weight: ') self.weightinput = wx.SpinCtrl(parent=self, size=(50, -1), style=wx.SP_WRAP | wx.SP_ARROW_KEYS) self.weightinput.SetRange(10, 800) self.weightinput.SetValue(155) self.weightunits = wx.ComboBox(parent=self, choices=(['Pounds', 'Kilograms']), style=wx.CB_READONLY) self.weightunits.SetValue('Kilograms') self.heightlabel = wx.StaticText(parent=self, label='Height: ') self.heightinput = wx.SpinCtrl(parent=self, size=(50, -1), style=wx.SP_WRAP | wx.SP_ARROW_KEYS) self.heightinput.SetRange(0, 500) self.heightinput.SetValue(65) self.heightunits = wx.ComboBox(parent=self, choices=(['Inches', 'Centimeters']), style=wx.CB_READONLY) self.heightunits.SetValue('Inches') self.scrlabel = wx.StaticText(parent=self, label='Serum Creatinine: ') self.scrinput = FloatSpin(parent=self, value=1.1, min_val=0, max_val=10, increment=0.1, digits=1, size=(50, -1)) self.scrunitslabel = wx.StaticText(parent=self, label=' mg/dL') #IBW widgets self.IdealBodyWeightlabel = wx.StaticText(parent=self, label='Ideal Weight: ') self.IdealBodyWeightoutput = wx.StaticText( parent=self, label=str( self.form.IdealBodyWeight(self.getsex(), self.getheight()))) self.IdealBodyWeightunits = wx.StaticText(parent=self, label='Kilograms') #CrCl Label updated self.crcllabel = wx.StaticText(parent=self, label='CrCl: ') self.crcloutput = wx.StaticText(parent=self, label=str( self.form.CrofGaul( self.getsex(), self.getage(), self.getCrClWeight(), self.getscr()))) self.crclunits = wx.StaticText(parent=self, label=' ml/min') #Create VD label and value self.VDlabel = wx.StaticText( self, label='Estimated Volume of Distribution: ') self.VDoutput = wx.StaticText(self, label=str(round(self.getvd(), 1))) self.VDunits = wx.StaticText(self, label='Liters') #create K label and value self.klabel = wx.StaticText(self, label='Estimated Rate Constant (k): ') self.koutput = wx.StaticText(self, label=str(round(self.getk(), 5))) self.kunits = wx.StaticText(self, label=' /hour') #create half life label and value self.thalflabel = wx.StaticText(self, label='Estimated Half-Life: ') self.thalfoutput = wx.StaticText(self, label=str(round(self.getthalf(), 1))) self.thalfunits = wx.StaticText(self, label=' hours') #place widgets into the sizer self.dummypanel = wx.Panel(parent=self) self.dummypanel1 = wx.Panel(parent=self) self.dummypanel2 = wx.Panel(parent=self) self.dummypanel3 = wx.Panel(parent=self) self.midsizer.AddMany([ (self.sexlabel, -1, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT), self.sexinputmale, self.sexinputfemale, (self.agelabel, -1, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT), self.ageinput, self.dummypanel1, (self.weightlabel, -1, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT), self.weightinput, self.weightunits, (self.IdealBodyWeightlabel, -1, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT), (self.IdealBodyWeightoutput, -1, wx.ALIGN_CENTER), (self.IdealBodyWeightunits, -1, wx.ALIGN_CENTER_VERTICAL), (self.heightlabel, -1, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT), self.heightinput, self.heightunits, (self.scrlabel, -1, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT), self.scrinput, (self.scrunitslabel, -1, wx.ALIGN_CENTER_VERTICAL), (self.crcllabel, -1, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT), (self.crcloutput, -1, wx.ALIGN_CENTER), (self.crclunits, -1, wx.ALIGN_CENTER_VERTICAL), (self.VDlabel, -1, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT), (self.VDoutput, -1, wx.ALIGN_CENTER), (self.VDunits, -1, wx.ALIGN_CENTER_VERTICAL), (self.klabel, -1, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT), (self.koutput, -1, wx.ALIGN_CENTER), (self.kunits, -1, wx.ALIGN_CENTER_VERTICAL), (self.thalflabel, -1, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT), (self.thalfoutput, -1, wx.ALIGN_CENTER), (self.thalfunits, -1, wx.ALIGN_CENTER_VERTICAL) ])
def CreateDirectoryOnlyControl(parent, dirLabel=_("Location:"), startingDirectory=None, choiceDirs=None, appDirDefaultStartDir=False): if not choiceDirs: choiceDirs = [] projectDirs = [] if appDirDefaultStartDir: appDirectory = wx.ConfigBase_Get().Read( ProjectEditor.PROJECT_DIRECTORY_KEY, ProjectEditor.NEW_PROJECT_DIRECTORY_DEFAULT) else: appDirectory = wx.ConfigBase_Get().Read( ProjectEditor.PROJECT_DIRECTORY_KEY) if appDirectory: choiceDirs.append(appDirectory) if appDirDefaultStartDir and not startingDirectory: startingDirectory = appDirectory projectService = wx.GetApp().GetService(ProjectEditor.ProjectService) if projectService: curProjectDoc = projectService.GetCurrentProject() if curProjectDoc: homeDir = curProjectDoc.GetAppDocMgr().homeDir if homeDir and (homeDir not in choiceDirs): choiceDirs.append(homeDir) if not startingDirectory: startingDirectory = homeDir for projectDoc in projectService.GetOpenProjects(): if projectDoc == curProjectDoc: continue homeDir = projectDoc.GetAppDocMgr().homeDir if homeDir and (homeDir not in projectDirs): projectDirs.append(homeDir) projectDirs.sort(CaseInsensitiveCompare) for projectDir in projectDirs: if projectDir not in choiceDirs: choiceDirs.append(projectDir) if startingDirectory and (startingDirectory not in choiceDirs): choiceDirs.insert(0, startingDirectory) if os.getcwd() not in choiceDirs: choiceDirs.append(os.getcwd()) if appdirs.getSystemDir() not in choiceDirs: choiceDirs.append(appdirs.getSystemDir()) if not startingDirectory: startingDirectory = os.getcwd() dirLabelText = wx.StaticText(parent, -1, dirLabel) dirControl = wx.ComboBox(parent, -1, startingDirectory, size=(-1, -1), choices=choiceDirs) dirControl.SetToolTipString(startingDirectory) button = wx.Button(parent, -1, _("Browse...")) def OnFindDirClick(event): dlg = wx.DirDialog(wx.GetApp().GetTopWindow(), _("Choose a directory:"), defaultPath=dirControl.GetValue().strip(), style=wx.DD_DEFAULT_STYLE | wx.DD_NEW_DIR_BUTTON) dlg.CenterOnParent() if dlg.ShowModal() == wx.ID_OK: dir = dlg.GetPath() if dirControl.FindString(dir) == wx.NOT_FOUND: dirControl.Insert(dir, 0) dirControl.SetValue(dir) dirControl.SetToolTipString(dir) dlg.Destroy() parent.Bind(wx.EVT_BUTTON, OnFindDirClick, button) def Validate(allowOverwriteOnPrompt=False): dirName = dirControl.GetValue().strip() if dirName == "": wx.MessageBox(_("Please provide a directory."), _("Provide a Directory")) return False if os.sep == "\\" and dirName.find("/") != -1: wx.MessageBox( _("Wrong delimiter '/' found in directory path. Use '%s' as delimiter." ) % os.sep, _("Provide a Valid Directory")) return False if not os.path.exists(dirName): wx.MessageBox( _("That directory does not exist. Please choose an existing directory." ), _("Provide a Valid Directory")) return False return True HALF_SPACE = 5 flexGridSizer = wx.FlexGridSizer(cols=3, vgap=HALF_SPACE, hgap=HALF_SPACE) flexGridSizer.AddGrowableCol(1, 1) flexGridSizer.Add(dirLabelText, flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT | wx.RIGHT, border=HALF_SPACE) flexGridSizer.Add(dirControl, 2, flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, border=HALF_SPACE) flexGridSizer.Add(button, flag=wx.ALIGN_RIGHT | wx.LEFT, border=HALF_SPACE) return dirControl, flexGridSizer, Validate
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)