def _init_sizers(self): # generated method, don't edit self.notebookSizer1 = wx.NotebookSizer(nb=self.notebook1) self.boxSizer1 = wx.BoxSizer(orient=wx.VERTICAL) self.gridSizer1 = wx.GridSizer(cols=2, hgap=0, rows=3, vgap=0) self.flexGridSizer1 = wx.FlexGridSizer(cols=3, hgap=0, rows=3, vgap=0) self.staticBoxSizer1 = wx.StaticBoxSizer(box=self.staticBox1, orient=wx.VERTICAL) self.boxSizer2 = wx.BoxSizer(orient=wx.HORIZONTAL) self._init_coll_boxSizer1_Items(self.boxSizer1) self._init_coll_gridSizer1_Items(self.gridSizer1) self._init_coll_flexGridSizer1_Growables(self.flexGridSizer1) self._init_coll_flexGridSizer1_Items(self.flexGridSizer1) self._init_coll_staticBoxSizer1_Items(self.staticBoxSizer1) self._init_coll_boxSizer2_Items(self.boxSizer2) self.panel1.SetSizer(self.boxSizer1) self.panel2.SetSizer(self.gridSizer1) self.panel3.SetSizer(self.flexGridSizer1) self.panel4.SetSizer(self.staticBoxSizer1)
def __init__(self, parent, IDmanager): self._wx = wx.Notebook(parent, -1, style=wx.CLIP_CHILDREN) self.sizer = wx.NotebookSizer(self._wx) self._toolbars = [] self._id_manager = IDmanager self.addToolBar("Main") self.addToolBar("Test")
def __init__(self, parent, id): # set up widgets wx.Panel.__init__(self, parent, id, wx.DefaultPosition, wx.DefaultSize) # make lab notebook self.nb = gmLabWidgets.cLabJournalNB(self, -1) # just one vertical sizer sizer = wx.BoxSizer(wx.VERTICAL) szr_nb = wx.NotebookSizer(self.nb) sizer.Add(szr_nb, 1, wx.EXPAND, 0) self.SetAutoLayout(1) self.SetSizer(sizer) sizer.Fit(self) self.Layout()
def NotebookFunc(parent, call_fit=True, set_sizer=True): item0 = wx.BoxSizer(wx.VERTICAL) item2 = wx.Notebook(parent, ID_NOTEBOOK, wx.DefaultPosition, [200, 160], 0) if wx.VERSION >= (2, 5, 2): item1 = item2 else: item1 = wx.NotebookSizer(item2) item3 = wx.Panel(item2, -1) PageOneFunc(item3, False) item2.AddPage(item3, "Page 1") item4 = wx.Panel(item2, -1) PageTwoFunc(item4, False) item2.AddPage(item4, "Page 2") item5 = wx.Panel(item2, -1) item2.AddPage(item5, "Page 3") item0.Add(item1, 0, wx.ALIGN_CENTER | wx.ALL, 5) item6 = wx.StaticLine(parent, ID_LINE, wx.DefaultPosition, [20, -1], wx.LI_HORIZONTAL) item0.Add(item6, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) item7 = wx.BoxSizer(wx.HORIZONTAL) item8 = wx.Button(parent, wx.ID_OK, "OK", wx.DefaultPosition, wx.DefaultSize, 0) item8.SetDefault() item7.Add(item8, 0, wx.ALIGN_CENTER | wx.ALL, 5) item9 = wx.Button(parent, wx.ID_CANCEL, "Cancel", wx.DefaultPosition, wx.DefaultSize, 0) item7.Add(item9, 0, wx.ALIGN_CENTER | wx.ALL, 5) item0.Add(item7, 0, wx.ALIGN_CENTER | wx.LEFT | wx.RIGHT | wx.BOTTOM, 5) if set_sizer == True: parent.SetSizer(item0) if call_fit == True: item0.SetSizeHints(parent) return item0
def __do_layout(self): # begin wxGlade: MetadataDialog.__do_layout sizer_1 = wx.BoxSizer(wx.VERTICAL) sizer_2 = wx.BoxSizer(wx.HORIZONTAL) sizer_3 = wx.BoxSizer(wx.HORIZONTAL) sizer_4 = wx.BoxSizer(wx.HORIZONTAL) sizer_4.Add(self.metadata_out, 1, wx.EXPAND, 0) self.notebook_1_pane_1.SetAutoLayout(1) self.notebook_1_pane_1.SetSizer(sizer_4) sizer_4.Fit(self.notebook_1_pane_1) sizer_4.SetSizeHints(self.notebook_1_pane_1) sizer_3.Add(self.sample, 1, wx.EXPAND, 0) self.notebook_1_pane_2.SetAutoLayout(1) self.notebook_1_pane_2.SetSizer(sizer_3) sizer_3.Fit(self.notebook_1_pane_2) sizer_3.SetSizeHints(self.notebook_1_pane_2) self.notebook_1.AddPage(self.notebook_1_pane_1, "metadata.xml") self.notebook_1.AddPage(self.notebook_1_pane_2, "sample") sizer_1.Add(wx.NotebookSizer(self.notebook_1), 1, wx.ALL | wx.EXPAND, 8) sizer_2.Add(self.button_save, 0, wx.LEFT, 80) sizer_2.Add(self.button_cancel, 0, wx.LEFT, 60) sizer_1.Add(sizer_2, 0, wx.ALL | wx.EXPAND, 8) self.SetAutoLayout(1) self.SetSizer(sizer_1) self.Layout() # end wxGlade #TODO: color/lex doesn't work #TODO: use PORTDIR! skel = open("/usr/portage/skel.metadata.xml").read() self.metadata_out.EmptyUndoBuffer() self.metadata_out.SetMarginType(1, wx.STC_MARGIN_NUMBER) self.metadata_out.SetMarginWidth(1, 25) self.metadata_out.SetLexer(wx.STC_LEX_XML) self.sample.SetMarginType(1, wx.STC_MARGIN_NUMBER) self.sample.SetMarginWidth(1, 25) self.sample.SetLexer(wx.STC_LEX_XML) self.sample.SetText(skel) self.sample.SetReadOnly(1)
def create_properties(self): """\ Creates the notebook with the properties of self """ self.notebook = wx.Notebook(self.property_window, -1) if not misc.check_wx_version(2, 5, 2): nb_sizer = wx.NotebookSizer(self.notebook) self.notebook.sizer = nb_sizer else: self.notebook.sizer = None self.notebook.SetAutoLayout(True) self.notebook.Hide() self._common_panel = panel = wx.ScrolledWindow( self.notebook, -1, style=wx.TAB_TRAVERSAL | wx.FULL_REPAINT_ON_RESIZE) self.name_prop.display(panel) self.klass_prop.display(panel) if getattr(self, '_custom_base_classes', False): self.properties['custom_base'].display(panel)
def __do_layout(self): sizer_1 = wx.BoxSizer(wx.VERTICAL) sizer_2 = wx.BoxSizer(wx.HORIZONTAL) sizer_3 = wx.BoxSizer(wx.VERTICAL) sizer_4 = wx.BoxSizer(wx.VERTICAL) sizer_2.Add(self.window_2, 1, wx.EXPAND, 0) self.window_1_pane_1.SetAutoLayout(1) self.window_1_pane_1.SetSizer(sizer_2) if wx.VERSION[:2] < (2, 6): sizer_3.Add(wx.NotebookSizer(self.notebook), 1, wx.EXPAND) else: sizer_3.Add(self.notebook, 1, wx.EXPAND) self.window_2_pane_1.SetAutoLayout(1) self.window_2_pane_1.SetSizer(sizer_3) sizer_4.Add(self.picture_list, 1, wx.EXPAND) self.window_1_pane_2.SetAutoLayout(1) self.window_1_pane_2.SetSizer(sizer_4) sizer_2.Fit(self.window_1_pane_1) sizer_1.Add(self.window_1, 1, wx.EXPAND, 0) self.SetAutoLayout(1) self.SetSizer(sizer_1) self.Layout() if wx.Platform == '__WXMAC__': wx.CallAfter(self.notebook.SetSelection, 0)
def __do_layout(self): # begin wxGlade: MyFrame.__do_layout MainSizer = wx.BoxSizer(wx.HORIZONTAL) TopPaneSizer = wx.BoxSizer(wx.HORIZONTAL) HelpPaneSizer = wx.FlexGridSizer(3, 1, 7, 7) SampleTextSizer = wx.BoxSizer(wx.HORIZONTAL) MatchesPaneSizer = wx.BoxSizer(wx.HORIZONTAL) BottomPaneSizer = wx.FlexGridSizer(5, 3, 0, 0) OptionsSizer = wx.FlexGridSizer(1, 2, 0, 7) FlagsSizer = wx.StaticBoxSizer(wx.StaticBox(self.TopPane, -1, "Flags"), wx.HORIZONTAL) FlagCheckSizer = wx.FlexGridSizer(4, 3, 7, 15) RegexSizer = wx.FlexGridSizer(1, 2, 0, 7) BottomPaneSizer.Add((7, 7), 0, wx.EXPAND, 0) BottomPaneSizer.Add((7, 7), 0, wx.EXPAND, 0) BottomPaneSizer.Add((7, 7), 0, wx.EXPAND, 0) BottomPaneSizer.Add((7, 7), 0, wx.EXPAND, 0) RegexSizer.Add(self.RegexBox, 0, wx.EXPAND, 0) RegexSizer.Add(self.EvaluateButton, 0, 0, 0) RegexSizer.AddGrowableCol(0) BottomPaneSizer.Add(RegexSizer, 1, wx.EXPAND, 0) BottomPaneSizer.Add((7, 7), 0, wx.EXPAND, 0) BottomPaneSizer.Add((7, 7), 0, wx.EXPAND, 0) BottomPaneSizer.Add((7, 7), 0, wx.EXPAND, 0) BottomPaneSizer.Add((7, 7), 0, wx.EXPAND, 0) BottomPaneSizer.Add((7, 7), 0, wx.EXPAND, 0) OptionsSizer.Add(self.MethodBox, 0, wx.EXPAND, 0) FlagCheckSizer.Add((7, 2), 0, wx.EXPAND, 0) FlagCheckSizer.Add((7, 2), 0, wx.EXPAND, 0) FlagCheckSizer.Add((7, 2), 0, wx.EXPAND, 0) FlagCheckSizer.Add(self.IgnoreCheckBox, 0, 0, 0) FlagCheckSizer.Add(self.LocaleCheckBox, 0, 0, 0) FlagCheckSizer.Add(self.MultilineCheckBox, 0, 0, 0) FlagCheckSizer.Add(self.DotAllCheckBox, 0, 0, 0) FlagCheckSizer.Add(self.UnicodeCheckBox, 0, 0, 0) FlagCheckSizer.Add(self.VerboseCheckBox, 0, 0, 0) FlagCheckSizer.Add((7, 2), 0, wx.EXPAND, 0) FlagCheckSizer.Add((7, 2), 0, wx.EXPAND, 0) FlagCheckSizer.Add((7, 2), 0, wx.EXPAND, 0) FlagsSizer.Add(FlagCheckSizer, 1, wx.EXPAND, 0) OptionsSizer.Add(FlagsSizer, 1, 0, 0) BottomPaneSizer.Add(OptionsSizer, 1, wx.EXPAND, 0) BottomPaneSizer.Add((7, 7), 0, wx.EXPAND, 0) BottomPaneSizer.Add((7, 7), 0, wx.EXPAND, 0) BottomPaneSizer.Add((7, 7), 0, wx.EXPAND, 0) BottomPaneSizer.Add((7, 7), 0, wx.EXPAND, 0) self.TopPane.SetAutoLayout(1) self.TopPane.SetSizer(BottomPaneSizer) BottomPaneSizer.Fit(self.TopPane) BottomPaneSizer.SetSizeHints(self.TopPane) BottomPaneSizer.AddGrowableCol(1) MatchesPaneSizer.Add(self.MatchesWindow, 1, wx.EXPAND, 0) self.MatchesPane.SetAutoLayout(1) self.MatchesPane.SetSizer(MatchesPaneSizer) MatchesPaneSizer.Fit(self.MatchesPane) MatchesPaneSizer.SetSizeHints(self.MatchesPane) SampleTextSizer.Add(self.SampleText, 1, wx.EXPAND, 0) self.SampleTextPane.SetAutoLayout(1) self.SampleTextPane.SetSizer(SampleTextSizer) SampleTextSizer.Fit(self.SampleTextPane) SampleTextSizer.SetSizeHints(self.SampleTextPane) HelpPaneSizer.Add((1, 1), 0, wx.EXPAND, 0) HelpPaneSizer.Add(self.HelpSelection, 0, wx.EXPAND, 0) HelpPaneSizer.Add(self.HelpWindow, 1, wx.EXPAND, 0) self.HelpPane.SetAutoLayout(1) self.HelpPane.SetSizer(HelpPaneSizer) HelpPaneSizer.Fit(self.HelpPane) HelpPaneSizer.SetSizeHints(self.HelpPane) HelpPaneSizer.AddGrowableRow(2) HelpPaneSizer.AddGrowableCol(0) self.Notebook.AddPage(self.MatchesPane, "Matches") self.Notebook.AddPage(self.SampleTextPane, "Sample text") self.Notebook.AddPage(self.HelpPane, "Help") TopPaneSizer.Add(wx.NotebookSizer(self.Notebook), 1, wx.EXPAND, 0) self.BottomPane.SetAutoLayout(1) self.BottomPane.SetSizer(TopPaneSizer) MainSizer.Add(self.SplitterWindow, 1, wx.EXPAND, 0) self.SetAutoLayout(1) self.SetSizer(MainSizer) self.Layout() self.Centre()
def __do_layout(self): # begin wxGlade sizer_1 = wx.BoxSizer(wx.VERTICAL) sizer_25 = wx.BoxSizer(wx.HORIZONTAL) sizer_4 = wx.BoxSizer(wx.VERTICAL) grid_sizer_1 = wx.GridSizer(5, 2, 0, 0) sizer_24 = wx.StaticBoxSizer( wx.StaticBox(self.notebook_1_pane_1, -1, _("Player 10")), wx.HORIZONTAL) sizer_20 = wx.StaticBoxSizer( wx.StaticBox(self.notebook_1_pane_1, -1, _("Player 5")), wx.HORIZONTAL) sizer_23 = wx.StaticBoxSizer( wx.StaticBox(self.notebook_1_pane_1, -1, _("Player 9")), wx.HORIZONTAL) sizer_19 = wx.StaticBoxSizer( wx.StaticBox(self.notebook_1_pane_1, -1, _("Player 4")), wx.HORIZONTAL) sizer_22 = wx.StaticBoxSizer( wx.StaticBox(self.notebook_1_pane_1, -1, _("Player 8")), wx.HORIZONTAL) sizer_18 = wx.StaticBoxSizer( wx.StaticBox(self.notebook_1_pane_1, -1, _("Player 3")), wx.HORIZONTAL) sizer_21 = wx.StaticBoxSizer( wx.StaticBox(self.notebook_1_pane_1, -1, _("Player 7")), wx.HORIZONTAL) sizer_17 = wx.StaticBoxSizer( wx.StaticBox(self.notebook_1_pane_1, -1, _("Player 2")), wx.HORIZONTAL) sizer_13 = wx.StaticBoxSizer( wx.StaticBox(self.notebook_1_pane_1, -1, _("Player 6")), wx.HORIZONTAL) sizer_12 = wx.StaticBoxSizer( wx.StaticBox(self.notebook_1_pane_1, -1, _("Player 1")), wx.HORIZONTAL) sizer_16 = wx.StaticBoxSizer( wx.StaticBox(self.notebook_1_pane_1, -1, _("Map")), wx.HORIZONTAL) sizer_5 = wx.StaticBoxSizer( wx.StaticBox(self.notebook_1_pane_1, -1, _("Players")), wx.HORIZONTAL) sizer_3 = wx.BoxSizer(wx.VERTICAL) sizer_14 = wx.StaticBoxSizer( wx.StaticBox(self.notebook_1_pane_3, -1, _("Server port")), wx.HORIZONTAL) sizer_8 = wx.StaticBoxSizer( wx.StaticBox(self.notebook_1_pane_3, -1, _("Server address")), wx.HORIZONTAL) sizer_7 = wx.StaticBoxSizer( wx.StaticBox(self.notebook_1_pane_3, -1, _("Name")), wx.HORIZONTAL) sizer_2 = wx.BoxSizer(wx.VERTICAL) sizer_15 = wx.StaticBoxSizer( wx.StaticBox(self.notebook_1_pane_2, -1, _("Map")), wx.HORIZONTAL) sizer_11 = wx.StaticBoxSizer( wx.StaticBox(self.notebook_1_pane_2, -1, _("Port number")), wx.HORIZONTAL) sizer_10 = wx.StaticBoxSizer( wx.StaticBox(self.notebook_1_pane_2, -1, _("Number of clients")), wx.HORIZONTAL) sizer_9 = wx.StaticBoxSizer( wx.StaticBox(self.notebook_1_pane_2, -1, _("Your name")), wx.HORIZONTAL) # Local Game Setup pane sizer_5.Add(self.lGamePads, 0, 0, 0) sizer_4.Add(sizer_5, 0, wx.EXPAND | wx.ADJUST_MINSIZE, 0) sizer_16.Add(self.lMap, 0, 0, 0) sizer_4.Add(sizer_16, 0, wx.EXPAND, 0) sizer_12.Add(self.name1, 0, 0, 0) sizer_12.Add(self.color1, 0, 0, 0) grid_sizer_1.Add(sizer_12, 1, wx.EXPAND, 0) sizer_13.Add(self.name6, 0, 0, 0) sizer_13.Add(self.color6, 0, 0, 0) grid_sizer_1.Add(sizer_13, 1, wx.EXPAND, 0) sizer_17.Add(self.name2, 0, 0, 0) sizer_17.Add(self.color2, 0, 0, 0) grid_sizer_1.Add(sizer_17, 1, wx.EXPAND, 0) sizer_21.Add(self.name7, 0, 0, 0) sizer_21.Add(self.color7, 0, 0, 0) grid_sizer_1.Add(sizer_21, 1, wx.EXPAND, 0) sizer_18.Add(self.name3, 0, 0, 0) sizer_18.Add(self.color3, 0, 0, 0) grid_sizer_1.Add(sizer_18, 1, wx.EXPAND, 0) sizer_22.Add(self.name8, 0, 0, 0) sizer_22.Add(self.color8, 0, 0, 0) grid_sizer_1.Add(sizer_22, 1, wx.EXPAND, 0) sizer_19.Add(self.name4, 0, 0, 0) sizer_19.Add(self.color4, 0, 0, 0) grid_sizer_1.Add(sizer_19, 1, wx.EXPAND, 0) sizer_23.Add(self.name9, 0, 0, 0) sizer_23.Add(self.color9, 0, 0, 0) grid_sizer_1.Add(sizer_23, 1, wx.EXPAND, 0) sizer_20.Add(self.name5, 0, 0, 0) sizer_20.Add(self.color5, 0, 0, 0) grid_sizer_1.Add(sizer_20, 1, wx.EXPAND, 0) sizer_24.Add(self.name10, 0, 0, 0) sizer_24.Add(self.color10, 0, 0, 0) grid_sizer_1.Add(sizer_24, 1, wx.EXPAND, 0) sizer_4.Add(grid_sizer_1, 1, wx.EXPAND, 0) sizer_4.Add(self.lLaunch, 0, 0, 0) self.notebook_1_pane_1.SetAutoLayout(1) self.notebook_1_pane_1.SetSizer(sizer_4) sizer_4.Fit(self.notebook_1_pane_1) sizer_4.SetSizeHints(self.notebook_1_pane_1) # Server Setup pane sizer_9.Add(self.sName, 0, 0, 0) sizer_2.Add(sizer_9, 0, wx.EXPAND, 0) sizer_10.Add(self.sClients, 0, 0, 0) sizer_2.Add(sizer_10, 0, wx.EXPAND, 0) sizer_11.Add(self.sPort, 0, 0, 0) sizer_2.Add(sizer_11, 0, wx.EXPAND, 0) sizer_15.Add(self.sMap, 0, 0, 0) sizer_2.Add(sizer_15, 0, wx.EXPAND, 0) sizer_2.Add(self.sLaunch, 0, 0, 0) self.notebook_1_pane_2.SetAutoLayout(1) self.notebook_1_pane_2.SetSizer(sizer_2) sizer_2.Fit(self.notebook_1_pane_2) sizer_2.SetSizeHints(self.notebook_1_pane_2) # Client Setup pane sizer_7.Add(self.clName, 0, 0, 0) sizer_3.Add(sizer_7, 0, wx.EXPAND, 0) sizer_8.Add(self.clServerAddress, 0, 0, 0) sizer_3.Add(sizer_8, 0, wx.EXPAND, 0) sizer_14.Add(self.clPort, 0, 0, 0) sizer_3.Add(sizer_14, 0, wx.EXPAND, 0) sizer_3.Add(self.clLaunch, 0, 0, 0) self.notebook_1_pane_3.SetAutoLayout(1) self.notebook_1_pane_3.SetSizer(sizer_3) sizer_3.Fit(self.notebook_1_pane_3) sizer_3.SetSizeHints(self.notebook_1_pane_3) # Help pane sizer_25.Add(self.hButton, 0, 0, 0) self.notebook_1_pane_4.SetAutoLayout(1) self.notebook_1_pane_4.SetSizer(sizer_25) sizer_25.Fit(self.notebook_1_pane_4) sizer_25.SetSizeHints(self.notebook_1_pane_4) self.notebook_1.AddPage(self.notebook_1_pane_1, _("Local game")) self.notebook_1.AddPage(self.notebook_1_pane_2, _("Server")) self.notebook_1.AddPage(self.notebook_1_pane_3, _("Client")) self.notebook_1.AddPage(self.notebook_1_pane_4, _("Help")) sizer_1.Add(wx.NotebookSizer(self.notebook_1), 1, wx.EXPAND, 0) self.SetAutoLayout(1) self.SetSizer(sizer_1) self.Layout()
def __do_layout(self): sizer = wx.FlexGridSizer(2, 1, 0, 0) button_sizer = wx.BoxSizer(wx.HORIZONTAL) grid_sizer_6 = wx.FlexGridSizer(5, 2, 0, 0) cell_sizer = wx.FlexGridSizer(5, 2, 0, 0) presstype_sizer = wx.BoxSizer(wx.HORIZONTAL) geo_sizer = wx.FlexGridSizer(6, 2, 0, 0) constraint_sizer = wx.BoxSizer(wx.HORIZONTAL) run_sizer = wx.FlexGridSizer(6, 2, 0, 0) sym_sizer = wx.FlexGridSizer(2, 2, 0, 0) symapply_sizer = wx.BoxSizer(wx.HORIZONTAL) func_sizer = wx.FlexGridSizer(2, 2, 0, 0) grid_sizer_1 = wx.FlexGridSizer(6, 2, 0, 0) kgrid_sizer = wx.BoxSizer(wx.HORIZONTAL) grid_sizer = wx.BoxSizer(wx.HORIZONTAL) jobtype_sizer = wx.BoxSizer(wx.HORIZONTAL) # # Main Tab # szrMain = wx.BoxSizer(wx.VERTICAL) szrTitle = wx.BoxSizer(wx.HORIZONTAL) szrJobType = wx.BoxSizer(wx.HORIZONTAL) szrOutputLevel = wx.BoxSizer(wx.HORIZONTAL) szrDimensions = wx.BoxSizer(wx.HORIZONTAL) szrRealGrid = wx.BoxSizer(wx.HORIZONTAL) szrKGrid = wx.BoxSizer(wx.HORIZONTAL) szrTitle.Add(self.lblTitle, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szrTitle.Add(self.txtTitle, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szrJobType.Add(self.lblJobType, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szrJobType.Add(self.chkSCF, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szrJobType.Add(self.chkRelax, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szrJobType.Add(self.chkCell, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szrJobType.Add(self.chkNEB, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szrJobType.Add(self.chkMD, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szrJobType.Add(self.chkPost, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szrOutputLevel.Add(self.lblOutputLevel, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szrOutputLevel.Add(self.cboOutputLevel, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szrDimensions.Add(self.lblDimensions, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szrDimensions.Add(self.cboDimensions, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szrRealGrid.Add(self.lblRealGrid, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szrRealGrid.Add(self.txtRealGridX, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szrRealGrid.Add(self.txtRealGridY, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szrRealGrid.Add(self.txtRealGridZ, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szrRealGrid.Add(self.btnGridGuess, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szrKGrid.Add(self.lblKGrid, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szrKGrid.Add(self.txtKGridX, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szrKGrid.Add(self.txtKGridY, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szrKGrid.Add(self.txtKGridZ, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szrKGrid.Add(self.chkKGridHex, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szrMain.Add(szrTitle, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szrMain.Add(szrJobType, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szrMain.Add(szrOutputLevel, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szrMain.Add(szrDimensions, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szrMain.Add(szrRealGrid, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szrMain.Add(szrKGrid, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) self.pnMain.SetAutoLayout(1) self.pnMain.SetSizer(szrMain) szrMain.Fit(self.pnMain) szrMain.SetSizeHints(self.pnMain) func_sizer.Add(self.func_label, 0, 0, 0) func_sizer.Add(self.func_combo, 0, 0, 0) func_sizer.Add(self.spinpol_label, 0, 0, 0) func_sizer.Add(self.spinpol_entry, 0, 0, 0) self.qopt_nb_func.SetAutoLayout(1) self.qopt_nb_func.SetSizer(func_sizer) func_sizer.Fit(self.qopt_nb_func) func_sizer.SetSizeHints(self.qopt_nb_func) sym_sizer.Add(self.symopt_label, 0, 0, 0) sym_sizer.Add(self.symopt_entry, 0, 0, 0) sym_sizer.Add(self.symapply_label, 0, 0, 0) symapply_sizer.Add(self.symapply_combo, 0, 0, 0) symapply_sizer.Add(self.symapply_button, 0, 0, 0) sym_sizer.Add(symapply_sizer, 1, wx.EXPAND, 0) self.qopt_nb_sym.SetAutoLayout(1) self.qopt_nb_sym.SetSizer(sym_sizer) sym_sizer.Fit(self.qopt_nb_sym) sym_sizer.SetSizeHints(self.qopt_nb_sym) run_sizer.Add(self.maxscf_label, 0, 0, 0) run_sizer.Add(self.maxscf_entry, 0, 0, 0) run_sizer.Add(self.temp_label, 0, 0, 0) run_sizer.Add(self.temp_entry, 0, 0, 0) run_sizer.Add(self.scfblend_label, 0, 0, 0) run_sizer.Add(self.scfblend_entry, 0, 0, 0) run_sizer.Add(self.convcrit_label, 0, 0, 0) run_sizer.Add(self.convcrit_entry, 0, 0, 0) run_sizer.Add(self.forcecut_label, 0, 0, 0) run_sizer.Add(self.forcecut_entry, 0, 0, 0) run_sizer.Add(self.intcut_label, 0, 0, 0) run_sizer.Add(self.intcut_entry, 0, 0, 0) self.qopt_nb_run.SetAutoLayout(1) self.qopt_nb_run.SetSizer(run_sizer) run_sizer.Fit(self.qopt_nb_run) run_sizer.SetSizeHints(self.qopt_nb_run) geo_sizer.Add(self.relax_label, 0, 0, 0) geo_sizer.Add(self.relax_combo, 0, 0, 0) geo_sizer.Add(self.constraint_label, 0, 0, 0) constraint_sizer.Add(self.constraint_combo, 0, 0, 0) constraint_sizer.Add(self.constraint_entry, 0, 0, 0) geo_sizer.Add(constraint_sizer, 1, wx.EXPAND, 0) geo_sizer.Add(self.fconvcrit_label, 0, 0, 0) geo_sizer.Add(self.fconvcrit_entry, 0, 0, 0) geo_sizer.Add(self.fblend_label, 0, 0, 0) geo_sizer.Add(self.fblend_entry, 0, 0, 0) geo_sizer.Add(self.gstepmax_label, 0, 0, 0) geo_sizer.Add(self.gstepmax_entry, 0, 0, 0) geo_sizer.Add(self.gmintstep_label, 0, 0, 0) geo_sizer.Add(self.gmintstep_entry, 0, 0, 0) self.qopt_nb_geo.SetAutoLayout(1) self.qopt_nb_geo.SetSizer(geo_sizer) geo_sizer.Fit(self.qopt_nb_geo) geo_sizer.SetSizeHints(self.qopt_nb_geo) cell_sizer.Add(self.stressmeth_label, 0, 0, 0) cell_sizer.Add(self.stressmeth_combo, 0, 0, 0) cell_sizer.Add(self.presstype_label, 0, 0, 0) presstype_sizer.Add(self.presstype_combo, 0, 0, 0) presstype_sizer.Add(self.presstype_entry, 0, 0, 0) cell_sizer.Add(presstype_sizer, 1, wx.EXPAND, 0) cell_sizer.Add(self.cminsteps_label, 0, 0, 0) cell_sizer.Add(self.cellminsteps_entry, 0, 0, 0) cell_sizer.Add(self.cellconvcrit_label, 0, 0, 0) cell_sizer.Add(self.cellconvcrit_entry, 0, 0, 0) cell_sizer.Add(self.bulkmod_label, 0, 0, 0) cell_sizer.Add(self.bulkmod_entry, 0, 0, 0) self.qopt_nb_cell.SetAutoLayout(1) self.qopt_nb_cell.SetSizer(cell_sizer) cell_sizer.Fit(self.qopt_nb_cell) cell_sizer.SetSizeHints(self.qopt_nb_cell) grid_sizer_6.Add(self.mdmeth_label, 0, 0, 0) grid_sizer_6.Add(self.mdmeth_entry, 0, 0, 0) grid_sizer_6.Add(self.mdtemp_label, 0, 0, 0) grid_sizer_6.Add(self.mdtemp_entry, 0, 0, 0) grid_sizer_6.Add(self.mdtstep_label, 0, 0, 0) grid_sizer_6.Add(self.mdtstep_entry, 0, 0, 0) grid_sizer_6.Add(self.mdeqsteps_label, 0, 0, 0) grid_sizer_6.Add(self.mdeqsteps_entry, 0, 0, 0) grid_sizer_6.Add(self.mdsteps_label, 0, 0, 0) grid_sizer_6.Add(self.mdsteps_entry, 0, 0, 0) self.qopt_nb_md.SetAutoLayout(1) self.qopt_nb_md.SetSizer(grid_sizer_6) grid_sizer_6.Fit(self.qopt_nb_md) grid_sizer_6.SetSizeHints(self.qopt_nb_md) self.qout_nb.AddPage(self.pnMain, "Main") self.qout_nb.AddPage(self.qopt_nb_func, "Functional") self.qout_nb.AddPage(self.qopt_nb_sym, "Symmetry") self.qout_nb.AddPage(self.qopt_nb_run, "Run Opts") self.qout_nb.AddPage(self.qopt_nb_geo, "Geo Opts") self.qout_nb.AddPage(self.qopt_nb_cell, "Cell Opts") self.qout_nb.AddPage(self.qopt_nb_md, "MD Opts") sizer.Add(wx.NotebookSizer(self.qout_nb), 1, wx.EXPAND, 0) button_sizer.Add(self.save_button, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 6) button_sizer.Add(self.cancel_button, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 6) sizer.Add(button_sizer, 1, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 3) self.SetAutoLayout(1) self.SetSizer(sizer) sizer.Fit(self) sizer.SetSizeHints(self) self.Layout()
def __init__(self, property_window): self.property_window = property_window self.notebook = wx.Notebook(self.property_window, -1) if not misc.check_wx_version(2, 5, 2): nb_sizer = wx.NotebookSizer(self.notebook) self.notebook.sizer = nb_sizer else: self.notebook.sizer = None self.notebook.SetAutoLayout(True) self.notebook.Hide() panel = wx.ScrolledWindow( self.notebook, -1, style=wx.TAB_TRAVERSAL|wx.FULL_REPAINT_ON_RESIZE) self.name = "app" # name of the wxApp instance to generate self.__saved = True # if True, there are no changes to save self.__filename = None # name of the output xml file self.klass = "MyApp" self.codegen_opt = 0 # if != 0, generates a separate file # for each class def set_codegen_opt(value): try: opt = int(value) except ValueError: pass else: self.codegen_opt = opt self.output_path = "" self.language = 'python' # output language def get_output_path(): return os.path.expanduser(self.output_path) def set_output_path(value): self.output_path = value self.is_template = False self.use_gettext = False def set_use_gettext(value): self.use_gettext = bool(int(value)) self.for_version = wx.VERSION_STRING[:3] def set_for_version(value): self.for_version = self.for_version_prop.get_str_value() self.access_functions = { 'name': (lambda : self.name, self.set_name), 'class': (lambda : self.klass, self.set_klass), 'code_generation': (lambda : self.codegen_opt, set_codegen_opt), 'output_path': (get_output_path, set_output_path), 'language': (self.get_language, self.set_language), 'encoding': (self.get_encoding, self.set_encoding), 'use_gettext': (lambda : self.use_gettext, set_use_gettext), 'for_version': (lambda : self.for_version, set_for_version), } self.name_prop = TextProperty(self, "name", panel, True) self.klass_prop = TextProperty(self, "class", panel, True) self.encoding = self._get_default_encoding() self.encoding_prop = TextProperty(self, 'encoding', panel) self.use_gettext_prop = CheckBoxProperty(self, "use_gettext", panel, _("Enable gettext support")) TOP_WIN_ID = wx.NewId() self.top_win_prop = wx.Choice(panel, TOP_WIN_ID, choices=[], size=(1, -1)) self.top_window = '' # name of the top window of the generated app self.codegen_prop = RadioProperty(self, "code_generation", panel, [_("Single file"), _("Separate file for" \ " each class")], label=_("Code Generation")) ext = getattr(common.code_writers.get('python'), 'default_extensions', []) wildcard = [] for e in ext: wildcard.append('%s files (*.%s)|*.%s' % ('Python', e, e)) wildcard.append('All files|*') dialog = FileDirDialog(self, panel, '|'.join(wildcard), _("Select output file"), _("Select output directory"), wx.SAVE|wx.OVERWRITE_PROMPT) _writers = common.code_writers.keys() columns = 3 self.codewriters_prop = RadioProperty(self, "language", panel, _writers, columns=columns) self.codewriters_prop.set_str_value('python') self.for_version_prop = RadioProperty(self, "for_version", panel, ['2.4', '2.6', '2.8'], columns=3, label=_("wxWidgets compatibility")) self.for_version_prop.set_str_value(self.for_version) # ALB 2004-01-18 self.access_functions['use_new_namespace'] = ( self.get_use_old_namespace, self.set_use_old_namespace) self.use_old_namespace_prop = CheckBoxProperty( self, 'use_new_namespace', panel, _('Use old "from wxPython.wx"\n' 'import (python output only)')) # `overwrite' property - added 2003-07-15 self.overwrite = False def get_overwrite(): return self.overwrite def set_overwrite(val): self.overwrite = bool(int(val)) self.access_functions['overwrite'] = (get_overwrite, set_overwrite) self.overwrite_prop = CheckBoxProperty(self, 'overwrite', panel, _('Overwrite existing sources')) self.outpath_prop = DialogProperty(self, "output_path", panel, dialog, label=_('Output path')) BTN_ID = wx.NewId() btn = wx.Button(panel, BTN_ID, _("Generate code")) # layout of self.notebook sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.name_prop.panel, 0, wx.EXPAND) sizer.Add(self.klass_prop.panel, 0, wx.EXPAND) sizer.Add(self.encoding_prop.panel, 0, wx.EXPAND) sizer.Add(self.use_gettext_prop.panel, 0, wx.EXPAND) szr = wx.BoxSizer(wx.HORIZONTAL) from widget_properties import _label_initial_width as _w label = wx.StaticText(panel, -1, _("Top window"), size=(_w, -1)) label.SetToolTip(wx.ToolTip(_("Top window"))) szr.Add(label, 2, wx.ALL|wx.ALIGN_CENTER, 3) szr.Add(self.top_win_prop, 5, wx.ALL|wx.ALIGN_CENTER, 3) sizer.Add(szr, 0, wx.EXPAND) sizer.Add(self.codegen_prop.panel, 0, wx.ALL|wx.EXPAND, 4) sizer.Add(self.codewriters_prop.panel, 0, wx.ALL|wx.EXPAND, 4) sizer.Add(self.for_version_prop.panel, 0, wx.ALL|wx.EXPAND, 4) sizer.Add(self.use_old_namespace_prop.panel, 0, wx.EXPAND) sizer.Add(self.overwrite_prop.panel, 0, wx.EXPAND) sizer.Add(self.outpath_prop.panel, 0, wx.EXPAND) sizer.Add(btn, 0, wx.ALL|wx.EXPAND, 5) panel.SetAutoLayout(True) panel.SetSizer(sizer) sizer.Layout() sizer.Fit(panel) h = panel.GetSize()[1] self.notebook.AddPage(panel, _("Application")) import math panel.SetScrollbars(1, 5, 1, int(math.ceil(h/5.0))) wx.EVT_BUTTON(btn, BTN_ID, self.generate_code) wx.EVT_CHOICE(self.top_win_prop, TOP_WIN_ID, self.set_top_window) # this is here to keep the interface similar to the various widgets # (to simplify Tree) self.widget = None # this is always None
def create_widget(self): self.widget = wx.Notebook(self.parent.widget, self.id, style=self.style) if not misc.check_wx_version(2, 5, 2): self.nb_sizer = wx.NotebookSizer(self.widget)
def __do_layout(self): sizer_frame = wx.BoxSizer(wx.HORIZONTAL) sizer_main = wx.BoxSizer(wx.VERTICAL) sizer_25 = wx.BoxSizer(wx.HORIZONTAL) sizer_26 = wx.StaticBoxSizer( wx.StaticBox(self.notebook_1_pane_3, -1, ""), wx.VERTICAL) sizer_27 = wx.BoxSizer(wx.HORIZONTAL) sizer_31 = wx.BoxSizer(wx.VERTICAL) sizer_33 = wx.BoxSizer(wx.HORIZONTAL) sizer_32 = wx.BoxSizer(wx.HORIZONTAL) sizer_28 = wx.BoxSizer(wx.VERTICAL) sizer_30 = wx.BoxSizer(wx.HORIZONTAL) sizer_29 = wx.BoxSizer(wx.HORIZONTAL) sizer_12 = wx.BoxSizer(wx.HORIZONTAL) sizer_13 = wx.StaticBoxSizer( wx.StaticBox(self.notebook_1_pane_2, -1, ""), wx.VERTICAL) sizer_14 = wx.BoxSizer(wx.HORIZONTAL) sizer_22 = wx.BoxSizer(wx.VERTICAL) sizer_24 = wx.BoxSizer(wx.HORIZONTAL) sizer_23 = wx.BoxSizer(wx.HORIZONTAL) sizer_18 = wx.BoxSizer(wx.VERTICAL) sizer_21 = wx.BoxSizer(wx.HORIZONTAL) sizer_20 = wx.BoxSizer(wx.HORIZONTAL) sizer_19 = wx.BoxSizer(wx.HORIZONTAL) sizer_15 = wx.BoxSizer(wx.VERTICAL) sizer_17 = wx.BoxSizer(wx.HORIZONTAL) sizer_16 = wx.BoxSizer(wx.HORIZONTAL) sizer_1 = wx.BoxSizer(wx.HORIZONTAL) sizer_2 = wx.StaticBoxSizer( wx.StaticBox(self.notebook_1_pane_1, -1, ""), wx.VERTICAL) sizer_8 = wx.BoxSizer(wx.HORIZONTAL) sizer_11 = wx.BoxSizer(wx.VERTICAL) sizer_12b = wx.BoxSizer(wx.HORIZONTAL) sizer_9 = wx.BoxSizer(wx.VERTICAL) sizer_10 = wx.BoxSizer(wx.HORIZONTAL) sizer_3 = wx.BoxSizer(wx.HORIZONTAL) sizer_6 = wx.BoxSizer(wx.VERTICAL) sizer_7 = wx.BoxSizer(wx.HORIZONTAL) sizer_4 = wx.BoxSizer(wx.VERTICAL) sizer_5 = wx.BoxSizer(wx.HORIZONTAL) sizer_main.Add(self.label_top, 0, wx.LEFT | wx.TOP, 5) sizer_main.Add(self.static_line_1, 0, wx.TOP | wx.BOTTOM | wx.EXPAND, 10) sizer_4.Add( self.button_1, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 5) sizer_4.Add(self.static_line_2, 0, wx.LEFT | wx.RIGHT | wx.EXPAND, 20) sizer_5.Add(self.button_2, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) sizer_4.Add(sizer_5, 1, wx.ALIGN_CENTER_HORIZONTAL, 0) sizer_3.Add(sizer_4, 1, wx.EXPAND, 0) sizer_3.Add(self.static_line_3, 0, wx.EXPAND, 0) sizer_6.Add( self.button_3, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 5) sizer_6.Add(self.static_line_4, 0, wx.LEFT | wx.RIGHT | wx.EXPAND, 20) sizer_7.Add(self.button_4, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) sizer_7.Add(self.button_22, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) sizer_6.Add(sizer_7, 1, wx.ALIGN_CENTER_HORIZONTAL, 0) sizer_3.Add(sizer_6, 1, wx.EXPAND, 0) sizer_2.Add(sizer_3, 1, wx.EXPAND, 0) sizer_2.Add(self.static_line_5, 0, wx.EXPAND, 0) sizer_9.Add( self.button_5, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 5) sizer_9.Add(self.static_line_6, 0, wx.LEFT | wx.RIGHT | wx.EXPAND, 20) sizer_10.Add(self.button_6, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) sizer_9.Add(sizer_10, 1, wx.ALIGN_CENTER_HORIZONTAL, 0) sizer_8.Add(sizer_9, 1, wx.EXPAND, 0) sizer_8.Add(self.static_line_7, 0, wx.EXPAND, 0) sizer_11.Add( self.button_7, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 5) sizer_11.Add(self.static_line_8, 0, wx.LEFT | wx.RIGHT | wx.EXPAND, 20) sizer_12b.Add(self.button_8, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) sizer_12b.Add(self.button_9, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) sizer_11.Add(sizer_12b, 1, wx.ALIGN_CENTER_HORIZONTAL, 0) sizer_8.Add(sizer_11, 1, wx.EXPAND, 0) sizer_2.Add(sizer_8, 1, wx.EXPAND, 0) sizer_1.Add(sizer_2, 1, wx.EXPAND, 0) self.notebook_1_pane_1.SetAutoLayout(1) self.notebook_1_pane_1.SetSizer(sizer_1) sizer_1.Fit(self.notebook_1_pane_1) sizer_1.SetSizeHints(self.notebook_1_pane_1) sizer_15.Add( self.button_10, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 5) sizer_15.Add(self.static_line_8, 0, wx.LEFT | wx.RIGHT | wx.EXPAND, 20) sizer_16.Add( self.button_11, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 5) sizer_15.Add(sizer_16, 1, wx.ALIGN_CENTER_HORIZONTAL, 0) sizer_17.Add( self.button_12, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 5) sizer_15.Add(sizer_17, 1, wx.ALIGN_CENTER_HORIZONTAL, 0) sizer_14.Add(sizer_15, 1, wx.EXPAND, 0) sizer_14.Add(self.static_line_10, 0, wx.EXPAND, 0) sizer_18.Add( self.button_13, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 5) sizer_18.Add(self.static_line_11, 0, wx.LEFT | wx.RIGHT | wx.EXPAND, 20) sizer_19.Add(self.label_1, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) sizer_19.Add(self.spin_ctrl_1, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) sizer_18.Add(sizer_19, 1, wx.ALIGN_CENTER_HORIZONTAL, 0) sizer_20.Add(self.label_2, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) sizer_20.Add(self.spin_ctrl_2, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) sizer_18.Add(sizer_20, 1, wx.ALIGN_CENTER_HORIZONTAL, 0) sizer_21.Add(self.label_3, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) sizer_21.Add(self.spin_ctrl_3, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) sizer_18.Add(sizer_21, 1, wx.ALIGN_CENTER_HORIZONTAL, 0) sizer_14.Add(sizer_18, 1, wx.EXPAND, 0) sizer_14.Add(self.static_line_12, 0, wx.EXPAND, 0) sizer_22.Add( self.button_14, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 5) sizer_22.Add(self.static_line_13, 0, wx.LEFT | wx.RIGHT | wx.EXPAND, 20) sizer_23.Add( self.button_15, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 5) sizer_22.Add(sizer_23, 1, wx.ALIGN_CENTER_HORIZONTAL, 0) sizer_24.Add( self.button_16, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 5) sizer_22.Add(sizer_24, 1, wx.ALIGN_CENTER_HORIZONTAL, 0) sizer_14.Add(sizer_22, 1, wx.EXPAND, 0) sizer_13.Add(sizer_14, 1, wx.EXPAND, 0) sizer_12.Add(sizer_13, 1, wx.EXPAND, 0) self.notebook_1_pane_2.SetAutoLayout(1) self.notebook_1_pane_2.SetSizer(sizer_12) sizer_12.Fit(self.notebook_1_pane_2) sizer_12.SetSizeHints(self.notebook_1_pane_2) sizer_28.Add( self.button_17, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 5) sizer_28.Add(self.static_line_14, 0, wx.LEFT | wx.RIGHT | wx.EXPAND, 20) sizer_29.Add(self.label_4, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5) sizer_29.Add(self.spin_ctrl_4, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) sizer_29.Add(self.label_5, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5) sizer_29.Add(self.spin_ctrl_5, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) sizer_28.Add(sizer_29, 1, wx.ALIGN_CENTER_HORIZONTAL, 0) sizer_30.Add(self.label_6, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5) sizer_30.Add(self.spin_ctrl_6, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) sizer_28.Add(sizer_30, 1, wx.ALIGN_CENTER_HORIZONTAL, 0) sizer_27.Add(sizer_28, 1, wx.EXPAND, 0) sizer_27.Add(self.static_line_15, 0, wx.EXPAND, 0) sizer_31.Add( self.button_18, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 5) sizer_31.Add(self.static_line_16, 0, wx.LEFT | wx.RIGHT | wx.EXPAND, 20) sizer_32.Add(self.button_19, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) sizer_32.Add(self.button_20, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) sizer_31.Add(sizer_32, 1, wx.ALIGN_CENTER_HORIZONTAL, 0) sizer_33.Add(self.button_21, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) sizer_31.Add(sizer_33, 1, wx.ALIGN_CENTER_HORIZONTAL, 0) sizer_27.Add(sizer_31, 1, wx.EXPAND, 0) sizer_26.Add(sizer_27, 1, wx.EXPAND, 0) sizer_25.Add(sizer_26, 1, wx.EXPAND, 0) self.notebook_1_pane_3.SetAutoLayout(1) self.notebook_1_pane_3.SetSizer(sizer_25) sizer_25.Fit(self.notebook_1_pane_3) sizer_25.SetSizeHints(self.notebook_1_pane_3) self.notebook_1.AddPage(self.notebook_1_pane_1, "Clock") self.notebook_1.AddPage(self.notebook_1_pane_2, "Ticks") self.notebook_1.AddPage(self.notebook_1_pane_3, "Hands") sizer_main.Add(wx.NotebookSizer(self.notebook_1), 1, wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, 5) self.panel_1.SetAutoLayout(1) self.panel_1.SetSizer(sizer_main) sizer_main.Fit(self.panel_1) sizer_main.SetSizeHints(self.panel_1) sizer_frame.Add( self.panel_1, 1, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 0) self.SetAutoLayout(1) self.SetSizer(sizer_frame) sizer_frame.Fit(self) sizer_frame.SetSizeHints(self) self.Layout() self.UpdateWidgets()
def __init__(self, parent, title): #create a default monitor with no name self.currentMon = monitors.Monitor('', verbose=False) self.currentMonName = None #can use this to test whether monitor is placeholder self.currentCalibName = None self.unSavedMonitor = False self.comPort = 1 self.photom = None #start building the frame wx.Frame.__init__(self, parent, -1, title, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE) self.makeMenuBar() if NOTEBOOKSTYLE: #make the notebook self.noteBook = wx.Notebook(self, -1) self.noteBookSizer = wx.NotebookSizer(self.noteBook) #add the info page self.infoPanel = wx.Panel(self.noteBook, -1) self.noteBook.AddPage(self.infoPanel, 'Monitor Info') infoSizer = wx.BoxSizer(wx.HORIZONTAL) infoSizer.Add(self.makeAdminBox(self.infoPanel), 1, wx.EXPAND) infoSizer.Add(self.makeInfoBox(self.infoPanel), 1, wx.EXPAND) self.infoPanel.SetAutoLayout(True) self.infoPanel.SetSizerAndFit(infoSizer) #add the calibration page self.calibPanel = wx.Panel(self.noteBook, -1) self.noteBook.AddPage(self.calibPanel, 'Calibration') calibSizer = self.makeCalibBox(self.calibPanel) self.calibPanel.SetAutoLayout(True) self.calibPanel.SetSizerAndFit(calibSizer) self.noteBookSizer.Layout() self.noteBookSizer.Fit(self) else: #just one page self.infoPanel = wx.Panel(self, -1) infoSizer = wx.BoxSizer(wx.HORIZONTAL) infoSizer.Add(self.makeAdminBox(self.infoPanel), 1, wx.EXPAND) infoSizer.Add(self.makeInfoBox(self.infoPanel), 1, wx.EXPAND) infoSizer.Add(self.makeCalibBox(self.infoPanel), 1, wx.EXPAND) infoSizer.Layout() self.infoPanel.SetAutoLayout(True) self.infoPanel.SetSizerAndFit(infoSizer) #if wx version 2.5+: self.SetSize(self.GetBestSize()) self.CreateStatusBar() #self.SetStatusText("Maybe put tooltips down here one day") if os.path.isfile('psychopy.ico'): try: self.SetIcon(wx.Icon('psychopy.ico', wx.BITMAP_TYPE_ICO)) except: pass wx.EVT_CLOSE(self, self.onCloseWindow) self.updateMonList()