def __init__(self, colors_dict, parent=None): wx.Dialog.__init__(self, parent, -1, "") self.colors_dict = colors_dict choices = list(self.colors_dict.keys()) choices.sort() # begin wxGlade: wxGladeColorDialog.__init__ self.panel_1 = wx.Panel(self, -1) self.use_sys_color = wx.RadioButton(self.panel_1, -1, _("System Color"), style=wx.RB_GROUP) self.sys_color = wx.ComboBox(self.panel_1, -1, choices=choices, style=wx.CB_DROPDOWN | wx.CB_READONLY) self.use_chooser = wx.RadioButton(self.panel_1, -1, _("Custom Color")) self.color_chooser = PyColourChooser(self, -1) self.ok = wx.Button(self, wx.ID_OK, _("OK")) self.cancel = wx.Button(self, wx.ID_CANCEL, _("Cancel")) self.__set_properties() self.__do_layout() # end wxGlade wx.EVT_RADIOBUTTON(self, self.use_sys_color.GetId(), self.on_use_sys_color) wx.EVT_RADIOBUTTON(self, self.use_chooser.GetId(), self.on_use_chooser)
def __init__(self, parent, log): wx.Panel.__init__(self, parent, -1) self.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD, False)) # Make the controls text1 = wx.StaticText(self, -1, "Draw a little picture in this window\n" "then switch the mode below and drag the\n" "picture to the lower window or to another\n" "application that accepts Bitmaps as a\n" "drop target.\n" ) rb1 = wx.RadioButton(self, -1, "Draw", style=wx.RB_GROUP) rb1.SetValue(True) rb2 = wx.RadioButton(self, -1, "Drag") rb2.SetValue(False) text2 = wx.StaticText(self, -1, "The lower window is accepting a\n" "custom data type that is a pickled\n" "Python list of lines data.") self.pad = DoodlePad(self, log) view = DoodleViewer(self, log) # put them in sizers sizer = wx.BoxSizer(wx.HORIZONTAL) box = wx.BoxSizer(wx.VERTICAL) rbox = wx.BoxSizer(wx.HORIZONTAL) rbox.Add(rb1) rbox.Add(rb2) box.Add(text1, 0, wx.ALL, 10) box.Add(rbox, 0, wx.ALIGN_CENTER) box.Add((10,90)) box.Add(text2, 0, wx.ALL, 10) sizer.Add(box) dndsizer = wx.BoxSizer(wx.VERTICAL) dndsizer.Add(self.pad, 1, wx.EXPAND|wx.ALL, 5) dndsizer.Add(view, 1, wx.EXPAND|wx.ALL, 5) sizer.Add(dndsizer, 1, wx.EXPAND) self.SetAutoLayout(True) self.SetSizer(sizer) # Events wx.EVT_RADIOBUTTON(self, rb1.GetId(), self.OnRadioButton) wx.EVT_RADIOBUTTON(self, rb2.GetId(), self.OnRadioButton)
def __init__(self, mainControl, parent, unifName, allowSkip=False, initialRbChoice=None): d = wx.PreDialog() self.PostCreate(d) self.mainControl = mainControl self.value = self.RET_CANCEL, None self.unifName = unifName res = wx.xrc.XmlResource.Get() res.LoadOnDialog(self, parent, "TrashBagRenameDialog") self.ctrls = XrcControls(self) self.ctrls.btnOk.SetId(wx.ID_OK) self.ctrls.btnOk = self.ctrls._byId(wx.ID_OK) self.ctrls.btnCancel.SetId(wx.ID_CANCEL) self.ctrls.rbSkip.Enable(allowSkip) if unifName.startswith(u"wikipage/"): nameCollision = unifName[9:] else: nameCollision = unifName # Should not happen self.ctrls.stNameCollision.SetLabel(nameCollision) if allowSkip and initialRbChoice in (self.RET_CANCEL, self.RET_SKIP): self.ctrls.rbSkip.SetValue(True) elif initialRbChoice == self.RET_RENAME_TRASHBAG: self.ctrls.rbRenameTrashBag.SetValue(True) elif initialRbChoice == self.RET_RENAME_WIKIELEMENT: self.ctrls.rbRenameWikiElement.SetValue(True) self.updateValidToWikiWord() wx.EVT_BUTTON(self, wx.ID_OK, self.OnOk) wx.EVT_BUTTON(self, wx.ID_CANCEL, self.OnCancel) wx.EVT_TEXT(self, GUI_ID.tfTrashBagTo, self.OnTextTrashBagTo) wx.EVT_TEXT(self, GUI_ID.tfWikiElementTo, self.OnTextWikiElementTo) wx.EVT_RADIOBUTTON(self, GUI_ID.rbOverwrite, self.OnRadioButtonChanged) wx.EVT_RADIOBUTTON(self, GUI_ID.rbSkip, self.OnRadioButtonChanged) wx.EVT_RADIOBUTTON(self, GUI_ID.rbRenameTrashBag, self.OnRadioButtonChanged) wx.EVT_RADIOBUTTON(self, GUI_ID.rbRenameWikiElement, self.OnRadioButtonChanged) # Fixes focus bug under Linux self.SetFocus()
def __init__(self, parent): wx.Panel.__init__(self, parent, armid.USECASECONTRIBUTION_ID) b = Borg() self.dbProxy = b.dbProxy mainSizer = wx.BoxSizer(wx.VERTICAL) ucs = self.dbProxy.getDimensionNames('usecase') mainSizer.Add( self.buildComboSizerList( 'Use Case', (87, 30), armid.REFERENCECONTRIBUTION_COMBOSOURCE_ID, ucs), 0, wx.EXPAND) charSynopses = self.dbProxy.getDimensionNames( 'characteristic_synopsis') mainSizer.Add( self.buildRadioButtonSizer( 'Referent', (87, 30), [(armid.REFERENCECONTRIBUTION_RADIOREFERENCE_ID, 'Reference'), (armid.REFERENCECONTRIBUTION_RADIOCHARACTERISTIC_ID, 'Characteristic')])) refs = self.dbProxy.getDimensionNames('reference_synopsis') mainSizer.Add( self.buildComboSizerList( 'Reference', (87, 30), armid.REFERENCECONTRIBUTION_COMBODESTINATION_ID, refs), 0, wx.EXPAND) mainSizer.Add( self.buildComboSizerList( 'Means/End', (87, 30), armid.REFERENCECONTRIBUTION_COMBOMEANSEND_ID, ['means', 'end']), 0, wx.EXPAND) contType = [ 'Make', 'SomePositive', 'Help', 'Hurt', 'SomeNegative', 'Break' ] mainSizer.Add( self.buildComboSizerList( 'Contribution', (87, 30), armid.REFERENCECONTRIBUTION_COMBOCONTRIBUTION_ID, contType), 0, wx.EXPAND) mainSizer.Add( self.buildCommitButtonSizer( armid.REFERENCECONTRIBUTION_BUTTONCOMMIT_ID, True), 0, wx.ALIGN_CENTER) wx.EVT_RADIOBUTTON(self, armid.REFERENCECONTRIBUTION_RADIOREFERENCE_ID, self.onReferenceSelected) wx.EVT_RADIOBUTTON(self, armid.REFERENCECONTRIBUTION_RADIOCHARACTERISTIC_ID, self.onCharacteristicSelected) self.SetSizer(mainSizer)
def __init__(self,parent,envName): wx.Panel.__init__(self,parent,EXCEPTION_ID) b = Borg() self.dbProxy = b.dbProxy self.theEnvironmentName = envName mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(WidgetFactory.buildTextSizer(self,'Name',(87,30),EXCEPTION_TEXTNAME_ID),0,wx.EXPAND) mainSizer.Add(WidgetFactory.buildRadioButtonSizer(self,'Type',(87,30),[(EXCEPTION_RADIOGOAL_ID,'Goal'),(EXCEPTION_RADIOREQUIREMENT_ID,'Requirement')])) goalList = self.dbProxy.environmentGoals(self.theEnvironmentName) mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Values',(87,30),EXCEPTION_COMBOGOALS_ID,goalList),0,wx.EXPAND) catList = ['Confidentiality Threat','Integrity Threat','Availability Threat','Accountability Threat','Anonymity Threat','Pseudonymity Threat','Unlinkability Threat','Unobservability Threat','Vulnerability','Duration','Frequency','Demands','Goal Support'] mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Category',(87,30),EXCEPTION_COMBOCATEGORY_ID,catList),0,wx.EXPAND) mainSizer.Add(WidgetFactory.buildMLTextSizer(self,'Definition',(87,30),EXCEPTION_TEXTDEFINITION_ID),1,wx.EXPAND) self.SetSizer(mainSizer) wx.EVT_RADIOBUTTON(self,EXCEPTION_RADIOGOAL_ID,self.onGoalSelected) wx.EVT_RADIOBUTTON(self,EXCEPTION_RADIOREQUIREMENT_ID,self.onRequirementSelected)
def __init__(self, parent, cvName): BasePanel.__init__(self, parent, armid.WEAKNESSTREATMENT_ID) self.theViewName = cvName b = Borg() self.dbProxy = b.dbProxy self.theGoalIndicator = 0 reqList = self.dbProxy.componentViewRequirements(cvName) assetList = [] effValues = ['None', 'Low', 'Medium', 'High'] mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add( self.buildRadioButtonSizer('Type', (87, 30), [ (armid.WEAKNESSTREATMENT_RADIOGOAL_ID, 'Goal'), (armid.WEAKNESSTREATMENT_RADIOREQUIREMENT_ID, 'Requirement') ])) mainSizer.Add( self.buildComboSizerList('', (87, 30), armid.WEAKNESSTREATMENT_COMBOREQGOAL_ID, reqList), 0, wx.EXPAND) mainSizer.Add( self.buildComboSizerList('Asset', (87, 30), armid.WEAKNESSTREATMENT_COMBOASSET_ID, assetList), 0, wx.EXPAND) mainSizer.Add( self.buildComboSizerList( 'Effectiveness', (87, 30), armid.WEAKNESSTREATMENT_COMBOEFFECTIVENESS_ID, effValues), 0, wx.EXPAND) mainSizer.Add( self.buildMLTextSizer('Rationale', (87, 60), armid.WEAKNESSTREATMENT_TEXTRATIONALE_ID), 1, wx.EXPAND) mainSizer.Add( self.buildCommitButtonSizer( armid.WEAKNESSTREATMENT_BUTTONCOMMIT_ID, False), 0, wx.CENTER) self.SetSizer(mainSizer) reqCtrl = self.FindWindowById(armid.WEAKNESSTREATMENT_COMBOREQGOAL_ID) reqCtrl.Bind(wx.EVT_COMBOBOX, self.onRequirementChange) wx.EVT_RADIOBUTTON(self, armid.WEAKNESSTREATMENT_RADIOGOAL_ID, self.onGoalSelected) wx.EVT_RADIOBUTTON(self, armid.WEAKNESSTREATMENT_RADIOREQUIREMENT_ID, self.onRequirementSelected) reqRadioCtrl = self.FindWindowById( armid.WEAKNESSTREATMENT_RADIOREQUIREMENT_ID) reqRadioCtrl.SetValue(True)
def buildControls(self, isCreate, inPersona): mainSizer = wx.BoxSizer(wx.VERTICAL) if (inPersona == False): personas = self.dbProxy.getDimensionNames('persona') mainSizer.Add( self.buildComboSizerList( 'Persona', (87, 30), PERSONACHARACTERISTIC_COMBOPERSONA_ID, personas), 0, wx.EXPAND) mainSizer.Add( self.buildRadioButtonSizer( 'Type', (87, 30), [(PERSONACHARACTERISTIC_RADIOREFERENCE_ID, 'Reference'), (PERSONACHARACTERISTIC_RADIOCONCEPT_ID, 'Concept')])) refs = ['[New reference]'] refs += self.dbProxy.getDimensionNames('document_reference') mainSizer.Add( self.buildComboSizerList('Reference', (87, 30), PERSONACHARACTERISTIC_COMBOREFERENCE_ID, refs), 0, wx.EXPAND) if (inPersona == False): bVars = self.dbProxy.getDimensionNames('behavioural_variable') mainSizer.Add( self.buildComboSizerList( 'Behavioural Variable', (87, 30), PERSONACHARACTERISTIC_COMBOVARIABLE_ID, bVars), 0, wx.EXPAND) mainSizer.Add( self.buildMLTextSizer('Characteristic', (87, 30), PERSONACHARACTERISTIC_TEXTCHARACTERISTIC_ID), 1, wx.EXPAND) mainSizer.Add( self.buildCommitButtonSizer(PERSONACHARACTERISTIC_BUTTONCOMMIT_ID, isCreate), 0, wx.CENTER) wx.EVT_COMBOBOX(self, PERSONACHARACTERISTIC_COMBOREFERENCE_ID, self.onReferenceChange) wx.EVT_RADIOBUTTON(self, PERSONACHARACTERISTIC_RADIOREFERENCE_ID, self.onReferenceSelected) wx.EVT_RADIOBUTTON(self, PERSONACHARACTERISTIC_RADIOCONCEPT_ID, self.onConceptSelected) self.SetSizer(mainSizer)
def __init__(self,parent): wx.Panel.__init__(self,parent) b = Borg() self.dbProxy = b.dbProxy topSizer = wx.BoxSizer(wx.VERTICAL) typeBox = wx.StaticBox(self,-1,'Type') typeBoxSizer = wx.StaticBoxSizer(typeBox,wx.HORIZONTAL) topSizer.Add(typeBoxSizer,0,wx.EXPAND) typeChoices = ['Functional','Data','Look and Feel','Usability','Performance','Operational','Maintainability','Portability','Security','Cultural and Political','Legal','Privacy'] self.typeCtrl = wx.ComboBox(self,SINGLEREQUIREMENT_COMBOTYPE_ID,choices=typeChoices,size=wx.DefaultSize,style=wx.CB_READONLY) typeBoxSizer.Add(self.typeCtrl,1,wx.EXPAND) radioBox = wx.StaticBox(self,-1,'Referrer') radioSizer = wx.StaticBoxSizer(radioBox,wx.HORIZONTAL) topSizer.Add(radioSizer,0,wx.EXPAND) radioSizer.Add(wx.RadioButton(self,SINGLEREQUIREMENT_RADIOASSET_ID,'Asset',style=wx.RB_GROUP)) radioSizer.Add(wx.RadioButton(self,SINGLEREQUIREMENT_RADIOENVIRONMENT_ID,'Environment',style=0)) self.refCtrl = wx.ComboBox(self,SINGLEREQUIREMENT_COMBOREFERRER_ID,choices=self.dbProxy.getDimensionNames('asset'),size=wx.DefaultSize,style=wx.CB_READONLY) radioSizer.Add(self.refCtrl,1,wx.EXPAND) wx.EVT_RADIOBUTTON(self,SINGLEREQUIREMENT_RADIOASSET_ID,self.onAssetSelected) wx.EVT_RADIOBUTTON(self,SINGLEREQUIREMENT_RADIOENVIRONMENT_ID,self.onEnvironmentSelected) priBox = wx.StaticBox(self,-1,'Priority') priBoxSizer = wx.StaticBoxSizer(priBox,wx.HORIZONTAL) topSizer.Add(priBoxSizer,0,wx.EXPAND) self.priorityCtrl = wx.ComboBox(self,SINGLEREQUIREMENT_COMBOPRIORITY_ID,choices=['1','2','3'],size=wx.DefaultSize,style=wx.CB_READONLY) priBoxSizer.Add(self.priorityCtrl,1,wx.EXPAND) descBox = wx.StaticBox(self,-1,'Description') descBoxSizer = wx.StaticBoxSizer(descBox,wx.HORIZONTAL) topSizer.Add(descBoxSizer,1,wx.EXPAND) self.descriptionCtrl = wx.TextCtrl(self,SINGLEREQUIREMENT_TEXTDESCRIPTION_ID,'',style=wx.TE_MULTILINE) descBoxSizer.Add(self.descriptionCtrl,1,wx.EXPAND) ctBox = wx.StaticBox(self,-1,'Contribution Type') ctBoxSizer = wx.StaticBoxSizer(ctBox,wx.HORIZONTAL) topSizer.Add(ctBoxSizer,0,wx.EXPAND) self.ctCtrl = wx.ComboBox(self,SINGLEREQUIREMENT_COMBOCONTRIBUTIONTYPE_ID,choices=['Operationalises','Obstructs'],size=wx.DefaultSize,style=wx.CB_READONLY) self.ctCtrl.SetSelection(0) ctBoxSizer.Add(self.ctCtrl,1,wx.EXPAND) self.SetSizer(topSizer)
def AddConflictItem(self, name, type_, local, remote, canMerge=True): id_ = wx.NewId() localWidget = type_(self, id_) localWidget.SetValue(local) localWidget.Enable(False) remoteWidget = type_(self, id_) remoteWidget.SetValue(remote) remoteWidget.Enable(False) fusionWidget = type_(self, id_, callback=self.OnFusionChanged) fusionWidget.SetValue(local) if not canMerge: fusionWidget.Enable(False) btnLocal = wx.RadioButton(self, id_, u'', style=wx.RB_GROUP) btnRemote = wx.RadioButton(self, id_, u'') if canMerge: btnFusion = wx.RadioButton(self, id_, u'') else: btnFusion = None wx.EVT_RADIOBUTTON(btnLocal, id_, self.OnLocalSelected) wx.EVT_RADIOBUTTON(btnRemote, id_, self.OnRemoteSelected) self.sizer.Add(wx.StaticText(self, wx.ID_ANY, name), 0, wx.ALIGN_CENTRE|wx.ALL, 3) self.sizer.Add(localWidget, 0, wx.EXPAND|wx.ALL, 3) self.sizer.Add(btnLocal) self.sizer.Add(remoteWidget, 0, wx.EXPAND|wx.ALL, 3) self.sizer.Add(btnRemote) self.sizer.Add(fusionWidget, 0, wx.EXPAND|wx.ALL, 3) if canMerge: self.sizer.Add(btnFusion) else: self.sizer.Add((0, 0)) self.fields[id_] = (localWidget, remoteWidget, fusionWidget, btnFusion) return id_
def __init__(self, parent, name): pre = wx.PrePanel() g.frame.res.LoadOnPanel(pre, parent, 'PANEL_BITMAP') self.PostCreate(pre) self.modified = self.freeze = False self.radio_std = xrc.XRCCTRL(self, 'RADIO_STD') self.radio_file = xrc.XRCCTRL(self, 'RADIO_FILE') self.combo = xrc.XRCCTRL(self, 'COMBO_STD') self.text = xrc.XRCCTRL(self, 'TEXT_FILE') self.button = xrc.XRCCTRL(self, 'BUTTON_BROWSE') self.textModified = False self.SetAutoLayout(True) self.GetSizer().SetMinSize((260, -1)) self.GetSizer().Fit(self) wx.EVT_RADIOBUTTON(self, xrc.XRCID('RADIO_STD'), self.OnRadioStd) wx.EVT_RADIOBUTTON(self, xrc.XRCID('RADIO_FILE'), self.OnRadioFile) wx.EVT_BUTTON(self, xrc.XRCID('BUTTON_BROWSE'), self.OnButtonBrowse) wx.EVT_COMBOBOX(self, xrc.XRCID('COMBO_STD'), self.OnCombo) wx.EVT_TEXT(self, xrc.XRCID('COMBO_STD'), self.OnChange) wx.EVT_TEXT(self, xrc.XRCID('TEXT_FILE'), self.OnChange)
def rebuild_editor(self): """ Rebuilds the contents of the editor whenever the original factory object's **values** trait changes. """ # Clear any existing content: panel = self.control panel.SetSizer(None) panel.DestroyChildren() # Get the current trait value: cur_name = self.str_value # Create a sizer to manage the radio buttons: names = self.names mapping = self.mapping n = len(names) cols = self.factory.cols rows = (n + cols - 1) / cols incr = [n / cols] * cols rem = n % cols for i in range(cols): incr[i] += (rem > i) incr[-1] = -(reduce(lambda x, y: x + y, incr[:-1], 0) - 1) if cols > 1: sizer = wx.GridSizer(0, cols, 2, 4) else: sizer = wx.BoxSizer(wx.VERTICAL) # Add the set of all possible choices: style = wx.RB_GROUP index = 0 for i in range(rows): for j in range(cols): if n > 0: name = label = names[index] label = self.string_value(label, capitalize) control = wx.RadioButton(panel, -1, label, style=style) control.value = mapping[name] style = 0 control.SetValue(name == cur_name) wx.EVT_RADIOBUTTON(panel, control.GetId(), self.update_object) self.set_tooltip(control) index += incr[j] n -= 1 else: control = wx.RadioButton(panel, -1, '') control.value = '' control.Show(False) sizer.Add(control, 0, wx.NORTH, 5) # Set-up the layout: panel.SetSizerAndFit(sizer)
def __init__(self, parent, id, choices, pos=wx.DefaultPosition, name='radiobox'): PPanel.__init__(self, parent, name) self.choices = choices topSizer = wx.BoxSizer() for i in choices: button = wx.RadioButton(self, -1, i, size=(-1, buttonSize[1]), name=i) topSizer.Add(button, 0, wx.RIGHT, 5) wx.EVT_RADIOBUTTON(self, button.GetId(), self.OnRadioChoice) self.SetAutoLayout(True) self.SetSizerAndFit(topSizer)
def __init__(self, notebook, Mainframe): wx.Panel.__init__(self, parent=notebook) # Specify relevant variables self.Mainframe = Mainframe self.AnovaCheck = True self.PostHocCheck = False self.Param = True self.ParamPostHoc = True self.nIteration = 1000 self.nIterationPostHoc = 1000 self.Alpha = 0.05 self.AlphaPostHoc = 0.05 self.PtsConseq = 1 self.PtsConseqPostHoc = 1 self.Clust = 1 self.ClustPostHoc = 1 self.AnalyseType = 'GFP Only' self.SPIFile = '' self.SPIPath = '' # Panel: Perform ANOVA self.PanelAnova = wx.Panel(self, wx.ID_ANY) sizerAnova = wx.BoxSizer(wx.VERTICAL) # Add "Perform ANOVA" checkbox self.AnovaCheckBox = wx.CheckBox(self, wx.ID_ANY, "Perform ANOVA") self.AnovaCheckBox.SetValue(self.AnovaCheck) # Parametric / Non-Parametric Test Section PanelParam = wx.Panel(self.PanelAnova, wx.ID_ANY) PanelNonParam = wx.Panel(PanelParam, wx.ID_ANY) self.RadioParam = wx.RadioButton( PanelNonParam, wx.ID_ANY, 'Parametric Test', style=wx.RB_GROUP) self.RadioNonParam = wx.RadioButton( PanelNonParam, self.RadioParam.Id, 'Non-Parametric Test (Bootstrapping)') # Iteration Section self.PanelIter = wx.Panel(PanelParam, wx.ID_ANY) TxtIter = wx.StaticText(self.PanelIter, wx.ID_ANY, label=" Iteration", style=wx.ALIGN_CENTER) self.IterInput = wx.TextCtrl( self.PanelIter, wx.ID_ANY, value=str(self.nIteration), style=wx.TE_CENTRE) # Statistic (alpha, conseq pts, cluster size) Section PanelStats = wx.Panel(self.PanelAnova, wx.ID_ANY) PanelAlpha = wx.Panel(PanelStats, wx.ID_ANY) TxtAlpha = wx.StaticText(PanelAlpha, wx.ID_ANY, label=" Alpha Value", style=wx.ALIGN_CENTER) self.AlphaInput = wx.TextCtrl( PanelAlpha, wx.ID_ANY, value=str(self.Alpha), style=wx.TE_CENTRE) PanelPtsConseq = wx.Panel(PanelStats, wx.ID_ANY) PtsConseqText = wx.StaticText( PanelPtsConseq, wx.ID_ANY, label="Consecutive Time Frames", style=wx.ALIGN_CENTER) self.PtsConseqInput = wx.TextCtrl( PanelPtsConseq, wx.ID_ANY, value=str(self.PtsConseq), style=wx.TE_CENTRE) self.PanelClust = wx.Panel(PanelStats, wx.ID_ANY) TxtClust = wx.StaticText( self.PanelClust, wx.ID_ANY, label="Cluster Size (Electrodes)", style=wx.ALIGN_CENTER) self.ClustInput = wx.TextCtrl( self.PanelClust, wx.ID_ANY, value=str(self.Clust), style=wx.TE_CENTRE) # Create Structure of "Perform ANOVA" sizerNonParam = wx.BoxSizer(wx.VERTICAL) sizerNonParam.Add(self.RadioParam, 0, wx.TOP) sizerNonParam.AddSpacer(2) sizerNonParam.Add(self.RadioNonParam, 0, wx.TOP) PanelNonParam.SetSizer(sizerNonParam) sizerIter = wx.BoxSizer(wx.VERTICAL) sizerIter.Add(TxtIter, 0, wx.EXPAND) sizerIter.AddSpacer(2) sizerIter.Add(self.IterInput, 0, wx.EXPAND) self.PanelIter.SetSizer(sizerIter) sizerParam = wx.BoxSizer(wx.HORIZONTAL) sizerParam.Add(PanelNonParam, 0, wx.EXPAND) sizerParam.AddSpacer(10) sizerParam.Add(self.PanelIter, 0, wx.EXPAND) PanelParam.SetSizer(sizerParam) sizerAlpha = wx.BoxSizer(wx.VERTICAL) sizerAlpha.Add(TxtAlpha, 0, wx.EXPAND) sizerAlpha.Add(self.AlphaInput, 0, wx.EXPAND) PanelAlpha.SetSizer(sizerAlpha) sizerPtsConseq = wx.BoxSizer(wx.VERTICAL) sizerPtsConseq.Add(PtsConseqText, 0, wx.EXPAND) sizerPtsConseq.Add(self.PtsConseqInput, 0, wx.EXPAND) PanelPtsConseq.SetSizer(sizerPtsConseq) SizerPtsClust = wx.BoxSizer(wx.VERTICAL) SizerPtsClust.Add(TxtClust, 0, wx.EXPAND) SizerPtsClust.Add(self.ClustInput, 0, wx.EXPAND) self.PanelClust.SetSizer(SizerPtsClust) sizerStats = wx.BoxSizer(wx.HORIZONTAL) sizerStats.Add(PanelAlpha) sizerStats.AddSpacer(10) sizerStats.Add(PanelPtsConseq) sizerStats.AddSpacer(10) sizerStats.Add(self.PanelClust) sizerStats.AddSpacer(10) PanelStats.SetSizer(sizerStats) sizerAnova.Add(PanelParam, 0, wx.EXPAND) sizerAnova.AddSpacer(10) sizerAnova.Add(PanelStats, 0, wx.EXPAND) sizerAnova.AddSpacer(10) self.PanelAnova.SetSizer(sizerAnova) # Panel: Perform Post hoc Analysis self.PanelPostHoc = wx.Panel(self, wx.ID_ANY) sizerPostHoc = wx.BoxSizer(wx.VERTICAL) # Add "Post hoc Analysis" checkbox titlePostHocText = "Post hoc Analysis (all possible t-test)" titlePostHocText += " - only on ANOVA, not on ANCOVA" # TODO: check that field is disabled if there is a covariate self.PostHocCheckBox = wx.CheckBox(self, wx.ID_ANY, titlePostHocText) self.PostHocCheckBox.SetValue(self.PostHocCheck) # Parametric / Non-Parametric Test Section PanelParam = wx.Panel(self.PanelPostHoc, wx.ID_ANY) PanelNonParam = wx.Panel(PanelParam, wx.ID_ANY) self.RadioParamPostHoc = wx.RadioButton( PanelNonParam, wx.ID_ANY, 'Parametric Test', style=wx.RB_GROUP) self.RadioNonParamPostHoc = wx.RadioButton( PanelNonParam, self.RadioParamPostHoc.Id, 'Non-Parametric Test (Bootstrapping)') # IterPostHocation Section self.PanelIterPostHoc = wx.Panel(PanelParam, wx.ID_ANY) TxtIterPostHoc = wx.StaticText( self.PanelIterPostHoc, wx.ID_ANY, label=" Iteration", style=wx.ALIGN_CENTER) self.IterInputPostHoc = wx.TextCtrl( self.PanelIterPostHoc, wx.ID_ANY, style=wx.TE_CENTRE, value=str(self.nIterationPostHoc)) # Statistic (alpha, conseq pts, cluster size) Section PanelStatsPostHoc = wx.Panel(self.PanelPostHoc, wx.ID_ANY) PanelAlphaPostHoc = wx.Panel(PanelStatsPostHoc, wx.ID_ANY) TxtAlphaPostHoc = wx.StaticText( PanelAlphaPostHoc, wx.ID_ANY, label=" Alpha Value", style=wx.ALIGN_CENTER) self.AlphaInputPostHoc = wx.TextCtrl( PanelAlphaPostHoc, wx.ID_ANY, value=str(self.Alpha), style=wx.TE_CENTRE) PanelPtsConseqPostHoc = wx.Panel(PanelStatsPostHoc, wx.ID_ANY) PtsConseqTextPostHoc = wx.StaticText( PanelPtsConseqPostHoc, wx.ID_ANY, label="Consecutive Time Frames", style=wx.ALIGN_CENTER) self.PtsConseqInputPostHoc = wx.TextCtrl( PanelPtsConseqPostHoc, wx.ID_ANY, value=str(self.PtsConseqPostHoc), style=wx.TE_CENTRE) self.PanelClustPostHoc = wx.Panel(PanelStatsPostHoc, wx.ID_ANY) TxtClustPostHoc = wx.StaticText( self.PanelClustPostHoc, wx.ID_ANY, label="Cluster Size (Electrodes)", style=wx.ALIGN_CENTER) self.ClustInputPostHoc = wx.TextCtrl( self.PanelClustPostHoc, wx.ID_ANY, value=str(self.ClustPostHoc), style=wx.TE_CENTRE) # Create Structure of "Perform Post hoc Analysis" sizerNonParam = wx.BoxSizer(wx.VERTICAL) sizerNonParam.Add(self.RadioParamPostHoc, 0, wx.TOP) sizerNonParam.AddSpacer(2) sizerNonParam.Add(self.RadioNonParamPostHoc, 0, wx.TOP) PanelNonParam.SetSizer(sizerNonParam) sizerIterPostHoc = wx.BoxSizer(wx.VERTICAL) sizerIterPostHoc.Add(TxtIterPostHoc, 0, wx.EXPAND) sizerIterPostHoc.AddSpacer(2) sizerIterPostHoc.Add(self.IterInputPostHoc, 0, wx.EXPAND) self.PanelIterPostHoc.SetSizer(sizerIterPostHoc) sizerParam = wx.BoxSizer(wx.HORIZONTAL) sizerParam.Add(PanelNonParam, 0, wx.EXPAND) sizerParam.AddSpacer(10) sizerParam.Add(self.PanelIterPostHoc, 0, wx.EXPAND) PanelParam.SetSizer(sizerParam) sizerAlphaPostHoc = wx.BoxSizer(wx.VERTICAL) sizerAlphaPostHoc.Add(TxtAlphaPostHoc, 0, wx.EXPAND) sizerAlphaPostHoc.Add(self.AlphaInputPostHoc, 0, wx.EXPAND) PanelAlphaPostHoc.SetSizer(sizerAlphaPostHoc) sizerPtsConseqPostHoc = wx.BoxSizer(wx.VERTICAL) sizerPtsConseqPostHoc.Add(PtsConseqTextPostHoc, 0, wx.EXPAND) sizerPtsConseqPostHoc.Add(self.PtsConseqInputPostHoc, 0, wx.EXPAND) PanelPtsConseqPostHoc.SetSizer(sizerPtsConseqPostHoc) SizerPtsClustPostHoc = wx.BoxSizer(wx.VERTICAL) SizerPtsClustPostHoc.Add(TxtClustPostHoc, 0, wx.EXPAND) SizerPtsClustPostHoc.Add(self.ClustInputPostHoc, 0, wx.EXPAND) self.PanelClustPostHoc.SetSizer(SizerPtsClustPostHoc) sizerStats = wx.BoxSizer(wx.HORIZONTAL) sizerStats.Add(PanelAlphaPostHoc) sizerStats.AddSpacer(10) sizerStats.Add(PanelPtsConseqPostHoc) sizerStats.AddSpacer(10) sizerStats.Add(self.PanelClustPostHoc) sizerStats.AddSpacer(10) PanelStatsPostHoc.SetSizer(sizerStats) sizerPostHoc.Add(PanelParam, 0, wx.EXPAND) sizerPostHoc.AddSpacer(10) sizerPostHoc.Add(PanelStatsPostHoc, 0, wx.EXPAND) sizerPostHoc.AddSpacer(10) self.PanelPostHoc.SetSizer(sizerPostHoc) # Panel: Specify SPI self.PanelSPI = wx.Panel(self, wx.ID_ANY) TxtSPI = wx.StaticText( self.PanelSPI, wx.ID_ANY, label="Select XYZ File", style=wx.ALIGN_CENTER) self.FieldSPIFile = wx.TextCtrl( self.PanelSPI, wx.ID_ANY, value=self.SPIFile, style=wx.TE_READONLY) self.ButtonSPI = wx.Button(self.PanelSPI, wx.ID_ANY, label="Browse") sizerSPI = wx.GridBagSizer() sizerSPI.Add(TxtSPI, (0, 0), (1, 5), wx.EXPAND) sizerSPI.Add(self.FieldSPIFile, (1, 0), (1, 4), wx.EXPAND) sizerSPI.Add(self.ButtonSPI, (1, 5), (1, 1), wx.EXPAND) self.PanelSPI.SetSizer(sizerSPI) sizerSPI.AddGrowableCol(0) # Panel: Analyse Type (GFP, All electrodes or both) TxtAnalyse = wx.StaticText( self, wx.ID_ANY, label="Choose Analyse Type", style=wx.CENTRE) analyseTypes = ["", "All Electrodes", "GFP Only", "Both"] self.BoxAnalyse = wx.ComboBox(self, wx.ID_ANY, choices=analyseTypes, style=wx.CB_READONLY) self.BoxAnalyse.SetSelection(0) # Create structure of Analysis Frame sizerFrame = wx.BoxSizer(wx.VERTICAL) self.SetSizer(sizerFrame) sizerFrame.Add(self.AnovaCheckBox, 0, wx.EXPAND) sizerFrame.AddSpacer(5) sizerFrame.Add(self.PanelAnova, 0, wx.EXPAND) sizerFrame.AddSpacer(5) sizerFrame.Add(self.PostHocCheckBox, 0, wx.EXPAND) sizerFrame.AddSpacer(5) sizerFrame.Add(self.PanelPostHoc, 0, wx.EXPAND) sizerFrame.Add(self.PanelSPI, 0, wx.EXPAND) sizerFrame.AddSpacer(10) sizerFrame.Add(TxtAnalyse, 0, wx.EXPAND) sizerFrame.Add(self.BoxAnalyse, 0, wx.EXPAND) self.SetSizer(sizerFrame) # Inactive certain Sections self.PanelPostHoc.Disable() self.PanelClust.Disable() self.PanelClustPostHoc.Disable() self.PanelIter.Disable() self.PanelIterPostHoc.Disable() self.PanelSPI.Disable() # Events wx.EVT_CHECKBOX(self, self.AnovaCheckBox.Id, self.checkAnova) wx.EVT_RADIOBUTTON(self, self.RadioParam.Id, self.clickParam) wx.EVT_TEXT(self, self.AlphaInput.Id, self.chooseAlpha) wx.EVT_TEXT(self, self.PtsConseqInput.Id, self.choosePtsConseq) wx.EVT_TEXT(self, self.ClustInput.Id, self.chooseClust) wx.EVT_TEXT(self, self.IterInput.Id, self.chooseIter) wx.EVT_CHECKBOX(self, self.PostHocCheckBox.Id, self.checkPostHoc) wx.EVT_RADIOBUTTON(self, self.RadioParamPostHoc.Id, self.clickParamPostHoc) wx.EVT_TEXT(self, self.AlphaInputPostHoc.Id, self.chooseAlphaPostHoc) wx.EVT_TEXT(self, self.PtsConseqInputPostHoc.Id, self.choosePtsConseqPostHoc) wx.EVT_TEXT(self, self.ClustInputPostHoc.Id, self.chooseClustPostHoc) wx.EVT_TEXT(self, self.IterInputPostHoc.Id, self.chooseIterPostHoc) wx.EVT_COMBOBOX(self, self.BoxAnalyse.Id, self.AnalyseChoose) wx.EVT_BUTTON(self, self.ButtonSPI.Id, self.chooseSPI)
def __init__(self, parent): WizardPage.__init__(self, parent, pgid.SCRIPTS) preinst = DebianScript(self, ID_INST_PRE) postinst = DebianScript(self, ID_INST_POST) prerm = DebianScript(self, ID_RM_PRE) postrm = DebianScript(self, ID_RM_POST) # Radio buttons for displaying between pre- and post- install scripts # FIXME: Names settings for tooltips are confusing rb_preinst = wx.RadioButton(self, preinst.GetId(), preinst.GetName(), name=preinst.FileName, style=wx.RB_GROUP) rb_postinst = wx.RadioButton(self, postinst.GetId(), postinst.GetName(), name=postinst.FileName) rb_prerm = wx.RadioButton(self, prerm.GetId(), prerm.GetName(), name=prerm.FileName) rb_postrm = wx.RadioButton(self, postrm.GetId(), postrm.GetName(), name=postrm.FileName) self.script_objects = ( (preinst, rb_preinst,), (postinst, rb_postinst,), (prerm, rb_prerm,), (postrm, rb_postrm,), ) # *** Auto-Link *** # pnl_autolink = BorderedPanel(self) # Auto-Link path for new link txt_autolink = wx.StaticText(pnl_autolink, label=GT(u'Path'), name=u'target') self.ti_autolink = PathCtrl(pnl_autolink, value=u'/usr/bin', warn=True) self.ti_autolink.SetName(u'target') self.ti_autolink.Default = self.ti_autolink.GetValue() # Auto-Link executables to be linked self.Executables = BasicFileList(pnl_autolink, size=(200, 200), hlExe=True, name=u'al list') # Auto-Link import, generate and remove buttons btn_al_import = CreateButton(pnl_autolink, btnid.IMPORT) btn_al_remove = CreateButton(pnl_autolink, btnid.REMOVE) btn_al_generate = CreateButton(pnl_autolink, image=u'build') # Auto-Link help btn_help = CreateButton(pnl_autolink, btnid.HELP, size=64) # Initialize script display self.ScriptSelect(None) SetPageToolTips(self) # *** Event Handling *** # for DS, RB in self.script_objects: wx.EVT_RADIOBUTTON(RB, RB.GetId(), self.ScriptSelect) wx.EVT_BUTTON(btn_al_import, btnid.IMPORT, self.ImportExes) wx.EVT_BUTTON(btn_al_generate, wx.ID_ANY, self.OnGenerate) wx.EVT_BUTTON(btn_al_remove, btnid.REMOVE, self.ImportExes) wx.EVT_BUTTON(btn_help, btnid.HELP, self.OnHelpButton) # *** Layout *** # # Organizing radio buttons lyt_sel_script = BoxSizer(wx.HORIZONTAL) lyt_sel_script.AddMany(( (rb_preinst), (rb_postinst), (rb_prerm), (rb_postrm), )) # Sizer for left half of scripts panel lyt_left = BoxSizer(wx.VERTICAL) lyt_left.Add(lyt_sel_script, 0, wx.EXPAND|wx.BOTTOM, 5) for DS, RB in self.script_objects: lyt_left.Add(DS, 1, wx.EXPAND) # Auto-Link/Right side lyt_ti_autolink = BoxSizer(wx.HORIZONTAL) lyt_ti_autolink.Add(txt_autolink, 0, lyt.ALGN_C) lyt_ti_autolink.Add(self.ti_autolink, 1, lyt.ALGN_C) lyt_btn_autolink = BoxSizer(wx.HORIZONTAL) lyt_btn_autolink.Add(btn_al_import, 0) lyt_btn_autolink.Add(btn_al_remove, 0, lyt.PAD_LR, 5) lyt_btn_autolink.Add(btn_al_generate, 0) lyt_autolink = BoxSizer(wx.VERTICAL) lyt_autolink.Add(lyt_ti_autolink, 0, wx.EXPAND|lyt.PAD_LRT, 5) lyt_autolink.Add(self.Executables, 3, wx.EXPAND|lyt.PAD_LRT, 5) lyt_autolink.Add(lyt_btn_autolink, 0, lyt.ALGN_CH) lyt_autolink.Add(btn_help, 1, lyt.ALGN_C) pnl_autolink.SetSizer(lyt_autolink) pnl_autolink.SetAutoLayout(True) pnl_autolink.Layout() # Sizer for right half of scripts panel lyt_right = BoxSizer(wx.VERTICAL) # Line up panels to look even lyt_right.AddSpacer(44) lyt_right.Add(wx.StaticText(self, label=GT(u'Auto-Link Executables')), 0, lyt.ALGN_LB) lyt_right.Add(pnl_autolink, 0, wx.EXPAND) lyt_main = BoxSizer(wx.HORIZONTAL) lyt_main.Add(lyt_left, 1, wx.EXPAND|wx.ALL, 5) lyt_main.Add(lyt_right, 0, wx.ALL, 5) self.SetAutoLayout(True) self.SetSizer(lyt_main) self.Layout()
def ShowManagePanel(self): # "Manage" mode -- i.e., the collection has already been shared self.Bind(wx.EVT_BUTTON, self.OnManageDone, id=wx.ID_OK) self.Bind(wx.EVT_BUTTON, self.OnCancel, id=wx.ID_CANCEL) self.Bind(wx.EVT_BUTTON, self.OnCopy, id=wx.xrc.XRCID("BUTTON_CLIPBOARD")) self.Bind(wx.EVT_BUTTON, self.OnUnPubSub, id=wx.xrc.XRCID("BUTTON_UNPUBLISH")) name = self.collection.displayName wx.xrc.XRCCTRL(self, "TEXT_MANAGE_COLLNAME").SetLabel(name) name = self.shareXML.conduit.account.displayName wx.xrc.XRCCTRL(self, "TEXT_ACCOUNT").SetLabel(name) url = self.shareXML.conduit.getLocation() wx.xrc.XRCCTRL(self, "TEXT_URL").SetLabel(url) self.UnPubSub = wx.xrc.XRCCTRL(self, "BUTTON_UNPUBLISH") share = Sharing.getShare(self.collection) if Sharing.isSharedByMe(share): self.UnPubSub.SetLabel("Unpublish") else: self.UnPubSub.SetLabel("Unsubscribe") # Controls for managing filtered shares: self.RadioItems = wx.xrc.XRCCTRL(self, "RADIO_ITEMS") self.RadioItemsHidden = wx.xrc.XRCCTRL(self, "RADIO_ITEMS_HIDDEN") self.RadioItemsHidden.Hide() wx.EVT_RADIOBUTTON(self.RadioItems, self.RadioItems.GetId(), self.OnAllItemsClicked) self.CheckboxMail = wx.xrc.XRCCTRL(self, "CHECK_MAIL") wx.EVT_CHECKBOX(self.CheckboxMail, self.CheckboxMail.GetId(), self.OnFilterClicked) self.CheckboxTasks = wx.xrc.XRCCTRL(self, "CHECK_TASKS") wx.EVT_CHECKBOX(self.CheckboxTasks, self.CheckboxTasks.GetId(), self.OnFilterClicked) self.CheckboxEvents = wx.xrc.XRCCTRL(self, "CHECK_EVENTS") wx.EVT_CHECKBOX(self.CheckboxEvents, self.CheckboxEvents.GetId(), self.OnFilterClicked) self.CheckboxShareAlarms = wx.xrc.XRCCTRL(self, "CHECKBOX_ALARMS") self.CheckboxShareAlarms.Enable(False) self.CheckboxShareStatus = wx.xrc.XRCCTRL(self, "CHECKBOX_STATUS") self.CheckboxShareStatus.Enable(False) self.filterKinds = self.shareXML.filterKinds self._loadKindFilterState() self._loadAttributeFilterState(self.shareXML) self.SetDefaultItem(wx.xrc.XRCCTRL(self, "wxID_OK"))
def _init_ctrls(self, prnt): # generated method, don't edit wx.Panel.__init__(self, id=wxID_PARTICLEPLOTSGUI, name='', parent=prnt, pos=wx.Point(428, 291), size=wx.Size(479, 227), style=wx.TAB_TRAVERSAL) self._init_utils() self.SetClientSize(wx.Size(471, 203)) self.ppxy = wx.Button(id=wxID_PARTICLEPLOTSGUIPPXY, label='ppxy', name='ppxy', parent=self, pos=wx.Point(8, 8), size=wx.Size(56, 22), style=0) self.ppxy.SetHelpText('Make x-y plot') self.ppxy.SetToolTipString('Plots x-y') wx.EVT_BUTTON(self.ppxy, wxID_PARTICLEPLOTSGUIPPXY, self.OnPpxyButton) self.ppxxp = wx.Button(id=wxID_PARTICLEPLOTSGUIPPXXP, label='ppxxp', name='ppxxp', parent=self, pos=wx.Point(72, 8), size=wx.Size(56, 22), style=0) self.ppxxp.SetToolTipString("Plots x-x'") self.ppxxp.SetHelpText("Plots x-x'") wx.EVT_BUTTON(self.ppxxp, wxID_PARTICLEPLOTSGUIPPXXP, self.OnPpxxpButton) self.ppyyp = wx.Button(id=wxID_PARTICLEPLOTSGUIPPYYP, label='ppyyp', name='ppyyp', parent=self, pos=wx.Point(8, 40), size=wx.Size(56, 22), style=0) self.ppyyp.SetToolTipString("Plots y-y'") self.ppyyp.SetHelpText("Plots y-y'") wx.EVT_BUTTON(self.ppyyp, wxID_PARTICLEPLOTSGUIPPYYP, self.OnPpyypButton) self.ppxpyp = wx.Button(id=wxID_PARTICLEPLOTSGUIPPXPYP, label='ppxpyp', name='ppxpyp', parent=self, pos=wx.Point(72, 40), size=wx.Size(56, 22), style=0) self.ppxpyp.SetToolTipString("Plots x'-y'") self.ppxpyp.SetHelpText("Plots x'-y'") wx.EVT_BUTTON(self.ppxpyp, wxID_PARTICLEPLOTSGUIPPXPYP, self.OnPpxpypButton) self.pptrace = wx.Button(id=wxID_PARTICLEPLOTSGUIPPTRACE, label='pptrace', name='pptrace', parent=self, pos=wx.Point(8, 72), size=wx.Size(120, 22), style=0) self.pptrace.SetToolTipString('Plots trace-space') self.pptrace.SetHelpText('Plots trace-space') wx.EVT_BUTTON(self.pptrace, wxID_PARTICLEPLOTSGUIPPTRACE, self.OnPptraceButton) self.izslider = wx.Slider(id=wxID_PARTICLEPLOTSGUIIZSLIDER, maxValue=100, minValue=0, name='izslider', parent=self, pos=wx.Point(115, 104), size=wx.Size(172, 35), style=wx.SL_LABELS | wx.SL_AUTOTICKS | wx.SL_HORIZONTAL, validator=wx.DefaultValidator, value=0) self.izslider.SetLabel('iz') self.izslider.SetToolTipString('Grid location') wx.EVT_LEFT_UP(self.izslider, self.OnIzsliderLeftUp) self.plotchoice = wx.Choice(choices=['iw', 'iz', 'iy', 'ix'], id=wxID_PARTICLEPLOTSGUIPLOTCHOICE, name='plotchoice', parent=self, pos=wx.Point(8, 112), size=wx.Size(60, 21), style=0, validator=wx.DefaultValidator) self.plotchoice.SetToolTipString('Choose plot location') wx.EVT_CHOICE(self.plotchoice, wxID_PARTICLEPLOTSGUIPLOTCHOICE, self.OnPlotchoiceChoice) self.Contours = wx.RadioButton(id=wxID_PARTICLEPLOTSGUICONTOURS, label='Contours', name='Contours', parent=self, pos=wx.Point(354, 24), size=wx.Size(94, 24), style=0) self.Contours.SetValue(true) self.Contours.SetToolTipString('Selects contour plots') wx.EVT_RADIOBUTTON(self.Contours, wxID_PARTICLEPLOTSGUICONTOURS, self.OnContoursRadiobutton) self.Density = wx.RadioButton(id=wxID_PARTICLEPLOTSGUIDENSITY, label='Density', name='Density', parent=self, pos=wx.Point(354, 40), size=wx.Size(94, 24), style=0) self.Density.SetValue(false) self.Density.SetToolTipString('Selects density color plots') wx.EVT_RADIOBUTTON(self.Density, wxID_PARTICLEPLOTSGUIDENSITY, self.OnDensityRadiobutton) self.Cellarray = wx.RadioButton(id=wxID_PARTICLEPLOTSGUICELLARRAY, label='Cellarray', name='Cellarray', parent=self, pos=wx.Point(354, 56), size=wx.Size(94, 24), style=0) self.Cellarray.SetValue(false) self.Cellarray.SetToolTipString('Selects density cellarray plots') wx.EVT_RADIOBUTTON(self.Cellarray, wxID_PARTICLEPLOTSGUICELLARRAY, self.OnCellarrayRadiobutton) self.Surface = wx.RadioButton(id=wxID_PARTICLEPLOTSGUISURFACE, label='Surface', name='Surface', parent=self, pos=wx.Point(354, 72), size=wx.Size(94, 24), style=0) self.Surface.SetValue(false) self.Surface.SetToolTipString('Selects surface plots') wx.EVT_RADIOBUTTON(self.Surface, wxID_PARTICLEPLOTSGUISURFACE, self.OnSurfaceRadiobutton) self.Palette = wx.Choice(choices=["earth", "rainbow", "gray", "yarg", "heat", "ncar", "cool", "rainbowaf", "stern", "christmas"], id=wxID_PARTICLEPLOTSGUIPALETTE, name='Palette', parent=self, pos=wx.Point(354, 96), size=wx.Size(112, 21), style=0, validator=wx.DefaultValidator) self.Palette.SetToolTipString('Selects palette') wx.EVT_CHOICE(self.Palette, wxID_PARTICLEPLOTSGUIPALETTE, self.OnPaletteChoice) self.Particles = wx.RadioButton(id=wxID_PARTICLEPLOTSGUIPARTICLES, label='Particles', name='Particles', parent=self, pos=wx.Point(354, 8), size=wx.Size(72, 24), style=0) self.Particles.SetValue(true) self.Particles.SetToolTipString('Selects particles plots') wx.EVT_RADIOBUTTON(self.Particles, wxID_PARTICLEPLOTSGUIPARTICLES, self.OnParticlesRadiobutton) self.PlotRefresh = wx.CheckBox(id=wxID_PARTICLEPLOTSGUIPLOTREFRESH, label='Refresh on Change', name='PlotRefresh', parent=self, pos=wx.Point(8, 144), size=wx.Size(128, 24), style=0) self.PlotRefresh.SetValue(false) self.PlotRefresh.SetToolTipString('Plot will refresh on change') wx.EVT_CHECKBOX(self.PlotRefresh, wxID_PARTICLEPLOTSGUIPLOTREFRESH, self.OnPlotrefreshCheckbox) self.staticLine1 = wx.StaticLine(id=wxID_PARTICLEPLOTSGUISTATICLINE1, name='staticLine1', parent=self, pos=wx.Point(136, 0), size=wx.Size(2, 104), style=wx.LI_VERTICAL) self.staticLine2 = wx.StaticLine(id=wxID_PARTICLEPLOTSGUISTATICLINE2, name='staticLine2', parent=self, pos=wx.Point(344, -8), size=wx.Size(2, 208), style=wx.LI_VERTICAL) self.staticLine3 = wx.StaticLine(id=wxID_PARTICLEPLOTSGUISTATICLINE3, name='staticLine3', parent=self, pos=wx.Point(0, 140), size=wx.Size(346, 2), style=wx.LI_HORIZONTAL) self.staticLine5 = wx.StaticLine(id=wxID_PARTICLEPLOTSGUISTATICLINE5, name='staticLine5', parent=self, pos=wx.Point(0, 104), size=wx.Size(344, 2), style=wx.LI_HORIZONTAL) self.ppzx = wx.Button(id=wxID_PARTICLEPLOTSGUIPPZX, label='ppzx', name='ppzx', parent=self, pos=wx.Point(144, 8), size=wx.Size(56, 22), style=0) self.ppzx.SetToolTipString('Plots z-x') wx.EVT_BUTTON(self.ppzx, wxID_PARTICLEPLOTSGUIPPZX, self.OnPpzxButton) self.ppzxp = wx.Button(id=wxID_PARTICLEPLOTSGUIPPZXP, label='ppzxp', name='ppzxp', parent=self, pos=wx.Point(144, 40), size=wx.Size(56, 22), style=0) self.ppzxp.SetToolTipString("Plots z-x'") wx.EVT_BUTTON(self.ppzxp, wxID_PARTICLEPLOTSGUIPPZXP, self.OnPpzxpButton) self.ppzyp = wx.Button(id=wxID_PARTICLEPLOTSGUIPPZYP, label='ppzyp', name='ppzyp', parent=self, pos=wx.Point(208, 40), size=wx.Size(56, 22), style=0) self.ppzyp.SetToolTipString("Plots z-y'") wx.EVT_BUTTON(self.ppzyp, wxID_PARTICLEPLOTSGUIPPZYP, self.OnPpzypButton) self.ppzy = wx.Button(id=wxID_PARTICLEPLOTSGUIPPZY, label='ppzy', name='ppzy', parent=self, pos=wx.Point(208, 8), size=wx.Size(56, 22), style=0) self.ppzy.SetToolTipString('Plots z-y') wx.EVT_BUTTON(self.ppzy, wxID_PARTICLEPLOTSGUIPPZY, self.OnPpzyButton) self.fmabeforeplot = wx.CheckBox(id=wxID_PARTICLEPLOTSGUIFMABEFOREPLOT, label='Frame Advance before plot', name='fmabeforeplot', parent=self, pos=wx.Point(8, 168), size=wx.Size(184, 24), style=0) self.fmabeforeplot.SetValue(true) self.fmabeforeplot.SetToolTipString('When checked, do frame advance before each plot') wx.EVT_CHECKBOX(self.fmabeforeplot, wxID_PARTICLEPLOTSGUIFMABEFOREPLOT, self.OnFmabeforeplotCheckbox) self.staticLine7 = wx.StaticLine(id=wxID_PARTICLEPLOTSGUISTATICLINE7, name='staticLine7', parent=self, pos=wx.Point(272, 0), size=wx.Size(2, 104), style=0) self.ppxyz = wx.Button(id=wxID_PARTICLEPLOTSGUIPPXYZ, label='ppxyz', name='ppxyz', parent=self, pos=wx.Point(280, 8), size=wx.Size(56, 22), style=0) wx.EVT_BUTTON(self.ppxyz, wxID_PARTICLEPLOTSGUIPPXYZ, self.OnPpxyzButton) self.ppxyz_v = wx.Button(id=wxID_PARTICLEPLOTSGUIPPXYZ_V, label='ppxyz-v', name='ppxyz_v', parent=self, pos=wx.Point(280, 40), size=wx.Size(56, 22), style=0) wx.EVT_BUTTON(self.ppxyz_v, wxID_PARTICLEPLOTSGUIPPXYZ_V, self.OnPpxyz_vButton)
def __init__(self, parent): WizardPage.__init__(self, parent, pgid.FILES) # *** Left Panel *** # pnl_treeopts = BorderedPanel(self) self.chk_individuals = CheckBoxCFG(pnl_treeopts, label=GT(u'List files individually'), name=u'individually', cfgSect=u'FILES') self.chk_preserve_top = CheckBoxCFG(pnl_treeopts, chkid.TOPLEVEL, GT(u'Preserve top-level directories'), name=u'top-level', cfgSect=u'FILES') self.chk_nofollow_symlink = CheckBoxCFG(pnl_treeopts, chkid.SYMLINK, GT(u'Don\'t follow symbolic links'), defaultValue=True, name=u'nofollow-symlink', cfgSect=u'FILES') self.tree_dirs = DirectoryTreePanel(self, size=(300,20)) # ----- Target path pnl_target = BorderedPanel(self) # choices of destination rb_bin = wx.RadioButton(pnl_target, label=u'/bin', style=wx.RB_GROUP) rb_usrbin = wx.RadioButton(pnl_target, label=u'/usr/bin') rb_usrlib = wx.RadioButton(pnl_target, label=u'/usr/lib') rb_locbin = wx.RadioButton(pnl_target, label=u'/usr/local/bin') rb_loclib = wx.RadioButton(pnl_target, label=u'/usr/local/lib') self.rb_custom = wx.RadioButton(pnl_target, inputid.CUSTOM, GT(u'Custom')) self.rb_custom.Default = True # Start with "Custom" selected self.rb_custom.SetValue(self.rb_custom.Default) # group buttons together # FIXME: Unnecessary??? self.grp_targets = ( rb_bin, rb_usrbin, rb_usrlib, rb_locbin, rb_loclib, self.rb_custom, ) # ----- Add/Remove/Clear buttons btn_add = CreateButton(self, btnid.ADD) btn_remove = CreateButton(self, btnid.REMOVE) btn_clear = CreateButton(self, btnid.CLEAR) self.prev_dest_value = u'/usr/bin' self.ti_target = TextArea(self, defaultValue=self.prev_dest_value, name=u'target') self.btn_browse = CreateButton(self, btnid.BROWSE) btn_refresh = CreateButton(self, btnid.REFRESH) # Display area for files added to list self.lst_files = FileListESS(self, inputid.LIST, name=u'filelist') # *** Event Handling *** # # create an event to enable/disable custom widget for item in self.grp_targets: wx.EVT_RADIOBUTTON(item, wx.ID_ANY, self.OnSetDestination) # Context menu events for directory tree wx.EVT_MENU(self, wx.ID_ADD, self.OnImportFromTree) # Button events btn_add.Bind(wx.EVT_BUTTON, self.OnImportFromTree) btn_remove.Bind(wx.EVT_BUTTON, self.OnRemoveSelected) btn_clear.Bind(wx.EVT_BUTTON, self.OnClearFileList) self.btn_browse.Bind(wx.EVT_BUTTON, self.OnBrowse) btn_refresh.Bind(wx.EVT_BUTTON, self.OnRefreshFileList) # ???: Not sure what these do wx.EVT_KEY_DOWN(self.ti_target, self.GetDestValue) wx.EVT_KEY_UP(self.ti_target, self.CheckDest) # Key events for file list wx.EVT_KEY_DOWN(self.lst_files, self.OnRemoveSelected) self.Bind(wx.EVT_DROP_FILES, self.OnDropFiles) # *** Layout *** # lyt_treeopts = BoxSizer(wx.VERTICAL) lyt_treeopts.AddSpacer(5) lyt_treeopts.Add(self.chk_individuals, 0, lyt.PAD_LR, 5) lyt_treeopts.Add(self.chk_preserve_top, 0, lyt.PAD_LR, 5) lyt_treeopts.Add(self.chk_nofollow_symlink, 0, lyt.PAD_LR, 5) lyt_treeopts.AddSpacer(5) pnl_treeopts.SetSizer(lyt_treeopts) lyt_left = BoxSizer(wx.VERTICAL) lyt_left.AddSpacer(10) lyt_left.Add(wx.StaticText(self, label=GT(u'Directory options')), 0, wx.ALIGN_BOTTOM) lyt_left.Add(pnl_treeopts, 0, wx.EXPAND|wx.ALIGN_LEFT|wx.BOTTOM, 5) lyt_left.Add(self.tree_dirs, 1, wx.EXPAND) lyt_target = wx.GridSizer(3, 2, 5, 5) for item in self.grp_targets: lyt_target.Add(item, 0, lyt.PAD_LR, 5) pnl_target.SetAutoLayout(True) pnl_target.SetSizer(lyt_target) pnl_target.Layout() # Put text input in its own sizer to force expand lyt_input = BoxSizer(wx.HORIZONTAL) lyt_input.Add(self.ti_target, 1, wx.ALIGN_CENTER_VERTICAL) lyt_buttons = BoxSizer(wx.HORIZONTAL) lyt_buttons.Add(btn_add, 0) lyt_buttons.Add(btn_remove, 0) lyt_buttons.Add(btn_clear, 0) lyt_buttons.Add(lyt_input, 1, wx.ALIGN_CENTER_VERTICAL) lyt_buttons.Add(self.btn_browse, 0) lyt_buttons.Add(btn_refresh, 0) lyt_right = BoxSizer(wx.VERTICAL) lyt_right.AddSpacer(10) lyt_right.Add(wx.StaticText(self, label=GT(u'Target'))) lyt_right.Add(pnl_target, 0, wx.TOP, 5) lyt_right.Add(lyt_buttons, 0, wx.EXPAND) lyt_right.Add(self.lst_files, 5, wx.EXPAND|wx.TOP, 5) PROP_LEFT = 0 PROP_RIGHT = 1 lyt_main = wx.FlexGridSizer(1, 2) lyt_main.AddGrowableRow(0) # Directory tree size issues with wx 2.8 if wx.MAJOR_VERSION <= 2: PROP_LEFT = 1 lyt_main.AddGrowableCol(0, 1) lyt_main.AddGrowableCol(1, 2) lyt_main.Add(lyt_left, PROP_LEFT, wx.EXPAND|lyt.PAD_LR|wx.BOTTOM, 5) lyt_main.Add(lyt_right, PROP_RIGHT, wx.EXPAND|lyt.PAD_RB, 5) self.SetAutoLayout(True) self.SetSizer(lyt_main) self.Layout() SetPageToolTips(self)
def __init__(self, parent, id, pos=wxDefaultPosition, size=wxDefaultSize, style=wx.TAB_TRAVERSAL): wx.Panel.__init__(self, parent, id, pos, size, style) # if we are not inside gnumed we won't get a definite answer on # who and where we are. in this case try to get config source # from main config file (see gmCfg on how the name of this file # is determined # this is necessary to enable stand alone use of the drug browser currworkplace = gmPraxis.gmCurrentPraxisBranch().active_workplace if currworkplace is None: # assume we are outside gnumed self.dbName = _cfg.get('DrugReferenceBrowser', 'drugDBname') else: self.dbName, match = gmCfg.getDBParam( currworkplace, option="DrugReferenceBrowser.drugDBName") if self.dbName is None: if __name__ == '__main__': title = _('Starting drug data browser') msg = _( 'Cannot start the drug data browser.\n\n' 'There is no drug database specified in the configuration.' ) gmGuiHelpers.gm_show_error(msg, title) _log.Log(gmLog.lErr, "No drug database specified. Aborting drug browser.") # FIXME: we shouldn't directly call Close() on the parent # parent.Close() raise gmExceptions.ConstructorError, "No drug database specified" # initialize interface to drug database. # this will fail if backend or config files are not available try: self.mDrugView = gmDrugView.DrugView(self.dbName) except Exception: _log.LogException("Unhandled exception during DrugView API init.", sys.exc_info(), verbose=0) raise gmExceptions.ConstructorError, "Couldn't initialize DrugView API" # return None self.mode = MODE_PRODUCT self.previousMode = MODE_PRODUCT self.printer = wx.HtmlEasyPrinting( ) #printer object to print html page self.mId = None self.drugProductInfo = None self.__mListCtrlItems = { } # array holding data on every row in the list #------------------------------------------------------------- # These things build the physical window that you see when # the program boots. They each refer to a subroutine that # is listed below by the same name eg def Menus_Create(self) #------------------------------------------------------------- self.GuiElements_Init() # add main gui elements self.inDisplay_PI = 0 # first we display a drug list, not product info self.GetDrugIssue() # ? #-------------------------------------------------------------- # handler declarations for DrugDisplay # note handlers for menu in Menus_Create() #-------------------------------------------------------------- wx.EVT_BUTTON(self, ID_BUTTON_PRINT, self.OnPrint) wx.EVT_BUTTON(self, ID_BUTTON_DISPLAY, self.OnDisplay) wx.EVT_BUTTON(self, ID_BUTTON_PRESCRIBE, self.OnPrescribe) wx.EVT_LISTBOX_DCLICK(self, ID_LISTBOX_JUMPTO, self.OnJumpToDblClick) wx.EVT_LISTBOX(self, ID_LISTBOX_JUMPTO, self.OnJumpToSelected) wx.EVT_LIST_ITEM_ACTIVATED(self, ID_LISTCTRL_DRUGCHOICE, self.OnDrugChoiceDblClick) wx.EVT_RADIOBUTTON(self, ID_RADIOBUTTON_BYINDICATION, self.OnSearchByIndication) wx.EVT_RADIOBUTTON(self, ID_RADIOBUTTON_BYGENERIC, self.OnSearchByGeneric) wx.EVT_RADIOBUTTON(self, ID_RADIOBUTTON_BYPRODUCT, self.OnSearchByProduct) wx.EVT_RADIOBUTTON(self, ID_RADIOBUTTON_BYANY, self.OnSearchByAny) wx.EVT_TEXT(self, ID_COMBO_PRODUCT, self.OnProductKeyPressed) wx.EVT_COMBOBOX(self, ID_COMBO_PRODUCT, self.OnProductSelected) wx.EVT_BUTTON(self, wxID_OK, self.OnOk) wx.EVT_BUTTON(self, wxID_CANCEL, self.OnCancel) wx.EVT_BUTTON(self, ID_BUTTON_BOOKMARK, self.OnBookmark)
def __build(self): """ Build import dialog. Overall layout: [Intro text] Certificate file: [------------------------------] [Browse] Certificate name: [static text for name] [Private key text] [X] Load private key from certificate file. [X] Load private key from separate file. Private key file: [--------------------------] [ Browse ] ------ [Import] [Cancel] """ topsizer = wx.BoxSizer(wx.VERTICAL) # # Introductory text. # introText = """Enter the pathname to your identity certificate below, or use the Browse button to browse to it. """ intro = wx.StaticText(self, -1, introText) topsizer.Add(intro, 0, wx.EXPAND) # # Certificate file browser # self.certWidget = FileLocationWidget(self, "Certificate file", "Certificate file: ", [("PEM files (*.pem)", "*.pem"), ("All files", "*")], self.OnCertSelect) topsizer.Add(self.certWidget, 0, wx.EXPAND | wx.ALL, 3) # # Cert name. # hb = wx.BoxSizer(wx.HORIZONTAL) topsizer.Add(hb, 0, wx.EXPAND) hb.Add(wx.StaticText(self, -1, "Certificate name: "), 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 3) self.certName = wx.StaticText(self, -1, "") hb.Add(self.certName, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 3) # # Separate from PK stuff. # topsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 4) # # Private key text. # pkText = """\ Enter the filename of the private key for this identity certificate below, or use the Browse button to browse for it. The private key may be included in the certificate file. """ sp = wx.StaticText(self, -1, pkText) topsizer.Add(sp, 0, wx.EXPAND) # # Private key box. # # Two radio buttons, plus another text/textctrl/browse button. # self.pkCertRadioButton = rb1 = wx.RadioButton( self, -1, "Load private key from certificate file", style=wx.RB_GROUP) self.pkFileRadioButton = rb2 = wx.RadioButton( self, -1, "Load private key from separate file") wx.EVT_RADIOBUTTON(self, rb1.GetId(), lambda event, self=self: self.SetRequirePKFile(0)) wx.EVT_RADIOBUTTON(self, rb2.GetId(), lambda event, self=self: self.SetRequirePKFile(1)) topsizer.Add(rb1, 0, wx.EXPAND | wx.ALL, 3) topsizer.Add(rb2, 0, wx.EXPAND | wx.ALL, 3) self.pkWidget = FileLocationWidget(self, "Private key file", "Private key file: ", [("PEM files (*.pem)", "*.pem"), ("All files", "*")], self.OnPKSelect) topsizer.Add(self.pkWidget, 0, wx.EXPAND | wx.ALL, 3) # # Import/Cancel buttons # hb = wx.BoxSizer(wx.HORIZONTAL) b = wx.Button(self, -1, "Import") wx.EVT_BUTTON(self, b.GetId(), self.OnImport) hb.Add(b, 0, wx.ALL, 3) b = wx.Button(self, -1, "Cancel") wx.EVT_BUTTON(self, b.GetId(), lambda event, self=self: self.EndModal(wx.ID_CANCEL)) hb.Add(b, 0, wx.ALL, 3) topsizer.Add(hb, 0, wx.ALIGN_RIGHT) # # Default to using file. # self.SetRequirePKFile(1) # # done with gui setup. # self.SetSizer(topsizer) self.SetAutoLayout(1) self.Fit()
def __build(self): """ Build import dialog. Overall layout: [Intro text] Certificate file: [------------------------------] [Browse] Certificate name: [static text for name] [Signing policy text] [X] Create signing policy from certificate [X] Create signing policy from file Signing policy file: [--------------------------] [ Browse ] ------ [Import] [Cancel] We force the two static text strings on the file lines to be the same size so it's not too ugly. """ topsizer = wx.BoxSizer(wx.VERTICAL) # # Create these and make them align in size. # static1 = wx.StaticText(self, -1, "Certificate file:") static2 = wx.StaticText(self, -1, "Signing policy file:") s1 = static1.GetSize() s2 = static2.GetSize() print "S1=%s S2=%s" % (s1, s2) if s1.GetWidth() > s2.GetWidth(): s2.SetWidth(s1.GetWidth()) static2.SetSize(s2) print "Force s2 to be ", s2 else: s1.SetWidth(s2.GetWidth()) static1.SetSize(s1) print "Force s1 to be ", s1 # # Introductory text. # introText = """Enter the pathname to the CA certificate below, or use the Browse button to browse to it. """ intro = wx.StaticText(self, -1, introText) topsizer.Add(intro, 0, wx.EXPAND) # # Certificate file browser # hb = wx.BoxSizer(wx.HORIZONTAL) topsizer.Add(hb, 0, wx.EXPAND) hb.Add(static1, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 3) self.certFileText = wx.TextCtrl(self, -1, style=wx.TE_PROCESS_ENTER) hb.Add(self.certFileText, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 3) wx.EVT_TEXT_ENTER(self, self.certFileText.GetId(), self.OnCertFileEnter) b = wx.Button(self, -1, "Browse") hb.Add(b, 0, wx.ALL, 3) wx.EVT_BUTTON(self, b.GetId(), self.OnCertBrowse) # # Cert name. # hb = wx.BoxSizer(wx.HORIZONTAL) topsizer.Add(hb, 0, wx.EXPAND) hb.Add(wx.StaticText(self, -1, "Certificate name: "), 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 3) self.certName = wx.StaticText(self, -1, "") hb.Add(self.certName, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 3) # # Separate from SP stuff. # topsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 4) # # Signing policy text. # spText = """\ Enter the filename of the signing policy for this CA certificate below, or use the Browse button to browse for it. Alternatively, it may be possible to construct the signing policy from the CA certificate. """ sp = wx.StaticText(self, -1, spText) topsizer.Add(sp, 0, wx.EXPAND) # # Signing policy box # # Two radio buttons, plus another text/textctrl/browse button. # rb1 = wx.RadioButton(self, -1, "Construct from certificate", style=wx.RB_GROUP) wx.EVT_RADIOBUTTON( self, rb1.GetId(), lambda event, self=self: self.setSPMode(self.SPConstruct)) self.fileRadioButton = rb2 = wx.RadioButton(self, -1, "Import from file") wx.EVT_RADIOBUTTON( self, rb2.GetId(), lambda event, self=self: self.setSPMode(self.SPFile)) topsizer.Add(rb1, 0, wx.EXPAND | wx.ALL, 3) topsizer.Add(rb2, 0, wx.EXPAND | wx.ALL, 3) # # Hsizer hb for the text label, file location, and browse button # hb = wx.BoxSizer(wx.HORIZONTAL) topsizer.Add(hb, 0, wx.EXPAND | wx.ALL, 3) hb.Add(static2, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 3) self.signingPolicyFileText = wx.TextCtrl(self, -1, style=wx.TE_PROCESS_ENTER) wx.EVT_TEXT_ENTER(self, self.signingPolicyFileText.GetId(), self.OnSPFileEnter) self.signingPolicyBrowseButton = b = wx.Button(self, -1, "Browse") wx.EVT_BUTTON(self, b.GetId(), self.OnSigningPolicyBrowse) hb.Add(self.signingPolicyFileText, 1, wx.ALL | wx.EXPAND, 3) hb.Add(b, 0, wx.ALL, 3) # # and a hbox with signing policy's CA name. # hb = wx.BoxSizer(wx.HORIZONTAL) topsizer.Add(hb, 0, wx.EXPAND) hb.Add(wx.StaticText(self, -1, "Signing policy for CA: "), 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 3) self.spName = wx.StaticText(self, -1, "") hb.Add(self.spName, 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 3) # # Import/Cancel buttons # hb = wx.BoxSizer(wx.HORIZONTAL) b = wx.Button(self, -1, "Import") wx.EVT_BUTTON(self, b.GetId(), self.OnImport) hb.Add(b, 0, wx.ALL, 3) b = wx.Button(self, -1, "Cancel") wx.EVT_BUTTON(self, b.GetId(), lambda event, self=self: self.EndModal(wx.ID_CANCEL)) hb.Add(b, 0, wx.ALL, 3) topsizer.Add(hb, 0, wx.ALIGN_RIGHT) # # Default to using file. # self.setSPMode(self.SPFile) # # done with gui setup. # self.SetSizer(topsizer) self.SetAutoLayout(1) self.Fit()
def __init__(self, filename, *args, **kwargs): super(CSVImportOptionsPage, self).__init__(*args, **kwargs) self.delimiter = wx.Choice(self, wx.ID_ANY) self.delimiter.Append(_('Comma')) self.delimiter.Append(_('Tab')) self.delimiter.Append(_('Space')) self.delimiter.Append(_('Colon')) self.delimiter.Append(_('Semicolon')) self.delimiter.Append(_('Pipe')) self.delimiter.SetSelection(0) self.date = wx.Choice(self) self.date.Append(_('DD/MM (day first)')) self.date.Append(_('MM/DD (month first)')) self.date.SetSelection(0) self.quoteChar = wx.Choice(self, wx.ID_ANY) self.quoteChar.Append(_('Simple quote')) self.quoteChar.Append(_('Double quote')) self.quoteChar.SetSelection(1) self.quotePanel = wx.Panel(self, wx.ID_ANY) self.doubleQuote = wx.RadioButton(self.quotePanel, wx.ID_ANY, _('Double it')) self.doubleQuote.SetValue(True) self.escapeQuote = wx.RadioButton(self.quotePanel, wx.ID_ANY, _('Escape with')) self.escapeChar = wx.TextCtrl(self.quotePanel, wx.ID_ANY, '\\', size=(50, -1)) self.escapeChar.Enable(False) self.escapeChar.SetMaxLength(1) hsizer = wx.BoxSizer(wx.HORIZONTAL) hsizer.Add(self.doubleQuote, 1, wx.ALL, 3) hsizer.Add(self.escapeQuote, 1, wx.ALL, 3) hsizer.Add(self.escapeChar, 1, wx.ALL, 3) self.quotePanel.SetSizer(hsizer) self.importSelectedRowsOnly = wx.CheckBox( self, wx.ID_ANY, _('Import only the selected rows')) self.importSelectedRowsOnly.SetValue(False) self.hasHeaders = wx.CheckBox(self, wx.ID_ANY, _('First line describes fields')) self.hasHeaders.SetValue(True) self.grid = gridlib.Grid(self) self.grid.SetRowLabelSize(0) self.grid.SetColLabelSize(0) self.grid.CreateGrid(0, 0) self.grid.EnableEditing(False) self.grid.SetSelectionMode(self.grid.wxGridSelectRows) vsizer = wx.BoxSizer(wx.VERTICAL) gridSizer = wx.FlexGridSizer(0, 2) gridSizer.Add(wx.StaticText(self, wx.ID_ANY, _('Delimiter')), 0, wx.ALIGN_CENTRE_VERTICAL | wx.ALL, 3) gridSizer.Add(self.delimiter, 0, wx.ALL, 3) gridSizer.Add(wx.StaticText(self, wx.ID_ANY, _('Date format')), 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 3) gridSizer.Add(self.date, 0, wx.ALL, 3) gridSizer.Add(wx.StaticText(self, wx.ID_ANY, _('Quote character')), 0, wx.ALIGN_CENTRE_VERTICAL | wx.ALL, 3) gridSizer.Add(self.quoteChar, 0, wx.ALL, 3) gridSizer.Add(wx.StaticText(self, wx.ID_ANY, _('Escape quote')), 0, wx.ALIGN_CENTRE_VERTICAL | wx.ALL, 3) gridSizer.Add(self.quotePanel, 0, wx.ALL, 3) gridSizer.Add(self.importSelectedRowsOnly, 0, wx.ALL, 3) gridSizer.Add((0, 0)) gridSizer.Add(self.hasHeaders, 0, wx.ALL, 3) gridSizer.Add((0, 0)) gridSizer.AddGrowableCol(1) vsizer.Add(gridSizer, 0, wx.EXPAND | wx.ALL, 3) vsizer.Add(self.grid, 1, wx.EXPAND | wx.ALL, 3) self.SetSizer(vsizer) self.headers = None self.filename = filename self.encoding = chardet.detect(file(filename, 'rb').read())['encoding'] self.OnOptionChanged(None) wx.EVT_CHOICE(self.delimiter, wx.ID_ANY, self.OnOptionChanged) wx.EVT_CHOICE(self.quoteChar, wx.ID_ANY, self.OnOptionChanged) wx.EVT_CHECKBOX(self.importSelectedRowsOnly, wx.ID_ANY, self.OnOptionChanged) wx.EVT_CHECKBOX(self.hasHeaders, wx.ID_ANY, self.OnOptionChanged) wx.EVT_RADIOBUTTON(self.doubleQuote, wx.ID_ANY, self.OnOptionChanged) wx.EVT_RADIOBUTTON(self.escapeQuote, wx.ID_ANY, self.OnOptionChanged) wx.EVT_TEXT(self.escapeChar, wx.ID_ANY, self.OnOptionChanged)
def __SwapDetailPanel(self, index): """ Given an index into the account list, store the current panel's (if any) contents to the data list, destroy current panel, determine type of panel to pull in, load it, populate it. """ if index == self.currentIndex: return if self.currentIndex != None: # Get current form data and tuck it away self.__StoreFormData(self.currentPanelType, self.currentPanel, self.data[self.currentIndex]['values']) self.accountsList.SetString( self.currentIndex, self.__GetDisplayName(self.currentIndex)) self.innerSizer.Detach(self.currentPanel) self.currentPanel.Hide() self.currentIndex = index self.currentPanelType = self.data[index]['type'] self.currentPanel = self.panels[self.currentPanelType] self.__FetchFormData(self.currentPanelType, self.currentPanel, self.data[index]['values']) self.innerSizer.Add(self.currentPanel, 0, wx.ALIGN_TOP | wx.ALL, 5) self.currentPanel.Show() self.innerSizer.Layout() self.outerSizer.Layout() self.outerSizer.SetSizeHints(self) self.outerSizer.Fit(self) # When a text field receives focus, call the handler. # When an exclusive radio button is clicked, call another handler. for field in PANELS[self.currentPanelType]['fields'].keys(): fieldInfo = PANELS[self.currentPanelType]['fields'][field] # This enables the clicking of a radio button to affect the value # of another field. In this case, the OnLinkedControl( ) method # will get called. if fieldInfo['type'] == "radioEnumeration": linkedTo = fieldInfo.get('linkedTo', None) if linkedTo is not None: for (button, value) in fieldInfo['buttons'].iteritems(): control = wx.xrc.XRCCTRL(self.currentPanel, button) wx.EVT_RADIOBUTTON(control, control.GetId(), self.OnLinkedControl) continue control = wx.xrc.XRCCTRL(self.currentPanel, field) if isinstance(control, wx.TextCtrl): wx.EVT_SET_FOCUS(control, self.OnFocusGained) elif isinstance(control, wx.RadioButton): # Set up the callback for an "exclusive" radio button, i.e., # one who when checked within one account will get unchecked # in all other accounts if fieldInfo.get('exclusive', False): try: # On GTK if you want to have a radio button which can # be set to False, you really need to create a second # radio button and set that guy's value to True, thus # setting the visible button to False: hidden = wx.xrc.XRCCTRL(self.currentPanel, "%s_HIDDEN" % field) hidden.Hide() except: pass wx.EVT_RADIOBUTTON(control, control.GetId(), self.OnExclusiveRadioButton) elif isinstance(control, wx.CheckBox): # This allows a checkbox to affect the value of another field linkedTo = fieldInfo.get('linkedTo', None) if linkedTo is not None: wx.EVT_CHECKBOX(control, control.GetId(), self.OnLinkedControl) # Hook up any other callbacks not tied to any fields, such as the # account testing buttons: for callbackReg in PANELS[self.currentPanelType].get('callbacks', ()): self.Bind(wx.EVT_BUTTON, getattr(self, callbackReg[1]), id=wx.xrc.XRCID(callbackReg[0]))
def __init__(self, parent, _): global widgets_list pb_editor.DirtyUIBase.__init__(self, parent) # overall container self._main_bs = wx.BoxSizer(wx.VERTICAL) # vertical sizebox & checkboxes for different repreat options hbs_1 = wx.BoxSizer(wx.HORIZONTAL) self._repeat_option_rb = wx.RadioBox(self, -1, "Repeat Types:", wx.DefaultPosition, wx.DefaultSize, self._repeat_options, 1, wx.RA_SPECIFY_COLS) widgets_list.append((self._repeat_option_rb, 'repeat')) wx.EVT_RADIOBOX(self, self._repeat_option_rb.GetId(), self.OnRepeatType) hbs_1.Add(self._repeat_option_rb, 0, wx.LEFT, 5) # daily options widgets self._option_bs = wx.BoxSizer(wx.VERTICAL) _box = wx.StaticBox(self, -1, 'Daily Options:') widgets_list.append((_box, 'repeat')) vbs = wx.StaticBoxSizer(_box, wx.VERTICAL) hbs = wx.BoxSizer(wx.HORIZONTAL) self._dl_every_nday = wx.RadioButton(self, -1, 'Every ', style=wx.RB_GROUP) self._dl_every_nday.SetValue(True) self._dl_every_wday = wx.RadioButton(self, -1, 'Every Weekday') wx.EVT_RADIOBUTTON(self, self._dl_every_nday.GetId(), self.OnDirtyUI) wx.EVT_RADIOBUTTON(self, self._dl_every_wday.GetId(), self.OnDirtyUI) hbs.Add(self._dl_every_nday, 0, wx.LEFT, 0) self._dl_interval = wx.TextCtrl(self, -1, '1') wx.EVT_TEXT(self, self._dl_interval.GetId(), self.OnDirtyUI) hbs.Add(self._dl_interval, 0, wx.LEFT, 0) hbs.Add(wx.StaticText(self, -1, ' day(s)'), 0, wx.LEFT, 0) vbs.Add(hbs, 0, wx.LEFT | wx.TOP, 10) vbs.Add(self._dl_every_wday, 0, wx.LEFT, 10) self._option_bs.Add(vbs, 0, wx.LEFT, 5) self._daily_option_bs = vbs # weekly options widgets _box = wx.StaticBox(self, -1, 'Weekly Options:') widgets_list.append((_box, 'repeat')) vbs = wx.StaticBoxSizer(_box, wx.VERTICAL) hbs = wx.BoxSizer(wx.HORIZONTAL) hbs.Add(wx.StaticText(self, -1, 'Every '), 0, wx.LEFT, 0) self._wl_interval = wx.TextCtrl(self, -1, '1') wx.EVT_TEXT(self, self._wl_interval.GetId(), self.OnDirtyUI) hbs.Add(self._wl_interval, 0, wx.LEFT, 0) hbs.Add(wx.StaticText(self, -1, ' week(s)'), 0, wx.LEFT, 0) vbs.Add(hbs, 0, wx.LEFT | wx.TOP, 10) vbs.Add(wx.StaticText(self, -1, 'On:'), 0, wx.LEFT, 10) hbs = wx.GridSizer(2, 4) self._wl_dow = {} for i, n in enumerate(self._dow): self._wl_dow[i] = wx.CheckBox(self, -1, n) wx.EVT_CHECKBOX(self, self._wl_dow[i].GetId(), self.OnDirtyUI) hbs.Add(self._wl_dow[i], 0, wx.LEFT | wx.TOP, 5) vbs.Add(hbs, 0, wx.LEFT, 5) hbs = wx.BoxSizer(wx.HORIZONTAL) hbs.Add(wx.StaticText(self, -1, 'Week starts on:'), 0, wx.LEFT, 10) self._wl_wkst = wx.ComboBox(self, -1, value=self._dow[0], choices=self._dow, style=wx.CB_READONLY) wx.EVT_COMBOBOX(self, self._wl_wkst.GetId(), self.OnDirtyUI) hbs.Add(self._wl_wkst, 0, wx.LEFT, 5) vbs.Add(hbs, 0, wx.TOP, 10) self._option_bs.Add(vbs, 0, wx.LEFT, 5) self._weekly_option_bs = vbs # monthly option widgets _box = wx.StaticBox(self, -1, 'Monthly Options:') widgets_list.append((_box, 'repeat')) vbs = wx.StaticBoxSizer(_box, wx.VERTICAL) hbs = wx.BoxSizer(wx.HORIZONTAL) hbs.Add(wx.StaticText(self, -1, 'Every '), 0, wx.LEFT, 0) self._ml_interval = wx.TextCtrl(self, -1, '1') wx.EVT_TEXT(self, self._ml_interval.GetId(), self.OnDirtyUI) hbs.Add(self._ml_interval, 0, wx.LEFT, 0) hbs.Add(wx.StaticText(self, -1, ' month(s)'), 0, wx.LEFT, 0) vbs.Add(hbs, 0, wx.LEFT | wx.TOP, 10) vbs.Add(wx.StaticText(self, -1, 'On:'), 0, wx.LEFT, 10) self._ml_every_nday = wx.RadioButton(self, -1, 'Every nth day', style=wx.RB_GROUP) self._ml_every_nday.SetValue(True) self._ml_every_wday = wx.RadioButton(self, -1, 'Every ') wx.EVT_RADIOBUTTON(self, self._ml_every_nday.GetId(), self.OnDirtyUI) wx.EVT_RADIOBUTTON(self, self._ml_every_wday.GetId(), self.OnDirtyUI) vbs.Add(self._ml_every_nday, 0, wx.LEFT | wx.TOP, 10) hbs = wx.BoxSizer(wx.HORIZONTAL) hbs.Add(self._ml_every_wday, 0, wx.LEFT, 0) self._ml_nth_day = wx.ComboBox(self, -1, value=self._monthly_nth_day[0], choices=self._monthly_nth_day, style=wx.CB_READONLY) self._ml_wday = wx.ComboBox(self, -1, value=self._dow[0], choices=self._dow, style=wx.CB_READONLY) wx.EVT_COMBOBOX(self, self._ml_nth_day.GetId(), self.OnDirtyUI) wx.EVT_COMBOBOX(self, self._ml_wday.GetId(), self.OnDirtyUI) hbs.Add(self._ml_nth_day, 0, wx.LEFT, 5) hbs.Add(self._ml_wday, 0, wx.LEFT, 5) vbs.Add(hbs, 0, wx.LEFT | wx.TOP, 10) self._option_bs.Add(vbs, 0, wx.LEFT, 5) self._monthly_option_bs = vbs hbs_1.Add(self._option_bs, 0, wx.LEFT, 5) self._main_bs.Add(hbs_1, 0, wx.LEFT | wx.TOP, 5) # the exceptions list _box = wx.StaticBox(self, -1, 'Excluded Dates:') widgets_list.append((_box, 'repeat')) hbs = wx.StaticBoxSizer(_box, wx.HORIZONTAL) self._exception_list = wx.ListBox(self, -1) hbs.Add(self._exception_list, 1, wx.LEFT | wx.TOP | wx.EXPAND, 5) exception_del = wx.Button(self, -1, 'Include') wx.EVT_BUTTON(self, exception_del.GetId(), self.OnIncludeException) hbs.Add(exception_del, 0, wx.LEFT | wx.TOP, 5) self._main_bs.Add(hbs, 1, wx.LEFT | wx.TOP | wx.EXPAND, 5) # all done self.SetSizer(self._main_bs) self.SetAutoLayout(True) self._main_bs.Fit(self) self.OnRepeatType(None)
def __init__(self, parent, cert, id=-1, title="Export Identity Certificate"): wx.Dialog.__init__(self, parent, id, title, size=wx.Size(600, 200), style=wx.CAPTION | wx.RESIZE_BORDER | wx.SYSTEM_MENU) self.cert = cert self.sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(self.sizer) self.SetAutoLayout(1) # # Title. # hb = wx.BoxSizer(wx.HORIZONTAL) t = wx.StaticText(self, -1, "Export identity ") t.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD)) hb.Add(t, 0) t = wx.StaticText(self, -1, str(cert.GetShortSubject())) t.SetFont(wx.Font(12, wx.SWISS, wx.ITALIC, wx.BOLD)) hb.Add(t, 0) self.sizer.Add(hb, 0, wx.EXPAND | wx.ALL, 5) # # Create radio boxes. # rb1 = wx.RadioButton( self, -1, "Write certificate and private key to a single file", style=wx.RB_GROUP) rb2 = wx.RadioButton( self, -1, "Write certificate and private key to separate files") wx.EVT_RADIOBUTTON(self, rb1.GetId(), self.OnSelectOne) wx.EVT_RADIOBUTTON(self, rb2.GetId(), self.OnSelectSep) self.sizer.Add(rb1, 0, wx.EXPAND | wx.ALL, 3) self.sizer.Add(rb2, 0, wx.EXPAND | wx.ALL, 3) self.sizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND) # # Create text input grid. # gs = wx.FlexGridSizer(cols=3, hgap=3, vgap=3) t = wx.StaticText(self, -1, "Certificate file:") gs.Add(t, 0, wx.ALIGN_CENTER_VERTICAL) self.certFileText = wx.TextCtrl(self, -1, "") gs.Add(self.certFileText, 1, wx.EXPAND) b = wx.Button(self, -1, "Browse") wx.EVT_BUTTON(self, b.GetId(), self.OnCertBrowse) gs.Add(b, 0) t = wx.StaticText(self, -1, "Private key file:") gs.Add(t, 0, wx.ALIGN_CENTER_VERTICAL) self.keyFileText = wx.TextCtrl(self, -1, "") gs.Add(self.keyFileText, 1, wx.EXPAND) b = wx.Button(self, -1, "Browse") wx.EVT_BUTTON(self, b.GetId(), self.OnKeyBrowse) gs.Add(b, 0) gs.AddGrowableCol(1) self.sizer.Add(gs, 1, wx.EXPAND | wx.ALL, 4) # # These will get disabled if we're not using a separate key file. # self.keyWidgets = [t, self.keyFileText, b] # # Initialize to one file. # rb1.SetValue(1) self.OnSelectOne(None) # # And the export/cancel buttons. # hs = wx.BoxSizer(wx.HORIZONTAL) b = wx.Button(self, -1, "Export Certificate") b.SetDefault() wx.EVT_BUTTON(self, b.GetId(), self.OnExport) hs.Add(b, 0, wx.ALL, 4) b = wx.Button(self, wx.ID_CANCEL, "Cancel") # wx.EVT_BUTTON(self, b.GetId(), self.OnCancel) hs.Add(b, 0, wx.ALL, 4) self.sizer.Add(hs, 0, wx.ALIGN_CENTER_HORIZONTAL)
def __init__(self, parent=None, id=-1, title="Access Grid Launcher",agtk_location=None): wx.Frame.__init__(self,parent,id,title,size=wx.Size(400,125),style=wx.DEFAULT_FRAME_STYLE&(~wx.MAXIMIZE_BOX)) self.processManager=ProcessManager(); self.browser=None; if IsOSX(): self.mainButton=wx.RadioButton(self,self.BUTTON_MAIN_ID,"Main",style=wx.RB_GROUP); wx.EVT_RADIOBUTTON(self,self.BUTTON_MAIN_ID,self.OnToggle); else: self.mainButton=wx.ToggleButton(self,self.BUTTON_MAIN_ID,"Main"); wx.EVT_TOGGLEBUTTON(self,self.BUTTON_MAIN_ID,self.OnToggle); self.mainButton.SetValue(True); if IsOSX(): self.docButton=wx.RadioButton(self,self.BUTTON_DOCS_ID,"Documentation"); wx.EVT_RADIOBUTTON(self,self.BUTTON_DOCS_ID,self.OnToggle); else: self.docButton=wx.ToggleButton(self,self.BUTTON_DOCS_ID,"Documentation"); wx.EVT_TOGGLEBUTTON(self,self.BUTTON_DOCS_ID,self.OnToggle); self.docButton.SetValue(False); if IsOSX(): self.confButton=wx.RadioButton(self,self.BUTTON_CONFIG_ID,"Configuration"); wx.EVT_RADIOBUTTON(self,self.BUTTON_CONFIG_ID,self.OnToggle); else: self.confButton=wx.ToggleButton(self,self.BUTTON_CONFIG_ID,"Configuration"); wx.EVT_TOGGLEBUTTON(self,self.BUTTON_CONFIG_ID,self.OnToggle); self.confButton.SetValue(False); if IsOSX(): self.servButton=wx.RadioButton(self,self.BUTTON_SERVICE_ID,"Services"); wx.EVT_RADIOBUTTON(self,self.BUTTON_SERVICE_ID,self.OnToggle); else: self.servButton=wx.ToggleButton(self,self.BUTTON_CONFIG_ID,"Services"); wx.EVT_TOGGLEBUTTON(self,self.BUTTON_SERVICE_ID,self.OnToggle); self.servButton.SetValue(False); if IsOSX(): self.debugButton=wx.RadioButton(self,self.BUTTON_DEBUG_ID,"Debug"); wx.EVT_RADIOBUTTON(self,self.BUTTON_DEBUG_ID,self.OnToggle); else: self.debugButton=wx.ToggleButton(self,self.BUTTON_DEBUG_ID,"Debug"); wx.EVT_TOGGLEBUTTON(self,self.BUTTON_DEBUG_ID,self.OnToggle); self.debugButton.SetValue(False) self.debugButton.Disable() self.debugButton.Show(False) if not agtk_location: agtk_location=".." self.mainButtonList=[]; self.mainButtonActions=[]; self.mainButtonList.append(wx.Button(self,self.BUTTON_VC_ID,"Venue Client")); venueClientPath = "%s/bin/VenueClient3.py"%(agtk_location) if not os.path.exists("%s/bin/VenueClient3.py"%(agtk_location)) and os.path.exists("%s/bin/VenueClient.py"%(agtk_location)): venueClientPath = "%s/bin/VenueClient.py"%(agtk_location) self.mainButtonActions.append([self.RunPython,venueClientPath,[]]); for button in self.mainButtonList: button.Show(False); self.docsButtonList=[]; self.docsButtonActions=[]; self.docsButtonList.append(wx.Button(self,self.BUTTON_README_ID,"Read Me")); self.docsButtonActions.append([self.LoadURL,"file://%s/doc/README"%(agtk_location),[]]); self.docsButtonList.append(wx.Button(self,self.BUTTON_VCM_ID,"Venue Client Manual")); self.docsButtonActions.append([self.LoadURL,"http://www.mcs.anl.gov/fl/research/accessgrid/documentation/manuals/VenueClient/3_0",[]]); self.docsButtonList.append(wx.Button(self,self.BUTTON_VMCM_ID,"Venue Management Manual")); self.docsButtonActions.append([self.LoadURL,"http://www.mcs.anl.gov/fl/research/accessgrid/documentation/manuals/VenueManagement/3_0",[]]); self.docsButtonList.append(wx.Button(self,self.BUTTON_LIC_ID,"License")); self.docsButtonActions.append([self.LoadURL,"file://%s/COPYING.txt"%(agtk_location),[]]); for button in self.docsButtonList: button.Show(False); self.configButtonList=[]; self.configButtonActions=[]; self.configButtonList.append(wx.Button(self,self.BUTTON_NM_ID,"Node Management")); nodeManagementPath = "%s/bin/NodeManagement3.py"%(agtk_location) if not os.path.exists("%s/bin/NodeManagement3.py"%(agtk_location)) and os.path.exists("%s/bin/NodeManagement.py"%(agtk_location)): nodeManagementPath = "%s/bin/NodeManagement.py"%(agtk_location) self.configButtonActions.append([self.RunPython,nodeManagementPath,[]]); self.configButtonList.append(wx.Button(self,self.BUTTON_VM_ID,"Venue Management")); venueManagementPath = "%s/bin/VenueManagement3.py"%(agtk_location) if not os.path.exists("%s/bin/VenueManagement3.py"%(agtk_location)) and os.path.exists("%s/bin/VenueManagement.py"%(agtk_location)): venueManagementPath = "%s/bin/VenueManagement.py"%(agtk_location) self.configButtonActions.append([self.RunPython,venueManagementPath,[]]); self.configButtonList.append(wx.Button(self,self.BUTTON_NSW_ID,"Node Setup Wizard")); nodeSetupWizardPath = "%s/bin/NodeSetupWizard3.py"%(agtk_location) if not os.path.exists("%s/bin/NodeSetupWizard3.py"%(agtk_location)) and os.path.exists("%s/bin/NodeSetupWizard.py"%(agtk_location)): nodeSetupWizardPath = "%s/bin/NodeSetupWizard.py"%(agtk_location) self.configButtonActions.append([self.RunPython,nodeSetupWizardPath,[]]); #self.configButtonList.append(wx.Button(self,self.BUTTON_CRW_ID,"Certificate Request Wizard")); #self.configButtonActions.append([self.RunPython,"%s/bin/CertificateRequestTool.py"%(agtk_location),[]]); self.configButtonList.append(wx.Button(self,self.BUTTON_CM_ID,"Certificate Management")); certManagerPath = "%s/bin/CertificateManager3.py"%(agtk_location) if not os.path.exists("%s/bin/CertificateManager3.py"%(agtk_location)) and os.path.exists("%s/bin/CertificateManager.py"%(agtk_location)): certManagerPath = "%s/bin/CertificateManager.py"%(agtk_location) self.configButtonActions.append([self.RunPython,certManagerPath,[]]); for button in self.configButtonList: button.Show(False); self.serviceButtonList=[]; self.serviceButtonActions=[]; self.serviceButtonList.append(wx.Button(self,self.BUTTON_NS_ID,"Node Service")); if IsOSX(): self.serviceButtonActions.append([self.RunCommandline,"/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal", ["-ps", "-e", "/Applications/AccessGridToolkit3.app/Contents/MacOS/runns.sh"]]); else: serviceManagerPath = "%s/bin/AGServiceManager3.py"%(agtk_location) if not os.path.exists("%s/bin/AGServiceManager3.py"%(agtk_location)) and os.path.exists("%s/bin/AGServiceManager.py"%(agtk_location)): serviceManagerPath = "%s/bin/AGServiceManager.py"%(agtk_location) self.serviceButtonActions.append([self.RunPython,serviceManagerPath,["-n"]]); self.serviceButtonList.append(wx.Button(self,self.BUTTON_SM_ID,"Service Manager")); if IsOSX(): self.serviceButtonActions.append([self.RunCommandline,"/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal", ["-ps", "-e", "/Applications/AccessGridToolkit3.app/Contents/MacOS/runsm.sh"]]); else: self.serviceButtonActions.append([self.RunPython,serviceManagerPath,[]]); self.serviceButtonList.append(wx.Button(self,self.BUTTON_VS_ID,"Venue Server")); if IsOSX(): self.serviceButtonActions.append([self.RunCommandline,"/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal", ["-ps", "-e", "/Applications/AccessGridToolkit3.app/Contents/MacOS/runvs.sh"]]); else: venueserverPath = "%s/bin/VenueServer3.py"%(agtk_location) if not os.path.exists("%s/bin/VenueServer3.py"%(agtk_location)) and os.path.exists("%s/bin/VenueServer.py"%(agtk_location)): venueserverPath = "%s/bin/VenueServer.py"%(agtk_location) self.serviceButtonActions.append([self.RunPython,venueserverPath,[]]); for button in self.serviceButtonList: button.Show(False); self.debugButtonList=[]; self.debugButtonActions=[]; self.debugButtonList.append(wx.Button(self,self.BUTTON_VCD_ID,"Venue Client (Debug)")); self.debugButtonActions.append([self.RunPythonDebug,venueClientPath,["-d"]]); self.debugButtonList.append(wx.Button(self,self.BUTTON_CMD_ID,"Certificate Management (Debug)")); self.debugButtonActions.append([self.RunPythonDebug,certManagerPath,["-d"]]); self.debugButtonList.append(wx.Button(self,self.BUTTON_NSD_ID,"Node Service (Debug)")); self.debugButtonActions.append([self.RunPythonDebug,"%s/bin/AGNodeService.py"%(agtk_location),["-d"]]); self.debugButtonList.append(wx.Button(self,self.BUTTON_SMD_ID,"Service Manager (Debug)")); self.debugButtonActions.append([self.RunPythonDebug,"%s/bin/AGServiceManager.py"%(agtk_location),["-d"]]); self.debugButtonList.append(wx.Button(self,self.BUTTON_VSD_ID,"Venue Server (Debug)")); self.debugButtonActions.append([self.RunPythonDebug,"%s/bin/VenueServer.py"%(agtk_location),["-d"]]); for button in self.debugButtonList: button.Show(False); wx.EVT_BUTTON(self,self.BUTTON_VC_ID,self.OnButton); wx.EVT_BUTTON(self,self.BUTTON_CM_ID,self.OnButton); wx.EVT_BUTTON(self,self.BUTTON_NS_ID,self.OnButton); wx.EVT_BUTTON(self,self.BUTTON_SM_ID,self.OnButton); wx.EVT_BUTTON(self,self.BUTTON_VS_ID,self.OnButton); wx.EVT_BUTTON(self,self.BUTTON_README_ID,self.OnButton); wx.EVT_BUTTON(self,self.BUTTON_VCM_ID,self.OnButton); wx.EVT_BUTTON(self,self.BUTTON_VMCM_ID,self.OnButton); wx.EVT_BUTTON(self,self.BUTTON_LIC_ID,self.OnButton); wx.EVT_BUTTON(self,self.BUTTON_NM_ID,self.OnButton); wx.EVT_BUTTON(self,self.BUTTON_VM_ID,self.OnButton); wx.EVT_BUTTON(self,self.BUTTON_NSW_ID,self.OnButton); #wx.EVT_BUTTON(self,self.BUTTON_CRW_ID,self.OnButton); wx.EVT_BUTTON(self,self.BUTTON_VCD_ID,self.OnButton); wx.EVT_BUTTON(self,self.BUTTON_CMD_ID,self.OnButton); wx.EVT_BUTTON(self,self.BUTTON_NSD_ID,self.OnButton); wx.EVT_BUTTON(self,self.BUTTON_SMD_ID,self.OnButton); wx.EVT_BUTTON(self,self.BUTTON_VSD_ID,self.OnButton); self.myLine=wx.StaticLine(self,-1,style=wx.LI_VERTICAL); self.__doLayout();