def __init__(self,parent,id): wx.Frame.__init__(self,parent,-1,'题目工厂',size=(300,400)) #创建,面板 panel=wx.Panel(self) self.optype=wx.StaticText(panel,label='操作符类型',pos=(5,15)) self.nutype = wx.StaticText(panel, label='数据类型', pos=(5, 55)) self.btype=wx.StaticText(panel,label='有无括号',pos=(150,55)) self.ran = wx.StaticText(panel, label='运算范围', pos=(5, 90)) self.j1 = wx.StaticText(panel, label='加', pos=(90, 5)) self.j2 = wx.StaticText(panel, label='减', pos=(140, 5)) self.j3 = wx.StaticText(panel, label='乘', pos=(190, 5)) self.j4 = wx.StaticText(panel, label='除', pos=(240, 5)) self.n=wx.StaticText(panel,label='题目数量',pos=(150,90)) self.ques = wx.StaticText(panel, label='题目', pos=(5, 270)) self.ans=wx.StaticText(panel,label='答案',pos=(5,290)) self.numtype = wx.ComboBox(panel, choices=['随机','整数','真分数'], pos=(75, 50), style=wx.CB_READONLY) self.bratype=wx.ComboBox(panel,choices=['有','无'],pos=(220,50),style=wx.CB_READONLY) self.jia=wx.TextCtrl(panel,size=(40,20),pos=(75,25)) self.jian = wx.TextCtrl(panel, size=(40, 20), pos=(125, 25)) self.cheng = wx.TextCtrl(panel, size=(40, 20), pos=(175, 25)) self.chu = wx.TextCtrl(panel, size=(40, 20), pos=(225, 25)) self.ran=wx.TextCtrl(panel,size=(50,20),pos=(75,90)) self.number=wx.TextCtrl(panel,size=(50,20),pos=(220,90)) self.quesname=wx.StaticText(panel,label='',pos=(40,270)) self.answer = wx.StaticText(panel, label='', pos=(40, 290)) self.con=wx.StaticText(panel,label='',pos=(10,345)) queslist=[] self.listbox=wx.ListBox(panel,-1,pos=(5,120),size=(270,150),choices=queslist,style=wx.LB_HSCROLL) if v.username!="": filename = v.username + "_setting.txt" ownsetlist = [] with open(filename) as file_object: for line in file_object: ownsetlist.append(line) ownlist = ownsetlist[0].split("||") #print ownlist if ownlist[6].rstrip() != '': self.jia.SetValue(ownlist[6]) if ownlist[7].rstrip() != '': self.jian.SetValue(ownlist[7]) if ownlist[8].rstrip() != '': self.cheng.SetValue(ownlist[8]) if ownlist[9].rstrip() != '': self.chu.SetValue(ownlist[9]) if ownlist[10].rstrip() != '': self.numtype.Select(int(ownlist[10])) if ownlist[11].rstrip() != '': self.bratype.Select(int(ownlist[11])) if ownlist[12].rstrip() != '': self.ran.SetValue(ownlist[12]) if ownlist[13].rstrip() != '': self.number.SetValue(ownlist[13]) sta = wx.Button(panel, label='开始出题', size=(70, 30), pos=(3, 310)) add = wx.Button(panel, label='添加', size=(70, 30), pos=(73, 310)) ex = wx.Button(panel, label='退出', size=(70, 30), pos=(213, 310)) cl = wx.Button(panel, label='清空', size=(70, 30), pos=(143, 310)) self.Bind(wx.EVT_BUTTON, self.OnSta, sta) self.Bind(wx.EVT_BUTTON, self.OnAdd, add) self.Bind(wx.EVT_BUTTON, self.OnEx, ex) self.Bind(wx.EVT_BUTTON, self.OnCl, cl) self.Bind(wx.EVT_LISTBOX,self.OnClick,self.listbox) self.Show(True)
def __init__(self, parent): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"msl-hs-logger", pos=wx.DefaultPosition, size=wx.Size(387, 174), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) self.SetSizeHints(wx.DefaultSize, wx.DefaultSize) bSizer9 = wx.BoxSizer(wx.HORIZONTAL) bSizer28 = wx.BoxSizer(wx.VERTICAL) self.new_job_b = wx.Button(self, wx.ID_ANY, u"New Job", wx.DefaultPosition, wx.DefaultSize, 0) self.new_job_b.Enable(False) bSizer28.Add(self.new_job_b, 0, wx.ALL, 5) self.open_job_b = wx.Button(self, wx.ID_ANY, u"Open Job", wx.DefaultPosition, wx.DefaultSize, 0) bSizer28.Add(self.open_job_b, 0, wx.ALL, 5) self.open_inst_b = wx.Button(self, wx.ID_ANY, u"Open Inst", wx.DefaultPosition, wx.DefaultSize, 0) self.open_inst_b.Enable(False) bSizer28.Add(self.open_inst_b, 0, wx.ALL, 5) self.stop_all = wx.Button(self, wx.ID_ANY, u"Stop All", wx.DefaultPosition, wx.DefaultSize, 0) self.stop_all.Enable(False) bSizer28.Add(self.stop_all, 0, wx.ALL, 5) bSizer9.Add(bSizer28, 0, wx.EXPAND, 5) bSizer29 = wx.BoxSizer(wx.VERTICAL) self.jobs_label = wx.StaticText(self, wx.ID_ANY, u"Jobs", wx.DefaultPosition, wx.DefaultSize, 0) self.jobs_label.Wrap(-1) bSizer29.Add(self.jobs_label, 0, wx.TOP | wx.RIGHT | wx.LEFT, 5) job_listboxChoices = [] self.job_listbox = wx.ListBox(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, job_listboxChoices, 0) bSizer29.Add(self.job_listbox, 1, wx.ALL | wx.EXPAND, 5) bSizer9.Add(bSizer29, 1, wx.EXPAND, 5) bSizer30 = wx.BoxSizer(wx.VERTICAL) self.inst_label = wx.StaticText(self, wx.ID_ANY, u"Instruments", wx.DefaultPosition, wx.DefaultSize, 0) self.inst_label.Wrap(-1) bSizer30.Add(self.inst_label, 0, wx.TOP | wx.RIGHT | wx.LEFT, 5) inst_listboxChoices = [] self.inst_listbox = wx.ListBox(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, inst_listboxChoices, 0) bSizer30.Add(self.inst_listbox, 1, wx.ALL | wx.EXPAND, 5) bSizer9.Add(bSizer30, 1, wx.EXPAND, 5) self.SetSizer(bSizer9) self.Layout() self.Centre(wx.BOTH) # Connect Events self.Bind(wx.EVT_CLOSE, self.OnCloseFrame) self.open_job_b.Bind(wx.EVT_BUTTON, self.file_open) self.job_listbox.Bind(wx.EVT_LISTBOX_DCLICK, self.switchToJob) self.inst_listbox.Bind(wx.EVT_LISTBOX_DCLICK, self.switchToInst)
def __init__(self, parent, log): self.log = log wx.Panel.__init__(self, parent, -1) # This will be used for all of the labels that follow (bold label) bfont = self.GetFont() bfont.SetWeight(wx.FONTWEIGHT_BOLD) # Contains everything tsizer = wx.BoxSizer(wx.VERTICAL) # Contains upper controls usizer = wx.BoxSizer(wx.HORIZONTAL) # Text control for ext / type entry plus label. t = wx.StaticText(self, -1, 'Extension / MIME type: ', style = wx.ALIGN_RIGHT ) t.SetFont(bfont) usizer.Add(t, 0, wx.ALL | wx.ALIGN_CENTER | wx.ALIGN_CENTER_VERTICAL, 2) self.ext = wx.TextCtrl(self, -1, value="wav", style = wx.TE_PROCESS_ENTER ) usizer.Add(self.ext, 0, wx.ALL | wx.ALIGN_TOP, 4) self.Bind(wx.EVT_TEXT_ENTER, self.OnLookup, self.ext) # Select how to look it up self.useExt = wx.RadioButton(self, -1, "By extension", style = wx.RB_GROUP) self.useMime = wx.RadioButton(self, -1, "By MIME type") usizer.Add(self.useExt, 0, wx.ALL | wx.ALIGN_CENTER | wx.ALIGN_CENTER_VERTICAL, 4) usizer.Add(self.useMime, 0, wx.ALL | wx.ALIGN_CENTER | wx.ALIGN_CENTER_VERTICAL, 4) self.useExt.SetValue(1) # Trigger a lookup (hitting ENTER in the text ctrl will do the same thing) self.go = wx.Button(self, -1, "Go get it!") usizer.Add(self.go, 0, wx.ALL | wx.ALIGN_CENTER | wx.ALIGN_CENTER_VERTICAL, 4) self.Bind(wx.EVT_BUTTON, self.OnLookup, self.go) # StaticBox with larger label than usual lbox = wx.StaticBox(self, -1, 'wx.FileType') f = self.GetFont() f.SetPointSize(f.GetPointSize() * 2) f.SetWeight(wx.FONTWEIGHT_BOLD) lbox.SetFont(f) lsizer = wx.StaticBoxSizer(lbox, wx.HORIZONTAL) # Contains the wx.FileType info llsizer = wx.GridBagSizer(2, 2) #------- Icon info t = wx.StaticText(self, -1, 'GetIconInfo: ', style = wx.ALIGN_RIGHT ) t.SetFont(bfont) llsizer.Add(t, (0, 0), (1, 1), wx.ALL | wx.EXPAND | wx.ALIGN_CENTER, 2) self.icon = wx.StaticBitmap(self, -1, images.NoIcon.GetBitmap()) llsizer.Add(self.icon, (0, 1), (1, 1), wx.ALL | wx.ALIGN_CENTER, 2) self.iconsource = wx.TextCtrl(self, -1, value="", size=(125, -1), style = wx.TE_READONLY ) llsizer.Add(self.iconsource, (0, 2), (1, 1), wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 2) self.iconoffset = wx.TextCtrl(self, -1, value="", size=(25,-1), style = wx.TE_READONLY ) llsizer.Add(self.iconoffset, (0, 3), (1, 1), wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2) #------- MIME Type t = wx.StaticText(self, -1, 'GetMimeType: ', style = wx.ALIGN_RIGHT ) t.SetFont(bfont) llsizer.Add(t, (1, 0), (1, 1), wx.ALL | wx.EXPAND | wx.ALIGN_CENTER, 2) self.mimetype = wx.TextCtrl(self, -1, value="", style = wx.TE_READONLY ) llsizer.Add(self.mimetype, (1, 1), (1, 3), wx.ALL | wx.EXPAND | wx.ALIGN_CENTER, 2) #------- MIME Types t = wx.StaticText(self, -1, 'GetMimeTypes: ', style = wx.ALIGN_RIGHT ) t.SetFont(bfont) llsizer.Add(t, (2, 0), (1, 1), wx.ALL | wx.EXPAND | wx.ALIGN_CENTER, 2) self.mimetypes = wx.TextCtrl(self, -1, value="", style = wx.TE_READONLY ) llsizer.Add(self.mimetypes, (2, 1), (1, 3), wx.ALL | wx.EXPAND | wx.ALIGN_CENTER, 2) #------- Extensions t = wx.StaticText(self, -1, 'GetExtensions: ', style = wx.ALIGN_RIGHT ) t.SetFont(bfont) llsizer.Add(t, (3, 0), (1, 1), wx.ALL | wx.EXPAND | wx.ALIGN_CENTER, 2) self.extensions = wx.TextCtrl(self, -1, value="", style = wx.TE_READONLY ) llsizer.Add(self.extensions, (3, 1), (1, 3), wx.ALL | wx.EXPAND | wx.ALIGN_CENTER, 2) #------- Description t = wx.StaticText(self, -1, 'GetDescription: ', style = wx.ALIGN_RIGHT ) t.SetFont(bfont) llsizer.Add(t, (4, 0), (1, 1), wx.ALL | wx.EXPAND | wx.ALIGN_CENTER, 2) self.description = wx.TextCtrl(self, -1, value="", style = wx.TE_READONLY) llsizer.Add(self.description, (4, 1), (1, 3), wx.ALL | wx.EXPAND | wx.ALIGN_CENTER, 2) #------- Open command t = wx.StaticText(self, -1, 'GetOpenCommand: ', style = wx.ALIGN_RIGHT ) t.SetFont(bfont) llsizer.Add(t, (5, 0), (1, 1), wx.ALL | wx.EXPAND | wx.ALIGN_CENTER, 2) self.opencommand = wx.TextCtrl(self, -1, value="", style = wx.TE_READONLY ) llsizer.Add(self.opencommand, (5, 1), (1, 3), wx.ALL | wx.EXPAND | wx.ALIGN_CENTER, 2) #------- Print command t = wx.StaticText(self, -1, 'GetPrintCommand: ', style = wx.ALIGN_RIGHT ) t.SetFont(bfont) llsizer.Add(t, (6, 0), (1, 1), wx.ALL | wx.EXPAND | wx.ALIGN_CENTER, 2) self.printcommand = wx.TextCtrl(self, -1, value="", style = wx.TE_READONLY ) llsizer.Add(self.printcommand, (6, 1), (1, 3), wx.ALL | wx.EXPAND | wx.ALIGN_CENTER, 2) #------- All commands t = wx.StaticText(self, -1, 'GetAllCommands: ', style = wx.ALIGN_RIGHT ) t.SetFont(bfont) llsizer.Add(t, (7, 0), (1, 1), wx.ALL | wx.EXPAND | wx.ALIGN_CENTER, 2) self.allcommands = wx.TextCtrl(self, -1, value="", style = wx.TE_READONLY | wx.TE_DONTWRAP | wx.TE_MULTILINE ) # Set the default height to be smaller than normal (for # multi-line) so the sizer can then expand it to whatever # space is available self.allcommands.SetSize((-1, 20)) llsizer.Add(self.allcommands, (7, 1), (1, 3), wx.ALL | wx.GROW | wx.ALIGN_CENTER, 2) # Tell the sizer to expand this row as needed llsizer.AddGrowableRow(7) llsizer.AddGrowableCol(2) #---------------------------------------------------------------------------- lrsizer = wx.BoxSizer(wx.VERTICAL) #------- List box with known MIME types t = wx.StaticText(self, -1, 'Known MIME types') t.SetFont(bfont) lrsizer.Add(t, 0, wx.ALL | wx.EXPAND | wx.ALIGN_CENTER, 4) self.mimelist = wx.ListBox(self, -1, choices=[], style = wx.LB_SINGLE)# | wx.LB_SORT) lrsizer.Add(self.mimelist, 1, wx.ALL | wx.EXPAND | wx.ALIGN_CENTER | wx.FIXED_MINSIZE, 4) self.Bind(wx.EVT_LISTBOX, self.OnListbox, self.mimelist) #---------------------------------------------------------------------------- lsizer.Add(llsizer, 1, wx.ALL | wx.EXPAND | wx.ALIGN_CENTER, 4) lsizer.Add(lrsizer, 0, wx.ALL | wx.EXPAND | wx.ALIGN_CENTER, 4) #---------------------------------------------------------------------------- tsizer.Add(usizer, 0, wx.ALL | wx.EXPAND | wx.ALIGN_CENTER, 4) tsizer.Add(lsizer, 1, wx.ALL | wx.EXPAND | wx.ALIGN_CENTER, 4) #---------------------------------------------------------------------------- self.SetSizer(tsizer) tsizer.Fit(self) # Populate the Known MIME types list with what is in the database try: mtypes = wx.TheMimeTypesManager.EnumAllFileTypes() except wx.PyAssertionError: mtypes = [] # TODO: On wxMac, EnumAllFileTypes produces tons of dupes, which # causes quirky behavior because the list control doesn't expect # dupes, and simply wastes space. So remove the dupes for now, # then remove this hack when we fix EnumAllFileTypes on Mac. mimes = [] for mt in mtypes: if mt not in mimes: #self.mimelist.Append(mt) mimes.append(mt) if mimes: mimes.sort() self.mimelist.AppendItems(mimes) # Do a lookup of *.wav for a starting position self.OnLookup()
def _init_ctrls(self, prnt): # generated method, don't edit wx.Frame.__init__(self, id=wxID_FRAME4, name='', parent=prnt, pos=wx.Point(6, 117), size=wx.Size(790, 587), style=wx.DEFAULT_FRAME_STYLE, title='Frame4') self.SetClientSize(wx.Size(774, 549)) self.SetBackgroundColour(wx.Colour(255, 255, 255)) self.panel1 = wx.Panel(id=wxID_FRAME4PANEL1, name='panel1', parent=self, pos=wx.Point(0, 0), size=wx.Size(774, 549), style=wx.TAB_TRAVERSAL) self.staticText1 = wx.StaticText(id=wxID_FRAME4STATICTEXT1, label=u'ENTER COLUMN NAME', name='staticText1', parent=self.panel1, pos=wx.Point(264, 48), size=wx.Size(272, 33), style=0) self.staticText1.SetFont( wx.Font(20, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'Tahoma')) self.staticText2 = wx.StaticText(id=wxID_FRAME4STATICTEXT2, label=u'Name:', name='staticText2', parent=self.panel1, pos=wx.Point(64, 144), size=wx.Size(56, 23), style=0) self.staticText2.SetFont( wx.Font(14, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'Tahoma')) self.textCtrl1 = wx.TextCtrl(id=wxID_FRAME4TEXTCTRL1, name='textCtrl1', parent=self.panel1, pos=wx.Point(200, 144), size=wx.Size(120, 24), style=0, value='') self.toggleButton1 = wx.ToggleButton(id=wxID_FRAME4TOGGLEBUTTON1, label=u'ADD', name='toggleButton1', parent=self.panel1, pos=wx.Point(72, 288), size=wx.Size(88, 40), style=0) self.toggleButton1.SetValue(False) self.toggleButton1.Enable(False) self.toggleButton1.Bind(wx.EVT_TOGGLEBUTTON, self.OnToggleButton1Togglebutton, id=wxID_FRAME4TOGGLEBUTTON1) self.toggleButton2 = wx.ToggleButton(id=wxID_FRAME4TOGGLEBUTTON2, label=u'REMOVE', name='toggleButton2', parent=self.panel1, pos=wx.Point(72, 344), size=wx.Size(88, 40), style=0) self.toggleButton2.SetValue(False) self.toggleButton2.Bind(wx.EVT_TOGGLEBUTTON, self.OnToggleButton2Togglebutton, id=wxID_FRAME4TOGGLEBUTTON2) self.listBox1 = wx.ListBox(choices=[], id=wxID_FRAME4LISTBOX1, name='listBox1', parent=self.panel1, pos=wx.Point(200, 288), size=wx.Size(112, 104), style=0) self.listBox1.Bind(wx.EVT_LISTBOX, self.OnListBox1Listbox, id=wxID_FRAME4LISTBOX1) self.toggleButton3 = wx.ToggleButton(id=wxID_FRAME4TOGGLEBUTTON3, label=u'SUBMIT', name='toggleButton3', parent=self.panel1, pos=wx.Point(256, 408), size=wx.Size(88, 40), style=0) self.toggleButton3.SetValue(True) self.toggleButton3.Bind(wx.EVT_TOGGLEBUTTON, self.OnToggleButton3Togglebutton, id=wxID_FRAME4TOGGLEBUTTON3) self.comboBox1 = wx.ComboBox(choices=["VARCHAR", "REAL"], id=wxID_FRAME4COMBOBOX1, name='comboBox1', parent=self.panel1, pos=wx.Point(72, 192), size=wx.Size(248, 21), style=0, value=u'selectVariableType') self.comboBox1.SetLabel(u'selectVariableType') self.comboBox1.Bind(wx.EVT_COMBOBOX, self.OnComboBox1Combobox, id=wxID_FRAME4COMBOBOX1) self.typeListBox = wx.ListBox(choices=[], id=wxID_FRAME4TYPELISTBOX, name=u'typeListBox', parent=self.panel1, pos=wx.Point(352, 288), size=wx.Size(112, 104), style=0) self.staticText3 = wx.StaticText( id=wxID_FRAME4STATICTEXT3, label=u'VARCHAR --- String\nREAL ---- Decimal', name='staticText3', parent=self.panel1, pos=wx.Point(368, 192), size=wx.Size(95, 26), style=1) self.staticText3.SetBackgroundColour(wx.Colour(255, 255, 0))
def __init__(self, parent, figurepanel, **kwargs): wx.Panel.__init__(self, parent, **kwargs) #the panel to draw charts on self.figurepanel = figurepanel self.sizer = wx.BoxSizer(wx.VERTICAL) testpanel = wx.Panel(self, style=wx.BORDER) sizer2 = wx.BoxSizer(wx.VERTICAL) import_button = wx.Button(testpanel, ID_IMPORT, "Import Properties File") self.importpathtext = wx.StaticText(testpanel, -1, "Please specify a properties file to import") self.tabledropdown = wx.Choice(testpanel, ID_TABLE_SELECT) wx.EVT_BUTTON(import_button, ID_IMPORT, self.loadproperties) wx.EVT_CHOICE(self.tabledropdown, ID_TABLE_SELECT, self.selecttable) sizer2.Add(import_button) sizer2.Add(self.importpathtext) sizer2.Add(self.tabledropdown) testpanel.SetSizer(sizer2) testpanel2 = wx.Panel(self, style=wx.BORDER) sizer3 = wx.BoxSizer(wx.VERTICAL) self.field1dropdown = wx.Choice(testpanel2) self.field2dropdown = wx.Choice(testpanel2) self.addtochartbutton = wx.Button(testpanel2, ID_ADDPOINTS, "Add to Chart") sizer3.Add(wx.StaticText(testpanel2, -1, "Charting Selections")) sizer3.Add(wx.StaticText(testpanel2, -1, "x-axis:")) sizer3.Add(self.field1dropdown) sizer3.Add(wx.StaticText(testpanel2, -1, "y-axis:")) sizer3.Add(self.field2dropdown) sizer3.Add(self.addtochartbutton) wx.EVT_BUTTON(self.addtochartbutton, ID_ADDPOINTS, self.addtochart) testpanel2.SetSizer(sizer3) testpanel3 = wx.Panel(self, style=wx.BORDER) self.plotfieldslistbox = wx.ListBox(testpanel3) self.removechartbutton = wx.Button(testpanel3, ID_REMOVEPOINTS, "Remove") sizer4 = wx.BoxSizer(wx.VERTICAL) sizer4.Add(self.plotfieldslistbox) sizer4.Add(self.removechartbutton) wx.EVT_BUTTON(self.removechartbutton, ID_REMOVEPOINTS, self.removefromchart) testpanel3.SetSizer(sizer4) self.sizer.Add(testpanel, 1, wx.EXPAND) self.sizer.Add(testpanel2, 1, wx.EXPAND) self.sizer.Add(testpanel3, 1, wx.EXPAND) #Layout sizers self.SetSizer(self.sizer) self.SetAutoLayout(1) self.sizer.Fit(self) self.Show(1)
def __init__(self, parent, ID, doodle): wx.Panel.__init__(self, parent, ID, style=wx.RAISED_BORDER) numCols = 4 spacing = 4 btnSize = wx.Size(self.BMP_SIZE + 2*self.BMP_BORDER, self.BMP_SIZE + 2*self.BMP_BORDER) self.clrBtns = {} colours = doodle.menuColours keys = list(colours.keys()) keys.sort() cGrid = wx.GridSizer(cols=numCols, hgap=2, vgap=2) for k in keys: bmp = self.MakeBitmap(colours[k]) b = buttons.GenBitmapToggleButton(self, k, bmp, size=btnSize ) b.SetBezelWidth(1) b.SetUseFocusIndicator(False) self.Bind(wx.EVT_BUTTON, self.OnSetColour, b) cGrid.Add(b, 0) self.clrBtns[colours[k]] = b self.clrBtns[colours[keys[0]]].SetToggle(True) self.thknsBtns = {} tGrid = wx.GridSizer(cols=numCols, hgap=2, vgap=2) for x in range(1, doodle.maxThickness+1): b = buttons.GenToggleButton(self, x, str(x), size=btnSize) b.SetBezelWidth(1) b.SetUseFocusIndicator(False) self.Bind(wx.EVT_BUTTON, self.OnSetThickness, b) tGrid.Add(b, 0) self.thknsBtns[x] = b self.thknsBtns[1].SetToggle(True) ci = ColourIndicator(self) doodle.AddListener(ci) doodle.Notify() self.doodle = doodle box = wx.BoxSizer(wx.VERTICAL) box.Add(cGrid, 0, wx.ALL, spacing) box.Add(tGrid, 0, wx.ALL, spacing) box.Add(ci, 0, wx.EXPAND|wx.ALL, spacing) if 1: e = wx.FontEnumerator() e.EnumerateFacenames() elist= e.GetFacenames() self.lb1 = wx.ListBox(self, -1, wx.DefaultPosition, (200, -1), elist, wx.LB_SINGLE) self.Bind(wx.EVT_LISTBOX, self.OnSelect, id=self.lb1.GetId()) box.Add(self.lb1, 0, wx.EXPAND|wx.ALL) self.SetSizer(box) self.SetAutoLayout(True) # Resize this window so it is just large enough for the # minimum requirements of the sizer. box.Fit(self)
def __init__(self, *args, **kwds): """Initialize the frame and its layout """ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) # Top level panels left_panel = wx.Panel(self, -1) right_panel = wx.Panel(self, -1) # Module categories (in left panel) module_categories_text = wx.StaticText( left_panel, -1, "Module Categories", style=wx.ALIGN_CENTER ) font = module_categories_text.GetFont() module_categories_text.SetFont( wx.Font( font.GetPointSize() * 1.2, font.GetFamily(), font.GetStyle(), wx.FONTWEIGHT_BOLD, ) ) self.__module_categories_list_box = wx.ListBox(left_panel, -1) # Control panel for the selected module selected_module_panel = wx.Panel(left_panel, -1) selected_module_static_box = wx.StaticBox( selected_module_panel, -1, "For Selected Module" ) add_to_pipeline_button = wx.Button( selected_module_panel, -1, "+ Add to Pipeline" ) module_help_button = wx.Button(selected_module_panel, -1, "? Module Help") # Other buttons getting_started_button = wx.Button(left_panel, -1, "Getting Started") done_button = wx.Button(left_panel, -1, "Done") # Right-side panel self.__module_list_box = wx.ListBox(right_panel, -1) w, h, _, _ = self.__module_list_box.GetFullTextExtent( "MeasureObjectIntensityDistribution" ) self.__module_list_box.SetMinSize(wx.Size(w, h * 30)) # Sizers self.SetSizer(wx.BoxSizer(wx.VERTICAL)) search_sizer = wx.BoxSizer(wx.HORIZONTAL) self.GetSizer().Add(search_sizer, 0, wx.EXPAND | wx.ALL, 2) search_sizer.Add( wx.StaticText(self, label="Find Modules:"), 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, ) self.search_text = wx.TextCtrl(self, style=wx.TE_PROCESS_ENTER) search_sizer.Add(self.search_text, 1, wx.EXPAND) self.search_button = wx.Button(self, label="Search Help") search_sizer.Add(self.search_button, 0, wx.EXPAND) self.GetSizer().AddSpacer(2) top_sizer = wx.BoxSizer(wx.HORIZONTAL) top_sizer.AddMany( [(left_panel, 0, wx.EXPAND | wx.LEFT, 5), (right_panel, 1, wx.EXPAND)] ) self.GetSizer().Add(top_sizer, 1, wx.EXPAND) left_sizer = wx.BoxSizer(wx.VERTICAL) left_sizer.Add(module_categories_text, 0, wx.EXPAND) left_sizer.AddSpacer(4) left_sizer.Add(self.__module_categories_list_box, 1, wx.EXPAND) left_sizer.Add((-1, 10)) left_sizer.Add(selected_module_panel, 0, wx.EXPAND) left_sizer.Add((-1, 10)) left_sizer.Add(getting_started_button, 0, wx.EXPAND) left_sizer.AddSpacer(2) left_sizer.Add(done_button, 0, wx.EXPAND | wx.BOTTOM, 5) left_panel.SetSizer(left_sizer) right_sizer = wx.BoxSizer(wx.VERTICAL) right_sizer.Add(self.__module_list_box, 1, wx.EXPAND | wx.ALL, 5) right_panel.SetSizer(right_sizer) selected_module_panel_sizer = wx.BoxSizer(wx.VERTICAL) selected_module_panel_sizer.Add(add_to_pipeline_button, 0, wx.EXPAND) selected_module_panel_sizer.AddSpacer(2) selected_module_panel_sizer.Add(module_help_button, 0, wx.EXPAND) selected_module_panel.SetSizer(selected_module_panel_sizer) self.__set_icon() accelerators = wx.AcceleratorTable( [(wx.ACCEL_CMD, ord("W"), cellprofiler.gui.cpframe.ID_FILE_EXIT)] ) self.SetAcceleratorTable(accelerators) self.Bind(wx.EVT_CLOSE, self.__on_close, self) self.Bind( wx.EVT_LISTBOX, self.__on_category_selected, self.__module_categories_list_box, ) self.Bind( wx.EVT_LISTBOX_DCLICK, self.__on_add_to_pipeline, self.__module_list_box ) self.Bind(wx.EVT_BUTTON, self.__on_add_to_pipeline, add_to_pipeline_button) self.Bind(wx.EVT_BUTTON, self.__on_close, done_button) self.Bind(wx.EVT_BUTTON, self.__on_help, module_help_button) self.Bind(wx.EVT_BUTTON, self.__on_getting_started, getting_started_button) self.Bind( wx.EVT_MENU, self.__on_close, id=cellprofiler.gui.cpframe.ID_FILE_EXIT ) self.search_text.Bind(wx.EVT_TEXT, self.__on_search_modules) self.search_text.Bind(wx.EVT_TEXT_ENTER, self.__on_add_to_pipeline) self.search_button.Bind(wx.EVT_BUTTON, self.__on_search_help) self.__get_module_files() self.__set_categories() self.__listeners = [] self.__module_categories_list_box.Select(0) self.__on_category_selected(None) self.Fit()
def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.Size(-1, -1), style=wx.TAB_TRAVERSAL, name=wx.EmptyString): wx.Panel.__init__(self, parent, id=id, pos=pos, size=size, style=style, name=name) bSizer32 = wx.BoxSizer(wx.VERTICAL) sbSizer6 = wx.StaticBoxSizer( wx.StaticBox(self, wx.ID_ANY, u"Bom destination"), wx.VERTICAL) fgSizer1 = wx.FlexGridSizer(0, 2, 0, 0) fgSizer1.AddGrowableCol(1) fgSizer1.SetFlexibleDirection(wx.BOTH) fgSizer1.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.m_staticText8 = wx.StaticText(sbSizer6.GetStaticBox(), wx.ID_ANY, u"Directory", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText8.Wrap(-1) fgSizer1.Add(self.m_staticText8, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.bomDirPicker = wx.DirPickerCtrl( sbSizer6.GetStaticBox(), wx.ID_ANY, wx.EmptyString, u"Select bom folder", wx.DefaultPosition, wx.DefaultSize, wx.DIRP_SMALL | wx.DIRP_USE_TEXTCTRL | wx.BORDER_SIMPLE) fgSizer1.Add(self.bomDirPicker, 1, wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.EXPAND, 5) self.m_staticText9 = wx.StaticText(sbSizer6.GetStaticBox(), wx.ID_ANY, u"Name format", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText9.Wrap(-1) fgSizer1.Add(self.m_staticText9, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) bSizer20 = wx.BoxSizer(wx.HORIZONTAL) self.fileNameFormatTextControl = wx.TextCtrl(sbSizer6.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) bSizer20.Add(self.fileNameFormatTextControl, 1, wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.EXPAND, 5) self.m_button12 = wx.Button(sbSizer6.GetStaticBox(), wx.ID_ANY, u"?", wx.DefaultPosition, wx.DefaultSize, wx.BU_EXACTFIT) bSizer20.Add(self.m_button12, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 4) fgSizer1.Add(bSizer20, 1, wx.EXPAND, 5) sbSizer6.Add(fgSizer1, 1, wx.EXPAND, 5) bSizer32.Add(sbSizer6, 0, wx.ALL | wx.EXPAND, 5) sortingSizer = wx.StaticBoxSizer( wx.StaticBox(self, wx.ID_ANY, u"Component sort order"), wx.VERTICAL) bSizer4 = wx.BoxSizer(wx.HORIZONTAL) bSizer6 = wx.BoxSizer(wx.VERTICAL) componentSortOrderBoxChoices = [] self.componentSortOrderBox = wx.ListBox( sortingSizer.GetStaticBox(), wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, componentSortOrderBoxChoices, wx.LB_SINGLE | wx.BORDER_SIMPLE) bSizer6.Add(self.componentSortOrderBox, 1, wx.ALL | wx.EXPAND, 5) bSizer4.Add(bSizer6, 1, wx.EXPAND, 5) bSizer5 = wx.BoxSizer(wx.VERTICAL) self.m_button1 = wx.Button(sortingSizer.GetStaticBox(), wx.ID_ANY, u"Up", wx.DefaultPosition, wx.Size(30, 30), 0 | wx.BORDER_DEFAULT) bSizer5.Add(self.m_button1, 0, wx.ALL, 5) self.m_button2 = wx.Button(sortingSizer.GetStaticBox(), wx.ID_ANY, u"Dn", wx.DefaultPosition, wx.Size(30, 30), 0 | wx.BORDER_DEFAULT) bSizer5.Add(self.m_button2, 0, wx.ALL, 5) self.m_button3 = wx.Button(sortingSizer.GetStaticBox(), wx.ID_ANY, u"+", wx.DefaultPosition, wx.Size(30, 30), 0 | wx.BORDER_DEFAULT) bSizer5.Add(self.m_button3, 0, wx.ALL, 5) self.m_button4 = wx.Button(sortingSizer.GetStaticBox(), wx.ID_ANY, u"-", wx.DefaultPosition, wx.Size(30, 30), 0 | wx.BORDER_DEFAULT) bSizer5.Add(self.m_button4, 0, wx.ALL, 5) bSizer4.Add(bSizer5, 0, wx.ALIGN_RIGHT, 5) sortingSizer.Add(bSizer4, 1, wx.EXPAND, 5) bSizer32.Add(sortingSizer, 1, wx.ALL | wx.EXPAND, 5) blacklistSizer = wx.StaticBoxSizer( wx.StaticBox(self, wx.ID_ANY, u"Component blacklist"), wx.VERTICAL) bSizer412 = wx.BoxSizer(wx.HORIZONTAL) bSizer612 = wx.BoxSizer(wx.VERTICAL) blacklistBoxChoices = [] self.blacklistBox = wx.ListBox( blacklistSizer.GetStaticBox(), wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, blacklistBoxChoices, wx.LB_SINGLE | wx.LB_SORT | wx.BORDER_SIMPLE) bSizer612.Add(self.blacklistBox, 1, wx.ALL | wx.EXPAND, 5) bSizer412.Add(bSizer612, 1, wx.EXPAND, 5) bSizer512 = wx.BoxSizer(wx.VERTICAL) self.m_button112 = wx.Button(blacklistSizer.GetStaticBox(), wx.ID_ANY, u"+", wx.DefaultPosition, wx.Size(30, 30), 0 | wx.BORDER_DEFAULT) bSizer512.Add(self.m_button112, 0, wx.ALL, 5) self.m_button212 = wx.Button(blacklistSizer.GetStaticBox(), wx.ID_ANY, u"-", wx.DefaultPosition, wx.Size(30, 30), 0 | wx.BORDER_DEFAULT) bSizer512.Add(self.m_button212, 0, wx.ALL, 5) bSizer412.Add(bSizer512, 0, wx.ALIGN_RIGHT, 5) blacklistSizer.Add(bSizer412, 1, wx.EXPAND, 5) self.m_staticText1 = wx.StaticText(blacklistSizer.GetStaticBox(), wx.ID_ANY, u"Globs are supported, e.g. MH*", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText1.Wrap(-1) blacklistSizer.Add(self.m_staticText1, 0, wx.ALL, 5) self.blacklistVirtualCheckbox = wx.CheckBox( blacklistSizer.GetStaticBox(), wx.ID_ANY, u"Blacklist virtual components", wx.DefaultPosition, wx.DefaultSize, 0) self.blacklistVirtualCheckbox.SetValue(True) blacklistSizer.Add(self.blacklistVirtualCheckbox, 0, wx.ALL, 5) self.blacklistEmptyValCheckbox = wx.CheckBox( blacklistSizer.GetStaticBox(), wx.ID_ANY, u"Blacklist components with empty value", wx.DefaultPosition, wx.DefaultSize, 0) blacklistSizer.Add(self.blacklistEmptyValCheckbox, 0, wx.ALL, 5) bSizer32.Add(blacklistSizer, 1, wx.ALL | wx.EXPAND | wx.TOP, 5) self.SetSizer(bSizer32) self.Layout() bSizer32.Fit(self) # Connect Events self.m_button12.Bind(wx.EVT_BUTTON, self.OnNameFormatHintClick) self.m_button1.Bind(wx.EVT_BUTTON, self.OnComponentSortOrderUp) self.m_button2.Bind(wx.EVT_BUTTON, self.OnComponentSortOrderDown) self.m_button3.Bind(wx.EVT_BUTTON, self.OnComponentSortOrderAdd) self.m_button4.Bind(wx.EVT_BUTTON, self.OnComponentSortOrderRemove) self.m_button112.Bind(wx.EVT_BUTTON, self.OnComponentBlacklistAdd) self.m_button212.Bind(wx.EVT_BUTTON, self.OnComponentBlacklistRemove)
def __init__(self, parent, lst_of_dataFrames): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"New 2D Graph", pos=wx.DefaultPosition, size=wx.Size(400, 525), style=wx.CAPTION | wx.FRAME_FLOAT_ON_PARENT) self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) main_sizer = wx.BoxSizer(wx.VERTICAL) self.main_panel = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.Size(400, 525), 0) self.main_panel.SetBackgroundColour(wx.Colour(219, 219, 219)) self.main_panel.SetToolTipString(u"tooltip...") main_panel_sizer = wx.BoxSizer(wx.VERTICAL) series_selection_sizer = wx.BoxSizer(wx.VERTICAL) bSizer122 = wx.BoxSizer(wx.VERTICAL) bSizer120 = wx.BoxSizer(wx.HORIZONTAL) bSizer123 = wx.BoxSizer(wx.VERTICAL) self.y_axis_staticTxt = wx.StaticText(self.main_panel, wx.ID_ANY, u"Y Series", wx.DefaultPosition, wx.DefaultSize, 0) self.y_axis_staticTxt.Wrap(-1) self.y_axis_staticTxt.SetFont( wx.Font(wx.NORMAL_FONT.GetPointSize(), 70, 90, 90, False, wx.EmptyString)) bSizer123.Add(self.y_axis_staticTxt, 0, wx.ALIGN_CENTER | wx.ALL, 5) bSizer120.Add(bSizer123, 1, wx.EXPAND, 5) bSizer124 = wx.BoxSizer(wx.VERTICAL) self.x_axis_staticText = wx.StaticText(self.main_panel, wx.ID_ANY, u"X Series", wx.DefaultPosition, wx.DefaultSize, 0) self.x_axis_staticText.Wrap(-1) bSizer124.Add(self.x_axis_staticText, 0, wx.ALIGN_CENTER | wx.ALL, 5) bSizer120.Add(bSizer124, 1, wx.EXPAND, 5) bSizer122.Add(bSizer120, 0, wx.EXPAND | wx.TOP, 5) bSizer121 = wx.BoxSizer(wx.HORIZONTAL) bSizer129 = wx.BoxSizer(wx.VERTICAL) y_DataFrame_ChoiceBoxChoices = lst_of_dataFrames self.y_DataFrame_ChoiceBox = wx.Choice(self.main_panel, wx.ID_ANY, wx.DefaultPosition, wx.Size(150, -1), y_DataFrame_ChoiceBoxChoices, 0) self.y_DataFrame_ChoiceBox.SetSelection(0) bSizer129.Add(self.y_DataFrame_ChoiceBox, 0, wx.ALL | wx.EXPAND, 5) bSizer121.Add(bSizer129, 1, wx.EXPAND, 5) bSizer135 = wx.BoxSizer(wx.VERTICAL) x_DataFrame_ChoiceBoxChoices = lst_of_dataFrames self.x_DataFrame_ChoiceBox = wx.Choice(self.main_panel, wx.ID_ANY, wx.DefaultPosition, wx.Size(150, -1), x_DataFrame_ChoiceBoxChoices, 0) self.x_DataFrame_ChoiceBox.SetSelection(0) bSizer135.Add(self.x_DataFrame_ChoiceBox, 0, wx.ALL | wx.EXPAND, 5) bSizer121.Add(bSizer135, 1, wx.EXPAND, 5) bSizer122.Add(bSizer121, 1, wx.EXPAND, 5) series_selection_sizer.Add(bSizer122, 0, wx.EXPAND, 5) bSizer125 = wx.BoxSizer(wx.HORIZONTAL) bSizer118 = wx.BoxSizer(wx.VERTICAL) y_Series_ListBoxChoices = [] self.y_Series_ListBox = wx.ListBox( self.main_panel, wx.ID_ANY, wx.DefaultPosition, wx.Size(-1, -1), y_Series_ListBoxChoices, wx.LB_HSCROLL | wx.LB_NEEDED_SB | wx.LB_SINGLE | wx.LB_SORT) self.y_Series_ListBox.SetMinSize(wx.Size(-1, 150)) bSizer118.Add(self.y_Series_ListBox, 0, wx.ALL | wx.EXPAND, 5) bSizer125.Add(bSizer118, 1, wx.EXPAND, 5) bSizer119 = wx.BoxSizer(wx.VERTICAL) x_Series_ListBoxChoices = [] self.x_Series_ListBox = wx.ListBox( self.main_panel, wx.ID_ANY, wx.DefaultPosition, wx.Size(-1, -1), x_Series_ListBoxChoices, wx.LB_HSCROLL | wx.LB_MULTIPLE | wx.LB_NEEDED_SB | wx.LB_SORT) self.x_Series_ListBox.SetMinSize(wx.Size(-1, 150)) bSizer119.Add(self.x_Series_ListBox, 0, wx.ALL | wx.EXPAND, 5) bSizer125.Add(bSizer119, 1, wx.EXPAND, 5) series_selection_sizer.Add(bSizer125, 1, wx.EXPAND, 5) bSizer126 = wx.BoxSizer(wx.HORIZONTAL) sub_sizer_left = wx.BoxSizer(wx.HORIZONTAL) self.y_axis_label_StaticTxt = wx.StaticText(self.main_panel, wx.ID_ANY, u"Axis: ", wx.DefaultPosition, wx.DefaultSize, 0) self.y_axis_label_StaticTxt.Wrap(-1) sub_sizer_left.Add(self.y_axis_label_StaticTxt, 0, wx.ALL, 5) y_axis_ChoiceBoxChoices = [u"Left", u"Right"] self.y_axis_ChoiceBox = wx.Choice(self.main_panel, wx.ID_ANY, wx.DefaultPosition, wx.Size(100, -1), y_axis_ChoiceBoxChoices, 0) self.y_axis_ChoiceBox.SetSelection(0) sub_sizer_left.Add(self.y_axis_ChoiceBox, 0, wx.ALL, 5) bSizer126.Add(sub_sizer_left, 0, wx.EXPAND, 5) sub_sizer_right = wx.BoxSizer(wx.HORIZONTAL) self.x_axis_label_StaticTxt = wx.StaticText(self.main_panel, wx.ID_ANY, u"Axis: ", wx.DefaultPosition, wx.DefaultSize, 0) self.x_axis_label_StaticTxt.Wrap(-1) sub_sizer_right.Add(self.x_axis_label_StaticTxt, 0, wx.ALL, 5) x_axis_ChoiceBoxChoices = [u"Bottom", u"Top"] self.x_axis_ChoiceBox = wx.Choice(self.main_panel, wx.ID_ANY, wx.DefaultPosition, wx.Size(100, -1), x_axis_ChoiceBoxChoices, 0) self.x_axis_ChoiceBox.SetSelection(0) sub_sizer_right.Add(self.x_axis_ChoiceBox, 0, wx.ALL, 5) bSizer126.Add(sub_sizer_right, 0, wx.EXPAND, 5) series_selection_sizer.Add(bSizer126, 0, wx.EXPAND, 5) main_panel_sizer.Add(series_selection_sizer, 0, wx.ALIGN_CENTER_HORIZONTAL, 5) add_option_sizer = wx.BoxSizer(wx.VERTICAL) self.add_button = wx.Button(self.main_panel, wx.ID_ANY, u"Add...", wx.DefaultPosition, wx.DefaultSize, 0) add_option_sizer.Add(self.add_button, 0, wx.ALIGN_CENTER | wx.ALL, 5) main_panel_sizer.Add(add_option_sizer, 0, wx.ALL | wx.EXPAND, 5) plot_options_sizer = wx.BoxSizer(wx.HORIZONTAL) bSizer127 = wx.BoxSizer(wx.HORIZONTAL) self.plot_title_StaticTxt = wx.StaticText(self.main_panel, wx.ID_ANY, u"Title: ", wx.DefaultPosition, wx.DefaultSize, 0) self.plot_title_StaticTxt.Wrap(-1) bSizer127.Add(self.plot_title_StaticTxt, 0, wx.ALL, 5) self.plot_title_TxtCtrl = wx.TextCtrl(self.main_panel, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) bSizer127.Add(self.plot_title_TxtCtrl, 0, wx.ALL, 5) plot_options_sizer.Add(bSizer127, 1, wx.EXPAND, 5) bSizer128 = wx.BoxSizer(wx.HORIZONTAL) self.plot_style_StaticTxt = wx.StaticText(self.main_panel, wx.ID_ANY, u"Style: ", wx.DefaultPosition, wx.DefaultSize, 0) self.plot_style_StaticTxt.Wrap(-1) bSizer128.Add(self.plot_style_StaticTxt, 0, wx.ALL, 5) plot_style_ChoiceBoxChoices = [u"Line", u"Scatter"] self.plot_style_ChoiceBox = wx.Choice(self.main_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, plot_style_ChoiceBoxChoices, 0) self.plot_style_ChoiceBox.SetSelection(0) bSizer128.Add(self.plot_style_ChoiceBox, 0, wx.ALL, 5) plot_options_sizer.Add(bSizer128, 1, wx.EXPAND, 5) main_panel_sizer.Add(plot_options_sizer, 0, wx.EXPAND, 5) dialog_box_sizer = wx.BoxSizer(wx.VERTICAL) self.m_staticText50 = wx.StaticText(self.main_panel, wx.ID_ANY, u"Display:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText50.Wrap(-1) dialog_box_sizer.Add(self.m_staticText50, 0, wx.ALL, 5) self.dialog_TxtCtrl = wx.TextCtrl( self.main_panel, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(-1, 100), wx.HSCROLL | wx.TE_READONLY | wx.VSCROLL) self.dialog_TxtCtrl.SetBackgroundColour( wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)) font = wx.Font(8, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, True) self.dialog_TxtCtrl.SetFont(font) dialog_box_sizer.Add(self.dialog_TxtCtrl, 0, wx.ALL | wx.EXPAND, 5) main_panel_sizer.Add(dialog_box_sizer, 0, wx.ALIGN_TOP | wx.EXPAND, 5) button_sizer = wx.BoxSizer(wx.HORIZONTAL) button_sub_sizer = wx.StdDialogButtonSizer() self.button_sub_sizerOK = wx.Button(self.main_panel, wx.ID_OK) button_sub_sizer.AddButton(self.button_sub_sizerOK) self.button_sub_sizerCancel = wx.Button(self.main_panel, wx.ID_CANCEL) button_sub_sizer.AddButton(self.button_sub_sizerCancel) button_sub_sizer.Realize() button_sizer.Add(button_sub_sizer, 1, wx.ALL, 5) main_panel_sizer.Add(button_sizer, 0, wx.EXPAND, 5) self.main_panel.SetSizer(main_panel_sizer) self.main_panel.Layout() main_sizer.Add(self.main_panel, 1, wx.EXPAND, 5) self.SetSizer(main_sizer) self.Layout() self.Centre(wx.BOTH) self.Show(True) # Connect Events self.y_DataFrame_ChoiceBox.Bind(wx.EVT_CHOICE, self.on_choice_ySeries_dataFrame) self.y_DataFrame_ChoiceBox.Bind(wx.EVT_LEAVE_WINDOW, self.calculate_ySeries_options) self.x_DataFrame_ChoiceBox.Bind(wx.EVT_CHOICE, self.on_choice_xSeries_dataFrame) self.x_DataFrame_ChoiceBox.Bind(wx.EVT_LEAVE_WINDOW, self.calculate_xSeries_options) self.y_Series_ListBox.Bind(wx.EVT_LISTBOX_DCLICK, self.on_choice_ySeries) self.x_Series_ListBox.Bind(wx.EVT_LISTBOX_DCLICK, self.on_choice_xSeries) self.y_axis_ChoiceBox.Bind(wx.EVT_CHOICE, self.on_choice_y_axis_position) self.x_axis_ChoiceBox.Bind(wx.EVT_CHOICE, self.on_choice_x_axis_position) self.add_button.Bind(wx.EVT_BUTTON, self.on_add_series_pair) self.plot_style_ChoiceBox.Bind(wx.EVT_CHOICE, self.on_choice_plot_style) self.button_sub_sizerCancel.Bind(wx.EVT_BUTTON, self.on_click_Cancel) self.button_sub_sizerOK.Bind(wx.EVT_BUTTON, self.on_click_OK)
def __init__(self, mode): """ Build up the GUI. """ wx.Frame.__init__(self, parent=None, title='6.00 Word Game') self.mode = mode # There are four nested levels of panels. The outerPanel contains the # status bar on the bottom and everything else on top of it (in # statsPanel). statsPanel contains the stats display for player 1 on # the left, the mainPanel in the middle, and the stats display for # player 2 on the right. mainPanel contains the history list box and # the entryPanel below it. The entryPanel contains the inputBox and # the submitButton side by side. outerPanel = wx.Panel(self) statsPanel = wx.Panel(outerPanel) mainPanel = wx.Panel(statsPanel) entryPanel = wx.Panel(mainPanel) # entryPanel self.inputBox = wx.TextCtrl(entryPanel) self.submitButton = wx.Button(entryPanel, label='Enter!') self.submitButton.SetDefault() hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add(self.inputBox, 1, wx.EXPAND) hbox.Add(self.submitButton, 0, wx.EXPAND) self.submitButton.Bind(wx.EVT_BUTTON, self.OnEnter) entryPanel.SetSizer(hbox) # mainPanel historyLabel = wx.StaticText(mainPanel, label='Previously entered words:') self.history = wx.ListBox(mainPanel) self.handLabel = wx.StaticText(mainPanel, label='Hand: ') inputBoxLabel = wx.StaticText(mainPanel, label='&Enter word, or . to end round:') vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(historyLabel, 0, wx.EXPAND) vbox.Add(self.history, 1, wx.EXPAND) vbox.Add(self.handLabel, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 10) vbox.Add(inputBoxLabel, 0, wx.ALIGN_CENTER_VERTICAL) vbox.Add(entryPanel, 0, wx.EXPAND) mainPanel.SetSizer(vbox) # statsPanel hbox = wx.BoxSizer(wx.HORIZONTAL) empty = lambda: wx.StaticText(statsPanel, label='') self.stats = [ wx.StaticText(statsPanel, label='', style=wx.ALIGN_CENTER | wx.ST_NO_AUTORESIZE, size=(150, -1)) for player in [1, 2] ] hbox.Add(self.stats[0], 0, wx.EXPAND) hbox.Add(mainPanel, 1, wx.EXPAND) hbox.Add(self.stats[1], 0, wx.EXPAND) statsPanel.SetSizer(hbox) # outerPanel self.statusBar = wx.StatusBar(outerPanel) self.statusBar.SetStatusText('This is the status bar.') vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(statsPanel, 1, wx.EXPAND) vbox.Add(self.statusBar, 0, wx.EXPAND) outerPanel.SetSizer(vbox) # Set some miscellaneous options on the window. self.SetMinSize((700, 300)) self.Center() # Bind some event handlers. self.Bind(wx.EVT_CLOSE, self.OnClose) self.Bind(EVT_WORD_SUBMISSION, self.OnWordSubmission) # Start things up. self.queue = Queue.Queue() self.inputBox.SetFocus() self.StartGame()
def __init__(self, parent, title): wx.Frame.__init__(self, parent, -1, title, wx.DefaultPosition, wx.Size(500, 500) #style=wx.DEFAULT_FRAME_STYLE #style=wx.DEFAULT_FRAME_STYLE ^ (wx.RESIZE_BORDER | wx.MAXIMIZE_BOX) ) #style=wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX | wx.MINIMIZE_BOX) #拖进到窗口中的文件列表 self.filesList = [] #创建状态栏 self.statusbar = self.CreateStatusBar() self.statusbar.SetForegroundColour('red') self.statusbar.SetFieldsCount(2) self.statusbar.SetStatusWidths([-2, -1]) #大小比例2:1 #创建工具栏 toolbar = self.CreateToolBar() toolbar.AddSimpleTool(1, wx.Image('./about.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap(), "关于我", "") toolbar.AddSeparator() toolbar.Realize() #准备显示工具栏 wx.EVT_TOOL(self, 1, self.OnAboutMe) #创建panel self.panel = wx.Panel(self) self.panel.SetDropTarget(AHDropTarget(self)) #self.font = wx.Font(18, wx.SCRIPT, wx.BOLD, wx.LIGHT) #self.selectedPath = wx.StaticText(self.panel, -1, u'请将xcarchive文件拖拽到窗口中!', pos=(138, 300)) #self.selectedPath.SetFont(self.font) self.vbox = wx.BoxSizer(wx.VERTICAL) self.description = wx.StaticText(self.panel, -1, u'请将dSYM文件拖拽到窗口中并选中任意一个版本进行分析', style=wx.TE_WORDWRAP | wx.TE_MULTILINE) self.fileTypeLB = wx.ListBox(self.panel, -1, style = wx.LB_EXTENDED) self.fileTypeLB.SetBackgroundColour(wx.Colour(232, 232, 232, 255)) #TODO: 从sqlite中读取文件路径 self.getdSYMFileFromSqlite() self.Bind(wx.EVT_LISTBOX, self.ListBoxClick, self.fileTypeLB) self.Bind(wx.EVT_LISTBOX_DCLICK, self.ListBoxClick, self.fileTypeLB) self.fileTypeLBhbox = wx.BoxSizer(wx.HORIZONTAL) self.fileTypeLBhbox.Add(self.fileTypeLB, 1, wx.EXPAND) self.vbox.Add(self.description, 0, wx.EXPAND | wx.ALL, 5) self.vbox.Add(self.fileTypeLBhbox, 1, wx.EXPAND | wx.ALL, 5) self.vbox.SetItemMinSize(self.fileTypeLBhbox, (200, 100)) self.vbox.Add((-1, 10)) self.UUIDString = wx.StaticText(self.panel, -1, u'选中dSYM文件的UUID:') self.vbox.Add(self.UUIDString, 0, wx.EXPAND | wx.ALL, 5) self.UUIDStringText = wx.TextCtrl(self.panel, -1) hbox2 = wx.BoxSizer(wx.HORIZONTAL) hbox2.Add(self.UUIDStringText, 1, wx.EXPAND) self.vbox.Add(hbox2, 0, wx.EXPAND | wx.ALL, 5) self.vbox.Add((-1, 10)) self.memAddressStr = wx.StaticText(self.panel, -1, u'请输入错误信息的内存地址:') self.vbox.Add(self.memAddressStr, 0, wx.ALL, 5) self.memAddress = wx.TextCtrl(self.panel, -1) hbox3 = wx.BoxSizer(wx.HORIZONTAL) hbox3.Add(self.memAddress, 1, wx.EXPAND) self.vbox.Add(hbox3, 0, wx.EXPAND | wx.ALL, 5) self.fileBtn = wx.Button(self.panel, -1, u'分析') self.fileBtn.Bind(wx.EVT_BUTTON, self.startCalc) hbox4 = wx.BoxSizer(wx.HORIZONTAL) hbox4.Add(self.fileBtn, 1, wx.EXPAND) self.vbox.Add(hbox4, 0, wx.EXPAND | wx.ALL, 5) self.vbox.Add((-1, 10)) self.maybeReason = wx.StaticText(self.panel, -1, u'有可能错误的地方:', style=wx.TE_WORDWRAP|wx.TE_MULTILINE)#size=(170, 30), pos=(5, 250), self.vbox.Add(self.maybeReason, 0, wx.EXPAND | wx.ALL, 5) self.maybeReasonContent = wx.TextCtrl(self.panel, -1, u'', style=wx.TE_WORDWRAP|wx.TE_MULTILINE)#size=(500, 60), pos=(5, 270), hbox5 = wx.BoxSizer(wx.HORIZONTAL) hbox5.Add(self.maybeReasonContent, 1, wx.EXPAND) self.vbox.Add(hbox5, 1, wx.EXPAND | wx.ALL, 5) self.vbox.SetItemMinSize(hbox5, (200, 100)) self.panel.Bind(wx.EVT_ENTER_WINDOW, self.OnEnterWindow) self.panel.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeaveWindow) self.panel.Bind(wx.EVT_MOTION, self.OnMotion) self.panel.SetSizer(self.vbox)
def __init__(self, parent, controller, tagname, exclude_input=False): """ Constructor @param parent: Parent wx.Window of dialog for modal @param controller: Reference to project controller @param tagname: Tagname of project POU edited @param exclude_input: Exclude input from variable class selection """ BlockPreviewDialog.__init__(self, parent, controller, tagname, title=_('Variable Properties')) # Init common sizers self._init_sizers(4, 2, 4, None, 3, 2) # Create label for variable class class_label = wx.StaticText(self, label=_('Class:')) self.LeftGridSizer.AddWindow(class_label, flag=wx.GROW) # Create a combo box for defining variable class self.Class = wx.ComboBox(self, style=wx.CB_READONLY) self.Bind(wx.EVT_COMBOBOX, self.OnClassChanged, self.Class) self.LeftGridSizer.AddWindow(self.Class, flag=wx.GROW) # Create label for variable execution order execution_order_label = wx.StaticText(self, label=_('Execution Order:')) self.LeftGridSizer.AddWindow(execution_order_label, flag=wx.GROW) # Create spin control for defining variable execution order self.ExecutionOrder = wx.SpinCtrl(self, min=0, style=wx.SP_ARROW_KEYS) self.Bind(wx.EVT_SPINCTRL, self.OnExecutionOrderChanged, self.ExecutionOrder) self.LeftGridSizer.AddWindow(self.ExecutionOrder, flag=wx.GROW) # Create label for variable expression name_label = wx.StaticText(self, label=_('Expression:')) self.RightGridSizer.AddWindow(name_label, border=5, flag=wx.GROW | wx.BOTTOM) # Create text control for defining variable expression self.Expression = wx.TextCtrl(self) self.Bind(wx.EVT_TEXT, self.OnExpressionChanged, self.Expression) self.RightGridSizer.AddWindow(self.Expression, flag=wx.GROW) # Create a list box to selected variable expression in the list of # variables defined in POU self.VariableName = wx.ListBox(self, size=wx.Size(-1, 120), style=wx.LB_SINGLE | wx.LB_SORT) self.Bind(wx.EVT_LISTBOX, self.OnNameChanged, self.VariableName) self.RightGridSizer.AddWindow(self.VariableName, border=4, flag=wx.GROW | wx.TOP) # Add preview panel and associated label to sizers self.MainSizer.AddWindow(self.PreviewLabel, border=20, flag=wx.GROW | wx.LEFT | wx.RIGHT) self.MainSizer.AddWindow(self.Preview, border=20, flag=wx.GROW | wx.LEFT | wx.RIGHT) # Add buttons sizer to sizers self.MainSizer.AddSizer(self.ButtonSizer, border=20, flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT) # Set options that can be selected in class combo box for var_class, choice in VARIABLE_CLASSES_DICT.iteritems(): if not exclude_input or var_class != INPUT: self.Class.Append(choice) self.Class.SetSelection(0) # Extract list of variables defined in POU self.RefreshVariableList() # Refresh values in name list box self.RefreshNameList() self.Preview.SetInitialSize(wx.Size(-1, 60)) self.Fit() # Class combo box is default control having keyboard focus self.Class.SetFocus()
def __init__(self, parent, items, default=None, default_custom_value="", title="Select Items", instructions="", custom_value_label="Custom Value"): wx.Dialog.__init__(self, parent, -1, title, size=(700, 500), pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) sizer = wx.BoxSizer(wx.VERTICAL) if instructions: t = wx.StaticText(self, -1, instructions) sizer.Add(t, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, self.border) # custom item will be last in the list self.custom_item_index = len(items) items.append("Custom") self.list = wx.ListBox(self, choices=items, size=(-1, 200), style=wx.LB_SINGLE) try: index = items.index(default) except ValueError: if default_custom_value: index = self.custom_item_index else: index = 0 self.list.SetSelection(index) # Both EVT_LISTBOX and EVT_CHECKLISTBOX cancel each other out when # clicking on the check box itself. Clicking only on item text causes # EVT_LISTBOX event only. self.list.Bind(wx.EVT_LISTBOX, self.on_list_selection) sizer.Add(self.list, 1, wx.EXPAND) hbox = wx.BoxSizer(wx.HORIZONTAL) t = wx.StaticText(self, -1, custom_value_label + ":") hbox.Add(t, 0, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, self.border) self.custom_value = wx.TextCtrl(self, -1, default_custom_value, size=(-1, -1)) hbox.Add(self.custom_value, 1, wx.ALL | wx.EXPAND, self.border) sizer.Add(hbox, 0, wx.EXPAND) btnsizer = wx.StdDialogButtonSizer() btn = wx.Button(self, wx.ID_OK) btn.SetDefault() btnsizer.AddButton(btn) btn = wx.Button(self, wx.ID_CANCEL) btnsizer.AddButton(btn) btnsizer.Realize() sizer.Add(btnsizer, 0, wx.EXPAND, 0) self.SetSizer(sizer) sizer.Fit(self) self.Layout()
def __init__(self, parent): wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=u"Color Picker", pos=wx.DefaultPosition, size=wx.Size(640, 480), style=wx.DEFAULT_DIALOG_STYLE) self.SetSizeHints(wx.Size(-1, -1), wx.DefaultSize) szrMain = wx.BoxSizer(wx.VERTICAL) self.pnlColorSelector = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) szrColorSelector = wx.BoxSizer(wx.HORIZONTAL) self.pnlColorPreview = wx.Panel(self.pnlColorSelector, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) self.pnlColorPreview.SetBackgroundColour( wx.SystemSettings.GetColour(wx.SYS_COLOUR_HIGHLIGHT)) self.pnlColorPreview.SetMaxSize(wx.Size(120, -1)) szrColorSelector.Add(self.pnlColorPreview, 1, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5) self.nbColorSelector = wx.Notebook(self.pnlColorSelector, wx.ID_ANY, wx.DefaultPosition, wx.Size(-1, -1), 0) self.pnlRGBPage = wx.Panel(self.nbColorSelector, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) szrRGBPage = wx.BoxSizer(wx.VERTICAL) fraRGBChannels = wx.StaticBoxSizer( wx.StaticBox(self.pnlRGBPage, wx.ID_ANY, u" RGB Channels "), wx.VERTICAL) szrRGBChannels = wx.FlexGridSizer(3, 3, 5, 10) szrRGBChannels.AddGrowableCol(1) szrRGBChannels.SetFlexibleDirection(wx.BOTH) szrRGBChannels.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.lblRedChannel = wx.StaticText(fraRGBChannels.GetStaticBox(), wx.ID_ANY, u"R:", wx.DefaultPosition, wx.DefaultSize, 0) self.lblRedChannel.Wrap(-1) szrRGBChannels.Add(self.lblRedChannel, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0) self.sldRedChannel = wx.Slider(fraRGBChannels.GetStaticBox(), wx.ID_ANY, 50, 0, 100, wx.DefaultPosition, wx.DefaultSize, wx.SL_HORIZONTAL) szrRGBChannels.Add(self.sldRedChannel, 0, wx.ALL | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0) self.spnRedChannel = wx.SpinCtrlDouble(fraRGBChannels.GetStaticBox(), wx.ID_ANY, u"0.0", wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, -1, 1, 0.000000, 0.01) self.spnRedChannel.SetDigits(4) szrRGBChannels.Add(self.spnRedChannel, 0, wx.ALL | wx.EXPAND, 0) self.lblGreenChannel = wx.StaticText(fraRGBChannels.GetStaticBox(), wx.ID_ANY, u"G:", wx.DefaultPosition, wx.DefaultSize, 0) self.lblGreenChannel.Wrap(-1) szrRGBChannels.Add(self.lblGreenChannel, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0) self.sldGreenChannel = wx.Slider(fraRGBChannels.GetStaticBox(), wx.ID_ANY, 50, 0, 100, wx.DefaultPosition, wx.DefaultSize, wx.SL_HORIZONTAL) szrRGBChannels.Add(self.sldGreenChannel, 0, wx.ALL | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0) self.spnGreenChannel = wx.SpinCtrlDouble(fraRGBChannels.GetStaticBox(), wx.ID_ANY, u"0.0", wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, -1, 1, 0.000000, 0.01) self.spnGreenChannel.SetDigits(4) szrRGBChannels.Add(self.spnGreenChannel, 0, wx.ALL | wx.EXPAND, 0) self.lblBlueChannel = wx.StaticText(fraRGBChannels.GetStaticBox(), wx.ID_ANY, u"B:", wx.DefaultPosition, wx.DefaultSize, 0) self.lblBlueChannel.Wrap(-1) szrRGBChannels.Add(self.lblBlueChannel, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0) self.sldBlueChannel = wx.Slider(fraRGBChannels.GetStaticBox(), wx.ID_ANY, 50, 0, 100, wx.DefaultPosition, wx.DefaultSize, wx.SL_HORIZONTAL) szrRGBChannels.Add(self.sldBlueChannel, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0) self.spnBlueChannel = wx.SpinCtrlDouble(fraRGBChannels.GetStaticBox(), wx.ID_ANY, u"0.0", wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, -1, 1, 0, 0.01) self.spnBlueChannel.SetDigits(4) szrRGBChannels.Add(self.spnBlueChannel, 0, wx.ALL | wx.EXPAND, 0) fraRGBChannels.Add(szrRGBChannels, 1, wx.EXPAND, 5) szrRGBPage.Add(fraRGBChannels, 0, wx.ALL | wx.EXPAND, 5) szrLowerRGBPage = wx.BoxSizer(wx.HORIZONTAL) fraHexRGB = wx.StaticBoxSizer( wx.StaticBox(self.pnlRGBPage, wx.ID_ANY, u"Hex/HTML"), wx.VERTICAL) self.txtHexRGB = wx.TextCtrl(fraHexRGB.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) fraHexRGB.Add(self.txtHexRGB, 0, wx.ALL | wx.EXPAND, 5) szrLowerRGBPage.Add(fraHexRGB, 1, wx.ALL, 5) fraRGBFormat = wx.StaticBoxSizer( wx.StaticBox(self.pnlRGBPage, wx.ID_ANY, u"RGB Format"), wx.VERTICAL) self.rdoRGBModePsychoPy = wx.RadioButton(fraRGBFormat.GetStaticBox(), wx.ID_ANY, u"PsychoPy RGB [-1:1]", wx.DefaultPosition, wx.DefaultSize, 0) self.rdoRGBModePsychoPy.SetValue(True) fraRGBFormat.Add(self.rdoRGBModePsychoPy, 0, wx.ALL, 2) self.rdoRGBModeNormalized = wx.RadioButton(fraRGBFormat.GetStaticBox(), wx.ID_ANY, u"Normalized RGB [0:1]", wx.DefaultPosition, wx.DefaultSize, 0) fraRGBFormat.Add(self.rdoRGBModeNormalized, 0, wx.ALL, 2) self.rdoRGBMode255 = wx.RadioButton(fraRGBFormat.GetStaticBox(), wx.ID_ANY, u"8-Bit RGB [0:255]", wx.DefaultPosition, wx.DefaultSize, 0) fraRGBFormat.Add(self.rdoRGBMode255, 0, wx.ALL, 2) szrLowerRGBPage.Add(fraRGBFormat, 1, wx.BOTTOM | wx.RIGHT | wx.TOP, 5) szrRGBPage.Add(szrLowerRGBPage, 1, wx.EXPAND, 5) self.pnlRGBPage.SetSizer(szrRGBPage) self.pnlRGBPage.Layout() szrRGBPage.Fit(self.pnlRGBPage) self.nbColorSelector.AddPage(self.pnlRGBPage, u"RGB", True) self.pnlHSVPage = wx.Panel(self.nbColorSelector, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) szrHSVPage = wx.BoxSizer(wx.VERTICAL) fraHSVChannels = wx.StaticBoxSizer( wx.StaticBox(self.pnlHSVPage, wx.ID_ANY, u" HSV Channels "), wx.VERTICAL) szrHSVChannels = wx.FlexGridSizer(3, 3, 5, 10) szrHSVChannels.AddGrowableCol(1) szrHSVChannels.SetFlexibleDirection(wx.BOTH) szrHSVChannels.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.lblHueChannel = wx.StaticText(fraHSVChannels.GetStaticBox(), wx.ID_ANY, u"H:", wx.DefaultPosition, wx.DefaultSize, 0) self.lblHueChannel.Wrap(-1) szrHSVChannels.Add(self.lblHueChannel, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0) self.sldHueChannel = wx.Slider(fraHSVChannels.GetStaticBox(), wx.ID_ANY, 50, 0, 100, wx.DefaultPosition, wx.DefaultSize, wx.SL_HORIZONTAL) szrHSVChannels.Add(self.sldHueChannel, 0, wx.ALL | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0) self.spnHueChannel = wx.SpinCtrlDouble(fraHSVChannels.GetStaticBox(), wx.ID_ANY, u"0.0", wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 360, 0, 1) self.spnHueChannel.SetDigits(0) szrHSVChannels.Add(self.spnHueChannel, 0, wx.ALL | wx.EXPAND, 0) self.lblSaturationChannel = wx.StaticText( fraHSVChannels.GetStaticBox(), wx.ID_ANY, u"S:", wx.DefaultPosition, wx.DefaultSize, 0) self.lblSaturationChannel.Wrap(-1) szrHSVChannels.Add(self.lblSaturationChannel, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0) self.sldStaturationChannel = wx.Slider(fraHSVChannels.GetStaticBox(), wx.ID_ANY, 50, 0, 100, wx.DefaultPosition, wx.DefaultSize, wx.SL_HORIZONTAL) szrHSVChannels.Add(self.sldStaturationChannel, 0, wx.ALL | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0) self.spnSaturationChannel = wx.SpinCtrlDouble( fraHSVChannels.GetStaticBox(), wx.ID_ANY, u"0.0", wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, -1, 1, 0.000000, 0.01) self.spnSaturationChannel.SetDigits(4) szrHSVChannels.Add(self.spnSaturationChannel, 0, wx.ALL | wx.EXPAND, 0) self.lblValueChannel = wx.StaticText(fraHSVChannels.GetStaticBox(), wx.ID_ANY, u"V:", wx.DefaultPosition, wx.DefaultSize, 0) self.lblValueChannel.Wrap(-1) szrHSVChannels.Add(self.lblValueChannel, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0) self.sldValueChannel = wx.Slider(fraHSVChannels.GetStaticBox(), wx.ID_ANY, 50, 0, 100, wx.DefaultPosition, wx.DefaultSize, wx.SL_HORIZONTAL) szrHSVChannels.Add(self.sldValueChannel, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0) self.spnValueChannel = wx.SpinCtrlDouble(fraHSVChannels.GetStaticBox(), wx.ID_ANY, u"0.0", wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, -1, 1, 0.000000, 0.001) self.spnValueChannel.SetDigits(4) szrHSVChannels.Add(self.spnValueChannel, 0, wx.ALL | wx.EXPAND, 0) fraHSVChannels.Add(szrHSVChannels, 0, wx.EXPAND, 5) szrHSVPage.Add(fraHSVChannels, 0, wx.ALL | wx.EXPAND, 5) self.pnlHSVPage.SetSizer(szrHSVPage) self.pnlHSVPage.Layout() szrHSVPage.Fit(self.pnlHSVPage) self.nbColorSelector.AddPage(self.pnlHSVPage, u"HSV", False) szrColorSelector.Add(self.nbColorSelector, 1, wx.EXPAND | wx.TOP, 5) lstColorPresetsChoices = [] self.lstColorPresets = wx.ListBox(self.pnlColorSelector, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, lstColorPresetsChoices, 0 | wx.ALWAYS_SHOW_SB) self.lstColorPresets.SetMinSize(wx.Size(140, -1)) szrColorSelector.Add(self.lstColorPresets, 1, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5) self.pnlColorSelector.SetSizer(szrColorSelector) self.pnlColorSelector.Layout() szrColorSelector.Fit(self.pnlColorSelector) szrMain.Add(self.pnlColorSelector, 1, wx.EXPAND, 0) self.stlMain = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) szrMain.Add(self.stlMain, 0, wx.EXPAND | wx.ALL, 5) self.pnlDlgButtons = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) szrDlgButtons = wx.FlexGridSizer(0, 6, 0, 0) szrDlgButtons.AddGrowableCol(1) szrDlgButtons.AddGrowableCol(2) szrDlgButtons.SetFlexibleDirection(wx.BOTH) szrDlgButtons.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.lblOutputSpace = wx.StaticText(self.pnlDlgButtons, wx.ID_ANY, u"Output Space:", wx.DefaultPosition, wx.DefaultSize, 0) self.lblOutputSpace.Wrap(-1) szrDlgButtons.Add( self.lblOutputSpace, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.TOP, 0) cboOutputSpaceChoices = [u"PsychoPy RGB (rgb)"] self.cboOutputSpace = wx.Choice(self.pnlDlgButtons, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, cboOutputSpaceChoices, 0) self.cboOutputSpace.SetSelection(0) szrDlgButtons.Add(self.cboOutputSpace, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5) szrDlgButtons.Add((0, 0), 1, wx.EXPAND, 0) self.cmdCancel = wx.Button(self.pnlDlgButtons, wx.ID_ANY, u"Cancel", wx.DefaultPosition, wx.DefaultSize, 0) szrDlgButtons.Add(self.cmdCancel, 0, wx.BOTTOM | wx.LEFT | wx.TOP, 5) self.cmdCopy = wx.Button(self.pnlDlgButtons, wx.ID_ANY, u"Copy", wx.DefaultPosition, wx.DefaultSize, 0) szrDlgButtons.Add(self.cmdCopy, 0, wx.BOTTOM | wx.LEFT | wx.TOP, 5) self.cmdInsert = wx.Button(self.pnlDlgButtons, wx.ID_ANY, u"Insert", wx.DefaultPosition, wx.DefaultSize, 0) szrDlgButtons.Add(self.cmdInsert, 0, wx.ALL, 5) self.pnlDlgButtons.SetSizer(szrDlgButtons) self.pnlDlgButtons.Layout() szrDlgButtons.Fit(self.pnlDlgButtons) szrMain.Add(self.pnlDlgButtons, 0, wx.ALL | wx.EXPAND, 5) self.SetSizer(szrMain) self.Layout() self.Centre(wx.BOTH) # Connect Events self.Bind(wx.EVT_CLOSE, self.OnClose) self.sldRedChannel.Bind(wx.EVT_SCROLL, self.OnRedScroll) self.spnRedChannel.Bind(wx.EVT_SPINCTRLDOUBLE, self.OnRedSpin) self.spnRedChannel.Bind(wx.EVT_TEXT_ENTER, self.OnRedTextEnter) self.sldGreenChannel.Bind(wx.EVT_SCROLL, self.OnGreenScroll) self.spnGreenChannel.Bind(wx.EVT_SPINCTRLDOUBLE, self.OnGreenSpin) self.spnGreenChannel.Bind(wx.EVT_TEXT_ENTER, self.OnGreenTextEnter) self.sldBlueChannel.Bind(wx.EVT_SCROLL, self.OnBlueScroll) self.spnBlueChannel.Bind(wx.EVT_SPINCTRLDOUBLE, self.OnBlueSpin) self.spnBlueChannel.Bind(wx.EVT_TEXT_ENTER, self.OnBlueTextEnter) self.txtHexRGB.Bind(wx.EVT_KEY_DOWN, self.OnHexRGBKeyDown) self.rdoRGBModePsychoPy.Bind(wx.EVT_RADIOBUTTON, self.OnRGBModePsychoPy) self.rdoRGBModeNormalized.Bind(wx.EVT_RADIOBUTTON, self.OnRGBModeNormalized) self.rdoRGBMode255.Bind(wx.EVT_RADIOBUTTON, self.OnRGBMode255) self.sldHueChannel.Bind(wx.EVT_SCROLL, self.OnHueScroll) self.spnHueChannel.Bind(wx.EVT_SPINCTRLDOUBLE, self.OnHueSpin) self.spnHueChannel.Bind(wx.EVT_TEXT_ENTER, self.OnHueTextEnter) self.sldStaturationChannel.Bind(wx.EVT_SCROLL, self.OnSaturationScroll) self.spnSaturationChannel.Bind(wx.EVT_SPINCTRLDOUBLE, self.OnSaturationSpin) self.spnSaturationChannel.Bind(wx.EVT_TEXT_ENTER, self.OnSaturationTextEnter) self.sldValueChannel.Bind(wx.EVT_SCROLL, self.OnValueScroll) self.spnValueChannel.Bind(wx.EVT_SPINCTRLDOUBLE, self.OnValueSpin) self.spnValueChannel.Bind(wx.EVT_TEXT_ENTER, self.OnValueTextEnter) self.lstColorPresets.Bind(wx.EVT_LISTBOX, self.OnPresetSelect) self.cmdCancel.Bind(wx.EVT_BUTTON, self.OnCancel) self.cmdCopy.Bind(wx.EVT_BUTTON, self.OnCopy) self.cmdInsert.Bind(wx.EVT_BUTTON, self.OnInsert)
def __init__( self, parent ): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"AJ-HotKey", pos = wx.DefaultPosition, size = wx.Size( 798,689 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) bSizer_left = wx.BoxSizer( wx.HORIZONTAL ) bSizer_listbox = wx.BoxSizer( wx.VERTICAL ) sbSizer_keylist = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"HotKey Group" ), wx.VERTICAL ) m_listBox_keylistChoices = [ u"Default" ] self.m_listBox_keylist = wx.ListBox( sbSizer_keylist.GetStaticBox(), wx.ID_ANY, wx.DefaultPosition, wx.Size( -1,550 ), m_listBox_keylistChoices, wx.LB_HSCROLL ) sbSizer_keylist.Add( self.m_listBox_keylist, 1, wx.EXPAND, 5 ) bSizer18 = wx.BoxSizer( wx.HORIZONTAL ) self.m_button109 = wx.Button( sbSizer_keylist.GetStaticBox(), wx.ID_ANY, u"MyButton", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer18.Add( self.m_button109, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) self.m_button110 = wx.Button( sbSizer_keylist.GetStaticBox(), wx.ID_ANY, u"MyButton", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer18.Add( self.m_button110, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) self.m_button111 = wx.Button( sbSizer_keylist.GetStaticBox(), wx.ID_ANY, u"MyButton", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer18.Add( self.m_button111, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) sbSizer_keylist.Add( bSizer18, 1, wx.EXPAND, 5 ) bSizer_listbox.Add( sbSizer_keylist, 1, wx.EXPAND|wx.LEFT, 5 ) bSizer_left.Add( bSizer_listbox, 1, wx.EXPAND|wx.ALL, 5 ) bSizer_right = wx.BoxSizer( wx.VERTICAL ) self.m_dataViewCtrl1 = wx.dataview.DataViewCtrl( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer_right.Add( self.m_dataViewCtrl1, 1, wx.ALL|wx.EXPAND, 5 ) sbSizer_joytokey = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"JoyToKey" ), wx.VERTICAL ) self.m_checkBox1 = wx.CheckBox( sbSizer_joytokey.GetStaticBox(), wx.ID_ANY, u"使用JoyToKey", wx.DefaultPosition, wx.DefaultSize, 0 ) sbSizer_joytokey.Add( self.m_checkBox1, 0, wx.ALL, 5 ) bSizer_joytokey_path = wx.BoxSizer( wx.VERTICAL ) self.m_staticText_path = wx.StaticText( sbSizer_joytokey.GetStaticBox(), wx.ID_ANY, u"JoyToKey路徑", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText_path.Wrap( -1 ) bSizer_joytokey_path.Add( self.m_staticText_path, 0, wx.ALL, 5 ) bSizer_joytokey_path_input = wx.BoxSizer( wx.HORIZONTAL ) self.m_textCtrl55 = wx.TextCtrl( sbSizer_joytokey.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer_joytokey_path_input.Add( self.m_textCtrl55, 1, wx.ALL, 5 ) self.m_button210 = wx.Button( sbSizer_joytokey.GetStaticBox(), wx.ID_ANY, u"MyButton", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer_joytokey_path_input.Add( self.m_button210, 0, wx.ALL, 5 ) bSizer_joytokey_path.Add( bSizer_joytokey_path_input, 1, wx.EXPAND, 5 ) sbSizer_joytokey.Add( bSizer_joytokey_path, 0, wx.EXPAND, 5 ) bSizer_joytokey_ini = wx.BoxSizer( wx.VERTICAL ) self.m_staticText_ini = wx.StaticText( sbSizer_joytokey.GetStaticBox(), wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText_ini.Wrap( -1 ) bSizer_joytokey_ini.Add( self.m_staticText_ini, 0, wx.ALL, 5 ) bSizerjoytokey_ini_input = wx.BoxSizer( wx.HORIZONTAL ) self.m_textCtrl551 = wx.TextCtrl( sbSizer_joytokey.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) bSizerjoytokey_ini_input.Add( self.m_textCtrl551, 1, wx.ALL, 5 ) self.m_button2101 = wx.Button( sbSizer_joytokey.GetStaticBox(), wx.ID_ANY, u"MyButton", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizerjoytokey_ini_input.Add( self.m_button2101, 0, wx.ALL, 5 ) bSizer_joytokey_ini.Add( bSizerjoytokey_ini_input, 1, wx.EXPAND, 5 ) sbSizer_joytokey.Add( bSizer_joytokey_ini, 0, wx.EXPAND, 5 ) bSizer_joytokey_cfg = wx.BoxSizer( wx.VERTICAL ) self.m_staticText402 = wx.StaticText( sbSizer_joytokey.GetStaticBox(), wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText402.Wrap( -1 ) bSizer_joytokey_cfg.Add( self.m_staticText402, 0, wx.ALL, 5 ) bSizer_joytokey_cfg_input = wx.BoxSizer( wx.HORIZONTAL ) self.m_textCtrl552 = wx.TextCtrl( sbSizer_joytokey.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer_joytokey_cfg_input.Add( self.m_textCtrl552, 1, wx.ALL, 5 ) self.m_button2102 = wx.Button( sbSizer_joytokey.GetStaticBox(), wx.ID_ANY, u"MyButton", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer_joytokey_cfg_input.Add( self.m_button2102, 0, wx.ALL, 5 ) bSizer_joytokey_cfg.Add( bSizer_joytokey_cfg_input, 1, wx.EXPAND, 5 ) sbSizer_joytokey.Add( bSizer_joytokey_cfg, 1, wx.EXPAND, 5 ) bSizer_right.Add( sbSizer_joytokey, 1, wx.EXPAND, 5 ) sbSizer8 = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"前景偵測" ), wx.VERTICAL ) self.m_checkBox2 = wx.CheckBox( sbSizer8.GetStaticBox(), wx.ID_ANY, u"只在程式位於前景時啟用", wx.DefaultPosition, wx.DefaultSize, 0 ) sbSizer8.Add( self.m_checkBox2, 0, wx.ALL, 5 ) bSizer87 = wx.BoxSizer( wx.VERTICAL ) self.m_staticText44 = wx.StaticText( sbSizer8.GetStaticBox(), wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText44.Wrap( -1 ) bSizer87.Add( self.m_staticText44, 0, wx.ALL, 5 ) self.m_textCtrl60 = wx.TextCtrl( sbSizer8.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer87.Add( self.m_textCtrl60, 0, wx.ALL|wx.EXPAND, 5 ) sbSizer8.Add( bSizer87, 1, wx.EXPAND, 5 ) bSizer_right.Add( sbSizer8, 1, wx.EXPAND, 5 ) bSizer_left.Add( bSizer_right, 1, wx.EXPAND, 5 ) self.SetSizer( bSizer_left ) self.Layout() self.Centre( wx.BOTH )
def __init__(self, parent, ID, title): wx.Frame.__init__(self, parent, ID, title, wx.DefaultPosition, wx.Size(700, 500)) ## Status Bar self.CreateStatusBar() self.SetStatusText("Ready") ## Menu Bar menuBar = wx.MenuBar() self.SetMenuBar(menuBar) fileMenu = wx.Menu() fileMenu.Append(self.ID_MENU_SET_MAP_DIR, "Set &Map Location", "Set the map folder location on your TomTom device") wx.EVT_MENU(self, self.ID_MENU_SET_MAP_DIR, self.setmapdirGUI) fileMenu.Append(self.ID_MENU_EXPORT_ALL_OV2, "&Save", "Export all ov2 files to map folder") #wx.EVT_MENU(self, self.ID_MENU_EXPORT_ALL_OV2, self.exportov2files) fileMenu.AppendSeparator() fileMenu.Append(self.ID_MENU_EXIT, "E&xit", "Terminate the program") wx.EVT_MENU(self, self.ID_MENU_EXIT, self.exit) menuBar.Append(fileMenu, "&File") ## Section Selection Widget topPanel = wx.Panel(self) self.guiSectionNotebook = wx.Notebook(topPanel, style=wx.NB_TOP) topSizer = wx.BoxSizer(wx.VERTICAL) topSizer.Add(self.guiSectionNotebook, 1, wx.EXPAND, 0) topPanel.SetSizer(topSizer) ## GPS Panel gpsMenu = wx.Menu() menuBar.Append(gpsMenu, "&GPS") gpsPanel = wx.Panel(self.guiSectionNotebook, -1) self.guiSectionNotebook.AddPage(gpsPanel, "My SatNav") gpsSizer = wx.BoxSizer(wx.VERTICAL) gpsPanel.SetSizer(gpsSizer) self.gpsLabel = wx.StaticText(gpsPanel, -1, '', (-1, -1), style=wx.ALIGN_CENTRE | wx.ST_NO_AUTORESIZE) gpsSizer.Add(self.gpsLabel, 0, wx.EXPAND | wx.ALL, 4) self.gpsUpdateButton = wx.Button(gpsPanel, self.ID_BUTTON_UPDATE_QUICKGPS, 'Update') self.gpsUpdateButton.Bind(wx.EVT_BUTTON, self.downloadQuickGPS) gpsSizer.Add(self.gpsUpdateButton, 0, wx.ALIGN_CENTER | wx.ALL, 0) line2 = wx.StaticLine(gpsPanel, -1, (-1, -1), style=wx.LI_HORIZONTAL) gpsSizer.Add(line2, 0, wx.EXPAND | wx.ALL, 30) tomtomLocationTitleLabel = wx.StaticText(gpsPanel, -1, 'SatNav Location:', (-1, -1), style=wx.ALIGN_CENTRE) gpsSizer.Add(tomtomLocationTitleLabel, 0, wx.EXPAND | wx.ALL, 4) self.tomtomLocationLabel = wx.StaticText(gpsPanel, -1, '', (-1, -1), style=wx.ALIGN_CENTRE | wx.ST_NO_AUTORESIZE) gpsSizer.Add(self.tomtomLocationLabel, 0, wx.EXPAND | wx.ALL, 4) changeLocationButton = wx.Button(gpsPanel, self.ID_BUTTON_CHANGE_LOCATION, 'Change') changeLocationButton.Bind(wx.EVT_BUTTON, self.changeTomTomDirGUI) gpsSizer.Add(changeLocationButton, 0, wx.ALIGN_CENTER | wx.ALL, 0) line3 = wx.StaticLine(gpsPanel, -1, (-1, -1), style=wx.LI_HORIZONTAL) gpsSizer.Add(line3, 0, wx.EXPAND | wx.ALL, 30) self.updateGPSPanel() ## POI Panel poiMenu = wx.Menu() poiMenu.Append(self.ID_MENU_EDIT_POI, "&Edit", "Edit Selected POI") wx.EVT_MENU(self, self.ID_MENU_EDIT_POI, self.editpoi) poiMenu.AppendSeparator() poiMenu.Append(self.ID_MENU_IMPORT_OV2, "&Import OV2", "Import TomTom Overlay POI file as new category") wx.EVT_MENU(self, self.ID_MENU_IMPORT_OV2, self.importov2) poiMenu.Append( self.ID_MENU_MERGE_OV2, "&Merge OV2", "Import TomTom Overlay POI file into selected category") wx.EVT_MENU(self, self.ID_MENU_MERGE_OV2, self.mergeov2) poiMenu.AppendSeparator() poiMenu.Append(self.ID_MENU_EXPORT_OV2, "E&xport OV2", "Export selected category as TomTom Overlay file") wx.EVT_MENU(self, self.ID_MENU_EXPORT_OV2, self.exportov2) menuBar.Append(poiMenu, "&Poi") poiPanel = wx.Panel(self.guiSectionNotebook, -1) self.guiSectionNotebook.AddPage(poiPanel, "Points of Interest") poiPanel.Show(False) poiSizer = wx.BoxSizer(wx.HORIZONTAL) poiPanel.SetSizer(poiSizer) self.guiPOICatListBox = wx.ListBox(poiPanel, self.ID_WIDGET_POICATLIST, (-1, -1), (-1, -1), self.data.categories(), wx.LB_SINGLE | wx.LB_SORT) wx.EVT_LISTBOX(self, self.ID_WIDGET_POICATLIST, self.poiCatSelect) poiSizer.Add(self.guiPOICatListBox, 1, wx.EXPAND, 0) self.guiPOIListBox = wx.ListBox(poiPanel, self.ID_WIDGET_POILIST, (-1, -1), (-1, -1), (), wx.LB_SINGLE) wx.EVT_LISTBOX_DCLICK(self, self.ID_WIDGET_POILIST, self.editpoi) poiSizer.Add(self.guiPOIListBox, 2, wx.EXPAND | wx.LEFT, 4) ## ITN Panel itnMenu = wx.Menu() itnMenu.Append(self.ID_MENU_EDIT_WAYPOINT, "&Edit", "Edit Selected Waypoint") #wx.EVT_MENU(self, self.ID_MENU_EDIT_ITN, self.edititn) itnMenu.AppendSeparator() itnMenu.Append(self.ID_MENU_IMPORT_ITN, "&Import ITN", "Import TomTom ITN file") wx.EVT_MENU(self, self.ID_MENU_IMPORT_ITN, self.importitn) itnMenu.Append(self.ID_MENU_EXPORT_ITN, "E&xport ITN", "Export selected route as TomTom ITN file") wx.EVT_MENU(self, self.ID_MENU_EXPORT_ITN, self.exportitn) menuBar.Append(itnMenu, "&Routes") itnPanel = wx.Panel(self.guiSectionNotebook, -1) self.guiSectionNotebook.AddPage(itnPanel, "Routes") itnPanel.Show(False) itnSizer = wx.BoxSizer(wx.HORIZONTAL) itnPanel.SetSizer(itnSizer) self.guiITNCatListBox = wx.ListBox(itnPanel, self.ID_WIDGET_ITNCATLIST, (-1, -1), (-1, -1), self.data.categories(), wx.LB_SINGLE | wx.LB_SORT) wx.EVT_LISTBOX(self, self.ID_WIDGET_ITNCATLIST, self.itnCatSelect) itnSizer.Add(self.guiITNCatListBox, 1, wx.EXPAND, 0) self.guiITNListBox = wx.ListBox(itnPanel, self.ID_WIDGET_ITNLIST, (-1, -1), (-1, -1), (), wx.LB_SINGLE) wx.EVT_LISTBOX_DCLICK(self, self.ID_WIDGET_ITNLIST, self.edititn) itnSizer.Add(self.guiITNListBox, 2, wx.EXPAND | wx.LEFT, 4) ## About/Help Menu helpMenu = wx.Menu() helpMenu.Append(self.ID_MENU_ABOUT, "&About", "About the program") wx.EVT_MENU(self, self.ID_MENU_ABOUT, self.about) menuBar.Append(helpMenu, "&Help")
def __init__(self, parent): super(minecraftImportWindow, self).__init__(parent, title='Cura - Minecraft import') saveFileList = map(os.path.basename, glob.glob(mclevel.saveFileDir + "/*")) self.panel = wx.Panel(self, -1) self.SetSizer(wx.BoxSizer()) self.GetSizer().Add(self.panel, 1, wx.EXPAND) sizer = wx.GridBagSizer(2, 2) self.saveListBox = wx.ListBox(self.panel, -1, choices=saveFileList) sizer.Add(self.saveListBox, (0, 0), span=(2, 1), flag=wx.EXPAND) self.playerListBox = wx.ListBox(self.panel, -1, choices=[]) sizer.Add(self.playerListBox, (0, 1), span=(2, 1), flag=wx.EXPAND) self.previewPanel = wx.Panel(self.panel, -1) self.previewPanel.SetMinSize((512, 512)) sizer.Add(self.previewPanel, (0, 2), flag=wx.EXPAND) self.importButton = wx.Button(self.panel, -1, 'Import') sizer.Add(self.importButton, (1, 2)) sizer.AddGrowableRow(1) self.panel.SetSizer(sizer) self.saveListBox.Bind(wx.EVT_LISTBOX, self.OnSaveSelect) self.playerListBox.Bind(wx.EVT_LISTBOX, self.OnPlayerSelect) self.importButton.Bind(wx.EVT_BUTTON, self.OnImport) self.previewPanel.Bind(wx.EVT_PAINT, self.OnPaintPreview) self.previewPanel.Bind(wx.EVT_SIZE, self.OnSizePreview) self.previewPanel.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackgroundPreview) self.previewPanel.Bind(wx.EVT_MOTION, self.OnMotion) self.level = None self.previewImage = None self.renderList = [] self.selectArea = None self.draggingArea = False self.Layout() self.Fit() self.gravelPen = wx.Pen(wx.Colour(128, 128, 128)) self.sandPen = wx.Pen(wx.Colour(192, 192, 0)) self.grassPen = [] self.waterPen = [] for z in xrange(0, 256): self.waterPen.append(wx.Pen(wx.Colour(0, 0, min(z + 64, 255)))) self.grassPen.append(wx.Pen(wx.Colour(0, min(64 + z, 255), 0))) self.isSolid = [True] * 256 self.isSolid[0] = False #Air self.isSolid[8] = False #Water self.isSolid[9] = False #Water self.isSolid[10] = False #Lava self.isSolid[11] = False #Lava self.isSolid[50] = False #Torch self.isSolid[51] = False #Fire
def __init__(self, *args, **kwds): """Initialize the frame and its layout """ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) # Top level panels left_panel = wx.Panel(self,-1) right_panel = wx.Panel(self,-1) self.SetBackgroundColour(left_panel.GetBackgroundColour()) # Module categories (in left panel) module_categories_text = wx.StaticText(left_panel,-1,'Module Categories',style=wx.ALIGN_CENTER) font = module_categories_text.GetFont() module_categories_text.SetFont(wx.Font(font.GetPointSize()*1.2,font.GetFamily(),font.GetStyle(),wx.FONTWEIGHT_BOLD)) self.__module_categories_list_box = wx.ListBox(left_panel,-1) # Control panel for the selected module selected_module_panel = wx.Panel(left_panel,-1) selected_module_static_box = wx.StaticBox(selected_module_panel,-1,'For Selected Module') add_to_pipeline_button = wx.Button(selected_module_panel,-1,'+ Add to Pipeline') module_help_button = wx.Button(selected_module_panel,-1,'? Module Help') # Other buttons getting_started_button = wx.Button(left_panel,-1,'Getting Started') wheres_my_module_button = wx.Button(left_panel,-1,"Where's my Module?") done_button = wx.Button(left_panel,-1,'Done') # Right-side panel self.__module_list_box = wx.ListBox(right_panel,-1) w,h = self.__module_list_box.GetTextExtent("CorrectIllumination_Calculate_Plus") self.__module_list_box.SetMinSize(wx.Size(w,h * 30)) # Sizers self.Sizer = wx.BoxSizer(wx.VERTICAL) search_sizer = wx.BoxSizer(wx.HORIZONTAL) self.Sizer.Add(search_sizer, 0, wx.EXPAND | wx.ALL, 2) search_sizer.Add(wx.StaticText(self, label="Search:"), 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL) self.search_text = wx.TextCtrl(self) search_sizer.Add(self.search_text, 1, wx.EXPAND) self.search_button = wx.Button(self, label="Search") search_sizer.Add(self.search_button, 0, wx.EXPAND) self.Sizer.AddSpacer(2) top_sizer = wx.BoxSizer(wx.HORIZONTAL) top_sizer.AddMany([(left_panel,0,wx.EXPAND|wx.LEFT,5), (right_panel,1,wx.EXPAND)]) self.Sizer.Add(top_sizer, 1, wx.EXPAND) left_sizer = wx.BoxSizer(wx.VERTICAL) left_sizer.Add(module_categories_text,0,wx.EXPAND) left_sizer.AddSpacer(4) left_sizer.Add(self.__module_categories_list_box,1,wx.EXPAND) left_sizer.AddSpacer((-1,10)) left_sizer.Add(selected_module_panel,0,wx.EXPAND) left_sizer.AddSpacer((-1,10)) left_sizer.Add(getting_started_button,0,wx.EXPAND) left_sizer.AddSpacer(2) left_sizer.Add(wheres_my_module_button,0,wx.EXPAND) left_sizer.AddSpacer(2) left_sizer.Add(done_button,0,wx.EXPAND |wx.BOTTOM,5) left_panel.SetSizer(left_sizer) right_sizer = wx.BoxSizer(wx.VERTICAL) right_sizer.Add(self.__module_list_box,1,wx.EXPAND|wx.ALL,5) right_panel.SetSizer(right_sizer) selected_module_panel_sizer = wx.StaticBoxSizer(selected_module_static_box,wx.VERTICAL) selected_module_panel_sizer.Add(add_to_pipeline_button,0,wx.EXPAND) selected_module_panel_sizer.AddSpacer(2) selected_module_panel_sizer.Add(module_help_button,0,wx.EXPAND) selected_module_panel.SetSizer(selected_module_panel_sizer) self.__set_icon() accelerators = wx.AcceleratorTable( [(wx.ACCEL_CMD, ord('W'), cpframe.ID_FILE_EXIT)]) self.SetAcceleratorTable(accelerators) self.Bind(wx.EVT_CLOSE,self.__on_close, self) self.Bind(wx.EVT_LISTBOX,self.__on_category_selected,self.__module_categories_list_box) self.Bind(wx.EVT_LISTBOX_DCLICK, self.__on_add_to_pipeline,self.__module_list_box) self.Bind(wx.EVT_BUTTON,self.__on_add_to_pipeline,add_to_pipeline_button) self.Bind(wx.EVT_BUTTON,self.__on_close,done_button) self.Bind(wx.EVT_BUTTON,self.__on_help, module_help_button) self.Bind(wx.EVT_BUTTON,self.__on_getting_started, getting_started_button) self.Bind(wx.EVT_BUTTON,self.__on_wheres_my_module, wheres_my_module_button) self.Bind(wx.EVT_MENU, self.__on_close, id=cpframe.ID_FILE_EXIT) self.search_button.Bind(wx.EVT_BUTTON, self.__on_search_help) self.__get_module_files() self.__set_categories() self.__listeners = [] self.__module_categories_list_box.Select(0) self.__on_category_selected(None) self.Fit()
def event_clickSWB(self, e): button = e.GetEventObject() swb = button.GetName() self.currentSWB = swb self.swbframe = wx.Frame(self, style=wx.DEFAULT_FRAME_STYLE & ~wx.RESIZE_BORDER, size=(410, 300)) self.swbframe.MakeModal(True) self.swbframe.Bind(wx.EVT_CLOSE, self.event_CloseSWBFrame) self.swbframe.panel = wx.Panel(self.swbframe, wx.ID_ANY) self.swbframe.routes = wx.ListBox(self.swbframe.panel, -1, size=(400, 200), pos=(0, 0)) self.swbframe.buttonAdd = wx.Button(self.swbframe.panel, name="btnAdd", label="Add route", size=(100, 50), pos=(0, 250)) self.swbframe.buttonDel = wx.Button(self.swbframe.panel, name="btnDel", label="Delete route", size=(100, 50), pos=(100, 250)) self.swbframe.buttonAdd.Bind(wx.wx.EVT_LEFT_DOWN, self.event_clickSWBAdd) self.swbframe.buttonDel.Bind(wx.wx.EVT_LEFT_DOWN, self.event_clickSWBDel) if self.configData != {}: if self.toolbar_ShowDataNetwork.IsToggled(): network = "data" else: network = "control" networks = self.configData['architecture']['network'] if self.prData != {}: connectionInfo = self.prData['place_and_route']['route'][ network] else: connectionInfo = {} if connectionInfo == None: connectionInfo = [] if swb in connectionInfo: if not isinstance(connectionInfo[swb]['connection'], list): swbConnections = [connectionInfo[swb]['connection']] else: swbConnections = connectionInfo[swb]['connection'] else: swbConnections = {} for connection in swbConnections: self.swbframe.routes.InsertItems([ str(connection['@source'] + " --> " + connection['@destination']) ], 0) inConnectionStrings = [] outConnectionStrings = [] for port in networks[swb][network]['ports']: port = make_tuple(port) for i in range(0, int(port[1])): inConnectionStrings.append(port[0] + "." + str(i)) outConnectionStrings.append(port[0] + "." + str(i)) if 'inputs' in networks[swb][network]: nrInputs = int(networks[swb][network]['inputs']) for i in range(0, nrInputs): outConnectionStrings.append("FUInputs." + str(i)) if 'outputs' in networks[swb][network]: nrOutputs = int(networks[swb][network]['outputs']) for i in range(0, nrOutputs): inConnectionStrings.append("FUOutputs." + str(i)) self.swbframe.inputChoice = wx.Choice(self.swbframe.panel, -1, size=(180, 30), pos=(0, 200), choices=inConnectionStrings) self.swbframe.inputChoice.SetSelection(0) self.swbframe.lbl1 = wx.StaticText(self.swbframe.panel, -1, style=wx.ALIGN_RIGHT, label="->", pos=(185, 200)) font = wx.Font(24, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False) self.swbframe.lbl1.SetFont(font) self.swbframe.outputChoice = wx.Choice( self.swbframe.panel, -1, size=(180, 30), pos=(220, 200), choices=outConnectionStrings) self.swbframe.outputChoice.SetSelection(0) self.swbframe.Show()
def __init__(self): self.currentPreviewImage = None #self.workerThread = None #self.processingFinishedEvent = None self.isProcessing = False self.statsMerger = None wx.Frame.__init__(self, parent=None, #pos=wx.Point(int(xmlElement.getAttribute("xpos")), int(xmlElement.getAttribute("ypos"))), #size=(60+MainWindow.PREVIEW_WIDTH, 600), style=wx.DEFAULT_FRAME_STYLE, title="%s v%s" % (settings.name, settings.versionNumber) ) # set window icon wx.InitAllImageHandlers() iconBundle = wx.IconBundle() # DEBUG: method to retrieve icon from executable temporarily removed, because that doesn't seem to work with IconBundle and SetIcons() #if hasattr(sys,"frozen") and sys.frozen == "windows_exe": # exeName = sys.executable #"main.exe" #win32api.GetModuleFileName(win32api.GetModuleHandle(None)) # iconBundle.AddIconFromFile(exeName, wx.BITMAP_TYPE_ICO) #else: # iconBundle.AddIconFromFile(settings.icon, wx.BITMAP_TYPE_ANY) iconBundle.AddIconFromFile(settings.icon, wx.BITMAP_TYPE_ANY) self.SetIcons(iconBundle) # base structure (panel as the base control, two static boxes inside it) basePanel = wx.Panel(self) upperBox = wx.StaticBox(basePanel, -1, "Screenshot processing") lowerBox = wx.StaticBox(basePanel, -1, "Results") # add a status bar self.CreateStatusBar() # A Statusbar in the bottom of the window # add the menu menuBarStructure = [ ( "File", "", ( #("&Generate", "Parse all screenshots, try to find clusters and merge them if possible", self.???), #None, ("E&xit", "Close the application", self.doExit), #[ # ("Submenu", # "", # ( # ("Test", "Test item", None), # ), # ) #] ), ), ( "Help", "", ( ("&About / Quickstart", "Show the about screen", self.doShowCredits), ), ), ] self.SetMenuBar(MenuBarCreator.createMenuBar(self, menuBarStructure)) # create the controls in the upper box labelSourceDir = wx.StaticText(parent=basePanel, label="Source directory") labelTimeframe = wx.StaticText(parent=basePanel, label="Screenshot timeframe (s)") self.pickerctrlSourceDir = wx.DirPickerCtrl(parent=basePanel, style=wx.DIRP_USE_TEXTCTRL | wx.DIRP_DIR_MUST_EXIST, message="Please select the directory Allegiance stores your screenshots in.") #wx.TextCtrl(parent=basePanel, value="e:\\Alleg") self.spinTimeframe = wx.SpinCtrl(parent=basePanel, min=1, max=60*60, initial=60) self.buttonProcess = wx.Button(parent=basePanel, label="Process") self.gaugeProgress = wx.Gauge(parent=basePanel, size=(-1, 10), style=wx.GA_HORIZONTAL | wx.GA_SMOOTH) # create the controls for the lower box labelClusters = wx.StaticText(parent=basePanel, label="Detected clusters (latest first):") self.listClusters = wx.ListBox(parent=basePanel, style=wx.LB_SINGLE | wx.LB_ALWAYS_SB) labelPreview = wx.StaticText(parent=basePanel, label="Preview of merged image:") #self.imagePreview = wx.StaticBitmap(parent=basePanel, size=(MainWindow.PREVIEW_WIDTH, -1), style=wx.SUNKEN_BORDER) #, bitmap=wxIm self.imagePreview = wx.Panel(parent=basePanel, size=(MainWindow.PREVIEW_WIDTH, -1), style=wx.SUNKEN_BORDER) #, bitmap=wxIm self.imagePreview.SetMaxSize((MainWindow.PREVIEW_WIDTH, -1)) self.imagePreview.SetMinSize((MainWindow.PREVIEW_WIDTH, -1)) self.scrollPreview = wx.ScrollBar(basePanel, style=wx.SB_VERTICAL) labelLog = wx.StaticText(parent=basePanel, label="Log:") self.textboxLog = wx.TextCtrl(parent=basePanel, style=wx.TE_READONLY | wx.TE_MULTILINE) labelSave = wx.StaticText(parent=basePanel, label="Save merged image:") self.pickerctrlTargetFile = wx.FilePickerCtrl(parent=basePanel, style=wx.FLP_USE_TEXTCTRL | wx.FLP_SAVE | wx.FLP_OVERWRITE_PROMPT, message="Please select the path and filename you want to write the merged image to.", wildcard="Portable Network Graphics (PNG) files (*.png)|*.png") self.buttonSave = wx.Button(parent=basePanel, label="Save") # set up all the sizers for the upper box upperSizer = wx.StaticBoxSizer(upperBox, wx.HORIZONTAL) generationSizer = wx.GridBagSizer(5, 20) generationSizer.AddGrowableCol(1) generationSizer.Add(labelSourceDir, pos=(0, 0), flag=wx.ALIGN_LEFT | wx.TOP, border=3) generationSizer.Add(self.pickerctrlSourceDir, pos=(0, 1), flag=wx.EXPAND) generationSizer.Add(labelTimeframe, pos=(1, 0), flag=wx.ALIGN_LEFT | wx.TOP, border=3) generationSizer.Add(self.spinTimeframe, pos=(1, 1), flag=wx.ALIGN_LEFT) generationSizer.Add(self.buttonProcess, pos=(2, 0), flag=wx.EXPAND) generationSizer.Add(self.gaugeProgress, pos=(2, 1), flag=wx.EXPAND) upperSizer.Add(generationSizer, proportion=1, flag=wx.EXPAND | wx.ALL, border=5) # set up all the sizers for the lower box lowerSizer = wx.StaticBoxSizer(lowerBox, wx.VERTICAL) lowerSizer.Add(labelClusters, proportion=0, flag=wx.EXPAND | wx.ALL, border=5) lowerSizer.Add(self.listClusters, proportion=1, flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, border=5) lowerSizer.Add(labelPreview, proportion=0, flag=wx.EXPAND | wx.ALL, border=5) previewSizer = wx.BoxSizer(wx.HORIZONTAL) previewSizer.Add(self.imagePreview, proportion=0, flag=wx.EXPAND) previewSizer.Add(self.scrollPreview, proportion=0, flag=wx.EXPAND | wx.LEFT, border=10) lowerSizer.Add(previewSizer, proportion=5, flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, border=5) lowerSizer.Add(labelLog, proportion=0, flag=wx.EXPAND | wx.ALL, border=5) lowerSizer.Add(self.textboxLog, proportion=2, flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, border=5) lowerSizer.Add(labelSave, proportion=0, flag=wx.EXPAND | wx.ALL, border=5) saveLineSizer = wx.BoxSizer(wx.HORIZONTAL) saveLineSizer.Add(self.pickerctrlTargetFile, proportion=1, flag=wx.EXPAND) saveLineSizer.Add(self.buttonSave, proportion=0, flag=wx.EXPAND | wx.LEFT, border=10) lowerSizer.Add(saveLineSizer, proportion=0, flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, border=5) # set up the main sizer (separating the two static boxes) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(upperSizer, proportion=0, flag=wx.EXPAND) sizer.Add((1, 10), proportion=0, flag=wx.EXPAND) sizer.Add(lowerSizer, proportion=1, flag=wx.EXPAND) # set up the border size and initialise the sizers border = wx.BoxSizer() border.Add(sizer, proportion=1, flag=wx.EXPAND | wx.ALL, border=10) basePanel.SetSizer(border) basePanel.SetAutoLayout(1) border.Fit(self) # set initial configuration self.onClusterSelect(None) self.SetStatusText("Ready.") # bind events self.listClusters.Bind(wx.EVT_LISTBOX, self.onClusterSelect) self.buttonProcess.Bind(wx.EVT_BUTTON, self.onButtonProcessAbortClick) self.imagePreview.Bind(wx.EVT_SIZE, self.onPreviewResize) self.imagePreview.Bind(wx.EVT_PAINT, self.onImageRedraw) self.scrollPreview.Bind(wx.EVT_SCROLL, self.onScroll) self.buttonSave.Bind(wx.EVT_BUTTON, self.saveMergedImage) self.Bind(wx.EVT_CLOSE, self.onClose) # show the window self.Centre() self.Show(True) # show the window # read the Alleg path from the registry and fill the file/dir pickers with it allegPath = self.getAllegArtPathFromRegistry() if(allegPath): self.pickerctrlSourceDir.SetPath(allegPath) self.pickerctrlTargetFile.SetPath(allegPath + "\\result.png") else: wx.MessageDialog(self, message="Couldn't determine the path to Alleg's \"artwork\" directory from the registry! Please set it manually.", caption="Warning", style=wx.OK | wx.ICON_WARNING).ShowModal()
def __init__(self, parent, id): wx.Panel.__init__(self, parent, id) extOptionsPanelBorderSizer = wx.BoxSizer(wx.VERTICAL) extOptionsPanelSizer = wx.BoxSizer(wx.HORIZONTAL) extCtrlSizer = wx.BoxSizer(wx.VERTICAL) extCtrlSizer.Add(wx.StaticText(self, -1, _("External Tools:")), 0, wx.BOTTOM, HALF_SPACE) self._extListBox = wx.ListBox(self, -1, style=wx.LB_SINGLE) self.Bind(wx.EVT_LISTBOX, self.OnListBoxSelect, self._extListBox) extCtrlSizer.Add(self._extListBox, 1, wx.BOTTOM | wx.EXPAND, SPACE) buttonSizer = wx.GridSizer(cols=2, vgap=HALF_SPACE, hgap=HALF_SPACE) self._moveUpButton = wx.Button(self, -1, _("Move Up")) self.Bind(wx.EVT_BUTTON, self.OnMoveUp, self._moveUpButton) buttonSizer.Add(self._moveUpButton, 1, wx.EXPAND) self._moveDownButton = wx.Button(self, -1, _("Move Down")) self.Bind(wx.EVT_BUTTON, self.OnMoveDown, self._moveDownButton) buttonSizer.Add(self._moveDownButton, 1, wx.EXPAND) self._addButton = wx.Button(self, wx.ID_ADD) self.Bind(wx.EVT_BUTTON, self.OnAdd, self._addButton) buttonSizer.Add(self._addButton, 1, wx.EXPAND) self._deleteButton = wx.Button(self, wx.ID_DELETE, label=_( "Delete")) # get rid of accelerator for letter d in "&Delete" self.Bind(wx.EVT_BUTTON, self.OnDelete, self._deleteButton) buttonSizer.Add(self._deleteButton, 1, wx.EXPAND) extCtrlSizer.Add(buttonSizer, 0, wx.ALIGN_CENTER) extOptionsPanelSizer.Add(extCtrlSizer, 0, wx.EXPAND) self._extDetailPanel = wx.Panel(self) staticBox = wx.StaticBox(self, label=_("Selected External Tool")) staticBoxSizer = wx.StaticBoxSizer(staticBox, wx.VERTICAL) extDetailSizer = wx.FlexGridSizer(cols=2, vgap=5, hgap=5) extDetailSizer.AddGrowableCol(1, 1) extDetailSizer.Add(wx.StaticText(self._extDetailPanel, -1, _("Menu Item Name:")), flag=wx.ALIGN_CENTER_VERTICAL) self._menuItemNameTextCtrl = wx.TextCtrl(self._extDetailPanel, -1, size=(-1, -1)) extDetailSizer.Add(self._menuItemNameTextCtrl, 0, wx.EXPAND) self.Bind(wx.EVT_TEXT, self.SaveCurrentItem, self._menuItemNameTextCtrl) extDetailSizer.Add(wx.StaticText(self._extDetailPanel, -1, _("Menu Item Description:")), flag=wx.ALIGN_CENTER_VERTICAL) self._menuItemDescTextCtrl = wx.TextCtrl(self._extDetailPanel, -1, size=(-1, -1)) extDetailSizer.Add(self._menuItemDescTextCtrl, 0, wx.EXPAND) extDetailSizer.Add(wx.StaticText(self._extDetailPanel, -1, _("Command Path:")), flag=wx.ALIGN_CENTER_VERTICAL) self._commandTextCtrl = wx.TextCtrl(self._extDetailPanel, -1, size=(-1, -1)) findFileButton = wx.Button(self._extDetailPanel, -1, _("Browse...")) def OnBrowseButton(event): fileDlg = wx.FileDialog(self, _("Choose an Executable:"), style=wx.OPEN | wx.FILE_MUST_EXIST | wx.CHANGE_DIR) path = self._commandTextCtrl.GetValue() if path: fileDlg.SetPath(path) # fileDlg.CenterOnParent() # wxBug: caused crash with wx.FileDialog if fileDlg.ShowModal() == wx.ID_OK: self._commandTextCtrl.SetValue(fileDlg.GetPath()) self._commandTextCtrl.SetInsertionPointEnd() self._commandTextCtrl.SetToolTipString(fileDlg.GetPath()) fileDlg.Destroy() wx.EVT_BUTTON(findFileButton, -1, OnBrowseButton) hsizer = wx.BoxSizer(wx.HORIZONTAL) hsizer.Add(self._commandTextCtrl, 1, wx.EXPAND) hsizer.Add(findFileButton, 0, wx.LEFT, HALF_SPACE) extDetailSizer.Add(hsizer, 0, wx.EXPAND) extDetailSizer.Add(wx.StaticText(self._extDetailPanel, -1, _("Command Pre Args:")), flag=wx.ALIGN_CENTER_VERTICAL) self._commandPreArgsTextCtrl = wx.TextCtrl(self._extDetailPanel, -1, size=(-1, -1)) extDetailSizer.Add(self._commandPreArgsTextCtrl, 0, wx.EXPAND) extDetailSizer.Add(wx.StaticText(self._extDetailPanel, -1, _("Command Post Args:")), flag=wx.ALIGN_CENTER_VERTICAL) self._commandPostArgsTextCtrl = wx.TextCtrl(self._extDetailPanel, -1, size=(-1, -1)) extDetailSizer.Add(self._commandPostArgsTextCtrl, 0, wx.EXPAND) extDetailSizer.Add(wx.StaticText(self._extDetailPanel, -1, _("File Extensions:")), flag=wx.ALIGN_CENTER_VERTICAL) self._fileExtTextCtrl = wx.TextCtrl(self._extDetailPanel, -1, size=(-1, -1)) self._fileExtTextCtrl.SetToolTipString( _("""For example: "txt, text" (comma separated) or "*" for all files""" )) extDetailSizer.Add(self._fileExtTextCtrl, 0, wx.EXPAND) self._selFileCtrl = wx.CheckBox(self._extDetailPanel, -1, _("Operate on Selected File")) extDetailSizer.Add(self._selFileCtrl, 0, wx.ALIGN_CENTER_VERTICAL | wx.TOP, SPACE) self._selFileCtrl.SetToolTipString( _("If focus is in the project, instead of operating on the project file, operate on the selected file." )) self._extDetailPanel.SetSizer(extDetailSizer) staticBoxSizer.Add(self._extDetailPanel, 1, wx.ALL | wx.EXPAND, SPACE) extOptionsPanelSizer.Add(staticBoxSizer, 1, wx.LEFT | wx.EXPAND, SPACE) extOptionsPanelBorderSizer.Add(extOptionsPanelSizer, 1, wx.ALL | wx.EXPAND, SPACE) self.SetSizer(extOptionsPanelBorderSizer) if self.PopulateItems(): self._extListBox.SetSelection(0) self.OnListBoxSelect() self.Layout() parent.AddPage(self, _("External Tools"))
def __init__(self, *args, **kwds): kwds["style"] = wx.DEFAULT_FRAME_STYLE #启动画面splash RunPicture = wx.Image("./picture/run.png").ConvertToBitmap() wx.SplashScreen(RunPicture, wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT, 1000, None, -1) wx.Yield() wx.Frame.__init__(self, *args, **kwds) # Tool Bar self.vToolbar = wx.ToolBar(self, -1) self.SetToolBar(self.vToolbar) vTidy = self.vToolbar.AddLabelTool( wx.NewId(), "整理", wx.Bitmap("./picture/tidy.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, "", "") vSortbytype = self.vToolbar.AddLabelTool( wx.NewId(), "按文件类型分组", wx.Bitmap("./picture/sort.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, "", "") vAbout = self.vToolbar.AddLabelTool( wx.NewId(), "关于", wx.Bitmap("./picture/about.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, "", "") # Tool Bar end self.vStaticPath = wx.StaticText(self, -1, u"路径", style=wx.ALIGN_CENTER) self.vStaticPath.SetFont(wx.Font(15, wx.DECORATIVE, wx.BOLD, wx.NORMAL)) self.vBeginDir = wx.Button(self, -1, u"选择文件夹") self.vInputPath = wx.TextCtrl(self, -1, "/") self.vStaticType = wx.StaticText(self, -1, u"类型\n", style=wx.ALIGN_CENTER) self.vStaticType.SetFont(wx.Font(15, wx.DECORATIVE, wx.BOLD, wx.NORMAL)) self.vInputType = wx.TextCtrl(self, -1, "pdf chm odt doc") self.vBeginSearch = wx.Button(self, -1, u"开始搜索") self.vStaticKey = wx.StaticText(self, -1, u"请输入关键字", style=wx.ALIGN_CENTER) self.vStaticKey.SetFont(wx.Font(15, wx.DECORATIVE, wx.BOLD, wx.NORMAL)) self.vInputKey = wx.TextCtrl(self, -1, "") self.vBeginFind = wx.Button(self, -1, u"搜索关键字") self.vLeftListBox = wx.ListBox( self, -1, choices=[ os.path.splitext(item)[0] for item in os.listdir(os.getcwd()) if os.path.splitext(item)[1] in ('.list', ) ]) #listctrl il = wx.ImageList(16, 16, True) for name in glob.glob("./picture/smicon??.png"): RunPicture = wx.Bitmap(name, wx.BITMAP_TYPE_PNG) il_max = il.Add(RunPicture) self.RightCtrl = wx.ListCtrl(self, -1, style=wx.LC_REPORT) self.RightCtrl.AssignImageList(il, wx.IMAGE_LIST_SMALL) for col, text in enumerate(data.columns): self.RightCtrl.InsertColumn(col, text) for item in data.rows: index = self.RightCtrl.InsertStringItem(sys.maxint, item[0]) for col, text in enumerate(item[1:]): self.RightCtrl.SetStringItem(index, col + 1, text) img = random.randint(0, il_max) self.RightCtrl.SetItemImage(index, img, img) self.RightCtrl.SetColumnWidth(0, 150) self.RightCtrl.SetColumnWidth(1, 150) self.RightCtrl.SetColumnWidth(2, 150) #end listctrl self.__set_properties() self.__do_layout() self.Bind(wx.EVT_TOOL, self.Tidy, vTidy) self.Bind(wx.EVT_TOOL, self.Sortbytype, vSortbytype) self.Bind(wx.EVT_TOOL, about.About, vAbout) self.Bind(wx.EVT_BUTTON, self.Search, self.vBeginSearch) self.Bind(wx.EVT_BUTTON, self.ChooseDir, self.vBeginDir) self.Bind(wx.EVT_BUTTON, self.Find, self.vBeginFind) self.Bind(wx.EVT_CONTEXT_MENU, self.ListRightButton, self.vLeftListBox) self.Bind(wx.EVT_LISTBOX, self.ButtonClick, self.vLeftListBox) self.RightCtrl.Bind(wx.EVT_CONTEXT_MENU, self.OnContextMenu)
def __init__(self, parent): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"将测试方案中配置同步到ITMS导入模板工具", pos=wx.DefaultPosition, size=wx.Size(504, 680), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) self.SetSizeHints(wx.DefaultSize, wx.DefaultSize) self.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_APPWORKSPACE)) bSizer2 = wx.BoxSizer(wx.VERTICAL) self.m_panel1 = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) self.m_panel1.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWFRAME)) bSizer10 = wx.BoxSizer(wx.VERTICAL) bSizer3 = wx.BoxSizer(wx.VERTICAL) self.text_title1 = wx.StaticText(self.m_panel1, wx.ID_ANY, u"Step 1.请选择要导出配置的EXCEL表格!", wx.DefaultPosition, wx.DefaultSize, wx.ST_NO_AUTORESIZE) self.text_title1.Wrap(-1) self.text_title1.SetFont( wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString)) self.text_title1.SetForegroundColour(wx.Colour(255, 255, 0)) self.text_title1.SetBackgroundColour(wx.Colour(0, 128, 0)) bSizer3.Add(self.text_title1, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) bSizer10.Add(bSizer3, 0, wx.EXPAND, 5) bSizer16 = wx.BoxSizer(wx.VERTICAL) bSizer10.Add(bSizer16, 0, 0, 5) bSizer9 = wx.BoxSizer(wx.HORIZONTAL) self.text_PathInputExcel = wx.TextCtrl(self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE) bSizer9.Add(self.text_PathInputExcel, 1, wx.ALL | wx.ALIGN_BOTTOM | wx.EXPAND, 5) self.btn_ChoseInputExcel = wx.Button(self.m_panel1, wx.ID_ANY, u"选择Excel", wx.DefaultPosition, wx.DefaultSize, 0) bSizer9.Add(self.btn_ChoseInputExcel, 0, wx.ALL | wx.EXPAND, 5) bSizer10.Add(bSizer9, 0, wx.EXPAND, 5) bSizer101 = wx.BoxSizer(wx.VERTICAL) self.btn_GetSheetName = wx.Button(self.m_panel1, wx.ID_ANY, u"获取Excel中所有Sheet的名称", wx.DefaultPosition, wx.DefaultSize, 0) bSizer101.Add(self.btn_GetSheetName, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND, 5) bSizer10.Add(bSizer101, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND, 5) bSizer4 = wx.BoxSizer(wx.VERTICAL) bSizer19 = wx.BoxSizer(wx.VERTICAL) self.text_title11 = wx.StaticText(self.m_panel1, wx.ID_ANY, u"Step 2.请选择要导出配置的Sheet的名称!", wx.DefaultPosition, wx.DefaultSize, wx.ST_NO_AUTORESIZE) self.text_title11.Wrap(-1) self.text_title11.SetFont( wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString)) self.text_title11.SetForegroundColour(wx.Colour(255, 255, 0)) self.text_title11.SetBackgroundColour(wx.Colour(0, 128, 0)) bSizer19.Add(self.text_title11, 0, wx.ALIGN_CENTER_HORIZONTAL, 5) bSizer4.Add(bSizer19, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 5) bSizer20 = wx.BoxSizer(wx.VERTICAL) listbox_SheetNameChoices = [] self.listbox_SheetName = wx.ListBox(self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, listbox_SheetNameChoices, 0) bSizer20.Add(self.listbox_SheetName, 1, wx.ALL | wx.EXPAND, 5) bSizer4.Add(bSizer20, 1, wx.EXPAND, 5) bSizer10.Add(bSizer4, 1, wx.EXPAND, 5) bSizer14 = wx.BoxSizer(wx.VERTICAL) bSizer15 = wx.BoxSizer(wx.VERTICAL) self.text_title121 = wx.StaticText(self.m_panel1, wx.ID_ANY, u"Step 3.请在此选择填写测试团队名称!\n一定要跟测试配置中的完全一样!", wx.DefaultPosition, wx.DefaultSize, wx.ST_NO_AUTORESIZE) self.text_title121.Wrap(-1) self.text_title121.SetFont( wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString)) self.text_title121.SetForegroundColour(wx.Colour(255, 255, 0)) self.text_title121.SetBackgroundColour(wx.Colour(0, 128, 0)) bSizer15.Add(self.text_title121, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) bSizer14.Add(bSizer15, 0, wx.EXPAND, 5) bSizer161 = wx.BoxSizer(wx.VERTICAL) self.text_TeamName = wx.TextCtrl(self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) bSizer161.Add(self.text_TeamName, 0, wx.ALL | wx.EXPAND, 5) bSizer14.Add(bSizer161, 1, wx.EXPAND, 5) bSizer10.Add(bSizer14, 0, wx.EXPAND, 5) bSizer21 = wx.BoxSizer(wx.VERTICAL) bSizer211 = wx.BoxSizer(wx.VERTICAL) self.text_title12 = wx.StaticText(self.m_panel1, wx.ID_ANY, u"Step 4.请点击GO开始导出!或者点击EXIT退出程序!", wx.DefaultPosition, wx.DefaultSize, wx.ST_NO_AUTORESIZE) self.text_title12.Wrap(-1) self.text_title12.SetFont( wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString)) self.text_title12.SetForegroundColour(wx.Colour(255, 255, 0)) self.text_title12.SetBackgroundColour(wx.Colour(0, 128, 0)) bSizer211.Add(self.text_title12, 0, wx.EXPAND, 5) bSizer21.Add(bSizer211, 0, wx.EXPAND, 5) bSizer22 = wx.BoxSizer(wx.HORIZONTAL) self.button_go = wx.Button(self.m_panel1, wx.ID_ANY, u"GO", wx.DefaultPosition, wx.DefaultSize, 0) bSizer22.Add(self.button_go, 0, wx.ALL, 5) self.button_exit = wx.Button(self.m_panel1, wx.ID_ANY, u"EXIT", wx.DefaultPosition, wx.DefaultSize, 0) bSizer22.Add(self.button_exit, 0, wx.ALL, 5) bSizer21.Add(bSizer22, 0, wx.ALIGN_CENTER_HORIZONTAL, 5) bSizer10.Add(bSizer21, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 5) bSizer91 = wx.BoxSizer(wx.VERTICAL) self.textctrl_display = wx.TextCtrl(self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE | wx.TE_READONLY) bSizer91.Add(self.textctrl_display, 1, wx.ALL | wx.EXPAND, 5) bSizer10.Add(bSizer91, 1, wx.EXPAND, 5) self.m_panel1.SetSizer(bSizer10) self.m_panel1.Layout() bSizer10.Fit(self.m_panel1) bSizer2.Add(self.m_panel1, 1, wx.EXPAND | wx.ALL, 5) self.SetSizer(bSizer2) self.Layout() self.Centre(wx.BOTH) # Connect Events self.btn_ChoseInputExcel.Bind(wx.EVT_BUTTON, self.get_inputexcel) self.btn_GetSheetName.Bind(wx.EVT_BUTTON, self.get_inputexcelsheetname) self.button_go.Bind(wx.EVT_BUTTON, self.onbutton) self.button_exit.Bind(wx.EVT_BUTTON, self.close)
def create_frame(self): "create top level frame" # Create the menubar menuBar = wx.MenuBar() fmenu = wx.Menu() add_menu(self, fmenu, "Open Library", "Open Existing XAS Data Library", action = self.onReadXDLFile) add_menu(self, fmenu, "New Library", "Create New XAS Data Library", action=self.OpenNewXDLFile) fmenu.AppendSeparator() add_menu(self, fmenu, "Import Spectra", "Read Spectra from ASCII File", action=self.ImportSpectra) add_menu(self, fmenu, "Export Spectra", "Write Spectra to ASCII (XDI) File", action=self.ExportSpectra) fmenu.AppendSeparator() add_menu(self, fmenu, "E&xit\tAlt-X", "Exit this Program", action=self.onClose) omenu = wx.Menu() add_menu(self, omenu, "Suites of Spectra", "Manage Suites of Spectra", action=self.onSuiteManager) add_menu(self, omenu, "Samples", "Manage Samples", action=self.onSampleManager) add_menu(self, omenu, "People", "Manage People Adding to Library", action=self.onPersonManager) add_menu(self, omenu, "Beamlines", "Manage Beamline", action=self.onBeamlineManager) # and put the menu on the menubar menuBar.Append(fmenu, "&File") menuBar.Append(omenu, "&Tables") self.SetMenuBar(menuBar) self.CreateStatusBar(1, wx.CAPTION|wx.THICK_FRAME) # Now create the Main Panel to put the other controls on. # SelectFilter | CurrentFilter | SpectraList # ------------------------------------------ # Spectra details # ------------------------------------------ topsection = wx.Panel(self) self.filterchoice = wx.Choice(topsection, size=(-1,-1), choices = self.filters) self.filterchoice.SetStringSelection(self.current_filter) self.filterchoice.Bind(wx.EVT_CHOICE, self.onFilterChoice) sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(wx.StaticText(topsection, label='Filter Spectra by:'), 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.GROW|wx.ALL, 4) sizer.Add(self.filterchoice, 0, wx.ALIGN_LEFT|wx.GROW|wx.ALL, 0) pack(topsection, sizer) splitter1 = wx.SplitterWindow(self, style=wx.SP_LIVE_UPDATE) splitter1.SetMinimumPaneSize(200) self.top_panel = wx.Panel(splitter1) # top self.bot_panel = SpectraPanel(splitter1) # bottom splitter2 = wx.SplitterWindow(self.top_panel, style=wx.SP_LIVE_UPDATE) splitter2.SetMinimumPaneSize(200) # left hand side -- filter self.left_panel = wx.Panel(splitter2) self.selection_list = wx.ListBox(self.left_panel) self.selection_label = wx.StaticText(self.left_panel, label=self.current_filter) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.selection_label, 0, wx.ALIGN_LEFT|wx.ALL, 1) sizer.Add(self.selection_list, 1, wx.ALIGN_LEFT|wx.GROW|wx.ALL, 1) pack(self.left_panel, sizer) # right hand side -- filtered spectra self.right_panel = wx.Panel(splitter2) self.spectra_list = wx.ListBox(self.right_panel) self.spectra_label = wx.StaticText(self.right_panel, label='Spectra') sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.spectra_label, 0, wx.ALIGN_LEFT|wx.ALL, 1) sizer.Add(self.spectra_list, 1, wx.ALIGN_LEFT|wx.GROW|wx.ALL, 1) pack(self.right_panel, sizer) self.selection_list.SetBackgroundColour(wx.Colour(255, 250, 250)) self.spectra_list.SetBackgroundColour(wx.Colour(250, 250, 240)) self.selection_list.Clear() # for name in ('Fe Compounds, GSECARS', 'As standards'): # self.selection_list.Append(name) self.spectra_list.Clear() # 'FeCO3', 'Fe metal', 'maghemite'): for name in ('Fe metal', 'Fe2O3', 'FeO'): self.spectra_list.Append(name) self.selection_list.Bind(wx.EVT_LISTBOX, self.onSelectionSelect) self.spectra_list.Bind(wx.EVT_LISTBOX, self.onSpectraSelect) splitter2.SplitVertically(self.left_panel, self.right_panel, 0) sizer2 = wx.BoxSizer(wx.HORIZONTAL) sizer2.Add(splitter2, 1, wx.GROW|wx.ALL, 5) pack(self.top_panel, sizer2) splitter1.SplitHorizontally(self.top_panel, self.bot_panel, 1) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(topsection, 0, wx.ALL|wx.GROW, 1) sizer.Add(splitter1, 1, wx.GROW|wx.ALL, 1) pack(self, sizer)
def __init__(self, parent): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"py2Nsis", pos=wx.DefaultPosition, size=wx.Size(480, 800), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) self.SetSizeHintsSz(wx.Size(480, 670), wx.DefaultSize) bSizer1 = wx.BoxSizer(wx.VERTICAL) self.m_panel1 = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.STATIC_BORDER | wx.TAB_TRAVERSAL) bSizer2 = wx.BoxSizer(wx.VERTICAL) bSizer201 = wx.BoxSizer(wx.HORIZONTAL) self.btPy2exe = wx.BitmapButton( self.m_panel1, wx.ID_ANY, wx.Bitmap(u"Images/py2nsis.png", wx.BITMAP_TYPE_ANY), wx.DefaultPosition, wx.DefaultSize, wx.BU_LEFT) bSizer201.Add(self.btPy2exe, 1, wx.ALL, 5) self.btpyInstaller = wx.BitmapButton( self.m_panel1, wx.ID_ANY, wx.Bitmap(u"Images/py2nsis.png", wx.BITMAP_TYPE_ANY), wx.DefaultPosition, wx.DefaultSize, wx.BU_LEFT) bSizer201.Add(self.btpyInstaller, 1, wx.ALL, 5) bSizer2.Add(bSizer201, 0, wx.EXPAND, 5) self.m_panel8 = wx.Panel(self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.STATIC_BORDER | wx.TAB_TRAVERSAL) bSizer20 = wx.BoxSizer(wx.VERTICAL) self.m_staticText101 = wx.StaticText(self.m_panel8, wx.ID_ANY, u"General", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText101.Wrap(-1) self.m_staticText101.SetFont(wx.Font(10, 74, 90, 92, False, "Tahoma")) bSizer20.Add(self.m_staticText101, 0, wx.ALL, 5) gSizer1 = wx.GridSizer(2, 2, 0, 0) self.m_staticText2 = wx.StaticText(self.m_panel8, wx.ID_ANY, u"Application Name", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText2.Wrap(-1) gSizer1.Add(self.m_staticText2, 0, wx.ALL, 5) self.tbAppName = wx.TextCtrl(self.m_panel8, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) gSizer1.Add(self.tbAppName, 0, wx.ALL | wx.EXPAND, 5) self.m_staticText21 = wx.StaticText(self.m_panel8, wx.ID_ANY, u"Version", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText21.Wrap(-1) gSizer1.Add(self.m_staticText21, 0, wx.ALL, 5) self.tbVersion = wx.TextCtrl(self.m_panel8, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) gSizer1.Add(self.tbVersion, 0, wx.ALL | wx.EXPAND, 5) self.m_staticText23 = wx.StaticText(self.m_panel8, wx.ID_ANY, u"Copyright", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText23.Wrap(-1) gSizer1.Add(self.m_staticText23, 0, wx.ALL, 5) self.tbCopyright = wx.TextCtrl(self.m_panel8, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) gSizer1.Add(self.tbCopyright, 0, wx.ALL | wx.EXPAND, 5) self.m_staticText22 = wx.StaticText(self.m_panel8, wx.ID_ANY, u"Company Name", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText22.Wrap(-1) gSizer1.Add(self.m_staticText22, 0, wx.ALL, 5) self.tbCompany = wx.TextCtrl(self.m_panel8, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) gSizer1.Add(self.tbCompany, 0, wx.EXPAND | wx.ALL, 5) self.m_staticText221 = wx.StaticText( self.m_panel8, wx.ID_ANY, u"Dist Folder (default is /dist)", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText221.Wrap(-1) gSizer1.Add(self.m_staticText221, 0, wx.ALL, 5) self.tbDist = wx.TextCtrl(self.m_panel8, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) gSizer1.Add( self.tbDist, 0, wx.EXPAND | wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL, 5) self.m_staticText20 = wx.StaticText(self.m_panel8, wx.ID_ANY, u"Bundle Level", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText20.Wrap(-1) gSizer1.Add(self.m_staticText20, 0, wx.ALL, 5) cbBundleChoices = [u"1", u"2", u"3"] self.cbBundle = wx.ComboBox(self.m_panel8, wx.ID_ANY, u"1", wx.DefaultPosition, wx.DefaultSize, cbBundleChoices, 0) gSizer1.Add(self.cbBundle, 0, wx.ALL | wx.EXPAND, 5) self.ckSetup = wx.CheckBox(self.m_panel8, wx.ID_ANY, u"Generate Only the Setup.py", wx.DefaultPosition, wx.DefaultSize, 0) gSizer1.Add(self.ckSetup, 0, wx.ALL, 5) bSizer20.Add(gSizer1, 0, wx.EXPAND | wx.FIXED_MINSIZE, 5) self.m_panel8.SetSizer(bSizer20) self.m_panel8.Layout() bSizer20.Fit(self.m_panel8) bSizer2.Add(self.m_panel8, 0, wx.EXPAND | wx.ALL, 5) self.m_staticText102 = wx.StaticText(self.m_panel1, wx.ID_ANY, u"Main Script", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText102.Wrap(-1) self.m_staticText102.SetFont(wx.Font(10, 74, 90, 92, False, "Tahoma")) bSizer2.Add(self.m_staticText102, 0, wx.ALL, 5) self.fpMainScript = wx.FilePickerCtrl(self.m_panel1, wx.ID_ANY, wx.EmptyString, u"Select a file", u"*.*", wx.DefaultPosition, wx.DefaultSize, wx.FLP_DEFAULT_STYLE) bSizer2.Add(self.fpMainScript, 0, wx.ALL | wx.EXPAND, 5) self.m_staticText10212 = wx.StaticText(self.m_panel1, wx.ID_ANY, u"Logo Icon", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText10212.Wrap(-1) self.m_staticText10212.SetFont(wx.Font(10, 74, 90, 92, False, "Tahoma")) bSizer2.Add(self.m_staticText10212, 0, wx.ALL, 5) self.fpLogo = wx.FilePickerCtrl(self.m_panel1, wx.ID_ANY, wx.EmptyString, u"Select a file", u"*.ico*", wx.DefaultPosition, wx.DefaultSize, wx.FLP_DEFAULT_STYLE) bSizer2.Add(self.fpLogo, 0, wx.ALL | wx.EXPAND, 5) self.m_panel9 = wx.Panel(self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.STATIC_BORDER | wx.TAB_TRAVERSAL) bSizer22 = wx.BoxSizer(wx.VERTICAL) self.m_staticText1021 = wx.StaticText(self.m_panel9, wx.ID_ANY, u"Aditional Python Modules", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText1021.Wrap(-1) self.m_staticText1021.SetFont(wx.Font(10, 74, 90, 92, False, "Tahoma")) bSizer22.Add(self.m_staticText1021, 0, wx.ALL, 5) bSizer13 = wx.BoxSizer(wx.HORIZONTAL) bSizer4 = wx.BoxSizer(wx.VERTICAL) self.tbModule = wx.TextCtrl(self.m_panel9, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) bSizer4.Add(self.tbModule, 0, wx.ALL, 5) self.btAdd = wx.Button(self.m_panel9, wx.ID_ANY, u"Add", wx.DefaultPosition, wx.DefaultSize, 0) bSizer4.Add(self.btAdd, 0, wx.ALL | wx.EXPAND, 5) bSizer13.Add(bSizer4, 0, wx.EXPAND, 5) lbModulesChoices = [] self.lbModules = wx.ListBox(self.m_panel9, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, lbModulesChoices, wx.LB_EXTENDED) bSizer13.Add(self.lbModules, 1, wx.ALL | wx.EXPAND, 5) bSizer22.Add(bSizer13, 1, wx.EXPAND, 5) self.m_staticText10211 = wx.StaticText(self.m_panel9, wx.ID_ANY, u"Static Files", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText10211.Wrap(-1) self.m_staticText10211.SetFont(wx.Font(10, 74, 90, 92, False, "Tahoma")) bSizer22.Add(self.m_staticText10211, 0, wx.ALL, 5) bSizer131 = wx.BoxSizer(wx.HORIZONTAL) bSizer41 = wx.BoxSizer(wx.VERTICAL) self.btAddDir = wx.Button(self.m_panel9, wx.ID_ANY, u"Add", wx.DefaultPosition, wx.DefaultSize, 0) bSizer41.Add(self.btAddDir, 0, wx.ALL | wx.EXPAND, 5) bSizer131.Add(bSizer41, 0, wx.EXPAND, 5) lbDirsChoices = [] self.lbDirs = wx.ListBox(self.m_panel9, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, lbDirsChoices, wx.LB_EXTENDED) bSizer131.Add(self.lbDirs, 1, wx.ALL | wx.EXPAND, 5) bSizer22.Add(bSizer131, 1, wx.EXPAND, 5) self.m_panel9.SetSizer(bSizer22) self.m_panel9.Layout() bSizer22.Fit(self.m_panel9) bSizer2.Add(self.m_panel9, 1, wx.EXPAND | wx.ALL, 5) self.btGenerate1 = wx.Button(self.m_panel1, wx.ID_ANY, u"Generate", wx.DefaultPosition, wx.DefaultSize, 0) self.btGenerate1.SetFont(wx.Font(8, 74, 90, 92, False, "Tahoma")) bSizer2.Add(self.btGenerate1, 0, wx.ALL | wx.EXPAND, 5) self.m_panel1.SetSizer(bSizer2) self.m_panel1.Layout() bSizer2.Fit(self.m_panel1) bSizer1.Add(self.m_panel1, 1, wx.EXPAND, 5) self.SetSizer(bSizer1) self.Layout() self.m_menubar1 = wx.MenuBar(0 | wx.CLIP_CHILDREN) self.mnFile = wx.Menu() self.mnOpen = wx.MenuItem(self.mnFile, wx.ID_ANY, u"&Open" + u"\t" + u"Ctrl+O", wx.EmptyString, wx.ITEM_NORMAL) self.mnFile.AppendItem(self.mnOpen) self.mnSave = wx.MenuItem(self.mnFile, wx.ID_ANY, u"&Save" + u"\t" + u"Ctrl+S", wx.EmptyString, wx.ITEM_NORMAL) self.mnFile.AppendItem(self.mnSave) self.mnSaveAs = wx.MenuItem(self.mnFile, wx.ID_ANY, u"Save As...", wx.EmptyString, wx.ITEM_NORMAL) self.mnFile.AppendItem(self.mnSaveAs) self.mnFile.AppendSeparator() self.mnExit = wx.MenuItem(self.mnFile, wx.ID_ANY, u"&Exit" + u"\t" + u"Ctrl+Q", wx.EmptyString, wx.ITEM_NORMAL) self.mnFile.AppendItem(self.mnExit) self.m_menubar1.Append(self.mnFile, u"&File") self.mnCode = wx.Menu() self.mnAddCode = wx.MenuItem(self.mnCode, wx.ID_ANY, u"&Add Custom Code", wx.EmptyString, wx.ITEM_NORMAL) self.mnCode.AppendItem(self.mnAddCode) self.m_menubar1.Append(self.mnCode, u"&Code") self.mnConfiguration = wx.Menu() self.mnConfig = wx.MenuItem(self.mnConfiguration, wx.ID_ANY, u"&Paths", wx.EmptyString, wx.ITEM_NORMAL) self.mnConfiguration.AppendItem(self.mnConfig) self.m_menubar1.Append(self.mnConfiguration, u"&Configuration") self.mnHelp = wx.Menu() self.mnAbout = wx.MenuItem(self.mnHelp, wx.ID_ANY, u"&About", wx.EmptyString, wx.ITEM_NORMAL) self.mnHelp.AppendItem(self.mnAbout) self.m_menubar1.Append(self.mnHelp, u"&Help") self.SetMenuBar(self.m_menubar1) self.Centre(wx.BOTH) # Connect Events self.btPy2exe.Bind(wx.EVT_BUTTON, self.btPy2exe_click) self.btpyInstaller.Bind(wx.EVT_BUTTON, self.btpyInstaller_click) self.btAdd.Bind(wx.EVT_BUTTON, self.btAdd_click) self.lbModules.Bind(wx.EVT_KEY_DOWN, self.lbModules_keyDown) self.btAddDir.Bind(wx.EVT_BUTTON, self.btAddDir_click) self.lbDirs.Bind(wx.EVT_KEY_DOWN, self.lbDirs_keyDown) self.btGenerate1.Bind(wx.EVT_BUTTON, self.btGenerate_click) self.Bind(wx.EVT_MENU, self.mnOpen_click, id=self.mnOpen.GetId()) self.Bind(wx.EVT_MENU, self.mnSave_click, id=self.mnSave.GetId()) self.Bind(wx.EVT_MENU, self.mnSaveAs_click, id=self.mnSaveAs.GetId()) self.Bind(wx.EVT_MENU, self.mnExit_click, id=self.mnExit.GetId()) self.Bind(wx.EVT_MENU, self.mnAddCustomCode_click, id=self.mnAddCode.GetId()) self.Bind(wx.EVT_MENU, self.btConfig_click, id=self.mnConfig.GetId()) self.Bind(wx.EVT_MENU, self.mnAbout_click, id=self.mnAbout.GetId())
def __init__(self, parent): wx.Panel.__init__(self, parent) #==============记住用户名=============== self.save = wx.CheckBox(self, -1, '记住用户名密码', (30, 70), (100, -1)) self.conf = ConfigParser.ConfigParser() self.conf.read("conf.ini") str_value = self.conf.get("Saveinfo", "value") str_name = self.conf.get("Saveinfo", "name") str_passwd = self.conf.get("Saveinfo", "passwd") if str_value == "1": self.save.SetValue(True) else: str_name = "" str_passwd = "" #===================================== wx.StaticText(self, -1, "TD工具服务器IP地址", (30, 10)) self.ip = wx.TextCtrl(self, -1, "172.16.121.11", pos=(30, 40), size=(120, -1)) self.ip.Enable(enable=False) wx.StaticText(self, -1, "用户名", (190, 10)) self.usrname = wx.TextCtrl(self, -1, str_name, pos=(190, 40), size=(100, -1)) wx.StaticText(self, -1, "密码", (310, 10)) self.passwd = wx.TextCtrl(self, -1, str_passwd, pos=(310, 40), size=(100, -1), style=wx.TE_PASSWORD) #==============功能1提示区=============# self.stat1 = wx.StaticText(self, -1, "", (200, 390)) #-----------------获取的所有数据库名 wx.StaticText(self, -1, "项目名", (30, 90)) wx.StaticText(self, -1, "搜索", (400, 82)) self.filtere = wx.TextCtrl(self, -1, "", pos=(435, 80), size=(100, -1), style=wx.TE_PROCESS_ENTER) sampleList = [] self.listBox1 = wx.ListBox(self, -1, (30, 110), (505, 100), sampleList, wx.LB_SINGLE) #-----------------获取的所有主轮次 wx.StaticText(self, -1, "轮次", (30, 220)) sampleList2 = [] self.listBox2 = wx.ListBox(self, -1, (30, 240), (230, 100), sampleList2, wx.LB_SINGLE) #-----------------获取所有子轮次 wx.StaticText(self, -1, "轮次子项", (300, 220)) self.tree = wx.TreeCtrl(self, pos=(300, 240), size=(230, 100)) self.Bind(wx.EVT_TREE_SEL_CHANGED, self.thirdtimeget, self.tree) #-----------------按钮1,获取数据库 self.button1 = wx.Button(self, -1, "登陆", pos=(450, 35)) #-----------------按钮4,统计重复执行用例条数 self.button4 = wx.Button(self, -1, "统计重复用例", pos=(30, 350)) #-----------------按钮5,导出excel self.button5 = wx.Button(self, -1, "导出excel", pos=(200, 350)) #-----------------按钮6,打开共享文件夹 #self.button6 = wx.Button(self, -1, "打开共享文件夹", pos=(330, 350)) #-----------------按钮7,统计按照时间执行的STEP self.button7 = wx.Button(self, -1, "统计时间点用例执行情况", pos=(350, 350)) #-----------------按钮登陆bind self.Bind(wx.EVT_BUTTON, self.login, self.button1) #-----------------列表数据库 self.Bind(wx.EVT_LISTBOX, self.timeget, self.listBox1) #-----------------列表轮次 self.Bind(wx.EVT_LISTBOX, self.sectimeget, self.listBox2) #-----------------按钮按钮统计重复 self.Bind(wx.EVT_BUTTON, self.statistics, self.button4) #-----------------按钮导出数据库 self.Bind(wx.EVT_BUTTON, self.excelout, self.button5) #-----------------按钮打开共享文件夹 #self.Bind(wx.EVT_BUTTON, self.communion, self.button6) #-----------------统计按照时间执行的STEP self.Bind(wx.EVT_BUTTON, self.timestatistics, self.button7) #-----------------搜索 self.Bind(wx.EVT_TEXT, self.filteres, self.filtere) self.Bind(wx.EVT_TEXT_ENTER, self.filteres, self.filtere) self.doyouwant = 0 #变量判断符
def __init__(self, parent=None): # Initializing parameters and setting up the GUI, not much to see here... wx.Frame.__init__(self, parent, -1, 'TribalOT', size=(600, 400)) self.Bind(wx.EVT_CLOSE, self.onClose) self.panel = wx.Panel(self) self.reverseSort = False self.repeatDelay = -1 self.numberOfVillages = -1 self.maptoattackdelay = 2000 self.closing = False self.sets = [] self.setHomes = [] self.setTimes = [] self.villages = [] self.setActive = [] try: self.load_data() except IOError: self.sets.append("First Village") self.setHomes.append((500, 500)) self.setTimes.append(-1) self.setActive.append(False) self.villages.append([village((-1, -1), -1)]) temp = wx.StaticText(self.panel, -1, "Attacking village: ", pos=(10, 5)) self.set_list = wx.ListBox(self.panel, 2, pos=wx.Point(10, 25), size=(180, 280), choices=self.sets, name='Sets') self.set_list.SetSelection(0) temp = wx.StaticText(self.panel, -1, "Targets and preset key: ", pos=(210, 5)) self.vil_list = wx.ListBox( self.panel, 3, pos=wx.Point(210, 25), size=(250, 280), choices=[str(each) for each in self.villages[0]], name='Villages') self.vil_list.SetSelection(0) self.set_list.Bind(wx.EVT_LISTBOX, self.onSetListBox, id=2) self.vil_list.Bind(wx.EVT_LISTBOX, self.onVilListBox, id=3) self.selected_set = 0 self.selected_vil = 0 self.addSetButton = wx.Button(self.panel, label="Add Set", pos=(10, 305)) self.Bind(wx.EVT_BUTTON, self.addSet, self.addSetButton) self.remSetButton = wx.Button(self.panel, label="Remove Set", pos=(10, 333)) self.Bind(wx.EVT_BUTTON, self.remSet, self.remSetButton) temp = wx.StaticText(self.panel, -1, "Curr Vil:", pos=(100, 310)) self.currentVillageIndicator = wx.TextCtrl(self.panel, -1, str(1), pos=(145, 310), size=(24, 16)) self.currentVillageIndicator.Bind(wx.EVT_TEXT, self.saveCurrVill) temp = wx.StaticText(self.panel, -1, "/", pos=(172, 310)) self.villagesNumberText = wx.TextCtrl(self.panel, -1, str(-1), pos=(180, 310), size=(32, 16)) self.villagesNumberText.Bind(wx.EVT_TEXT, self.saveVillNumber) self.setUpButton = wx.Button(self.panel, label="UP", pos=(110, 333), size=(32, 26)) self.Bind(wx.EVT_BUTTON, self.setUp, self.setUpButton) self.setDownButton = wx.Button(self.panel, label="DOWN", pos=(150, 333), size=(48, 26)) self.Bind(wx.EVT_BUTTON, self.setDown, self.setDownButton) self.newAttackButton = wx.Button(self.panel, label="Create New Attack", pos=(470, 5), size=(110, 25)) self.Bind(wx.EVT_BUTTON, self.newAttack, self.newAttackButton) self.homeCoordText = wx.TextCtrl(self.panel, -1, str(self.setHomes[0][0]), pos=(105, 5), size=(40, 16)) self.homeCoordText.Bind(wx.EVT_TEXT, self.saveHome) self.homeCoordText2 = wx.TextCtrl(self.panel, -1, str(self.setHomes[0][1]), pos=(150, 5), size=(40, 16)) self.homeCoordText2.Bind(wx.EVT_TEXT, self.saveHome) self.coordText = wx.TextCtrl(self.panel, -1, str(self.villages[0][0].pos[0]), pos=(480, 40), size=(40, 16)) self.coordText.Bind(wx.EVT_TEXT, self.saveAttack) self.coordText2 = wx.TextCtrl(self.panel, -1, str(self.villages[0][0].pos[1]), pos=(530, 40), size=(40, 16)) self.coordText2.Bind(wx.EVT_TEXT, self.saveAttack) self.presetText = wx.TextCtrl(self.panel, -1, str(self.villages[0][0].preset), pos=(515, 60), size=(16, 16)) self.presetText.Bind(wx.EVT_TEXT, self.saveAttack) #self.saveAttackButton = wx.Button(self.panel, label="Save", pos=(470,90), size=(110,50)) #self.Bind(wx.EVT_BUTTON, self.saveAttack, self.saveAttackButton) self.sortVillagesButton = wx.Button(self.panel, label="Sort 1to2", pos=(465, 85), size=(60, 30)) self.Bind(wx.EVT_BUTTON, self.sortVillages, self.sortVillagesButton) self.deleteAttackButton = wx.Button(self.panel, label="Delete", pos=(525, 85), size=(50, 30)) self.Bind(wx.EVT_BUTTON, self.deleteAttack, self.deleteAttackButton) self.continueCheckBox = wx.CheckBox( self.panel, -1, label=" Continue from \n selected attack", pos=(470, 170)) self.runButton = wx.Button(self.panel, label="Run Set", pos=(470, 205), size=(100, 40)) self.Bind(wx.EVT_BUTTON, self.run, self.runButton) self.attackNum = wx.StaticText(self.panel, -1, "Number of attacks: " + str(len(self.villages[0])), pos=(210, 305)) self.presetNum = wx.StaticText(self.panel, -1, self.makePresetText(), pos=(210, 335)) #self.timeSlider = wx.Slider(self.panel, -1, value=self.maptoattackdelay, minValue=0, maxValue=5000, style=(wx.SL_HORIZONTAL|wx.SL_LABELS), pos=(480, 145)) #self.timeSlider.Bind(wx.EVT_SLIDER, self.timeSliderScroll) self.timeMTA = wx.TextCtrl(self.panel, -1, str(self.maptoattackdelay), pos=(475, 145), size=(60, 16)) self.timeMTA.Bind(wx.EVT_TEXT, self.timeMTAChange) self.timeMTAText = wx.StaticText(self.panel, -1, "MapToAttack Delay: ", pos=(470, 120)) self.timeMTAText = wx.StaticText(self.panel, -1, "msec", pos=(540, 145)) self.timeRepeat = wx.TextCtrl(self.panel, -1, str(self.setTimes[0]), pos=(475, 275), size=(60, 16)) self.timeRepeat.Bind(wx.EVT_TEXT, self.timeRepeatChange) self.timeRepeatText = wx.StaticText(self.panel, -1, "Repeat attacks every: ", pos=(470, 250)) self.timeRepeatText = wx.StaticText(self.panel, -1, "mins", pos=(540, 275)) self.timeLeft = wx.StaticText(self.panel, -1, "00:00", pos=(500, 310)) font = wx.Font(18, wx.DEFAULT, wx.NORMAL, wx.BOLD) self.timeLeft.SetFont(font) self.commandQueue = [] self.aThread = attackerThread(self.commandQueue, -1, currentVillageFunction, self) self.tThread = timerThread([], self.commandQueue, timerFuncPlus, self, doneFunc, self.aThread) self.aThread.start() self.tThread.start()
def _init_ctrls(self, parent): wx.Dialog.__init__(self, name='MovieEditor', parent=parent, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER, title=self.title, size=wx.Size(-1, -1)) self.Bind(wx.EVT_CLOSE, self.OnClose) self.chkAutoAdd = wx.CheckBox(self, label="Auto Add Files to library") self.chkAutoAdd.SetValue(True) self.Bind(wx.EVT_CHECKBOX, self.OnToggleAutoAdd, self.chkAutoAdd) self.lblStatus = wx.StaticText( self, label='Click "Scan" to scan the library') self.lblDir = wx.StaticText(self, label='') self.lblDir.Show(False) self.lblFile = wx.StaticText(self, label='') self.lblFile.Show(False) self.lblCount = wx.StaticText(self, label='') #this displayed when autoadd is enabled self.autoAddDisp = wx.Notebook(self, style=wx.BK_DEFAULT) self.lstAdded = wx.ListBox(self.autoAddDisp) self.autoAddDisp.AddPage(self.lstAdded, "Added") self.pnlUnrecognized = wx.Panel(self.autoAddDisp) self.lstUnrecognized = wx.ListCtrl(self.pnlUnrecognized, style=wx.LC_REPORT | wx.SUNKEN_BORDER) self.lstUnrecognized.InsertColumn(0, 'Files', width=300) self.addUnrecognizedNew = wx.Button(self.pnlUnrecognized, label="Add to new movie") self.addUnrecognizedNew.Bind(wx.EVT_BUTTON, self.OnAddUnrecNew) self.addUnrecognizedExisting = wx.Button(self.pnlUnrecognized, label="Add to existing movie") self.addUnrecognizedExisting.Bind(wx.EVT_BUTTON, self.OnAddUnrecExist) self.addUnrecognizedExisting.Show(False) #this hidden for now ubox = wx.BoxSizer(wx.VERTICAL) ubox.Add(self.lstUnrecognized, 1, wx.ALL | wx.EXPAND, 3) ubox.Add(self.addUnrecognizedNew, 0, wx.ALL, 3) ubox.Add(self.addUnrecognizedExisting, 0, wx.ALL, 3) self.pnlUnrecognized.SetSizer(ubox) self.pnlUnrecognized.Layout() self.autoAddDisp.AddPage(self.pnlUnrecognized, "Unrecognized") #this displayed when autoadd is disabled self.noAutoDisp = wx.Panel(self, style=wx.RAISED_BORDER) self.lstFound = wx.ListCtrl(self.noAutoDisp, style=wx.LC_REPORT | wx.SUNKEN_BORDER) self.lstFound.InsertColumn(0, 'Files', width=300) self.addNew = wx.Button(self.noAutoDisp, label="Add to new movie") self.addNew.Bind(wx.EVT_BUTTON, self.OnAddNew) self.addExisting = wx.Button(self.noAutoDisp, label="Add to existing movie") self.addExisting.Bind(wx.EVT_BUTTON, self.OnAddExisting) self.addExisting.Show(False) #this hidden for now nbox = wx.BoxSizer(wx.VERTICAL) nbox.Add(self.lstFound, 1, wx.ALL | wx.EXPAND, 3) nbox.Add(self.addNew, 0, wx.ALL, 3) nbox.Add(self.addExisting, 0, wx.ALL, 3) self.noAutoDisp.SetSizer(nbox) self.noAutoDisp.Layout() self.noAutoDisp.Show(False) #start/stop and close self.btnStartStop = wx.Button(self, label='Scan') self.btnStartStop.Bind(wx.EVT_BUTTON, self.OnStartStop) self.btnClose = wx.Button(self, label="Close") self.btnClose.Bind(wx.EVT_BUTTON, self.OnClose) #layout sbox = wx.BoxSizer(wx.VERTICAL) sbox.Add(self.lblStatus, 0, wx.ALL, 3) sbox.Add(self.lblCount, 0, wx.ALL, 3) sbox.Add(self.lblDir, 0, wx.ALL, 3) sbox.Add(self.lblFile, 0, wx.ALL, 3) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add(self.btnStartStop, 0, 5) hbox.Add(self.btnClose, 0, 5) vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(self.chkAutoAdd, 0, wx.ALL, 5) vbox.Add(sbox, 0, wx.ALL, 5) vbox.Add(self.autoAddDisp, 1, wx.ALL | wx.EXPAND, 10) vbox.Add(self.noAutoDisp, 1, wx.ALL | wx.EXPAND, 10) vbox.Add(hbox, 0, wx.ALIGN_CENTER, 5) self.SetSizer(vbox) self.Layout()
def _init_ctrls(self, prnt): wx.SplitterWindow.__init__(self, id=ID_EDITINGPANEL, name='MainSplitter', parent=prnt, pos=wx.Point(0, 0), size=wx.Size(-1, -1), style=wx.SP_3D) self._init_utils() self.PartList = wx.ListBox(choices=[], id=ID_EDITINGPANELPARTLIST, name='PartList', parent=self, pos=wx.Point(0, 0), size=wx.Size(-1, -1), style=0) self.PartList.Bind(wx.EVT_LISTBOX, self.OnPartListBoxClick, id=ID_EDITINGPANELPARTLIST) self.SecondSplitter = wx.SplitterWindow(id=ID_EDITINGPANELSECONDSPLITTER, name='SecondSplitter', parent=self, pos=wx.Point(0, 0), size=wx.Size(-1, -1), style=wx.SP_3D) self.SplitHorizontally(self.PartList, self.SecondSplitter, 110) self.SetMinimumPaneSize(1) self.SubindexGridPanel = wx.Panel(id=ID_EDITINGPANELSUBINDEXGRIDPANEL, name='SubindexGridPanel', parent=self.SecondSplitter, pos=wx.Point(0, 0), size=wx.Size(-1, -1), style=wx.TAB_TRAVERSAL) self.IndexListPanel = wx.Panel(id=ID_EDITINGPANELINDEXLISTPANEL, name='IndexListPanel', parent=self.SecondSplitter, pos=wx.Point(0, 0), size=wx.Size(-1, -1), style=wx.TAB_TRAVERSAL) self.SecondSplitter.SplitVertically(self.IndexListPanel, self.SubindexGridPanel, 280) self.SecondSplitter.SetMinimumPaneSize(1) self.SubindexGrid = wx.grid.Grid(id=ID_EDITINGPANELSUBINDEXGRID, name='SubindexGrid', parent=self.SubindexGridPanel, pos=wx.Point(0, 0), size=wx.Size(-1, -1), style=0) # self.SubindexGrid.SetFont(wx.Font(12, 77, wx.NORMAL, wx.NORMAL, False, # 'Sans')) self.SubindexGrid.SetFont(wx.Font(wx.FontInfo(12))) # self.SubindexGrid.SetLabelFont(wx.Font(10, 77, wx.NORMAL, wx.NORMAL, # False, 'Sans')) self.SubindexGrid.SetLabelFont(wx.Font(wx.FontInfo(10))) self.SubindexGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGED, self.OnSubindexGridCellChange) self.SubindexGrid.Bind(wx.grid.EVT_GRID_CELL_RIGHT_CLICK, self.OnSubindexGridRightClick) self.SubindexGrid.Bind(wx.grid.EVT_GRID_SELECT_CELL, self.OnSubindexGridSelectCell) self.SubindexGrid.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.OnSubindexGridCellLeftClick) self.SubindexGrid.Bind(wx.grid.EVT_GRID_EDITOR_SHOWN, self.OnSubindexGridEditorShown) self.CallbackCheck = wx.CheckBox(id=ID_EDITINGPANELCALLBACKCHECK, label=_('Have Callbacks'), name='CallbackCheck', parent=self.SubindexGridPanel, pos=wx.Point(0, 0), size=wx.Size(152, 24), style=0) self.CallbackCheck.Bind(wx.EVT_CHECKBOX, self.OnCallbackCheck, id=ID_EDITINGPANELCALLBACKCHECK) self.IndexList = wx.ListBox(choices=[], id=ID_EDITINGPANELINDEXLIST, name='IndexList', parent=self.IndexListPanel, pos=wx.Point(0, 0), size=wx.Size(-1, -1), style=0) self.IndexList.Bind(wx.EVT_LISTBOX, self.OnIndexListClick, id=ID_EDITINGPANELINDEXLIST) self.IndexList.Bind(wx.EVT_RIGHT_UP, self.OnIndexListRightUp) self.AddButton = wx.Button(id=ID_EDITINGPANELADDBUTTON, label=_('Add'), name='AddButton', parent=self.IndexListPanel, pos=wx.Point(0, 0), size=wx.DefaultSize, style=0) self.AddButton.Bind(wx.EVT_BUTTON, self.OnAddButtonClick, id=ID_EDITINGPANELADDBUTTON) self.IndexChoice = wx.ComboBox(choices=[], id=ID_EDITINGPANELINDEXCHOICE, name='IndexChoice', parent=self.IndexListPanel, pos=wx.Point(50, 0), size=wx.Size(-1, 30), style=wx.CB_READONLY) self._init_sizers()
def __init__(self, parent, id): global craft, slider, spin, gauge, combo, txt, lb wx.Frame.__init__(self, parent, id, "Craft Python SDK Sample", size=(800, 400)) panel = wx.Panel(self) lbl = wx.StaticText(panel, -1, label="text", pos=(10, 20), size=(50, -1)) lbl.SetLabel("Slider") slider = wx.Slider(panel, -1, 0, 1, 1000, (100, 20), (200, -1)) slider.Bind(wx.EVT_SET_FOCUS, self.sliderFocus) slider.Bind(wx.EVT_LEFT_UP, self.sliderFocus) lbl = wx.StaticText(panel, -1, label="text", pos=(10, 100), size=(50, -1)) lbl.SetLabel("SpinCtrl") spin = wx.SpinCtrl(panel, -1, "", pos=(100, 100), size=(200, -1), min=0, max=1000) spin.Bind(wx.EVT_CHILD_FOCUS, self.spinCtrlFocus) spin.Bind(wx.EVT_LEFT_UP, self.spinCtrlFocus) lbl = wx.StaticText(panel, -1, label="text", pos=(10, 180), size=(50, -1)) lbl.SetLabel("Gauge") gauge = wx.Gauge(panel, -1, range=500, pos=(100, 180), size=(200, 25)) gauge.Bind(wx.EVT_LEFT_UP, self.gaugeClick) lbl = wx.StaticText(panel, -1, label="text", pos=(10, 260), size=(50, -1)) lbl.SetLabel("ComboBox") l = [] for i in range(0, 1000): l.append(str(i)) combo = wx.ComboBox(panel, -1, "", pos=(100, 260), size=(200, 25), choices=l) combo.Bind(wx.EVT_SET_FOCUS, self.comboBoxFocus) combo.Bind(wx.EVT_LEFT_UP, self.comboBoxFocus) lbl = wx.StaticText(panel, -1, label="text", pos=(400, 20), size=(50, -1)) lbl.SetLabel("TextCtrl") vtxt = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque semper ut felis non bibendum. " \ "Suspendisse potenti. Mauris rhoncus auctor quam, non ullamcorper elit interdum a. Aliquam erat volutpat. " \ "Ut facilisis odio a enim facilisis, at porta lectus hendrerit. Curabitur et vulputate lectus, nec sollicitudin odio. " \ "Morbi tincidunt iaculis erat, eu bibendum sapien vehicula vel. Etiam sodales malesuada mauris, " \ "quis viverra eros imperdiet at. Vestibulum maximus dui dolor, sed laoreet arcu laoreet in. " txt = wx.TextCtrl(panel, -1, vtxt, pos=(480, 20), size=(100, -1), style=wx.TE_MULTILINE | wx.TE_READONLY) txt.Bind(wx.EVT_SET_FOCUS, self.textCtrlFocus) txt.Bind(wx.EVT_LEFT_UP, self.textCtrlFocus) lbl = wx.StaticText(panel, -1, label="text", pos=(400, 180), size=(50, -1)) lbl.SetLabel("ListBox") li = [] for i in range(0, 1000): li.append(str(i)) lb = wx.ListBox(panel, -1, pos=(480, 180), size=(100, -1), choices=li) lb.Bind(wx.EVT_SET_FOCUS, self.listBoxFocus) lb.Bind(wx.EVT_LEFT_UP, self.listBoxFocus)