def buildControls(self,parameters): mainSizer = wx.BoxSizer(wx.VERTICAL) associationSizer = wx.BoxSizer(wx.HORIZONTAL) mainSizer.Add(WidgetFactory.buildCheckSizer(self,'Alternative',GOALASSOCIATION_CHECKALTERNATIVE_ID,False),0,wx.EXPAND) mainSizer.Add(associationSizer,0,wx.EXPAND) environments = self.dbProxy.getDimensionNames('environment') goals = [] associationTypes = ['and','or','conflict','responsible','obstruct','resolve'] goalDimensions = ['goal','requirement','countermeasure','obstacle'] subGoalDimensions = ['goal','requirement','role','task','usecase','countermeasure','domainproperty','obstacle','threat','vulnerability'] associationSizer.Add(WidgetFactory.buildComboSizerList(self,'Environment',(87,30),GOALASSOCIATION_COMBOENVIRONMENT_ID,environments),0,wx.EXPAND) associationSizer.Add(WidgetFactory.buildComboSizerList(self,'Dimension',(87,30),GOALASSOCIATION_COMBOGOALDIM_ID,goalDimensions),0,wx.EXPAND) associationSizer.Add(WidgetFactory.buildComboSizerList(self,'Goal',(87,30),GOALASSOCIATION_COMBOGOAL_ID,goals),0,wx.EXPAND) associationSizer.Add(WidgetFactory.buildComboSizerList(self,'Type',(87,30),GOALASSOCIATION_COMBOATYPE_ID,associationTypes),0,wx.EXPAND) associationSizer.Add(WidgetFactory.buildComboSizerList(self,'Dimension',(87,30),GOALASSOCIATION_COMBOSUBGOALDIM_ID,subGoalDimensions),0,wx.EXPAND) associationSizer.Add(WidgetFactory.buildComboSizerList(self,'Sub-Goal',(87,30),GOALASSOCIATION_COMBOSUBGOAL_ID,goals),0,wx.EXPAND) mainSizer.Add(WidgetFactory.buildMLTextSizer(self,'Rationale',(87,60),GOALASSOCIATION_TEXTRATIONALE_ID),1,wx.EXPAND,1,wx.EXPAND) mainSizer.Add(WidgetFactory.buildAddCancelButtonSizer(self,GOALASSOCIATION_BUTTONCOMMIT_ID),0,wx.ALIGN_CENTER) self.SetSizer(mainSizer) wx.EVT_BUTTON(self,GOALASSOCIATION_BUTTONCOMMIT_ID,self.onCommit) wx.EVT_COMBOBOX(self,GOALASSOCIATION_COMBOENVIRONMENT_ID,self.onEnvironmentChange) wx.EVT_COMBOBOX(self,GOALASSOCIATION_COMBOGOALDIM_ID,self.onGoalDimChange) wx.EVT_COMBOBOX(self,GOALASSOCIATION_COMBOSUBGOALDIM_ID,self.onSubGoalDimChange)
def __init__(self, parent, figpanel, **kwargs): wx.Panel.__init__(self, parent, **kwargs) # the panel to draw charts on self.SetBackgroundColour('white') # color for the background of panel self.figpanel = figpanel sizer = wx.BoxSizer(wx.VERTICAL) self.x_columns = [] # column names to plot if selecting multiple columns self.table_choice = ui.TableComboBox(self, -1, style=wx.CB_READONLY) self.x_choice = ComboBox(self, -1, size=(200,-1)) self.x_multiple = wx.Button(self, -1, 'select multiple') self.group_choice = ComboBox(self, -1, choices=[NO_GROUP]+p._groups_ordered, style=wx.CB_READONLY) self.group_choice.Select(0) self.filter_choice = ui.FilterComboBox(self, style=wx.CB_READONLY) self.filter_choice.Select(0) self.update_chart_btn = wx.Button(self, -1, "Update Chart") self.update_column_fields() sz = wx.BoxSizer(wx.HORIZONTAL) sz.Add(wx.StaticText(self, -1, "table:"), 0, wx.TOP, 4) sz.AddSpacer((3,-1)) sz.Add(self.table_choice, 1, wx.EXPAND) sz.AddSpacer((3,-1)) sz.Add(wx.StaticText(self, -1, "measurement:"), 0, wx.TOP, 4) sz.AddSpacer((3,-1)) sz.Add(self.x_choice, 2, wx.EXPAND) sz.AddSpacer((3,-1)) sz.Add(self.x_multiple, 0, wx.EXPAND|wx.TOP, 2) sizer.Add(sz, 1, wx.EXPAND) sizer.AddSpacer((-1,3)) sz = wx.BoxSizer(wx.HORIZONTAL) sz.Add(wx.StaticText(self, -1, "group x-axis by:"), 0, wx.TOP, 4) sz.AddSpacer((3,-1)) sz.Add(self.group_choice, 1, wx.EXPAND) sizer.Add(sz, 1, wx.EXPAND) sizer.AddSpacer((-1,3)) sz = wx.BoxSizer(wx.HORIZONTAL) sz.Add(wx.StaticText(self, -1, "filter:"), 0, wx.TOP, 4) sz.AddSpacer((3,-1)) sz.Add(self.filter_choice, 1, wx.EXPAND) sizer.Add(sz, 1, wx.EXPAND) sizer.AddSpacer((-1,3)) sizer.Add(self.update_chart_btn) wx.EVT_BUTTON(self.x_multiple, -1, self.on_select_multiple) wx.EVT_COMBOBOX(self.table_choice, -1, self.on_table_selected) wx.EVT_COMBOBOX(self.x_choice, -1, self.on_column_selected) wx.EVT_BUTTON(self.update_chart_btn, -1, self.update_figpanel) self.SetSizer(sizer) self.Show(1)
def _show_all_constraint(self): """ Show constraint fields """ box_description = wx.StaticBox(self, wx.ID_ANY, "Easy Setup ") box_sizer = wx.StaticBoxSizer(box_description, wx.HORIZONTAL) sizer_constraint = wx.BoxSizer(wx.HORIZONTAL) self.model_cbox_left = wx.ComboBox(self, wx.ID_ANY, style=wx.CB_READONLY) self.model_cbox_left.Clear() self.model_cbox_right = wx.ComboBox(self, wx.ID_ANY, style=wx.CB_READONLY) self.model_cbox_right.Clear() wx.EVT_COMBOBOX(self.model_cbox_left, wx.ID_ANY, self._on_select_modelcb) wx.EVT_COMBOBOX(self.model_cbox_right, wx.ID_ANY, self._on_select_modelcb) egal_txt = wx.StaticText(self, wx.ID_ANY, " = ") self.set_button = wx.Button(self, self.ID_SET_ALL, 'Set All') self.set_button.Bind(wx.EVT_BUTTON, self._on_set_all_equal, id=self.set_button.GetId()) set_tip = "Add constraints for all the adjustable parameters " set_tip += "(checked in FitPages) if exist." self.set_button.SetToolTipString(set_tip) self.set_button.Disable() for id, model in self.constraint_dict.items(): # check if all parameters have been selected for constraint # then do not allow add constraint on parameters self.model_cbox_left.Append(str(model.name), model) self.model_cbox_left.Select(0) for id, model in self.constraint_dict.items(): # check if all parameters have been selected for constraint # then do not allow add constraint on parameters self.model_cbox_right.Append(str(model.name), model) box_sizer.Add(self.model_cbox_left, flag=wx.RIGHT | wx.EXPAND, border=10) # box_sizer.Add(wx.StaticText(self, wx.ID_ANY, ".parameters"), # flag=wx.RIGHT | wx.EXPAND, border=5) box_sizer.Add(egal_txt, flag=wx.RIGHT | wx.EXPAND, border=5) box_sizer.Add(self.model_cbox_right, flag=wx.RIGHT | wx.EXPAND, border=10) # box_sizer.Add(wx.StaticText(self, wx.ID_ANY, ".parameters"), # flag=wx.RIGHT | wx.EXPAND, border=5) box_sizer.Add((20, -1)) box_sizer.Add(self.set_button, flag=wx.RIGHT | wx.EXPAND, border=5) sizer_constraint.Add(box_sizer, flag=wx.RIGHT | wx.EXPAND, border=5) self.sizer_all_constraints.Insert(0, sizer_constraint, flag=wx.TOP | wx.BOTTOM | wx.EXPAND, border=5) self.FitInside()
def _layout_model_selection(self): """ Do the layout for model selection related widgets """ box_width = 195 # combobox width #First set up main sizer for the selection selection_box_title = wx.StaticBox(self, -1, 'Select', size=(PNL_WIDTH - 30, 70)) self._selection_box = wx.StaticBoxSizer(selection_box_title, wx.VERTICAL) #Next create the help labels for the model selection select_help_box = wx.BoxSizer(wx.HORIZONTAL) model_string = " Model%s (p%s):" select_help_box.Add(wx.StaticText(self, -1, model_string % (1, 1)), 0, 0) select_help_box.Add((box_width - 25, 10), 0, 0) select_help_box.Add(wx.StaticText(self, -1, model_string % (2, 2)), 0, 0) self._selection_box.Add(select_help_box, 0, 0) #Next create the actual selection box with 3 combo boxes selection_box_choose = wx.BoxSizer(wx.HORIZONTAL) self.model1 = wx.ComboBox(self, -1, style=wx.CB_READONLY) wx.EVT_COMBOBOX(self.model1, -1, self.on_model1) self.model1.SetMinSize((box_width * 5 / 6, -1)) self.model1.SetToolTipString("model1") self._operator_choice = wx.ComboBox(self, -1, size=(50, -1), style=wx.CB_READONLY) wx.EVT_COMBOBOX(self._operator_choice, -1, self.on_select_operator) operation_tip = "Add: +, Multiply: * " self._operator_choice.SetToolTipString(operation_tip) self.model2 = wx.ComboBox(self, -1, style=wx.CB_READONLY) wx.EVT_COMBOBOX(self.model2, -1, self.on_model2) self.model2.SetMinSize((box_width * 5 / 6, -1)) self.model2.SetToolTipString("model2") self._set_model_list() selection_box_choose.Add(self.model1, 0, 0) selection_box_choose.Add((15, 10)) selection_box_choose.Add(self._operator_choice, 0, 0) selection_box_choose.Add((15, 10)) selection_box_choose.Add(self.model2, 0, 0) # add some space between labels and selection self._selection_box.Add((20, 5), 0, 0) self._selection_box.Add(selection_box_choose, 0, 0)
def __init__(self, parent, window, controler): wx.Panel.__init__(self, parent, style=wx.TAB_TRAVERSAL) self.ParentWindow = window self.Controler = controler self.DefaultConfig = [] for i in range(0, NUM_OF_AO): self.DefaultConfig.append({ "Name" : "OnBoardAo{}".format(i), "Address" : "", "Len" : "", "Type" : u"REAL", "Initial": "", "Description": "On board AO", "OnChange":"", "Options":"4-20mA"}) main_sizer = wx.BoxSizer(wx.VERTICAL) self.title = wx.StaticText(self, label="Analog output configuration") font = wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD) self.title.SetFont(font) main_sizer.Add(self.title, flag=wx.ALIGN_CENTER_VERTICAL) self.outputs = [] for i in range(0,2): channel = MK201AoChannelEditor(self, i) self.outputs.append(channel) wx.EVT_COMBOBOX(self, channel.modeCmbbx.GetId(), self.OnChange) main_sizer.Add(channel, flag=wx.ALIGN_CENTER_VERTICAL) self.SetSizer(main_sizer) self.firstCall = 1 self.Bind(wx.EVT_SHOW, self.OnShow)
def SetupComboBox(self): cbID = wx.NewId() self.widget = wx.ComboBox(self, cbID, size=self.button_size, choices=[]) for idx in range(len(self.obj_dict['default'])): self.widget.Append(self.obj_dict['default'][idx]) self.widget.SetValue(self.obj_dict['value']) self.sbsizer.Add(self.widget) wx.EVT_COMBOBOX(self, cbID, self.ComboCB) if self.obj_dict['icon']: #in this version, if icon, then actor. fname = os.path.abspath( os.path.join(self.env.sitepkgdir, self.env.appname, 'Actors', self.obj_dict['value'], 'icon.gif')) gif = wx.Image(fname, wx.BITMAP_TYPE_GIF).ConvertToBitmap() self.bmp = wx.StaticBitmap(self, -1, gif) self.sbsizer.Add(self.bmp) else: self.label = wx.StaticText(self, wx.NewId(), '', size=self.button_size) self.sbsizer.Add(self.label)
def init(self, parent): """ Finishes initializing the editor by creating the underlying toolkit widget. """ super(SimpleEditor, self).init(parent) factory = self.factory if factory.evaluate is None: self.control = control = wx.Choice(parent, -1, wx.Point(0, 0), wx.Size(-1, -1), self.names) wx.EVT_CHOICE(parent, self.control.GetId(), self.update_object) else: self.control = control = wx.ComboBox(parent, -1, '', wx.Point(0, 0), wx.Size(-1, -1), self.names, style=wx.CB_DROPDOWN) wx.EVT_COMBOBOX(parent, control.GetId(), self.update_object) wx.EVT_TEXT_ENTER(parent, control.GetId(), self.update_text_object) wx.EVT_KILL_FOCUS(control, self.on_kill_focus) if (not factory.is_grid_cell) and factory.auto_set: wx.EVT_TEXT(parent, control.GetId(), self.update_text_object) self._no_enum_update = 0 self.set_tooltip()
def __init__(self,parent,id,title): wx.Frame.__init__(self, parent, -1, title, size = (592, 633), style = wx.CLOSE_BOX | wx.CAPTION | wx.MINIMIZE_BOX) self.timer = wx.Timer(self, 1) self.SetIcon(wx.Icon(Variables.playonlinux_env+"/etc/playonlinux.png", wx.BITMAP_TYPE_ANY)) self.panel = wx.Panel(self, -1) self.panels_buttons = wx.Panel(self.panel, -1) self.onglets = Onglets(self.panel) self.sizer = wx.BoxSizer(wx.VERTICAL) self.sizer.Add(self.onglets, 11, wx.EXPAND|wx.ALL, 2) self.sizer.Add(self.panels_buttons, 1, wx.EXPAND|wx.ALL, 2) self.getVersions() self.panel.SetSizer(self.sizer) self.panel.SetAutoLayout(True) self.onglets.liste_versions() self.onglets.liste_games() self.oldreload="" self.oldversions = [] self.add_games() self.button = wx.Button(self.panels_buttons, wx.ID_CLOSE, pos=(493, 5), size=wx.DefaultSize) wx.EVT_BUTTON(self, wx.ID_CLOSE, self.closeapp) wx.EVT_CLOSE(self, self.closeapp) wx.EVT_BUTTON(self, wx.ID_REMOVE, self.delete) wx.EVT_BUTTON(self, wx.ID_ADD, self.install) wx.EVT_TREE_SEL_CHANGED(self, 106, self.unselect) wx.EVT_TREE_SEL_CHANGED(self, 107, self.unselect) wx.EVT_TREE_SEL_CHANGED(self, 111, self.select_game) wx.EVT_COMBOBOX(self, 112, self.assign) self.Bind(wx.EVT_TIMER, self.AutoReload, self.timer) self.timer.Start(200)
def __do_layout(self): # begin wxGlade: GetURIDialog.__do_layout sizer_1 = wx.BoxSizer(wx.VERTICAL) sizer_4 = wx.BoxSizer(wx.HORIZONTAL) sizer_3 = wx.BoxSizer(wx.HORIZONTAL) sizer_2 = wx.BoxSizer(wx.HORIZONTAL) sizer_2.Add(self.label_uri, 0, wx.LEFT, 4) sizer_2.Add(self.URI, 1, wx.LEFT, 12) sizer_1.Add(sizer_2, 0, wx.TOP|wx.BOTTOM|wx.EXPAND, 10) sizer_3.Add(self.label_template, 0, wx.LEFT|wx.ALIGN_RIGHT, 4) sizer_3.Add(self.combo_box_1, 1, wx.LEFT, 20) sizer_1.Add(sizer_3, 0, wx.TOP|wx.BOTTOM|wx.EXPAND, 10) sizer_1.Add(self.static_line_2, 0, wx.EXPAND, 0) sizer_4.Add(self.button_cancel, 0, 0, 0) sizer_4.Add((20, 20), 0, 0, 0) sizer_4.Add(self.button_ok, 0, 0, 0) sizer_1.Add(sizer_4, 0, wx.ALL|wx.EXPAND, 12) self.SetAutoLayout(True) self.SetSizer(sizer_1) self.Layout() # end wxGlade wx.EVT_COMBOBOX(self, self.combo_box_1.GetId(), self.EvtComboBox) self.template = "Minimum.ebuild" lines = os.listdir("/usr/share/abeni/templates/") for f in lines: bn = string.replace(os.path.basename(f), ".ebuild", "") self.combo_box_1.Append(bn, f) self.combo_box_1.SetSelection(self.combo_box_1.FindString("Minimum"))
def __init__(self, parent, window, controler): MK201IOEditor.__init__(self, parent, window, controler) """ Настройки по умолчанию для частоных/счетных входов """ self.DefaultConfig = [] for i in range(0, NUM_OF_FRQ_IN): self.DefaultConfig.append({ "Name": "OnBoardFrqIn{}".format(i), "Address": "", "Len": "", "Type": u"REAL", "Initial": "", "Description": DESCRIPTION, "OnChange": "", "Options": "Couter" }) main_sizer = wx.BoxSizer(wx.VERTICAL) self.title = wx.StaticText(self, label="Frequency input configuration") font = wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD) self.title.SetFont(font) main_sizer.Add(self.title, flag=wx.ALIGN_CENTER_VERTICAL) self.inputs = [] for i in range(0, 4): channel = MK201FreqInChannelEditor(self, i) wx.EVT_COMBOBOX(self, channel.modeCmbbx.GetId(), self.OnChange) self.inputs.append(channel) main_sizer.Add(channel, flag=wx.ALIGN_CENTER_VERTICAL) self.SetSizer(main_sizer)
def _fill_data_sizer(self): """ fill sizer 0 with data info """ self.data_box_description = wx.StaticBox(self, wx.ID_ANY, 'I(q) Data Source') if check_data_validity(self.data): dname_color = wx.BLUE else: dname_color = wx.RED self.data_box_description.SetForegroundColour(dname_color) boxsizer1 = wx.StaticBoxSizer(self.data_box_description, wx.VERTICAL) #---------------------------------------------------------- sizer_data = wx.BoxSizer(wx.VERTICAL) text1 = wx.StaticText(self, wx.ID_ANY, ' - Choose a file to set initial fit parameters -') text1.SetForegroundColour(wx.RED) sizer_data.Add(text1) text2 = wx.StaticText(self, wx.ID_ANY, ' - This panel is not designed to view individual fits. - ') text2.SetForegroundColour(wx.RED) sizer_data.Add(text2) combo = wx.BoxSizer(wx.HORIZONTAL) self.dataSource = wx.ComboBox(self, wx.ID_ANY, style=wx.CB_READONLY) wx.EVT_COMBOBOX(self.dataSource, wx.ID_ANY, self.on_select_data) self.dataSource.SetMinSize((_DATA_BOX_WIDTH, -1)) combo.Add(wx.StaticText(self, wx.ID_ANY, 'Name : ')) combo.Add((0, 5)) combo.Add(self.dataSource) sizer_data.Add(combo, 0, wx.ALL, 10) boxsizer1.Add(sizer_data, 0, wx.ALL, 0) self.sizer0.Add(boxsizer1, 0, wx.EXPAND | wx.ALL, 10) self.sizer0.Layout()
def __init__(self, parent): wx.Panel.__init__(self, parent, armid.STEPSYNOPSIS_ID) b = Borg() self.dbProxy = b.dbProxy mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add( WidgetFactory.buildTextSizer(self, 'Synopsis', (87, 30), armid.STEPSYNOPSIS_TEXTSYNOPSIS_ID), 0, wx.EXPAND) actorSizer = wx.BoxSizer(wx.HORIZONTAL) mainSizer.Add(actorSizer, 0, wx.EXPAND) actorSizer.Add( WidgetFactory.buildComboSizerList( self, 'Actor Type', (87, 30), armid.STEPSYNOPSIS_COMBOACTORTYPE_ID, ['asset', 'role']), 1, wx.EXPAND) actorSizer.Add( WidgetFactory.buildComboSizerList( self, 'Actor', (87, 30), armid.STEPSYNOPSIS_COMBOACTORNAME_ID, ['']), 1, wx.EXPAND) mainSizer.Add(wx.StaticText(self, -1, ''), 1, wx.EXPAND) mainSizer.Add( WidgetFactory.buildCommitButtonSizer( self, armid.STEPSYNOPSIS_BUTTONCOMMIT_ID, True), 0, wx.ALIGN_CENTER) self.SetSizer(mainSizer) wx.EVT_COMBOBOX(self, armid.STEPSYNOPSIS_COMBOACTORTYPE_ID, self.onActorType)
def buildControls(self, isCreate, isUpdateable=True): mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add( self.buildTextSizer('Name', (87, 30), armid.CONCEPTREFERENCE_TEXTNAME_ID), 0, wx.EXPAND) dims = [ 'asset', 'attacker', 'countermeasure', 'domainproperty', 'environment', 'goal', 'misusecase', 'obstacle', 'persona', 'requirement', 'response', 'risk', 'role', 'task', 'threat', 'vulnerability' ] mainSizer.Add( self.buildComboSizerList('Concept', (87, 30), armid.CONCEPTREFERENCE_COMBODIMNAME_ID, dims), 0, wx.EXPAND) mainSizer.Add( self.buildComboSizerList('Object', (87, 30), armid.CONCEPTREFERENCE_COMBOOBJTNAME_ID, []), 0, wx.EXPAND) mainSizer.Add( self.buildMLTextSizer('Description', (87, 30), armid.CONCEPTREFERENCE_TEXTDESCRIPTION_ID), 1, wx.EXPAND) mainSizer.Add( self.buildCommitButtonSizer(armid.CONCEPTREFERENCE_BUTTONCOMMIT_ID, isCreate), 0, wx.CENTER) wx.EVT_COMBOBOX(self, armid.CONCEPTREFERENCE_COMBODIMNAME_ID, self.onDimensionChange) self.SetSizer(mainSizer)
def _combo(self, parent, model, label): """ Creates the switcher combo box. """ sizer = wx.BoxSizer(wx.HORIZONTAL) # Label. if label is not None: text = wx.StaticText(parent, -1, label) sizer.Add(text, 0, wx.ALIGN_CENTER | wx.ALL, 5) # Combo. self.combo = combo = wx.ComboBox(parent, -1, style=wx.CB_DROPDOWN | wx.CB_READONLY) sizer.Add(combo, 1, wx.EXPAND | wx.ALIGN_CENTER | wx.ALL, 5) # Ask the model for the available options. items = model.items if len(items) > 0: for name, data in model.items: combo.Append(name, data) # Listen for changes to the selected item. wx.EVT_COMBOBOX(self, combo.GetId(), self._on_combobox) # If the model's selected variable has been set ... if model.selected != -1: combo.SetSelection(model.selected) return sizer
def populate(self, panel_sizer): sizer = wx.BoxSizer(wx.VERTICAL) sizer2 = wx.BoxSizer(wx.HORIZONTAL) text = wx.StaticText(self.panel, -1, 'Adapter Type: ') sizer2.Add(text, 0, 0, 3) current_type = self.types_dict_rev[str( self.item._xml_item.attr.type)] if sys.platform == 'win32': style = 0 else: style = wx.CB_READONLY comboctrl = wx.ComboBox(self.panel, -1, current_type, style=style) def type_combo_changed(event): self.load_adapter_list() self.changed(event) wx.EVT_COMBOBOX(comboctrl, -1, type_combo_changed) wx.EVT_TEXT(comboctrl, -1, type_combo_changed) [comboctrl.Append(typename) for typename in self.types_dict.keys()] sizer2.Add(comboctrl, 1, wx.EXPAND, 3) sizer.Add(sizer2, 0, wx.EXPAND | wx.ALL, 3) self.type_combo = comboctrl sizer2 = wx.BoxSizer(wx.HORIZONTAL) text = wx.StaticText(self.panel, -1, 'Adapter Name: ') sizer2.Add(text, 0, 0, 3) comboctrl = wx.ComboBox(self.panel, -1) wx.EVT_COMBOBOX(comboctrl, -1, self.changed) wx.EVT_TEXT(comboctrl, -1, self.changed) sizer2.Add(comboctrl, 1, wx.EXPAND, 3) sizer.Add(sizer2, 0, wx.EXPAND | wx.ALL, 3) self.name_combo = comboctrl self.load_adapter_list(False) comboctrl.SetValue(str(self.item._xml_item.attr.name)) sizer2 = wx.BoxSizer(wx.HORIZONTAL) text = wx.StaticText(self.panel, -1, 'Index: ') sizer2.Add(text, 0, 0, 3) self.index_text = textctrl = wx.TextCtrl( self.panel, -1, self.item._xml_item.attr.index) wx.EVT_TEXT(textctrl, -1, self.changed) sizer2.Add(textctrl, 0, 0, 3) sizer.Add(sizer2, 0, wx.EXPAND | wx.ALL, 3) panel_sizer.Add(sizer, 0, wx.EXPAND | wx.ALL)
def __init__(self, parent, autoCompletion): wx.Dialog.__init__(self, parent, -1, "Auto-completion", style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) self.autoCompletion = autoCompletion vsizer = wx.BoxSizer(wx.VERTICAL) hsizer = wx.BoxSizer(wx.HORIZONTAL) self.elementsCombo = wx.ComboBox(self, -1, style=wx.CB_READONLY | wx.EXPAND) for t in autoCompletion.types.itervalues(): self.elementsCombo.Append(t.ti.name, t.ti.lt) wx.EVT_COMBOBOX(self, self.elementsCombo.GetId(), self.OnElementCombo) hsizer.Add(self.elementsCombo, 0) vsizer.Add(hsizer, 0, wx.EXPAND) vsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 10) self.enabledCb = wx.CheckBox(self, -1, "Auto-completion Enabled") wx.EVT_CHECKBOX(self, self.enabledCb.GetId(), self.OnMisc) vsizer.Add(self.enabledCb, 0, wx.BOTTOM, 10) self.itemsEntry = wx.TextCtrl(self, -1, style=wx.TE_MULTILINE | wx.TE_DONTWRAP, size=(200, 250)) wx.EVT_TEXT(self, self.itemsEntry.GetId(), self.OnMisc) vsizer.Add(self.itemsEntry, 1, wx.EXPAND) hsizer = wx.BoxSizer(wx.HORIZONTAL) hsizer.Add((1, 1), 1) cancelBtn = gutil.createStockButton(self, "Cancel") hsizer.Add(cancelBtn, 0, wx.LEFT, 10) okBtn = gutil.createStockButton(self, "OK") hsizer.Add(okBtn, 0, wx.LEFT, 10) vsizer.Add(hsizer, 0, wx.EXPAND | wx.TOP, 10) util.finishWindow(self, vsizer) self.elementsCombo.SetSelection(0) self.OnElementCombo() wx.EVT_BUTTON(self, cancelBtn.GetId(), self.OnCancel) wx.EVT_BUTTON(self, okBtn.GetId(), self.OnOK)
def dispose(self): """ Disposes of the control at the end of its life cycle. """ control, self.control = self.control, None parent = control.GetParent() wx.EVT_COMBOBOX(parent, control.GetId(), None) wx.EVT_TEXT_ENTER(parent, control.GetId(), None) wx.EVT_KILL_FOCUS(control, None)
def __init__(self, parent, _=None): self._choices = [ TodoEntry.ST_Names[x] for x in range(TodoEntry.ST_Last) ] super(StatusComboBox, self).__init__(parent, -1, self._choices[0], (-1, -1), (-1, -1), self._choices, wx.CB_READONLY) wx.EVT_COMBOBOX(self, self.GetId(), parent.OnMakeDirty)
def __init__(self, parent): wx.Dialog.__init__(self, parent, armid.TRACEABILITY_ID, 'Traceability Relations', style=wx.DEFAULT_DIALOG_STYLE | wx.MAXIMIZE_BOX | wx.THICK_FRAME | wx.RESIZE_BORDER, size=(700, 500)) b = Borg() self.dbProxy = b.dbProxy mainSizer = wx.BoxSizer(wx.VERTICAL) tcBox = wx.StaticBox(self, -1, 'Environment') comboSizer = wx.StaticBoxSizer(tcBox, wx.HORIZONTAL) environments = self.dbProxy.getDimensionNames('environment') self.environmentCtrl = wx.ComboBox( self, armid.TRACEABILITY_COMBOENVIRONMENT_ID, "", choices=environments, size=wx.DefaultSize, style=wx.CB_READONLY) mainSizer.Add(comboSizer, 0, wx.EXPAND) comboSizer.Add(self.environmentCtrl, 1, wx.EXPAND) self.traceList = wx.ListCtrl(self, armid.TRACEABILITY_LISTTRACES_ID, style=wx.LC_REPORT) self.traceList.InsertColumn(0, 'From') self.traceList.InsertColumn(1, 'Name') self.traceList.InsertColumn(2, 'From') self.traceList.InsertColumn(3, 'Name') self.traceList.SetColumnWidth(0, 150) self.traceList.SetColumnWidth(1, 150) self.traceList.SetColumnWidth(2, 150) self.traceList.SetColumnWidth(3, 150) mainSizer.Add(self.traceList, 1, wx.EXPAND) buttonSizer = wx.BoxSizer(wx.HORIZONTAL) mainSizer.Add(buttonSizer, 0, wx.EXPAND) deleteButton = wx.Button(self, armid.TRACEABILITY_BUTTONDELETE_ID, "Delete") buttonSizer.Add(deleteButton) closeButton = wx.Button(self, wx.ID_CLOSE, "Close") buttonSizer.Add(closeButton) self.SetSizer(mainSizer) self.selectedIdx = -1 wx.EVT_LIST_ITEM_SELECTED(self, armid.TRACEABILITY_LISTTRACES_ID, self.onItemSelected) wx.EVT_LIST_ITEM_DESELECTED(self, armid.TRACEABILITY_LISTTRACES_ID, self.onItemDeselected) wx.EVT_COMBOBOX(self, armid.TRACEABILITY_COMBOENVIRONMENT_ID, self.onEnvironmentChange) wx.EVT_BUTTON(self, armid.TRACEABILITY_BUTTONDELETE_ID, self.onDelete) wx.EVT_BUTTON(self, wx.ID_CLOSE, self.onClose)
def buildControls(self, parameters): mainSizer = wx.BoxSizer(wx.VERTICAL) associationSizer = wx.BoxSizer(wx.HORIZONTAL) mainSizer.Add(associationSizer, 0, wx.EXPAND) environments = self.dbProxy.getDimensionNames('environment') roles = self.dbProxy.getDimensionNames('role') self.dependencyTypes = ['goal', 'task', 'asset'] self.dependencies = [] associationSizer.Add( WidgetFactory.buildComboSizerList( self, 'Environment', (150, 30), armid.DEPENDENCY_COMBOENVIRONMENT_ID, environments), 0, wx.EXPAND) associationSizer.Add( WidgetFactory.buildComboSizerList( self, 'Depender', (200, 30), armid.DEPENDENCY_COMBODEPENDER_ID, roles), 0, wx.EXPAND) associationSizer.Add( WidgetFactory.buildComboSizerList( self, 'Dependee', (200, 30), armid.DEPENDENCY_COMBODEPENDEE_ID, roles), 0, wx.EXPAND) associationSizer.Add( WidgetFactory.buildComboSizerList(self, 'Type', (87, 30), armid.DEPENDENCY_COMBODTYPE_ID, self.dependencyTypes), 0, wx.EXPAND) associationSizer.Add( WidgetFactory.buildComboSizerList( self, 'Dependency', (200, 30), armid.DEPENDENCY_COMBODEPENDENCY_ID, self.dependencies), 0, wx.EXPAND) mainSizer.Add( WidgetFactory.buildMLTextSizer(self, 'Rationale', (87, 60), armid.DEPENDENCY_TEXTRATIONALE_ID), 1, wx.EXPAND, 1, wx.EXPAND) mainSizer.Add( WidgetFactory.buildAddCancelButtonSizer( self, armid.DEPENDENCY_BUTTONCOMMIT_ID), 0, wx.ALIGN_CENTER) self.SetSizer(mainSizer) wx.EVT_BUTTON(self, armid.DEPENDENCY_BUTTONCOMMIT_ID, self.onCommit) wx.EVT_COMBOBOX(self, armid.DEPENDENCY_COMBOENVIRONMENT_ID, self.onEnvironmentChange) wx.EVT_COMBOBOX(self, armid.DEPENDENCY_COMBODTYPE_ID, self.onDependencyTypeChange)
def __init__(self, parent, _=None): self._choices = [ '<None>', '1 - Highest', '2', '3', '4', '5 - Normal', '6', '7', '8', '9', '10 - Lowest' ] super(PriorityBox, self).__init__(parent, -1, self._choices[0], (-1, -1), (-1, -1), self._choices, wx.CB_READONLY) wx.EVT_COMBOBOX(self, self.GetId(), parent.OnMakeDirty)
def __init__(self, parent, _=None): self._choices = [ '<None>', '0%', '10%', '20%', '30%', '40%', '50%', '60%', '70%', '80%', '90%', '100%' ] super(PercentCompleteBox, self).__init__(parent, -1, self._choices[0], (-1, -1), (-1, -1), self._choices, wx.CB_READONLY) wx.EVT_COMBOBOX(self, self.GetId(), parent.OnMakeDirty)
def AddMiscElement(self, title, shortname, elements, wine, num): elements.insert(0,"Default") wine.insert(0,"default") elemsize = (230,25) self.display_elements[shortname+"_text"] = wx.StaticText(self.panelMisc, -1, title,pos=(15,19+num*40)) self.display_elements[shortname] = wx.ComboBox(self.panelMisc, 400+num, style=wx.CB_READONLY,pos=(300,17+num*40),size=elemsize) self.display_elements[shortname].AppendItems(wine) self.display_elements[shortname].SetValue(wine[0]) wx.EVT_COMBOBOX(self, 400+num, self.change_settings)
def __init__(self, parent, _): global widgets_list # base clase pb_editor.DirtyUIBase.__init__(self, parent) # structure to hold all the widgets of this panel self._fields = [ ['description', 'Summary:', DVTextControl, None, None, None], ['location', 'Location:', DVTextControl, None, None, None], ['allday', 'All-Day:', wx.CheckBox, None, None, None], [ 'start', 'From:', DVDateTimeControl, None, self._set_start_datetime, None ], [ 'end', 'To:', DVDateTimeControl, None, self._set_end_datetime, None ], [ 'priority', 'Priority:', None, self._get_priority, self._set_priority, None ], ['alarm', 'Alarm:', DVIntControl, None, None, None], ['vibrate', 'Vibrate:', wx.CheckBox, None, None, None], ] # overall container vbs = wx.StaticBoxSizer(wx.StaticBox(self, -1), wx.VERTICAL) # instantiate the widgets self._w = {} gs = wx.FlexGridSizer(-1, 2, 5, 5) gs.AddGrowableCol(1) for n in self._fields: desc = n[self._label_index] t = wx.StaticText(self, -1, desc, style=wx.ALIGN_LEFT) widgets_list.append((t, n[self._dict_key_index])) gs.Add(t) if desc == 'Priority:': c = wx.ComboBox(self, -1, "", (-1, -1), (-1, -1), [ '<None>', '1 - Highest', '2', '3', '4', '5 - Normal', '6', '7', '8', '9', '10 - Lowest' ], wx.CB_DROPDOWN) else: c = n[self._class_index](self, -1) gs.Add(c, 0, wx.EXPAND, 0) n[self._w_index] = self._w[n[self._dict_key_index]] = c vbs.Add(gs, 0, wx.EXPAND | wx.ALL, 5) # event handlers wx.EVT_CHECKBOX(self, self._w['allday'].GetId(), self.OnAllday) wx.EVT_CHECKBOX(self, self._w['vibrate'].GetId(), self.OnDirtyUI) wx.EVT_COMBOBOX(self, self._w['priority'].GetId(), self.OnDirtyUI) # all done self.SetSizer(vbs) self.SetAutoLayout(True) vbs.Fit(self)
def General(self, nom): self.panelGeneral = wx.Panel(self, -1) self.AddPage(self.panelGeneral, nom) self.general_elements = {} # Les polices if(os.environ["POL_OS"] == "Mac"): self.fontTitle = wx.Font(14, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "", wx.FONTENCODING_DEFAULT) self.caption_font = wx.Font(11, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL,False, "", wx.FONTENCODING_DEFAULT) else : self.fontTitle = wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "", wx.FONTENCODING_DEFAULT) self.caption_font = wx.Font(8, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL,False, "", wx.FONTENCODING_DEFAULT) self.txtGeneral = wx.StaticText(self.panelGeneral, -1, _("General"), (10,10), wx.DefaultSize) self.txtGeneral.SetFont(self.fontTitle) self.AddGeneralButton(_("Make a new shortcut from this virtual drive"),"newshort",1) self.AddGeneralChamp(_("Name"),"name","",2) self.AddGeneralElement(_("Wine version"),"wineversion",[],[],3) self.AddGeneralChamp(_("Debug flags"), "winedebug", "", 4) self.AddGeneralElement(_("Virtual drive"), "wineprefix", playonlinux.Get_Drives(), playonlinux.Get_Drives(), 5) self.AddGeneralChamp(_("Arguments"), "arguments", "", 6) self.configurator_title = wx.StaticText(self.panelGeneral, -1, "", (10,294), wx.DefaultSize) self.configurator_title.SetFont(self.fontTitle) self.configurator_button = wx.Button(self.panelGeneral, 106, _("Run configuration wizard"), pos=(15,324)) wx.EVT_TEXT(self, 202, self.setname) wx.EVT_TEXT(self, 206, self.setargs) wx.EVT_TEXT(self, 204, self.setwinedebug) wx.EVT_COMBOBOX(self, 203, self.assign) wx.EVT_COMBOBOX(self, 205, self.assignPrefix) wx.EVT_BUTTON(self, 601, self.Parent.Parent.Parent.WineVersion)
def _create_priority_combo(self, parent): import wx sizer = wx.BoxSizer(wx.HORIZONTAL) label = wx.StaticText(parent, -1, "How critical is this issue?") sizer.Add(label, 0, wx.ALL, border=0) cb = wx.ComboBox(parent, -1, self.priority, wx.Point(90, 50), wx.Size(95, -1), priority_levels, wx.CB_READONLY) sizer.Add(cb, 1, wx.EXPAND | wx.LEFT | wx.CLIP_CHILDREN, border=10) wx.EVT_COMBOBOX(parent, cb.GetId(), self._on_priority) return sizer
def __init__(self, parent): wx.Panel.__init__(self, parent) self.topbit = wx.StaticText(self, -1, "Log file report for chosen day", wx.Point(20, 30)) self.sampleList = availdays() self.bo = wx.ComboBox(self, 30, "", wx.Point(50, 60), wx.Size(125, -1), self.sampleList, wx.CB_DROPDOWN) self.button = wx.Button(self, 10, "Analyse", wx.Point(50, 100)) self.leaver = wx.Button(self, 11, "Quit", wx.Point(50, 130)) self.logger = wx.TextCtrl(self,5, "",wx.Point(230,20), wx.Size(200,140),\ wx.TE_MULTILINE | wx.TE_READONLY) wx.EVT_BUTTON(self, 10, self.OnClick) wx.EVT_BUTTON(self, 11, self.OnClick) wx.EVT_COMBOBOX(self, 30, self.EvtComboBox) parent.SetTitle("Analysis of web server log file") self.currentselectedfile = None
def EvtRadioBox(self, event): if event.GetId()==92: Form1.formcalculate=event.GetString() print Form1.formcalculate if Form1.formcalculate=="Single": Form1.species_profile=Form1.speciesList[0] self.SelcMap = wx.StaticText(self,-1,"Selec Map:",wx.Point(20, 120)) #______________________________________________________________________________________________________ Form1.editspeciesList=wx.ComboBox(self, 93, Form1.species_profile, wx.Point(80, 120), wx.Size(280, -1), Form1.speciesList, wx.CB_DROPDOWN) wx.EVT_COMBOBOX(self, 93, self.EvtComboBox) wx.EVT_TEXT(self, 93, self.EvtText) #______________________________________________________________________________________________________ else: self.Refresh()
def create_control(self, parent): """ Creates the control. """ self.control = control = wx.ComboBox(parent, -1, self.value, wx.Point(0, 0), wx.Size(-1, -1), self.history, style=wx.CB_DROPDOWN) wx.EVT_COMBOBOX(parent, control.GetId(), self._update_value) wx.EVT_KILL_FOCUS(control, self._kill_focus) wx.EVT_TEXT_ENTER(parent, control.GetId(), self._update_text_value) if self.auto_set: wx.EVT_TEXT(parent, control.GetId(), self._update_value_only) return control
def makeResRefControl(self, typeSpec, prop, parent): if len(typeSpec) > 1: keyList, index = self.getResRefList(typeSpec, prop) control = wx.ComboBox(parent, -1, choices=keyList, style=wx.CB_DROPDOWN) if len(prop.getValue()) > 0: control.SetSelection(index) else: control.SetSelection(0) wx.EVT_COMBOBOX(self, control.GetId(), self.controlUsed) wx.EVT_TEXT(self, control.GetId(), self.controlUsed) else: control = wx.TextCtrl(parent, -1, prop.getValue()) wx.EVT_TEXT(self, control.GetId(), self.controlUsed) return control