def Rebuild(self): isExpanded = self.cp.IsExpanded() self.Freeze() cp = PCP.PyCollapsiblePane(self, label=self.label1, agwStyle=self.cpStyle) cp.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.OnPaneChanged) self.MakePaneContent(cp.GetPane()) cp.SetExpanderDimensions(*self.GetUserSize()) self.GetSizer().Replace(self.cp, cp) self.cp.Destroy() self.cp = cp btn = self.MakeButton() if btn: self.cp.SetButton(btn) self.gtkText.Enable(btn is None) self.gtkChoice.Enable(btn is None) self.btnRB.Enable(btn is not None) if isExpanded: self.cp.Expand() self.Thaw() self.OnPaneChanged(None) self.Layout()
def __init__(self, parent, log, model, interpreter): self.log = log self._interp = interpreter wx.Panel.__init__(self, parent, -1) self.dvc = dv.DataViewCtrl(self, style=wx.BORDER_THEME | dv.DV_ROW_LINES | dv.DV_VERT_RULES) self.model = model self.dvc.AssociateModel(self.model) for row in list(self.model.row_mapper.values()): self.dvc.AppendTextColumn(row.title, row.colid, width=row.width) for c in self.dvc.Columns: c.Sortable = True c.Reorderable = True self.cp = cp = PCP.PyCollapsiblePane(self, label="Show console", agwStyle=wx.CP_GTK_EXPANDER) self.MakePaneContent(cp.GetPane()) self.Sizer = wx.BoxSizer(wx.VERTICAL) self.Sizer.Add(self.dvc, 1, wx.EXPAND) self.Sizer.Add(cp, 0, wx.RIGHT | wx.LEFT | wx.EXPAND) self.SetSizer(self.Sizer) self.SetAutoLayout(True) self.dvc.Bind(dv.EVT_DATAVIEW_SELECTION_CHANGED, self.OnItemSelected)
def __init__(self, parent, log): wx.Panel.__init__(self, parent) self.log = log self.label1 = "Click here to show pane" self.label2 = "Click here to hide pane" title = wx.StaticText(self, label="PyCollapsiblePane") title.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) title.SetForegroundColour("blue") self.cpStyle = wx.CP_NO_TLW_RESIZE self.cp = cp = PCP.PyCollapsiblePane(self, label=self.label1, agwStyle=self.cpStyle) self.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.OnPaneChanged, cp) self.MakePaneContent(cp.GetPane()) self.btnRB = radioBox = wx.RadioBox(self, -1, "Button Types", choices=choices, style=wx.RA_SPECIFY_ROWS) self.static1 = wx.StaticText(self, -1, "Collapsed Button Text:") self.static2 = wx.StaticText(self, -1, "Expanded Button Text:") self.buttonText1 = wx.TextCtrl(self, -1, self.label1) self.buttonText2 = wx.TextCtrl(self, -1, self.label2) self.updateButton = wx.Button(self, -1, "Update!") sbox = wx.StaticBox(self, -1, 'Styles') sboxsizer = wx.StaticBoxSizer(sbox, wx.VERTICAL) self.styleCBs = list() for styleName in styles: cb = wx.CheckBox(self, -1, styleName) if styleName == "CP_NO_TLW_RESIZE": cb.SetValue(True) cb.Disable() cb.Bind(wx.EVT_CHECKBOX, self.OnStyleChoice) self.styleCBs.append(cb) sboxsizer.Add(cb, 0, wx.ALL, 4) self.gtkText = wx.StaticText(self, -1, "Expander Size") self.gtkChoice = wx.ComboBox(self, -1, choices=gtkChoices) self.gtkChoice.SetSelection(0) self.gtkText.Enable(False) self.gtkChoice.Enable(False) sizer = wx.BoxSizer(wx.VERTICAL) radioSizer = wx.BoxSizer(wx.HORIZONTAL) dummySizer = wx.BoxSizer(wx.VERTICAL) dummySizer.Add(self.gtkText, 0, wx.EXPAND|wx.BOTTOM, 2) dummySizer.Add(self.gtkChoice, 0, wx.EXPAND) radioSizer.Add(radioBox, 0, wx.EXPAND) radioSizer.Add(sboxsizer, 0, wx.EXPAND|wx.LEFT, 10) radioSizer.Add(dummySizer, 0, wx.ALIGN_BOTTOM|wx.LEFT, 10) self.SetSizer(sizer) sizer.Add((0, 10)) sizer.Add(title, 0, wx.LEFT|wx.RIGHT, 25) sizer.Add((0, 10)) sizer.Add(radioSizer, 0, wx.LEFT, 25) sizer.Add((0, 10)) subSizer = wx.FlexGridSizer(2, 3, 5, 5) subSizer.Add(self.static1, 0, wx.LEFT|wx.ALIGN_CENTER_VERTICAL, 5) subSizer.Add(self.buttonText1, 0, wx.EXPAND) subSizer.Add((0, 0)) subSizer.Add(self.static2, 0, wx.LEFT|wx.ALIGN_CENTER_VERTICAL, 5) subSizer.Add(self.buttonText2, 0, wx.EXPAND) subSizer.Add(self.updateButton, 0, wx.LEFT|wx.RIGHT, 10) subSizer.AddGrowableCol(1) sizer.Add(subSizer, 0, wx.EXPAND|wx.LEFT, 20) sizer.Add((0, 15)) sizer.Add(cp, 0, wx.RIGHT|wx.LEFT|wx.EXPAND, 20) self.btn = wx.Button(self, label=btnlbl1) sizer.Add(self.btn, 0, wx.ALL, 25) self.Bind(wx.EVT_BUTTON, self.OnToggle, self.btn) self.Bind(wx.EVT_BUTTON, self.OnUpdate, self.updateButton) self.Bind(wx.EVT_RADIOBOX, self.OnButtonChoice) self.Bind(wx.EVT_COMBOBOX, self.OnUserChoice, self.gtkChoice)
def __init__( self, parent, titr,txts,cods,lstmlk ): wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size( 660,315 ), style = wx.TAB_TRAVERSAL ) self.iMolk = DG.GetData(u'',u'') #self.jMolk = DG.SetData(u'',u'') self.inumr = adad.Adaad(1,'') self.titr = titr self.txts = txts self.lstmlk = lstmlk self.mcod = cods[2] TB = self.MRcods( cods ) #print titr, txts, TB Vsz1 = wx.BoxSizer( wx.VERTICAL ) self.SetFont( wx.Font( 11, 74, 90, 92, False, FONT_TYPE ) ) ################################################### Vsz2 = wx.BoxSizer( wx.VERTICAL ) self.P1 = MyPanel3(self,titr,TB) Vsz2.Add( self.P1, 0,wx.EXPAND |wx.ALL, 5) Vsz1.Add( Vsz2, 0, wx.EXPAND, 5 ) ################################################## Vsz3 = wx.BoxSizer( wx.HORIZONTAL ) self.lbl1 = u'امکانات' self.lbl2 = u'امکانات ملک' self.cpStyle = wx.CP_NO_TLW_RESIZE self.cp = cp = PCP.PyCollapsiblePane(self, label=self.lbl1, agwStyle=self.cpStyle) self.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.OnPaneChanged, cp) Vsz3.Add( self.cp, 1, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) self.cp.SetLayoutDirection(2) self.MakePaneContent(cp.GetPane()) Vsz1.Add( Vsz3, 1, wx.EXPAND, 5 ) ################################################## Vsz4 = wx.BoxSizer( wx.VERTICAL ) self.P4 = MyPanel4(self,txts) Vsz4.Add( self.P4, 0, wx.EXPAND|wx.ALL, 5) Vsz1.Add( Vsz4, 0, wx.EXPAND, 5 ) Hsz4 = wx.BoxSizer( wx.HORIZONTAL ) self.btn1 = wx.Button( self, wx.ID_ANY, u"برگشت", wx.DefaultPosition, wx.DefaultSize, 0 ) self.btn1.SetFont( wx.Font( 12, 74, 90, 92, False, FONT_TYPE ) ) Hsz4.Add( self.btn1, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) #self.btn2 = wx.Button( self, wx.ID_ANY, u"انصراف", wx.DefaultPosition, wx.DefaultSize, 0 ) #self.btn2.SetFont( wx.Font( 12, 74, 90, 92, False, FONT_TYPE ) ) #Hsz4.Add( self.btn2, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) Hsz4.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) self.bkbtn = wx.BitmapButton( self, wx.ID_ANY, wx.ArtProvider.GetBitmap( wx.ART_GO_BACK, wx.ART_BUTTON ), wx.DefaultPosition, wx.DefaultSize, wx.BU_AUTODRAW ) Hsz4.Add( self.bkbtn, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) self.frbtn = wx.BitmapButton( self, wx.ID_ANY, wx.ArtProvider.GetBitmap( wx.ART_GO_FORWARD, wx.ART_BUTTON ), wx.DefaultPosition, wx.DefaultSize, wx.BU_AUTODRAW ) Hsz4.Add( self.frbtn, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) Vsz1.Add( Hsz4, 0, wx.EXPAND, 5 ) self.setdata(self.mcod) self.SetSizer( Vsz1 ) self.Layout() # Connect Events self.btn1.Bind( wx.EVT_BUTTON, self.savit ) #self.btn2.Bind( wx.EVT_BUTTON, self.cancl ) self.bkbtn.Bind( wx.EVT_BUTTON, self.bkmlk ) self.frbtn.Bind( wx.EVT_BUTTON, self.frmlk )
def __init__(self, parent, id, frame): #--------------------------------------------------------------------------- wx.ScrolledWindow.__init__(self, parent, id) self.frame = frame self.workerThread = None self.initLOO = None topSizer = wx.BoxSizer(wx.VERTICAL) # mode box modeBox = wx.StaticBox(self, -1, "Mode of operation") modeBoxSizer = wx.StaticBoxSizer(modeBox, wx.HORIZONTAL) modeBoxGridSizer = wx.GridBagSizer(hgap=5, vgap=5) modeBoxSizer.Add(modeBoxGridSizer, 1, wx.EXPAND) self.selectingLabel = "Feature selection" self.weightingLabel = "Feature weighting" self.featureSelection = wx.RadioButton(self, -1, self.selectingLabel) self.featureSelection.SetValue(True) self.featureWeighting = wx.RadioButton(self, -1, self.weightingLabel) self.normalization = wx.CheckBox(self, -1, "Normalization") modeBoxGridSizer.Add(self.featureSelection, pos=(0,0), \ flag=wx.LEFT | wx.RIGHT | wx.TOP | wx.EXPAND, border=10) modeBoxGridSizer.Add(self.normalization, pos=(0,1), \ flag=wx.LEFT | wx.RIGHT | wx.TOP | wx.EXPAND, border=10) modeBoxGridSizer.Add(self.featureWeighting, pos=(1,0), \ flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=10) self.Bind(wx.EVT_RADIOBUTTON, self.OnOpModeChange, self.featureSelection) self.Bind(wx.EVT_RADIOBUTTON, self.OnOpModeChange, self.featureWeighting) # basic settings box settingsBox = wx.StaticBox(self, -1, "Basic GA settings") settingsBoxSizer = wx.StaticBoxSizer(settingsBox, wx.VERTICAL) settingsBoxFlexSizer = wx.FlexGridSizer(0, 2, 5, 15) settingsBoxFlexSizer.AddGrowableCol(1) text = wx.StaticText(self, -1, "Population size:") settingsBoxFlexSizer.Add(text, 0, wx.ALIGN_CENTER_VERTICAL |wx.LEFT | wx.RIGHT | wx.TOP, 0) self.popSize = wx.SpinCtrl(self, -1, size=(100,-1), min=2, max=1000, value='75') settingsBoxFlexSizer.Add(self.popSize, 0, wx.ALIGN_LEFT | wx.LEFT | wx.RIGHT | wx.TOP, 0) text = wx.StaticText(self, -1, "Crossover rate:") settingsBoxFlexSizer.Add(text, 0, wx.ALIGN_BOTTOM | wx.LEFT | wx.RIGHT | wx.TOP, 0) self.crossoverRate = wx.Slider(self, -1, 95, 0, 100, style= wx.SL_LABELS) settingsBoxFlexSizer.Add(self.crossoverRate, 0, wx.LEFT | wx.RIGHT | wx.TOP | wx.EXPAND, 0) text = wx.StaticText(self, -1, "Mutation rate:") settingsBoxFlexSizer.Add(text, 0, wx.ALIGN_BOTTOM | wx.LEFT | wx.RIGHT | wx.TOP, 0) self.mutationRate = wx.Slider(self, -1, 5, 0, 100, style= wx.SL_LABELS) settingsBoxFlexSizer.Add(self.mutationRate, 0, wx.LEFT | wx.RIGHT | wx.TOP | wx.EXPAND, 0) settingsBoxSizer.Add(settingsBoxFlexSizer, 0, wx.ALL | wx.EXPAND, 10) # expert settings box expertPane = PCP.PyCollapsiblePane(self, -1, "Expert GA settings", \ style=wx.CP_DEFAULT_STYLE | wx.CP_NO_TLW_RESIZE) self.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.OnPaneChanged, expertPane) self.MakeExpertPane(expertPane.GetPane()) # buttons buttonSizer = wx.BoxSizer(wx.HORIZONTAL) self.startButton = wx.Button(self, -1, "Start") self.startButton.Disable() buttonSizer.Add(self.startButton, 0, wx.ALL | wx.EXPAND, 10) self.Bind(wx.EVT_BUTTON, self.OnButton, self.startButton) self.stopButton = wx.Button(self, -1, "Stop") self.stopButton.Disable() buttonSizer.Add(self.stopButton, 0, wx.ALL | wx.EXPAND, 10) self.Bind(wx.EVT_BUTTON, self.OnButton, self.stopButton) topSizer.Add(modeBoxSizer, 0, wx.LEFT | wx.TOP | wx.RIGHT | wx.EXPAND, 25) topSizer.Add(settingsBoxSizer, 0, wx.LEFT | wx.TOP | wx.RIGHT | wx.EXPAND, 25) topSizer.Add(expertPane, 0, wx.LEFT | wx.TOP | wx.RIGHT | wx.EXPAND, 25) topSizer.Add(buttonSizer, 0, wx.ALL | wx.CENTER, 25) self.SetSizer(topSizer) width, height = topSizer.GetMinSize() self.SetScrollbars(10, 10, width/10, height/10)
def _init_ctrls(self, prnt): # generated method, don't edit wx.Panel.__init__(self, id=wxID_PNLSERIESSELECTOR, name=u'pnlSeriesSelector', parent=prnt, size=wx.Size(935, 270), style=wx.TAB_TRAVERSAL) self.SetClientSize(wx.Size(919, 232)) self.Enable(True) ## Radio panel self.pnlRadio = wx.Panel(id=wxID_PNLRADIO, name='pnlRadio', parent=self, pos=wx.Point(3, 3), size=wx.Size(919, 20), style=wx.TAB_TRAVERSAL) self.rbAll = wx.RadioButton(id=wxID_FRAME1RBALL, label=u'All', name=u'rbAll', parent=self.pnlRadio, pos=wx.Point(0, 0), size=wx.Size(81, 20), style=0) self.rbAll.SetValue(True) self.rbAll.Bind(wx.EVT_RADIOBUTTON, self.OnRbAllRadiobutton, id=wxID_FRAME1RBALL) self.rbSimple = wx.RadioButton(id=wxID_FRAME1RBSIMPLE, label=u'Simple Filter', name=u'rbSimple', parent=self.pnlRadio, pos=wx.Point(81, 0), size=wx.Size(112, 20), style=0) self.rbSimple.Bind(wx.EVT_RADIOBUTTON, self.OnRbSimpleRadiobutton, id=wxID_FRAME1RBSIMPLE) self.rbAdvanced = wx.RadioButton(id=wxID_FRAME1RBADVANCED, label=u'Advanced Filter', name=u'rbAdvanced', parent=self.pnlRadio, pos=wx.Point(193, 0), size=wx.Size(104, 20), style=0) self.rbAdvanced.Bind(wx.EVT_RADIOBUTTON, self.OnRbAdvancedRadiobutton, id=wxID_FRAME1RBADVANCED) self.rbAdvanced.Enable(False) ## Splitter panel self.pnlData = wx.Panel(id=wxID_PNLSPLITTER, name='pnlData', parent=self, pos=wx.Point(0, -10), size=wx.Size(900, 349), style=wx.TAB_TRAVERSAL) ## self.splitter = wx.SplitterWindow(id=wxID_FRAME1SPLITTER, ## name=u'splitter', parent=self.pnlData, pos=wx.Point(0, 0), ## size=wx.Size(604, 137), style=wx.NO_BORDER) ## self.splitter.SetMinSize(wx.Size(-1, -1)) self.cpnlSimple =PCP.PyCollapsiblePane( parent=self.pnlData, label="", agwStyle=wx.CP_NO_TLW_RESIZE | wx.CP_GTK_EXPANDER | wx.CP_USE_STATICBOX, size = wx.Size(300,20), pos =wx.Point(0,-20)) self.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.OnPaneChanged, self.cpnlSimple) ## panel for simple filter(top of splitter) ## self.pnlSimple = wx.Panel(id=wxID_PNLSIMPLE, name='panel3', ## parent=self.splitter, pos=wx.Point(0, 0), size=wx.Size(919, 300), ## style=wx.TAB_TRAVERSAL) ## Site Panel self.pnlSite = wx.Panel(id=wxID_PNLSERIESSELECTORPANEL1, name='pnlSite', parent=self.cpnlSimple.GetPane(), pos=wx.Point(3, 0), size=wx.Size(800, 25), style=wx.TAB_TRAVERSAL) self.cbSites = wx.ComboBox(choices=[], id=wxID_PNLSERIESSELECTORCBSITES, name=u'cbSites', parent=self.pnlSite, pos=wx.Point(100, 0), size=wx.Size(700, 23), style=0, value=u'') self.cbSites.SetLabel(u'') self.cbSites.Bind(wx.EVT_COMBOBOX, self.OnCbSitesCombobox, id=wxID_PNLSERIESSELECTORCBSITES) self.checkSite = wx.CheckBox(id=wxID_PNLSERIESSELECTORCHECKSITE, label=u'', name=u'checkSite', parent=self.pnlSite, pos=wx.Point(3, 0), size=wx.Size(21, 21), style=0) self.checkSite.SetValue(True) self.checkSite.Bind(wx.EVT_CHECKBOX, self.OnCheck, id=wxID_PNLSERIESSELECTORCHECKSITE) self.lblSite = wx.StaticText(id=wxID_PNLSERIESSELECTORLBLSITE, label=u'Site', name=u'lblSite', parent=self.pnlSite, pos=wx.Point(30, 0), size=wx.Size(60, 21), style=0) self.lblSite.SetToolTipString(u'staticText1') ### Variable Panel self.pnlVar = wx.Panel(id=wxID_PNLSERIESSELECTORPANEL2, name='pnlVar', parent=self.cpnlSimple.GetPane(), pos=wx.Point(3, 26), size=wx.Size(800, 25), style=wx.TAB_TRAVERSAL) self.lblVariable = wx.StaticText(id=wxID_PNLSERIESSELECTORLBLVARIABLE, label=u'Variable', name=u'lblVariable', parent=self.pnlVar, pos=wx.Point(30, 0), size=wx.Size(60, 21), style=0) self.checkVariable = wx.CheckBox(id=wxID_PNLSERIESSELECTORCHECKVARIABLE, label=u'', name=u'checkVariable', parent=self.pnlVar, pos=wx.Point(3, 0), size=wx.Size(21, 21), style=0) self.checkVariable.Bind(wx.EVT_CHECKBOX, self.OnCheck, id=wxID_PNLSERIESSELECTORCHECKVARIABLE) self.cbVariables = wx.ComboBox(choices=[], id=wxID_PNLSERIESSELECTORCBVARIABLES, name=u'cbVariables', parent=self.pnlVar, pos=wx.Point(100, 0), size=wx.Size(700, 25), style=0, value='comboBox4') self.cbVariables.SetLabel(u'') self.cbVariables.Enable(False) self.cbVariables.Bind(wx.EVT_COMBOBOX, self.OnCbVariablesCombobox, id=wxID_PNLSERIESSELECTORCBVARIABLES) self.tableSeries = clsULC(id=wxID_PNLSERIESSELECTORtableSeries, name=u'tableSeries', parent=self.pnlData, pos=wx.Point(5, 5), size=wx.Size(903, 108), agwStyle= ULC.ULC_REPORT | ULC.ULC_HRULES | ULC.ULC_VRULES | ULC.ULC_HAS_VARIABLE_ROW_HEIGHT |ULC.ULC_SINGLE_SEL) ## self.splitter.Initialize(self.tableSeries) self.cpnlSimple.Collapse(True) # self.splitter.SplitHorizontally(self.pnlSimple, self.tableSeries, 1) self.tableSeries.Bind(ULC.EVT_LIST_ITEM_CHECKED, self.OntableSeriesListItemSelected, id=wxID_PNLSERIESSELECTORtableSeries) self.tableSeries.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, self.OnTableRightDown, id=wxID_PNLSERIESSELECTORtableSeries) Publisher.subscribe(self.OnEditButton, ("selectEdit")) self._init_sizers()