def add_widget(self, widget): widget_type = type(widget) if (widget_type == TextBox or isinstance(widget, TextBox)): widget.instance = wx.TextCtrl(self.panel, -1, widget.text, widget.position, widget.size, style=wx.TE_MULTILINE) elif (widget_type == TextField or isinstance(widget, TextField)): widget.instance = wx.TextCtrl(self.panel, -1, widget.text, widget.position, widget.size) elif (widget_type == TextFieldPass or isinstance(widget, TextFieldPass)): widget.instance = wx.TextCtrl(self.panel, -1, widget.text, widget.position, widget.size, style=wx.TE_PASSWORD) elif (widget_type == Button or isinstance(widget, Button)): widget.instance = wx.Button(self.panel, -1, widget.title, widget.position, widget.size) if (widget.callbackMethod != None): widget.instance.Bind(wx.EVT_BUTTON, widget.callbackMethod) elif (widget_type == CheckBox or isinstance(widget, CheckBox)): widget.instance = wx.CheckBox(self.panel, -1, widget.title, widget.position, widget.size) widget.instance.SetValue(widget.value) elif (widget_type == RadioButtons or isinstance(widget, RadioButtons)): widget.instance = [] radio_instance = wx.RadioButton(self.panel, -1, widget.labels[0], widget.positions[0], widget.size, style=wx.RB_GROUP) widget.instance.append(radio_instance) for i in range(1, len(widget.labels)): radio_instance = wx.RadioButton(self.panel, -1, widget.labels[i], widget.positions[i], widget.size) widget.instance.append(radio_instance) if (widget.selected_index != None): widget.instance[widget.selected_index].SetValue(True) elif (widget_type == LabelText or isinstance(widget, LabelText)): widget.instance = wx.StaticText(self.panel, -1, widget.text, widget.position, widget.size) elif (widget_type == ValueList or isinstance(widget, ValueList)): widget.instance = wx.ComboBox(self.panel, -1, widget.value, widget.position, widget.size, widget.choices, style=wx.CB_READONLY) elif (widget_type == Slider or isinstance(widget, Slider)): widget.instance = wx.Slider(self.panel, -1, minValue=widget._from, maxValue=widget._to, pos=widget.position, size=widget.size, style=wx.SL_HORIZONTAL) elif (widget_type == SpinBox or isinstance(widget, SpinBox)): widget.instance = wx.SpinCtrl(self.panel, -1, size=widget.size, pos=widget.position, style=wx.SP_HORIZONTAL) widget.instance.SetRange(widget.start, widget.end)
def __do_layout(self): # just to add space around the settings box = wx.BoxSizer(wx.VERTICAL) summary_box = wx.StaticBox(self, wx.ID_ANY, label=_("Inkscape objects")) sizer = wx.StaticBoxSizer(summary_box, wx.HORIZONTAL) # sizer = wx.BoxSizer(wx.HORIZONTAL) self.description = wx.StaticText(self) self.update_description() self.description.SetLabel(self.description_text) self.description_container = box self.Bind(wx.EVT_SIZE, self.resized) sizer.Add(self.description, proportion=0, flag=wx.EXPAND | wx.ALL, border=5) box.Add(sizer, proportion=0, flag=wx.ALL, border=5) if self.toggle: box.Add(self.toggle_checkbox, proportion=0, flag=wx.BOTTOM, border=10) for param in self.params: description = wx.StaticText(self, label=param.description) description.SetToolTip(param.tooltip) self.settings_grid.Add(description, proportion=1, flag=wx.EXPAND | wx.RIGHT, border=40) if param.type == 'boolean': if len(param.values) > 1: input = wx.CheckBox(self, style=wx.CHK_3STATE) input.Set3StateValue(wx.CHK_UNDETERMINED) else: input = wx.CheckBox(self) if param.values: input.SetValue(param.values[0]) input.Bind(wx.EVT_CHECKBOX, self.changed) elif len(param.values) > 1: input = wx.ComboBox(self, wx.ID_ANY, choices=sorted(param.values), style=wx.CB_DROPDOWN) input.Bind(wx.EVT_COMBOBOX, self.changed) input.Bind(wx.EVT_TEXT, self.changed) else: value = param.values[0] if param.values else "" input = wx.TextCtrl(self, wx.ID_ANY, value=str(value)) input.Bind(wx.EVT_TEXT, self.changed) self.param_inputs[param.name] = input self.settings_grid.Add(input, proportion=1, flag=wx.ALIGN_CENTER_VERTICAL) self.settings_grid.Add(wx.StaticText(self, label=param.unit or ""), proportion=1, flag=wx.ALIGN_CENTER_VERTICAL) box.Add(self.settings_grid, proportion=1, flag=wx.ALL, border=10) self.SetSizer(box) self.Layout()
def makeSettings(self, settingsSizer): sHelper = guiHelper.BoxSizerHelper(self, sizer=settingsSizer) # Translators: label of a dialog. setSeparatorLabel = _( "Type the string to be used as a &separator between contents added to the clipboard." ) self.setSeparatorEdit = sHelper.addLabeledControl( setSeparatorLabel, wx.TextCtrl) try: self.setSeparatorEdit.SetValue( config.conf["clipContentsDesigner"]["separator"]) except KeyError: pass # Translators: label of a dialog. self.addTextBeforeCheckBox = sHelper.addItem( wx.CheckBox(self, label=_("&Add text before clip data"))) self.addTextBeforeCheckBox.SetValue( config.conf["clipContentsDesigner"]["addTextBefore"]) # Translators: label of a dialog. confirmBoxLabel = _( "Sele&ct the actions which require previous confirmation") confirmChoices = [ # Translators: label of a dialog. _("Confirm to add text"), # Translators: label of a dialog. _("Confirm to clear clipboard"), # Translators: label of a dialog. _("Confirm to emulate copy"), # Translators: label of a dialog. _("Confirm to emulate cut"), ] self.confirmList = sHelper.addLabeledControl( confirmBoxLabel, gui.nvdaControls.CustomCheckListBox, choices=confirmChoices) checkedItems = [] if config.conf["clipContentsDesigner"]["confirmToAdd"]: checkedItems.append(0) if config.conf["clipContentsDesigner"]["confirmToClear"]: checkedItems.append(1) if config.conf["clipContentsDesigner"]["confirmToCopy"]: checkedItems.append(2) if config.conf["clipContentsDesigner"]["confirmToCut"]: checkedItems.append(3) self.confirmList.CheckedItems = checkedItems self.confirmList.Select(0) # Translators: label of a dialog. confirmRequirementsLabel = _( "&Request confirmation before performing the selected actions when:" ) requirementChoices = [ # Translators: label of a dialog. _("Always"), # Translators: label of a dialog. _("If the clipboard contains text"), # Translators: label of a dialog. _("If the clipboard is not empty"), ] self.confirmRequirementChoices = sHelper.addLabeledControl( confirmRequirementsLabel, wx.Choice, choices=requirementChoices) self.confirmRequirementChoices.SetSelection( config.conf["clipContentsDesigner"]["confirmationRequirement"]) # Translators: label of a dialog. formatLabel = _("&Format to show the clipboard text in browse mode:") self.formatChoices = sHelper.addLabeledControl( formatLabel, wx.Choice, choices=BROWSEABLETEXT_FORMATS) self.formatChoices.SetSelection( config.conf["clipContentsDesigner"]["browseableTextFormat"]) # Translators: label of a dialog. wx.StaticText( self, -1, label= _("&Maximum number of characters when showing clipboard text in browse mode" )) self.maxLengthEdit = gui.nvdaControls.SelectOnFocusSpinCtrl( self, min=1, max=1000000, initial=config.conf["clipContentsDesigner"] ["maxLengthForBrowseableText"])
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.AddGeneralElement(_("Virtual drive"), "wineprefix", playonlinux.Get_Drives(), playonlinux.Get_Drives(), 4) self.general_elements["debug_text"] = wx.StaticText( self.panelGeneral, -1, _("Enable debugging"), pos=(15, 19 + 5 * 40)) self.general_elements["debug_check"] = wx.CheckBox(self.panelGeneral, 205, pos=(300, 20 + 5 * 40)) 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_BUTTON(self, 100, self.evt_winecfg) wx.EVT_BUTTON(self, 101, self.evt_regedit) wx.EVT_BUTTON(self, 102, self.evt_wineboot) wx.EVT_BUTTON(self, 103, self.evt_cmd) wx.EVT_BUTTON(self, 104, self.evt_taskmgr) wx.EVT_BUTTON(self, 105, self.evt_killall) wx.EVT_BUTTON(self, 106, self.evt_config) wx.EVT_TEXT(self, 202, self.setname) wx.EVT_TEXT(self, 206, self.setargs) wx.EVT_COMBOBOX(self, 203, self.assign) wx.EVT_COMBOBOX(self, 204, self.assignPrefix) wx.EVT_CHECKBOX(self, 205, self.setDebug)
def createControls(self): self.DrawButton = wx.Button(self, -1, "Draw/Recalc") self.SaveVarioButton = wx.Button(self, -1, "Save data") self.dateLabel = wx.StaticText(self, label="Insert time range:") self.startdateLabel = wx.StaticText(self, label="Start date:") self.startDatePicker = wx.DatePickerCtrl( self, dt=wx.DateTimeFromTimeT( time.mktime( datetime.strptime("2011-10-22", "%Y-%m-%d").timetuple()))) self.enddateLabel = wx.StaticText(self, label="End date:") self.endDatePicker = wx.DatePickerCtrl( self, dt=wx.DateTimeFromTimeT( time.mktime( datetime.strptime("2011-10-22", "%Y-%m-%d").timetuple()))) self.instLabel = wx.StaticText(self, label="Select variometer:") self.resolutionLabel = wx.StaticText(self, label="Select resolution:") self.scalarLabel = wx.StaticText(self, label="Select F source:") self.scalarReviewedLabel = wx.StaticText(self, label="only reviewed!") self.varioComboBox = wx.ComboBox(self, choices=self.varios, style=wx.CB_DROPDOWN, value=self.varios[0]) self.overrideAutoBaselineButton = wx.Button(self, -1, "Manual base.") self.baselinefileTextCtrl = wx.TextCtrl(self, value="--") self.baselinefileTextCtrl.Disable() self.scalarComboBox = wx.ComboBox(self, choices=self.scalars, style=wx.CB_DROPDOWN, value=self.scalars[0]) self.resolutionComboBox = wx.ComboBox(self, choices=self.resolution, style=wx.CB_DROPDOWN, value=self.resolution[0]) self.datatypeLabel = wx.StaticText(self, label="Select datatype:") self.datatypeComboBox = wx.ComboBox(self, choices=self.datatype, style=wx.CB_DROPDOWN, value=self.datatype[1]) self.drawRadioBox = wx.RadioBox(self, label="Select vector components", choices=self.comp, majorDimension=3, style=wx.RA_SPECIFY_COLS) self.addoptLabel = wx.StaticText(self, label="Optional graphs:") self.baselinecorrCheckBox = wx.CheckBox(self, label="Baseline corr.") self.fCheckBox = wx.CheckBox(self, label="Plot F") self.dfCheckBox = wx.CheckBox(self, label="calculate dF") self.dfCheckBox.Disable() self.tCheckBox = wx.CheckBox(self, label="Plot T") self.showFlaggedCheckBox = wx.CheckBox(self, label="show flagged") self.curdateTextCtrl = wx.TextCtrl(self, value="--") self.curdateTextCtrl.Disable() self.prevdateTextCtrl = wx.TextCtrl(self, value="--") self.prevdateTextCtrl.Disable() self.GetGraphMarksButton = wx.Button(self, -1, "Get marks") self.flagSingleButton = wx.Button(self, -1, "Flag date") self.flagRangeButton = wx.Button(self, -1, "Flag range") self.curselecteddateLabel = wx.StaticText(self, label="Current sel.") self.prevselecteddateLabel = wx.StaticText(self, label="Previous sel.") self.dfIniTextCtrl = wx.TextCtrl(self, value="dF(ini): 0 nT") self.dfCurTextCtrl = wx.TextCtrl(self, value="dF(cur): --") self.dfIniTextCtrl.Disable() self.dfCurTextCtrl.Disable()
def CreateOptionsPage(self): """ Creates the :class:`~wx.lib.agw.labelbook.LabelBook` option page which holds the :class:`~wx.lib.agw.flatmenu.FlatMenu` styles. """ options = wx.Panel(self._book, wx.ID_ANY, wx.DefaultPosition, wx.Size(300, 300)) # Create some options here vsizer = wx.BoxSizer(wx.VERTICAL) options.SetSizer(vsizer) #----------------------------------------------------------- # options page layout # - Menu Style: Default or 2007 (radio group) # # - Default Style Settings: (static box) # + Draw vertical gradient (check box) # + Draw border (check box) # + Drop toolbar shadow (check box) # # - Colour Scheme (static box) # + Menu bar background colour (combo button) #----------------------------------------------------------- self._menuStyleID = wx.NewId() choices = [_("Default Style"), _("Metallic")] self._menuStyle = wx.RadioBox(options, self._menuStyleID, _("Menu bar style"), wx.DefaultPosition, wx.DefaultSize, choices) # update the selection theme = ArtManager.Get().GetMenuTheme() if theme == Style2007: self._menuStyle.SetSelection(1) else: self._menuStyle.SetSelection(0) # connect event to the control self._menuStyle.Bind(wx.EVT_RADIOBOX, self.OnChangeStyle) vsizer.Add(self._menuStyle, 0, wx.EXPAND | wx.ALL, 5) self._sbStyle = wx.StaticBoxSizer( wx.StaticBox(options, -1, _("Default style settings")), wx.VERTICAL) self._drawVertGradID = wx.NewId() self._verticalGradient = wx.CheckBox(options, self._drawVertGradID, _("Draw vertical gradient")) self._verticalGradient.Bind(wx.EVT_CHECKBOX, self.OnChangeStyle) self._sbStyle.Add(self._verticalGradient, 0, wx.EXPAND | wx.ALL, 3) self._verticalGradient.SetValue( ArtManager.Get().GetMBVerticalGradient()) self._drawBorderID = wx.NewId() self._drawBorder = wx.CheckBox(options, self._drawBorderID, _("Draw border around menu bar")) self._drawBorder.Bind(wx.EVT_CHECKBOX, self.OnChangeStyle) self._sbStyle.Add(self._drawBorder, 0, wx.EXPAND | wx.ALL, 3) self._drawBorder.SetValue(ArtManager.Get().GetMenuBarBorder()) self._shadowUnderTBID = wx.NewId() self._shadowUnderTB = wx.CheckBox(options, self._shadowUnderTBID, _("Toolbar float over menu bar")) self._shadowUnderTB.Bind(wx.EVT_CHECKBOX, self.OnChangeStyle) self._sbStyle.Add(self._shadowUnderTB, 0, wx.EXPAND | wx.ALL, 3) self._shadowUnderTB.SetValue(ArtManager.Get().GetRaiseToolbar()) vsizer.Add(self._sbStyle, 0, wx.EXPAND | wx.ALL, 5) # Misc sb = wx.StaticBoxSizer(wx.StaticBox(options, -1, _("Colour Scheme")), wx.VERTICAL) self._colourID = wx.NewId() colourChoices = ArtManager.Get().GetColourSchemes() colourChoices.sort() self._colour = wx.ComboBox(options, self._colourID, ArtManager.Get().GetMenuBarColourScheme(), choices=colourChoices, style=wx.CB_DROPDOWN | wx.CB_READONLY) sb.Add(self._colour, 0, wx.EXPAND) vsizer.Add(sb, 0, wx.EXPAND | wx.ALL, 5) self._colour.Bind(wx.EVT_COMBOBOX, self.OnChangeStyle) # update the dialog by sending all possible events to us event = wx.CommandEvent(wx.wxEVT_COMMAND_RADIOBOX_SELECTED, self._menuStyleID) event.SetEventObject(self) event.SetInt(self._menuStyle.GetSelection()) self._menuStyle.ProcessEvent(event) event.SetEventType(wx.wxEVT_COMMAND_CHECKBOX_CLICKED) event.SetId(self._drawVertGradID) event.SetInt(ArtManager.Get().GetMBVerticalGradient()) self._verticalGradient.ProcessEvent(event) event.SetEventType(wx.wxEVT_COMMAND_CHECKBOX_CLICKED) event.SetId(self._shadowUnderTBID) event.SetInt(ArtManager.Get().GetRaiseToolbar()) self._shadowUnderTB.ProcessEvent(event) event.SetEventType(wx.wxEVT_COMMAND_CHECKBOX_CLICKED) event.SetId(self._drawBorderID) event.SetInt(ArtManager.Get().GetMenuBarBorder()) self._drawBorder.ProcessEvent(event) event.SetEventType(wx.wxEVT_COMMAND_COMBOBOX_SELECTED) event.SetId(self._colourID) self._colour.ProcessEvent(event) return options
def __init__(self, parent): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"microDAQ System", pos=wx.Point(710, 20), size=wx.Size(1200, 250), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) self.m_menubar1 = wx.MenuBar(0) self.m_menu1 = wx.Menu() self.m_menuItem1 = wx.MenuItem(self.m_menu1, wx.ID_ANY, u"MyMenuItem", wx.EmptyString, wx.ITEM_NORMAL) self.m_menu1.AppendItem(self.m_menuItem1) self.m_menuItem2 = wx.MenuItem(self.m_menu1, wx.ID_ANY, u"MyMenuItem", wx.EmptyString, wx.ITEM_NORMAL) self.m_menu1.AppendItem(self.m_menuItem2) self.m_menubar1.Append(self.m_menu1, u"MyMenu") self.m_menu2 = wx.Menu() self.m_menuItem3 = wx.MenuItem(self.m_menu2, wx.ID_ANY, u"MyMenuItem", wx.EmptyString, wx.ITEM_NORMAL) self.m_menu2.AppendItem(self.m_menuItem3) self.m_menuItem4 = wx.MenuItem(self.m_menu2, wx.ID_ANY, u"MyMenuItem", wx.EmptyString, wx.ITEM_NORMAL) self.m_menu2.AppendItem(self.m_menuItem4) self.m_menubar1.Append(self.m_menu2, u"MyMenu") self.m_menu3 = wx.Menu() self.m_menuItem5 = wx.MenuItem(self.m_menu3, wx.ID_ANY, u"MyMenuItem", wx.EmptyString, wx.ITEM_NORMAL) self.m_menu3.AppendItem(self.m_menuItem5) self.m_menuItem6 = wx.MenuItem(self.m_menu3, wx.ID_ANY, u"MyMenuItem", wx.EmptyString, wx.ITEM_NORMAL) self.m_menu3.AppendItem(self.m_menuItem6) self.m_menubar1.Append(self.m_menu3, u"MyMenu") self.SetMenuBar(self.m_menubar1) bSizer1 = wx.BoxSizer(wx.VERTICAL) self.Title_panel1 = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.Size(-1, 30), wx.TAB_TRAVERSAL) self.Title_panel1.SetMinSize(wx.Size(-1, 30)) self.Title_panel1.SetMaxSize(wx.Size(-1, 30)) TitleSizer = wx.BoxSizer(wx.VERTICAL) self.m_staticText60 = wx.StaticText(self.Title_panel1, wx.ID_ANY, u"NIDaq 計測システム", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText60.Wrap(-1) self.m_staticText60.SetFont( wx.Font(16, 70, 90, 90, False, wx.EmptyString)) TitleSizer.Add( self.m_staticText60, 1, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.Title_panel1.SetSizer(TitleSizer) self.Title_panel1.Layout() bSizer1.Add(self.Title_panel1, 1, wx.ALL | wx.EXPAND, 5) self.Main_panel = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) MainPanelSizer = wx.BoxSizer(wx.HORIZONTAL) self.SinWave_Control_panel = wx.Panel( self.Main_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.STATIC_BORDER | wx.TAB_TRAVERSAL) self.SinWave_Control_panel.SetMaxSize(wx.Size(270, -1)) SinWaveSizer1 = wx.BoxSizer(wx.HORIZONTAL) self.SinWaveText1 = wx.StaticText( self.SinWave_Control_panel, wx.ID_ANY, u"Dev1/AO\nController\n\nSin Wave\nGenerator\n", wx.DefaultPosition, wx.DefaultSize, 0) self.SinWaveText1.Wrap(-1) self.SinWaveText1.SetMaxSize(wx.Size(70, -1)) SinWaveSizer1.Add(self.SinWaveText1, 0, wx.ALL | wx.EXPAND, 5) SinWaveSizer2 = wx.GridSizer(5, 2, 0, 0) self.SinWaveText2 = wx.StaticText(self.SinWave_Control_panel, wx.ID_ANY, u"Sin Freq", wx.DefaultPosition, wx.Size(60, -1), 0) self.SinWaveText2.Wrap(-1) self.SinWaveText2.SetMaxSize(wx.Size(60, 25)) SinWaveSizer2.Add(self.SinWaveText2, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.AO_SinFreq = wx.TextCtrl(self.SinWave_Control_panel, wx.ID_ANY, u"20", wx.DefaultPosition, wx.DefaultSize, 0) self.AO_SinFreq.SetMaxSize(wx.Size(50, -1)) SinWaveSizer2.Add(self.AO_SinFreq, 0, wx.ALL, 5) self.SinWaveText3 = wx.StaticText(self.SinWave_Control_panel, wx.ID_ANY, u"Sample N", wx.DefaultPosition, wx.DefaultSize, 0) self.SinWaveText3.Wrap(-1) self.SinWaveText3.SetMaxSize(wx.Size(60, 25)) SinWaveSizer2.Add(self.SinWaveText3, 0, wx.ALL, 5) self.AO_SinSampleN = wx.TextCtrl(self.SinWave_Control_panel, wx.ID_ANY, u"1000", wx.DefaultPosition, wx.DefaultSize, 0) self.AO_SinSampleN.SetMaxSize(wx.Size(50, -1)) SinWaveSizer2.Add(self.AO_SinSampleN, 1, wx.ALL, 5) self.SinWaveTexxt4 = wx.StaticText(self.SinWave_Control_panel, wx.ID_ANY, u"Amp", wx.DefaultPosition, wx.DefaultSize, 0) self.SinWaveTexxt4.Wrap(-1) self.SinWaveTexxt4.SetMaxSize(wx.Size(60, -1)) SinWaveSizer2.Add(self.SinWaveTexxt4, 0, wx.ALL, 5) self.AO_SinAmp = wx.TextCtrl(self.SinWave_Control_panel, wx.ID_ANY, u"1.0", wx.DefaultPosition, wx.DefaultSize, 0) self.AO_SinAmp.SetMaxSize(wx.Size(50, -1)) SinWaveSizer2.Add(self.AO_SinAmp, 1, wx.ALL, 5) self.SInWaveText5 = wx.StaticText(self.SinWave_Control_panel, wx.ID_ANY, u"Sycle N", wx.DefaultPosition, wx.DefaultSize, 0) self.SInWaveText5.Wrap(-1) SinWaveSizer2.Add(self.SInWaveText5, 0, wx.ALL, 5) self.AO_SinWaveCycleN = wx.TextCtrl(self.SinWave_Control_panel, wx.ID_ANY, u"2", wx.DefaultPosition, wx.DefaultSize, 0) self.AO_SinWaveCycleN.SetMaxSize(wx.Size(50, -1)) SinWaveSizer2.Add(self.AO_SinWaveCycleN, 0, wx.ALL, 5) SinWaveSizer1.Add(SinWaveSizer2, 1, wx.EXPAND, 5) SinWaveSizer3 = wx.BoxSizer(wx.VERTICAL) self.AO_SinWaveStartButton = wx.Button(self.SinWave_Control_panel, wx.ID_ANY, u"Start", wx.DefaultPosition, wx.DefaultSize, 0) SinWaveSizer3.Add(self.AO_SinWaveStartButton, 1, wx.ALL | wx.EXPAND, 5) self.m_staticline2 = wx.StaticLine(self.SinWave_Control_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) SinWaveSizer3.Add(self.m_staticline2, 0, wx.EXPAND | wx.ALL, 5) self.AO_SinWaveStopButton = wx.Button(self.SinWave_Control_panel, wx.ID_ANY, u"Stop", wx.DefaultPosition, wx.DefaultSize, 0) SinWaveSizer3.Add(self.AO_SinWaveStopButton, 1, wx.ALL | wx.EXPAND, 5) SinWaveSizer1.Add(SinWaveSizer3, 1, wx.EXPAND, 5) self.SinWave_Control_panel.SetSizer(SinWaveSizer1) self.SinWave_Control_panel.Layout() SinWaveSizer1.Fit(self.SinWave_Control_panel) MainPanelSizer.Add(self.SinWave_Control_panel, 1, wx.EXPAND | wx.ALL, 5) self.WhiteNoise_Contol_panel = wx.Panel( self.Main_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.STATIC_BORDER | wx.TAB_TRAVERSAL) self.WhiteNoise_Contol_panel.SetMaxSize(wx.Size(270, -1)) NoiseSizer1 = wx.BoxSizer(wx.HORIZONTAL) self.NoiseText1 = wx.StaticText( self.WhiteNoise_Contol_panel, wx.ID_ANY, u"Dev1/AO\nController\n\nWhite\nNoise\nGenerator\n", wx.DefaultPosition, wx.DefaultSize, 0) self.NoiseText1.Wrap(-1) self.NoiseText1.SetMaxSize(wx.Size(70, -1)) NoiseSizer1.Add(self.NoiseText1, 0, wx.ALL | wx.EXPAND, 5) NoiseSiser2 = wx.GridSizer(5, 2, 0, 0) self.NoiseText2 = wx.StaticText(self.WhiteNoise_Contol_panel, wx.ID_ANY, u"Max Freq", wx.DefaultPosition, wx.Size(60, -1), 0) self.NoiseText2.Wrap(-1) self.NoiseText2.SetMaxSize(wx.Size(60, 25)) NoiseSiser2.Add(self.NoiseText2, 0, wx.ALL, 5) self.AO_NoizeMaxFreq = wx.TextCtrl(self.WhiteNoise_Contol_panel, wx.ID_ANY, u"500", wx.DefaultPosition, wx.DefaultSize, 0) self.AO_NoizeMaxFreq.SetMaxSize(wx.Size(50, -1)) NoiseSiser2.Add(self.AO_NoizeMaxFreq, 0, wx.ALL, 5) self.NoiseText3 = wx.StaticText(self.WhiteNoise_Contol_panel, wx.ID_ANY, u"Sample N", wx.DefaultPosition, wx.DefaultSize, 0) self.NoiseText3.Wrap(-1) self.NoiseText3.SetMaxSize(wx.Size(60, 25)) NoiseSiser2.Add(self.NoiseText3, 0, wx.ALL, 5) self.AO_NoiseSampleN = wx.TextCtrl(self.WhiteNoise_Contol_panel, wx.ID_ANY, u"4000", wx.DefaultPosition, wx.DefaultSize, 0) self.AO_NoiseSampleN.SetMaxSize(wx.Size(50, -1)) NoiseSiser2.Add(self.AO_NoiseSampleN, 1, wx.ALL, 5) self.NoiseText4 = wx.StaticText(self.WhiteNoise_Contol_panel, wx.ID_ANY, u"Amp", wx.DefaultPosition, wx.DefaultSize, 0) self.NoiseText4.Wrap(-1) self.NoiseText4.SetMaxSize(wx.Size(60, -1)) NoiseSiser2.Add(self.NoiseText4, 0, wx.ALL, 5) self.AO_NoiseAmp = wx.TextCtrl(self.WhiteNoise_Contol_panel, wx.ID_ANY, u"1.0", wx.DefaultPosition, wx.DefaultSize, 0) self.AO_NoiseAmp.SetMaxSize(wx.Size(50, -1)) NoiseSiser2.Add(self.AO_NoiseAmp, 1, wx.ALL, 5) NoiseSizer1.Add(NoiseSiser2, 1, wx.EXPAND, 5) NoiseSiser3 = wx.BoxSizer(wx.VERTICAL) self.AO_NoiseStartButton = wx.Button(self.WhiteNoise_Contol_panel, wx.ID_ANY, u"Start", wx.DefaultPosition, wx.DefaultSize, 0) NoiseSiser3.Add(self.AO_NoiseStartButton, 1, wx.ALL | wx.EXPAND, 5) self.m_staticline3 = wx.StaticLine(self.WhiteNoise_Contol_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) NoiseSiser3.Add(self.m_staticline3, 0, wx.EXPAND | wx.ALL, 5) self.AO_NoiseStopButton = wx.Button(self.WhiteNoise_Contol_panel, wx.ID_ANY, u"Stop", wx.DefaultPosition, wx.DefaultSize, 0) NoiseSiser3.Add(self.AO_NoiseStopButton, 1, wx.ALL | wx.EXPAND, 5) NoiseSizer1.Add(NoiseSiser3, 1, wx.EXPAND, 5) self.WhiteNoise_Contol_panel.SetSizer(NoiseSizer1) self.WhiteNoise_Contol_panel.Layout() NoiseSizer1.Fit(self.WhiteNoise_Contol_panel) MainPanelSizer.Add(self.WhiteNoise_Contol_panel, 1, wx.EXPAND | wx.ALL, 5) self.AI_Control_panel = wx.Panel(self.Main_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.STATIC_BORDER | wx.TAB_TRAVERSAL) self.AI_Control_panel.SetMaxSize(wx.Size(270, -1)) AISizer1 = wx.BoxSizer(wx.HORIZONTAL) bSizer12 = wx.BoxSizer(wx.VERTICAL) self.AIText1 = wx.StaticText(self.AI_Control_panel, wx.ID_ANY, u"Dev1/AI\nController\n\nAnalog\nInput", wx.DefaultPosition, wx.DefaultSize, 0) self.AIText1.Wrap(-1) self.AIText1.SetMaxSize(wx.Size(70, -1)) bSizer12.Add(self.AIText1, 0, wx.ALL | wx.EXPAND, 5) self.m_staticline5 = wx.StaticLine(self.AI_Control_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) bSizer12.Add(self.m_staticline5, 0, wx.EXPAND | wx.ALL, 5) self.AI_command = wx.TextCtrl(self.AI_Control_panel, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) self.AI_command.SetMaxSize(wx.Size(55, -1)) bSizer12.Add(self.AI_command, 0, wx.ALL, 5) AISizer1.Add(bSizer12, 1, wx.EXPAND, 5) AISizer2 = wx.GridSizer(5, 2, 0, 0) self.AIText2 = wx.StaticText(self.AI_Control_panel, wx.ID_ANY, u"Start CH", wx.DefaultPosition, wx.Size(60, -1), 0) self.AIText2.Wrap(-1) self.AIText2.SetMaxSize(wx.Size(60, 25)) AISizer2.Add(self.AIText2, 0, wx.ALL, 5) self.AI_StartCH = wx.TextCtrl(self.AI_Control_panel, wx.ID_ANY, u"1", wx.DefaultPosition, wx.DefaultSize, 0) self.AI_StartCH.SetMaxSize(wx.Size(60, -1)) AISizer2.Add(self.AI_StartCH, 0, wx.ALL, 5) self.AIText3 = wx.StaticText(self.AI_Control_panel, wx.ID_ANY, u"End CH", wx.DefaultPosition, wx.DefaultSize, 0) self.AIText3.Wrap(-1) self.AIText3.SetMaxSize(wx.Size(60, 25)) AISizer2.Add(self.AIText3, 0, wx.ALL, 5) self.AI_EndCH = wx.TextCtrl(self.AI_Control_panel, wx.ID_ANY, u"2", wx.DefaultPosition, wx.DefaultSize, 0) self.AI_EndCH.SetMaxSize(wx.Size(60, -1)) AISizer2.Add(self.AI_EndCH, 1, wx.ALL, 5) self.AIText4 = wx.StaticText(self.AI_Control_panel, wx.ID_ANY, u"Sample Frq", wx.DefaultPosition, wx.DefaultSize, 0) self.AIText4.Wrap(-1) self.AIText4.SetMaxSize(wx.Size(60, -1)) AISizer2.Add(self.AIText4, 0, wx.ALL, 5) self.AI_SampleFreq = wx.TextCtrl(self.AI_Control_panel, wx.ID_ANY, u"1000", wx.DefaultPosition, wx.DefaultSize, 0) self.AI_SampleFreq.SetMaxSize(wx.Size(60, -1)) AISizer2.Add(self.AI_SampleFreq, 1, wx.ALL, 5) self.AIText5 = wx.StaticText(self.AI_Control_panel, wx.ID_ANY, u"Range", wx.DefaultPosition, wx.DefaultSize, 0) self.AIText5.Wrap(-1) self.AIText5.SetMaxSize(wx.Size(60, -1)) AISizer2.Add(self.AIText5, 0, wx.ALL, 5) self.AI_Range = wx.TextCtrl(self.AI_Control_panel, wx.ID_ANY, u"5.0", wx.DefaultPosition, wx.DefaultSize, 0) self.AI_Range.SetMaxSize(wx.Size(60, -1)) AISizer2.Add(self.AI_Range, 1, wx.ALL, 5) self.AIText6 = wx.StaticText(self.AI_Control_panel, wx.ID_ANY, u"Sample N", wx.DefaultPosition, wx.DefaultSize, 0) self.AIText6.Wrap(-1) self.AIText6.SetMaxSize(wx.Size(60, -1)) AISizer2.Add(self.AIText6, 0, wx.ALL, 5) self.AI_SampleN = wx.TextCtrl(self.AI_Control_panel, wx.ID_ANY, u"4096", wx.DefaultPosition, wx.DefaultSize, 0) self.AI_SampleN.SetMaxSize(wx.Size(60, -1)) AISizer2.Add(self.AI_SampleN, 0, wx.ALL, 5) AISizer1.Add(AISizer2, 1, wx.EXPAND, 5) AISizer3 = wx.BoxSizer(wx.VERTICAL) self.AI_StartButton = wx.Button(self.AI_Control_panel, wx.ID_ANY, u"Start", wx.DefaultPosition, wx.DefaultSize, 0) AISizer3.Add(self.AI_StartButton, 1, wx.ALL | wx.EXPAND, 5) self.m_staticline4 = wx.StaticLine(self.AI_Control_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) AISizer3.Add(self.m_staticline4, 0, wx.EXPAND | wx.ALL, 5) self.AI_StopButton = wx.Button(self.AI_Control_panel, wx.ID_ANY, u"Stop", wx.DefaultPosition, wx.DefaultSize, 0) AISizer3.Add(self.AI_StopButton, 1, wx.ALL | wx.EXPAND, 5) self.m_staticline6 = wx.StaticLine(self.AI_Control_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) AISizer3.Add(self.m_staticline6, 0, wx.EXPAND | wx.ALL, 5) self.AI_ExtSample = wx.CheckBox(self.AI_Control_panel, wx.ID_ANY, u"ExtSample", wx.DefaultPosition, wx.DefaultSize, 0) self.AI_ExtSample.SetValue(True) AISizer3.Add(self.AI_ExtSample, 1, wx.ALL, 5) AISizer1.Add(AISizer3, 1, wx.EXPAND, 5) self.AI_Control_panel.SetSizer(AISizer1) self.AI_Control_panel.Layout() AISizer1.Fit(self.AI_Control_panel) MainPanelSizer.Add(self.AI_Control_panel, 1, wx.EXPAND | wx.ALL, 5) self.Graph_panel = wx.Panel(self.Main_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) bSizer141 = wx.BoxSizer(wx.VERTICAL) self.Graph_panel1 = wx.Panel(self.Graph_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.STATIC_BORDER | wx.TAB_TRAVERSAL) bSizer141.Add(self.Graph_panel1, 1, wx.EXPAND | wx.ALL, 5) self.Graph_panel.SetSizer(bSizer141) self.Graph_panel.Layout() bSizer141.Fit(self.Graph_panel) MainPanelSizer.Add(self.Graph_panel, 1, wx.ALL | wx.EXPAND, 5) self.Main_panel.SetSizer(MainPanelSizer) self.Main_panel.Layout() MainPanelSizer.Fit(self.Main_panel) bSizer1.Add(self.Main_panel, 1, wx.EXPAND | wx.ALL, 5) self.SetSizer(bSizer1) self.Layout() # Connect Events self.AO_SinWaveStartButton.Bind(wx.EVT_BUTTON, self.SinWaveStart) self.AO_SinWaveStopButton.Bind(wx.EVT_BUTTON, self.SinWaveStop) self.AO_NoiseStartButton.Bind(wx.EVT_BUTTON, self.WhiteNoiseStart) self.AO_NoiseStopButton.Bind(wx.EVT_BUTTON, self.WhiteNoiseStop) self.AI_command.Bind(wx.EVT_TEXT, self.AI_Command) self.AI_StartButton.Bind(wx.EVT_BUTTON, self.AI_Srart) self.AI_StopButton.Bind(wx.EVT_BUTTON, self.AI_Stop) ######################################################################################################## self.AO_SinWaveStartButton.Enabled = True self.AO_SinWaveStopButton.Enabled = False self.AO_NoiseStartButton.Enabled = True self.AO_NoiseStopButton.Enabled = False self.GraphDataExist = False self.figure = Figure(None) # Figure(グラフの台紙)オブジェクトを生成
def __init__(self, parent): wx.Dialog.__init__(self, parent, -1, name="DLG_Impression_infos_medicales", style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX | wx.THICK_FRAME) self.parent = parent intro = _( u"Vous pouvez ici imprimer une liste au format PDF des informations médicales des individus présents sur la période de votre choix. Pour une liste standard, sélectionnez simplement une période puis cliquez sur 'Aperçu'." ) titre = _(u"Impression de la liste des informations médicales") self.ctrl_bandeau = CTRL_Bandeau.Bandeau( self, titre=titre, texte=intro, hauteurHtml=30, nomImage="Images/32x32/Imprimante.png") # Calendrier self.staticbox_date_staticbox = wx.StaticBox(self, -1, _(u"Période")) self.ctrl_calendrier = CTRL_Grille_periode.CTRL(self) self.ctrl_calendrier.SetMinSize((230, 150)) # Activités self.staticbox_activites_staticbox = wx.StaticBox( self, -1, _(u"Activités")) self.ctrl_activites = CTRL_Activites(self) self.ctrl_activites.SetMinSize((10, 50)) # Groupes self.staticbox_groupes_staticbox = wx.StaticBox( self, -1, _(u"Groupes")) self.ctrl_groupes = CTRL_Groupes(self) # Options self.staticbox_options_staticbox = wx.StaticBox( self, -1, _(u"Options")) self.label_modele = wx.StaticText(self, -1, _(u"Modèle :")) self.ctrl_modele = wx.Choice(self, -1, choices=[ _(u"Modèle par défaut"), ]) self.ctrl_modele.Select(0) self.label_tri = wx.StaticText(self, -1, _(u"Tri :")) self.ctrl_tri = wx.Choice(self, -1, choices=["Nom", _(u"Prénom"), _(u"Age")]) self.ctrl_tri.Select(0) self.ctrl_ordre = wx.Choice(self, -1, choices=["Croissant", _(u"Décroissant")]) self.ctrl_ordre.Select(0) self.checkbox_lignes_vierges = wx.CheckBox( self, -1, _(u"Afficher des lignes vierges :")) self.checkbox_lignes_vierges.SetValue(True) self.ctrl_nbre_lignes = wx.Choice(self, -1, choices=[ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15" ]) self.ctrl_nbre_lignes.Select(2) self.checkbox_page_groupe = wx.CheckBox( self, -1, _(u"Insérer un saut de page après chaque groupe")) self.checkbox_page_groupe.SetValue(True) self.checkbox_nonvides = wx.CheckBox( self, -1, _(u"Afficher uniquement les individus avec infos")) self.checkbox_nonvides.SetValue(False) self.checkbox_age = wx.CheckBox(self, -1, _(u"Afficher l'âge des individus")) self.checkbox_age.SetValue(True) self.checkbox_photos = wx.CheckBox(self, -1, _(u"Afficher les photos :")) self.checkbox_photos.SetValue(False) self.ctrl_taille_photos = wx.Choice(self, -1, choices=[ _(u"Petite taille"), _(u"Moyenne taille"), _(u"Grande taille") ]) self.ctrl_taille_photos.SetSelection(1) # Mémorisation des paramètres self.ctrl_memoriser = wx.CheckBox(self, -1, _(u"Mémoriser les paramètres")) font = self.GetFont() font.SetPointSize(7) self.ctrl_memoriser.SetFont(font) self.ctrl_memoriser.SetValue(True) # Boutons self.bouton_aide = CTRL_Bouton_image.CTRL( self, texte=_(u"Aide"), cheminImage="Images/32x32/Aide.png") self.bouton_ok = CTRL_Bouton_image.CTRL( self, texte=_(u"Aperçu"), cheminImage="Images/32x32/Apercu.png") self.bouton_annuler = CTRL_Bouton_image.CTRL( self, id=wx.ID_CANCEL, texte=_(u"Fermer"), cheminImage="Images/32x32/Fermer.png") self.__set_properties() self.__do_layout() self.Bind(wx.EVT_CHECKBOX, self.OnCheckLignesVierges, self.checkbox_lignes_vierges) self.Bind(wx.EVT_CHECKBOX, self.OnCheckPhotos, self.checkbox_photos) self.Bind(wx.EVT_BUTTON, self.OnBoutonAide, self.bouton_aide) self.Bind(wx.EVT_BUTTON, self.OnBoutonOk, self.bouton_ok) # Récupération des paramètres dans le CONFIG param_tri = UTILS_Config.GetParametre("impression_infos_med_tri", defaut=0) self.ctrl_tri.Select(param_tri) param_ordre = UTILS_Config.GetParametre("impression_infos_med_ordre", defaut=0) self.ctrl_ordre.Select(param_ordre) param_lignes_vierges = UTILS_Config.GetParametre( "impression_infos_med_lignes_vierges", defaut=1) self.checkbox_lignes_vierges.SetValue(param_lignes_vierges) if param_lignes_vierges == 1: param_nbre_lignes_vierges = UTILS_Config.GetParametre( "impression_infos_med_nbre_lignes_vierges", defaut=2) self.ctrl_nbre_lignes.Select(param_nbre_lignes_vierges) param_page_groupe = UTILS_Config.GetParametre( "impression_infos_med_page_groupe", defaut=1) self.checkbox_page_groupe.SetValue(param_page_groupe) param_nonvides = UTILS_Config.GetParametre( "impression_infos_med_nonvides", defaut=0) self.checkbox_nonvides.SetValue(param_nonvides) param_age = UTILS_Config.GetParametre("impression_infos_med_age", defaut=1) self.checkbox_age.SetValue(param_age) param_photos = UTILS_Config.GetParametre("impression_infos_med_photos", defaut=1) self.checkbox_photos.SetValue(param_photos) param_taille_photos = UTILS_Config.GetParametre( "impression_infos_med_taille_photos", defaut=1) self.ctrl_taille_photos.SetSelection(param_taille_photos) param_memoriser = UTILS_Config.GetParametre( "impression_infos_med_memoriser", defaut=1) self.ctrl_memoriser.SetValue(param_memoriser) # Init Contrôles self.OnCheckLignesVierges(None) self.OnCheckPhotos(None) self.bouton_ok.SetFocus() self.ctrl_calendrier.SetVisibleSelection() self.SetListesPeriodes(self.ctrl_calendrier.GetDatesSelections()) self.grid_sizer_base.Fit(self)
def populatePanel(self, panel): self.UpdateSettings = UpdateSettings.getInstance() self.dirtySettings = False dlgWidth = panel.GetParent().GetParent().ClientSize.width mainSizer = wx.BoxSizer(wx.VERTICAL) self.stTitle = wx.StaticText(panel, wx.ID_ANY, self.title, wx.DefaultPosition, wx.DefaultSize, 0) self.stTitle.Wrap(-1) self.stTitle.SetFont(wx.Font(12, 70, 90, 90, False, wx.EmptyString)) mainSizer.Add(self.stTitle, 0, wx.EXPAND | wx.ALL, 5) self.m_staticline1 = wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) mainSizer.Add(self.m_staticline1, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) self.stDesc = wx.StaticText(panel, wx.ID_ANY, self.desc, wx.DefaultPosition, wx.DefaultSize, 0) self.stDesc.Wrap(dlgWidth - 50) mainSizer.Add(self.stDesc, 0, wx.ALL, 5) self.suppressPrerelease = wx.CheckBox( panel, wx.ID_ANY, "Allow pre-release notifications", wx.DefaultPosition, wx.DefaultSize, 0) self.suppressPrerelease.Bind(wx.EVT_CHECKBOX, self.OnPrereleaseStateChange) self.suppressPrerelease.SetValue( not self.UpdateSettings.get('prerelease')) mainSizer.Add(self.suppressPrerelease, 0, wx.ALL | wx.EXPAND, 5) if self.UpdateSettings.get('version'): self.versionSizer = wx.BoxSizer(wx.VERTICAL) self.versionTitle = wx.StaticText( panel, wx.ID_ANY, "Suppressing {0} Notifications".format( self.UpdateSettings.get('version')), wx.DefaultPosition, wx.DefaultSize, 0) self.versionTitle.Wrap(-1) self.versionTitle.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) self.versionInfo = ( "There is a release available which you have chosen to suppress. " "You can choose to reset notification suppression for this release, " "or download the new release from GitHub.") self.versionSizer.AddStretchSpacer() self.versionSizer.Add( wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL), 0, wx.EXPAND, 5) self.versionSizer.AddStretchSpacer() self.versionSizer.Add(self.versionTitle, 0, wx.EXPAND, 5) self.versionDesc = wx.StaticText(panel, wx.ID_ANY, self.versionInfo, wx.DefaultPosition, wx.DefaultSize, 0) self.versionDesc.Wrap(dlgWidth - 50) self.versionSizer.Add(self.versionDesc, 0, wx.ALL, 5) actionSizer = wx.BoxSizer(wx.HORIZONTAL) resetSizer = wx.BoxSizer(wx.VERTICAL) self.downloadButton = wx.Button(panel, wx.ID_ANY, "Download", wx.DefaultPosition, wx.DefaultSize, 0) self.downloadButton.Bind(wx.EVT_BUTTON, self.OnDownload) resetSizer.Add(self.downloadButton, 0, wx.ALL, 5) actionSizer.Add(resetSizer, 1, wx.EXPAND, 5) self.resetButton = wx.Button(panel, wx.ID_ANY, "Reset Suppression", wx.DefaultPosition, wx.DefaultSize, 0) self.resetButton.Bind(wx.EVT_BUTTON, self.ResetSuppression) actionSizer.Add(self.resetButton, 0, wx.ALL, 5) self.versionSizer.Add(actionSizer, 0, wx.EXPAND, 5) mainSizer.Add(self.versionSizer, 0, wx.EXPAND, 5) panel.SetSizer(mainSizer) panel.Layout()
def __init__(self, parent, isUpdate): self.isUpdate = isUpdate self.textWrapWidth = 600 # Translators: The title of the Install NVDA dialog. super().__init__(parent, title=_("Install NVDA")) import addonHandler shouldAskAboutAddons = any( addonHandler.getIncompatibleAddons( # the defaults from the installer are ok. We are testing against the running version. )) mainSizer = self.mainSizer = wx.BoxSizer(wx.VERTICAL) sHelper = gui.guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) # Translators: An informational message in the Install NVDA dialog. msg = _( "To install NVDA to your hard drive, please press the Continue button." ) if self.isUpdate: # Translators: An informational message in the Install NVDA dialog. msg += " " + _( "A previous copy of NVDA has been found on your system. This copy will be updated." ) if not os.path.isdir(installer.defaultInstallPath): # Translators: a message in the installer telling the user NVDA is now located in a different place. msg += " " + _( "The installation path for NVDA has changed. it will now be installed in {path}" ).format(path=installer.defaultInstallPath) if shouldAskAboutAddons: msg += _( # Translators: A message in the installer to let the user know that # some addons are not compatible. "\n\n" "However, your NVDA configuration contains add-ons that are incompatible with this version of NVDA. " "These add-ons will be disabled after installation. If you rely on these add-ons, " "please review the list to decide whether to continue with the installation" ) text = sHelper.addItem(wx.StaticText(self, label=msg)) text.Wrap(self.scaleSize(self.textWrapWidth)) if shouldAskAboutAddons: self.confirmationCheckbox = sHelper.addItem( wx.CheckBox( self, # Translators: A message to confirm that the user understands that addons that have not been reviewed and made # available, will be disabled after installation. label= _("I understand that these incompatible add-ons will be disabled" ))) self.bindHelpEvent("InstallWithIncompatibleAddons", self.confirmationCheckbox) self.confirmationCheckbox.SetFocus() # Translators: The label for a group box containing the NVDA installation dialog options. optionsLabel = _("Options") optionsSizer = sHelper.addItem( wx.StaticBoxSizer(wx.VERTICAL, self, label=optionsLabel)) optionsHelper = guiHelper.BoxSizerHelper(self, sizer=optionsSizer) optionsBox = optionsSizer.GetStaticBox() # Translators: The label of a checkbox option in the Install NVDA dialog. startOnLogonText = _("Use NVDA during sign-in") self.startOnLogonCheckbox = optionsHelper.addItem( wx.CheckBox(optionsBox, label=startOnLogonText)) self.bindHelpEvent("StartAtWindowsLogon", self.startOnLogonCheckbox) if globalVars.appArgs.enableStartOnLogon is not None: self.startOnLogonCheckbox.Value = globalVars.appArgs.enableStartOnLogon else: self.startOnLogonCheckbox.Value = config.getStartOnLogonScreen( ) if self.isUpdate else True shortcutIsPrevInstalled = installer.isDesktopShortcutInstalled() if self.isUpdate and shortcutIsPrevInstalled: # Translators: The label of a checkbox option in the Install NVDA dialog. keepShortCutText = _("&Keep existing desktop shortcut") keepShortCutBox = wx.CheckBox(optionsBox, label=keepShortCutText) self.createDesktopShortcutCheckbox = optionsHelper.addItem( keepShortCutBox) else: # Translators: The label of the option to create a desktop shortcut in the Install NVDA dialog. # If the shortcut key has been changed for this locale, # this change must also be reflected here. createShortcutText = _( "Create &desktop icon and shortcut key (control+alt+n)") createShortcutBox = wx.CheckBox(optionsBox, label=createShortcutText) self.createDesktopShortcutCheckbox = optionsHelper.addItem( createShortcutBox) self.bindHelpEvent("CreateDesktopShortcut", self.createDesktopShortcutCheckbox) self.createDesktopShortcutCheckbox.Value = shortcutIsPrevInstalled if self.isUpdate else True # Translators: The label of a checkbox option in the Install NVDA dialog. createPortableText = _( "Copy &portable configuration to current user account") createPortableBox = wx.CheckBox(optionsBox, label=createPortableText) self.copyPortableConfigCheckbox = optionsHelper.addItem( createPortableBox) self.bindHelpEvent("CopyPortableConfigurationToCurrentUserAccount", self.copyPortableConfigCheckbox) self.copyPortableConfigCheckbox.Value = ( bool(globalVars.appArgs.copyPortableConfig) and _canPortableConfigBeCopied()) self.copyPortableConfigCheckbox.Enable(_canPortableConfigBeCopied()) bHelper = sHelper.addDialogDismissButtons( guiHelper.ButtonHelper(wx.HORIZONTAL)) if shouldAskAboutAddons: # Translators: The label of a button to launch the add-on compatibility review dialog. reviewAddonButton = bHelper.addButton( self, label=_("&Review add-ons...")) self.bindHelpEvent("InstallWithIncompatibleAddons", reviewAddonButton) reviewAddonButton.Bind(wx.EVT_BUTTON, self.onReviewAddons) # Translators: The label of a button to continue with the operation. continueButton = bHelper.addButton(self, label=_("&Continue"), id=wx.ID_OK) continueButton.SetDefault() continueButton.Bind(wx.EVT_BUTTON, self.onInstall) if shouldAskAboutAddons: self.confirmationCheckbox.Bind( wx.EVT_CHECKBOX, lambda evt: continueButton.Enable(not continueButton.Enabled)) continueButton.Enable(False) bHelper.addButton(self, id=wx.ID_CANCEL) # If we bind this using button.Bind, it fails to trigger when the dialog is closed. self.Bind(wx.EVT_BUTTON, self.onCancel, id=wx.ID_CANCEL) mainSizer.Add(sHelper.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) self.Sizer = mainSizer mainSizer.Fit(self) self.CentreOnScreen()
def __init__(self, parent): # Translators: The title of the Create Portable NVDA dialog. super().__init__(parent, title=_("Create Portable NVDA")) mainSizer = self.mainSizer = wx.BoxSizer(wx.VERTICAL) sHelper = gui.guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) # Translators: An informational message displayed in the Create Portable NVDA dialog. dialogCaption = _( "To create a portable copy of NVDA, please select the path and other options and then press Continue" ) sHelper.addItem(wx.StaticText(self, label=dialogCaption)) # Translators: The label of a grouping containing controls to select the destination directory # in the Create Portable NVDA dialog. directoryGroupText = _("Portable &directory:") groupSizer = wx.StaticBoxSizer(wx.VERTICAL, self, label=directoryGroupText) groupHelper = sHelper.addItem( gui.guiHelper.BoxSizerHelper(self, sizer=groupSizer)) groupBox = groupSizer.GetStaticBox() # Translators: The label of a button to browse for a directory. browseText = _("Browse...") # Translators: The title of the dialog presented when browsing for the # destination directory when creating a portable copy of NVDA. dirDialogTitle = _("Select portable directory") directoryPathHelper = gui.guiHelper.PathSelectionHelper( groupBox, browseText, dirDialogTitle) directoryEntryControl = groupHelper.addItem(directoryPathHelper) self.portableDirectoryEdit = directoryEntryControl.pathControl if globalVars.appArgs.portablePath: self.portableDirectoryEdit.Value = globalVars.appArgs.portablePath # Translators: The label of a checkbox option in the Create Portable NVDA dialog. copyConfText = _("Copy current &user configuration") self.copyUserConfigCheckbox = sHelper.addItem( wx.CheckBox(self, label=copyConfText)) self.copyUserConfigCheckbox.Value = False if globalVars.appArgs.launcher: self.copyUserConfigCheckbox.Disable() # Translators: The label of a checkbox option in the Create Portable NVDA dialog. startAfterCreateText = _("&Start the new portable copy after creation") self.startAfterCreateCheckbox = sHelper.addItem( wx.CheckBox(self, label=startAfterCreateText)) self.startAfterCreateCheckbox.Value = False bHelper = sHelper.addDialogDismissButtons(gui.guiHelper.ButtonHelper( wx.HORIZONTAL), separated=True) continueButton = bHelper.addButton(self, label=_("&Continue"), id=wx.ID_OK) continueButton.SetDefault() continueButton.Bind(wx.EVT_BUTTON, self.onCreatePortable) bHelper.addButton(self, id=wx.ID_CANCEL) # If we bind this using button.Bind, it fails to trigger when the dialog is closed. self.Bind(wx.EVT_BUTTON, self.onCancel, id=wx.ID_CANCEL) mainSizer.Add(sHelper.sizer, border=gui.guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) self.Sizer = mainSizer mainSizer.Fit(self) self.CentreOnScreen()
def __init__(self, panel, configName, valueOverride=None, index=None): "Add a setting to the configuration panel" sizer = panel.GetSizer() x = sizer.GetRows() y = 0 flag = 0 self.setting = profile.settingsDictionary[configName] self.settingIndex = index self.validationMsg = '' self.panel = panel self.label = wx.lib.stattext.GenStaticText(panel, -1, self.setting.getLabel()) self.label.Bind(wx.EVT_ENTER_WINDOW, self.OnMouseEnter) self.label.Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseExit) #if self.setting.getType() is types.FloatType and False: # digits = 0 # while 1 / pow(10, digits) > defaultValue: # digits += 1 # self.ctrl = floatspin.FloatSpin(panel, -1, value=float(getSettingFunc(configName)), increment=defaultValue, digits=digits, min_val=0.0) # self.ctrl.Bind(floatspin.EVT_FLOATSPIN, self.OnSettingChange) # flag = wx.EXPAND if self.setting.getType() is types.BooleanType: self.ctrl = wx.CheckBox(panel, -1, style=wx.ALIGN_RIGHT) self.SetValue(self.setting.getValue(self.settingIndex)) self.ctrl.Bind(wx.EVT_CHECKBOX, self.OnSettingChange) elif valueOverride is not None and valueOverride is wx.Colour: self.ctrl = wx.ColourPickerCtrl(panel, -1) self.SetValue(self.setting.getValue(self.settingIndex)) self.ctrl.Bind(wx.EVT_COLOURPICKER_CHANGED, self.OnSettingChange) elif type(self.setting.getType()) is list or valueOverride is not None: value = self.setting.getValue(self.settingIndex) choices = self.setting.getType() if valueOverride is not None: choices = valueOverride self._englishChoices = choices[:] if value not in choices and len(choices) > 0: value = choices[0] for n in xrange(0, len(choices)): choices[n] = _(choices[n]) value = _(value) self.ctrl = wx.ComboBox(panel, -1, value, choices=choices, style=wx.CB_DROPDOWN | wx.CB_READONLY) self.ctrl.Bind(wx.EVT_COMBOBOX, self.OnSettingChange) self.ctrl.Bind(wx.EVT_LEFT_DOWN, self.OnMouseExit) flag = wx.EXPAND else: self.ctrl = wx.TextCtrl(panel, -1, self.setting.getValue(self.settingIndex)) self.ctrl.Bind(wx.EVT_TEXT, self.OnSettingChange) flag = wx.EXPAND sizer.Add(self.label, (x, y), flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT, border=10) sizer.Add(self.ctrl, (x, y + 1), flag=wx.ALIGN_BOTTOM | flag) sizer.SetRows(x + 1) self.ctrl.Bind(wx.EVT_ENTER_WINDOW, self.OnMouseEnter) self.ctrl.Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseExit) if isinstance(self.ctrl, floatspin.FloatSpin): self.ctrl.GetTextCtrl().Bind(wx.EVT_ENTER_WINDOW, self.OnMouseEnter) self.ctrl.GetTextCtrl().Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseExit) self.defaultBGColour = self.ctrl.GetTextCtrl().GetBackgroundColour( ) else: self.defaultBGColour = self.ctrl.GetBackgroundColour() panel.main.settingControlList.append(self)
def __init__(self, parent, char_name): wx.Dialog.__init__(self, parent, -1, "Login to EVE-Central", style=wx.DEFAULT_DIALOG_STYLE) sizer = wx.BoxSizer(wx.VERTICAL) label = wx.StaticText( self, -1, "Please enter your username and password as registered\non EVE-central.com" ) sizer.Add(label, 0, wx.ALIGN_CENTRE | wx.ALL, 5) self.anon_cb = wx.CheckBox(self, -1, "Anonymous login - no username") self.Bind(wx.EVT_CHECKBOX, self.OnAnonCb, self.anon_cb) sizer.Add(self.anon_cb, 0, wx.ALL, 5) line = wx.StaticLine(self, -1, size=(20, -1), style=wx.LI_HORIZONTAL) sizer.Add(line, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.TOP, 5) box = wx.BoxSizer(wx.HORIZONTAL) label = wx.StaticText(self, -1, "Username:"******"This is the help text for the label") box.Add(label, 0, wx.ALIGN_CENTRE | wx.ALL, 5) self.uname = wx.TextCtrl(self, -1, "", size=(80, -1)) self.uname.SetHelpText("Here's some help text for field #1") box.Add(self.uname, 1, wx.ALIGN_CENTRE | wx.ALL, 5) sizer.Add(box, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) box = wx.BoxSizer(wx.HORIZONTAL) label = wx.StaticText(self, -1, "Password: "******"This is the help text for the label") box.Add(label, 0, wx.ALIGN_CENTRE | wx.ALL, 5) self.passwd = wx.TextCtrl(self, -1, "", size=(80, -1), style=wx.TE_PASSWORD) self.passwd.SetHelpText("Here's some help text for field #2") box.Add(self.passwd, 1, wx.ALIGN_CENTRE | wx.ALL, 5) sizer.Add(box, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) line = wx.StaticLine(self, -1, size=(20, -1), style=wx.LI_HORIZONTAL) sizer.Add(line, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.TOP, 5) btnsizer = wx.StdDialogButtonSizer() if wx.Platform != "__WXMSW__": btn = wx.ContextHelpButton(self) btnsizer.AddButton(btn) btn = wx.Button(self, wx.ID_OK) btn.SetHelpText("The OK button completes the dialog") btn.SetDefault() btnsizer.AddButton(btn) btn = wx.Button(self, wx.ID_CANCEL) btn.SetHelpText("The Cancel button cancels the dialog. ") btnsizer.AddButton(btn) btnsizer.Realize() sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.SetSizer(sizer) sizer.Fit(self) if char_name == "Anonymous": self.anon_cb.SetValue(True) self.uname.Enable(False) self.passwd.Enable(False) else: self.uname.SetValue(char_name)
def __init__(self, *args, **kwds): # begin wxGlade: gui_host.__init__ kwds["style"] = wx.DEFAULT_DIALOG_STYLE wx.Dialog.__init__(self, *args, **kwds) self.label_host_server_name = wx.StaticText(self, -1, "Battle Name") self.text_host_server_nameData = wx.TextCtrl(self, 201, "", style=wx.TE_PROCESS_ENTER | wx.TE_PROCESS_TAB) self.label_host_server_modType = wx.StaticText(self, -1, "Mod") self.choice_host_server_modData = wx.Choice( self, -1, choices=["Spring - v0.51b1", ""]) self.label_host_server_port = wx.StaticText(self, -1, "Port") self.text_host_server_portData = wx.TextCtrl(self, 202, "8452", style=wx.TE_PROCESS_ENTER | wx.TE_PROCESS_TAB) self.checkbox_host_server_privateGameData = wx.CheckBox( self, 301, "Private Game") self.checkbox_host_server_lanGameData = wx.CheckBox( self, 302, "Lan Game") self.label_host_server_maxPlayers = wx.StaticText( self, -1, "Max Players") self.slider_host_server_maxPlayersData = wx.Slider( self, -1, 2, 2, 12, style=wx.SL_HORIZONTAL | wx.SL_AUTOTICKS) self.label_host_battle_maxUnitsData_copy = wx.StaticText(self, -1, "2") self.label_host_server_maxUnits = wx.StaticText(self, -1, "Max Units") self.text_host_server_maxUnitsData = wx.TextCtrl( self, 203, "300", style=wx.TE_PROCESS_ENTER | wx.TE_PROCESS_TAB) self.label_host_server_startEnergy = wx.StaticText( self, -1, "Start Energy") self.text_host_server_startEnergyData = wx.TextCtrl( self, 204, "1000", style=wx.TE_PROCESS_ENTER | wx.TE_PROCESS_TAB) self.label_host_server_startMetal = wx.StaticText( self, -1, "Start Metal") self.text_host_server_startMetalData = wx.TextCtrl( self, 205, "1000", style=wx.TE_PROCESS_ENTER | wx.TE_PROCESS_TAB) self.button_host_server_ok = wx.Button(self, 101, "OK") self.button_host_server_cancel = wx.Button(self, 102, "Cancel") self.button_host_server_testHost = wx.Button(self, 103, "Test") #=============================================================================== # Added os.path.join() to make it so that Windows users can see the icons too! self.bitmap_host_map_preview = wx.StaticBitmap( self, -1, wx.Bitmap(os.path.join("resource/", "minimap-placeholder.png"), wx.BITMAP_TYPE_ANY)) # /end edits =================================================================== self.choice_host_map_mapData = wx.Choice( self, -1, choices=["FloodedDesert - 10x10", ""]) self.label_host_map_description_copy_2_copy_copy = wx.StaticText( self, -1, "Description:") self.text_host_map_description = wx.TextCtrl( self, -1, "", style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_AUTO_URL) self.__set_properties() self.__do_layout() # end wxGlade self.__do_events()
def _createWidgets(self): self.labels = {} self.params = {} self.labels["output"] = StaticText( parent=self, id=wx.ID_ANY, label=_("Name for output raster map:")) self.params["output"] = Select( parent=self, type="raster", mapsets=[grass.gisenv()["MAPSET"]], size=globalvar.DIALOG_GSELECT_SIZE, ) self.regionStBoxLabel = StaticBox(parent=self, id=wx.ID_ANY, label=" %s " % _("Export region")) self.region_types_order = ["display", "comp", "named"] self.region_types = {} self.region_types["display"] = RadioButton(parent=self, label=_("Map display"), style=wx.RB_GROUP) self.region_types["comp"] = RadioButton( parent=self, label=_("Computational region")) self.region_types["named"] = RadioButton(parent=self, label=_("Named region")) self.region_types["display"].SetToolTip( _("Extent and resolution" " are based on Map Display geometry.")) self.region_types["comp"].SetToolTip( _("Extent and resolution" " are based on computational region.")) self.region_types["named"].SetToolTip( _("Extent and resolution" " are based on named region.")) self.region_types["display"].SetValue( True) # set default as map display self.overwrite = wx.CheckBox(parent=self, id=wx.ID_ANY, label=_("Overwrite existing raster map")) self.named_reg_panel = wx.Panel(parent=self, id=wx.ID_ANY) self.labels["region"] = StaticText(parent=self.named_reg_panel, id=wx.ID_ANY, label=_("Choose named region:")) self.params["region"] = Select( parent=self.named_reg_panel, type="region", size=globalvar.DIALOG_GSELECT_SIZE, ) # buttons self.btn_close = Button(parent=self, id=wx.ID_CLOSE) self.SetEscapeId(self.btn_close.GetId()) self.btn_close.SetToolTip(_("Close dialog")) self.btn_ok = Button(parent=self, label=_("&Save layer")) self.btn_ok.SetToolTip(_("Save web service layer as raster map")) # statusbar self.statusbar = wx.StatusBar(parent=self, id=wx.ID_ANY) self._layout()
def __init__( self, parent ): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"站點劇本編輯器", pos = wx.DefaultPosition, size = wx.Size( 500,331 ), style = wx.CAPTION|wx.CLOSE_BOX|wx.MINIMIZE_BOX|wx.TAB_TRAVERSAL ) self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) self.SetBackgroundColour( wx.Colour( 255, 128, 0 ) ) all_layout = wx.BoxSizer( wx.HORIZONTAL ) station_layout = wx.BoxSizer( wx.VERTICAL ) self.station_text = wx.StaticText( self, wx.ID_ANY, u"站點列表", wx.Point( -1,-1 ), wx.Size( -1,-1 ), 0 ) self.station_text.Wrap( -1 ) self.station_text.SetFont( wx.Font( 16, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString ) ) station_layout.Add( self.station_text, 0, wx.ALL, 5 ) listChoices = [] self.list = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( 140,220 ), listChoices, 0 ) station_layout.Add( self.list, 0, 0, 5 ) button_layout = wx.BoxSizer( wx.HORIZONTAL ) self.add = wx.Button( self, wx.ID_ANY, u"+", wx.DefaultPosition, wx.Size( 20,20 ), 0 ) self.add.SetFont( wx.Font( 12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString ) ) self.add.SetForegroundColour( wx.Colour( 0, 189, 0 ) ) button_layout.Add( self.add, 0, 0, 5 ) self.delete = wx.Button( self, wx.ID_ANY, u"-", wx.DefaultPosition, wx.Size( 20,20 ), 0 ) self.delete.SetFont( wx.Font( 12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString ) ) self.delete.SetForegroundColour( wx.Colour( 255, 0, 0 ) ) button_layout.Add( self.delete, 0, 0, 5 ) station_layout.Add( button_layout, 0, 0, 5 ) all_layout.Add( station_layout, 1, wx.EXPAND, 5 ) setting_layout = wx.BoxSizer( wx.VERTICAL ) self.type_text = wx.StaticText( self, wx.ID_ANY, u"類型", wx.DefaultPosition, wx.DefaultSize, 0 ) self.type_text.Wrap( -1 ) self.type_text.SetFont( wx.Font( 12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString ) ) setting_layout.Add( self.type_text, 0, wx.ALL, 5 ) type_choiceChoices = [ u"去程點", u"回程點", u"雙向點" ] self.type_choice = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, type_choiceChoices, 0 ) self.type_choice.SetSelection( 0 ) setting_layout.Add( self.type_choice, 0, wx.ALL, 5 ) self.laser_text = wx.StaticText( self, wx.ID_ANY, u"雷射", wx.DefaultPosition, wx.DefaultSize, 0 ) self.laser_text.Wrap( -1 ) self.laser_text.SetFont( wx.Font( 12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString ) ) setting_layout.Add( self.laser_text, 0, wx.ALL, 5 ) laser_choiceChoices = [ u"開", u"關" ] self.laser_choice = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, laser_choiceChoices, 0 ) self.laser_choice.SetSelection( 0 ) setting_layout.Add( self.laser_choice, 0, wx.ALL, 5 ) self.ultrasonic_text = wx.StaticText( self, wx.ID_ANY, u"超聲波", wx.DefaultPosition, wx.DefaultSize, 0 ) self.ultrasonic_text.Wrap( -1 ) self.ultrasonic_text.SetFont( wx.Font( 12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString ) ) setting_layout.Add( self.ultrasonic_text, 0, wx.ALL, 5 ) ultrasonic_layout = wx.GridSizer( 4, 2, 0, 0 ) self.checkBox0 = wx.CheckBox( self, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0 ) self.checkBox0.SetFont( wx.Font( wx.NORMAL_FONT.GetPointSize(), wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString ) ) ultrasonic_layout.Add( self.checkBox0, 0, wx.ALL, 5 ) self.checkBox4 = wx.CheckBox( self, wx.ID_ANY, u"4", wx.DefaultPosition, wx.DefaultSize, 0 ) ultrasonic_layout.Add( self.checkBox4, 0, wx.ALL, 5 ) self.checkBox1 = wx.CheckBox( self, wx.ID_ANY, u"1", wx.DefaultPosition, wx.DefaultSize, 0 ) ultrasonic_layout.Add( self.checkBox1, 0, wx.ALL, 5 ) self.checkBox5 = wx.CheckBox( self, wx.ID_ANY, u"5", wx.DefaultPosition, wx.DefaultSize, 0 ) ultrasonic_layout.Add( self.checkBox5, 0, wx.ALL, 5 ) self.m_checkBox2 = wx.CheckBox( self, wx.ID_ANY, u"2", wx.DefaultPosition, wx.DefaultSize, 0 ) ultrasonic_layout.Add( self.m_checkBox2, 0, wx.ALL, 5 ) self.checkBox6 = wx.CheckBox( self, wx.ID_ANY, u"6", wx.DefaultPosition, wx.DefaultSize, 0 ) ultrasonic_layout.Add( self.checkBox6, 0, wx.ALL, 5 ) self.checkBox3 = wx.CheckBox( self, wx.ID_ANY, u"3", wx.DefaultPosition, wx.DefaultSize, 0 ) ultrasonic_layout.Add( self.checkBox3, 0, wx.ALL, 5 ) self.checkBox7 = wx.CheckBox( self, wx.ID_ANY, u"7", wx.DefaultPosition, wx.DefaultSize, 0 ) ultrasonic_layout.Add( self.checkBox7, 0, wx.ALL, 5 ) setting_layout.Add( ultrasonic_layout, 1, 0, 5 ) all_layout.Add( setting_layout, 1, wx.EXPAND, 5 ) action_layout = wx.BoxSizer( wx.VERTICAL ) self.action = wx.StaticText( self, wx.ID_ANY, u"動作", wx.DefaultPosition, wx.DefaultSize, 0 ) self.action.Wrap( -1 ) self.action.SetFont( wx.Font( 16, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString ) ) action_layout.Add( self.action, 0, wx.ALL, 5 ) action_listChoices = [] self.action_list = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( 140,220 ), action_listChoices, 0 ) action_layout.Add( self.action_list, 0, 0, 5 ) button_layout1 = wx.BoxSizer( wx.HORIZONTAL ) self.add1 = wx.Button( self, wx.ID_ANY, u"+", wx.DefaultPosition, wx.Size( 20,20 ), 0 ) self.add1.SetFont( wx.Font( 12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString ) ) self.add1.SetForegroundColour( wx.Colour( 0, 189, 0 ) ) button_layout1.Add( self.add1, 0, 0, 5 ) self.delete1 = wx.Button( self, wx.ID_ANY, u"-", wx.DefaultPosition, wx.Size( 20,20 ), 0 ) self.delete1.SetFont( wx.Font( 12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString ) ) self.delete1.SetForegroundColour( wx.Colour( 255, 0, 0 ) ) button_layout1.Add( self.delete1, 0, 0, 5 ) action_layout.Add( button_layout1, 1, wx.EXPAND, 5 ) all_layout.Add( action_layout, 1, wx.EXPAND, 5 ) self.SetSizer( all_layout ) self.Layout() self.menubar = wx.MenuBar( 0 ) self.file_menu = wx.Menu() self.load_menuitem = wx.MenuItem( self.file_menu, wx.ID_ANY, u"開啟檔案..."+ u"\t" + u"CTRL+O", wx.EmptyString, wx.ITEM_NORMAL ) self.file_menu.Append( self.load_menuitem ) self.save_menuItem = wx.MenuItem( self.file_menu, wx.ID_ANY, u"儲存"+ u"\t" + u"CTRL+S", wx.EmptyString, wx.ITEM_NORMAL ) self.file_menu.Append( self.save_menuItem ) self.file_menu.AppendSeparator() self.exit_menuItem = wx.MenuItem( self.file_menu, wx.ID_ANY, u"結束", wx.EmptyString, wx.ITEM_NORMAL ) self.file_menu.Append( self.exit_menuItem ) self.menubar.Append( self.file_menu, u"檔案(F)" ) self.help_menu = wx.Menu() self.about_menuItem = wx.MenuItem( self.help_menu, wx.ID_ANY, u"關於", wx.EmptyString, wx.ITEM_NORMAL ) self.help_menu.Append( self.about_menuItem ) self.menubar.Append( self.help_menu, u"說明(H)" ) self.SetMenuBar( self.menubar ) self.Centre( wx.BOTH )
def __init__(self, parent, label, value): ObjectPropUI.__init__(self, parent, label) self.ui = wx.CheckBox(self.uiPane, -1, "", size=(50, 30)) self.setValue(value) self.eventType = wx.EVT_CHECKBOX self.Layout()
def __init__(self, parent, title): frame = wx.Frame.__init__(self, parent, title=title, size=(self.window_w, self.window_h)) # init frames camera = PiCamera() camera.resolution = (self.capture_w, self.capture_h) camera.framerate = self.capture_fps rawCapture = PiRGBArray(camera, size=(self.capture_w, self.capture_h)) camera.capture(rawCapture, format="bgr") graygroundraw = cv2.cvtColor(rawCapture.array, cv2.COLOR_BGR2GRAY) self.rawback = cv2.GaussianBlur(graygroundraw, (self.gaussian_x, self.gaussian_y), 0) self.previous = self.rawback rgbcv = cv2.cvtColor(rawCapture.array, cv2.COLOR_BGR2RGB) rgbcv = cv2.resize(rgbcv, (self.preview_w, self.preview_h)) self.photoname = "" rawCapture.truncate(0) camera.close() self.filecount = 0 self.processed = None self.backselect = 0 self.automode = False self.rawimg = None time.sleep(0.1) self.bmp = wx.Bitmap.FromBuffer(self.preview_w, self.preview_h, rgbcv.tostring()) self.capbmp = None bSizer1 = wx.BoxSizer(wx.VERTICAL) self.stbmp1 = wx.StaticBitmap(self, -1, wx.NullBitmap, (10, 10), wx.DefaultSize, 0) self.stbmp2 = wx.StaticBitmap(self, -1, wx.NullBitmap, (300, 10), wx.DefaultSize, 0) self.stbmp1.SetBitmap(self.bmp) bSizer1.Add(self.stbmp1, 0.5, wx.ALIGN_LEFT, 5) bSizer1.Add(self.stbmp2, 0.5, wx.ALIGN_RIGHT, 5) worker = FrameThread(self) worker.start() # init window self.Center() self.CreateStatusBar() filemenu = wx.Menu() menuAbout = filemenu.Append(wx.ID_ABOUT, "&About", " Information about this program") menuExit = filemenu.Append(wx.ID_EXIT, "E&xit", " Terminate the program") self.select_auto = wx.CheckBox(self, -1, "Auto", (20, 270)) self.select_auto.SetValue(False) capture_button = wx.Button(self, -1, "Capture", (120, 270)) select_default_button = wx.Button(self, -1, "True", (220, 270)) select_back1_button = wx.Button(self, -1, "Forest", (320, 270)) select_back2_button = wx.Button(self, -1, "Space", (420, 270)) send_button = wx.Button(self, -1, "Send", (520, 270)) # Set events self.Bind(wx.EVT_CHECKBOX, self.auto_capture, self.select_auto) self.Bind(wx.EVT_BUTTON, self.set_default, select_default_button) self.Bind(wx.EVT_BUTTON, self.set_back1, select_back1_button) self.Bind(wx.EVT_BUTTON, self.set_back2, select_back2_button) self.Bind(wx.EVT_BUTTON, self.capture_photo, capture_button) self.Bind(wx.EVT_BUTTON, self.sendfile, send_button) self.Bind(wx.EVT_MENU, self.OnAbout, menuAbout) self.Bind(wx.EVT_MENU, self.OnExit, menuExit) self.Bind(EVT_CVSTREAM, self.self_refresh) self.Show(True)
def __init__(self, *args, **kwds): # begin wxGlade: sampoorna_win.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.notebook_1 = wx.Notebook(self, wx.ID_ANY, style=0) self.login_pane = wx.Panel(self.notebook_1, wx.ID_ANY) self.panel_login = wx.Panel(self.login_pane, wx.ID_ANY) self.label_1 = wx.StaticText( self.panel_login, wx.ID_ANY, _("Warning: Always backup your database before you proceed to avoid potential data loss !!!" )) self.label_2 = wx.StaticText( self.panel_login, wx.ID_ANY, _("This software does not save Sampoorna credentials. It is used for one time login" )) self.panel_1 = wx.Panel(self.panel_login, wx.ID_ANY, style=wx.SUNKEN_BORDER | wx.RAISED_BORDER | wx.TAB_TRAVERSAL) self.label_3 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Sampoorna Username")) self.text_ctrl_user = wx.TextCtrl(self.panel_1, wx.ID_ANY, "", style=wx.TE_PROCESS_ENTER | wx.NO_BORDER) self.label_4 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Sampoorna Password")) self.text_ctrl_passw = wx.TextCtrl(self.panel_1, wx.ID_ANY, "", style=wx.TE_PROCESS_ENTER | wx.TE_PASSWORD | wx.NO_BORDER) self.button_next = wx.Button(self.panel_login, wx.ID_ANY, _("Next >>")) self.standard_pane = wx.Panel(self.notebook_1, wx.ID_ANY) self.panel_3 = wx.Panel(self.standard_pane, wx.ID_ANY, style=wx.SUNKEN_BORDER | wx.RAISED_BORDER | wx.STATIC_BORDER | wx.TAB_TRAVERSAL) self.checkbox_8 = wx.CheckBox(self.panel_3, wx.ID_ANY, _("8 Standard")) self.checkbox_9 = wx.CheckBox(self.panel_3, wx.ID_ANY, _("9 Standard")) self.checkbox_10 = wx.CheckBox(self.panel_3, wx.ID_ANY, _("10 Standard")) self.button_next_copy_copy = wx.Button(self.standard_pane, wx.ID_ANY, _("<<Previous")) self.button_next_copy = wx.Button(self.standard_pane, wx.ID_ANY, _("Proceed >>")) self.report_pane = wx.Panel(self.notebook_1, wx.ID_ANY) self.panel_2 = wx.Panel(self.report_pane, wx.ID_ANY) self.label_7 = wx.StaticText(self.panel_2, wx.ID_ANY, _("Progress")) self.progresss_total = wx.TextCtrl(self.panel_2, wx.ID_ANY, "") self.progress_each = wx.TextCtrl(self.panel_2, wx.ID_ANY, "") self.label_satus = wx.StaticText(self.panel_2, wx.ID_ANY, _("Status")) self.text_ctrl_1 = wx.TextCtrl(self.panel_2, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL | wx.NO_BORDER) self.button_finished = wx.Button(self.panel_2, wx.ID_ANY, _("Finished")) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_TEXT_ENTER, self.on_password_enter, self.text_ctrl_passw) self.Bind(wx.EVT_BUTTON, self.on_next, self.button_next) self.Bind(wx.EVT_CHECKBOX, self.on_check, self.checkbox_8) self.Bind(wx.EVT_CHECKBOX, self.on_check, self.checkbox_9) self.Bind(wx.EVT_CHECKBOX, self.on_check, self.checkbox_10) self.Bind(wx.EVT_BUTTON, self.on_previous, self.button_next_copy_copy) self.Bind(wx.EVT_BUTTON, self.on_proceed, self.button_next_copy) self.Bind(wx.EVT_BUTTON, self.on_finished, self.button_finished)
def __init__(self): # begin wxGlade: MyFrame.__init__ # startLocation ='' # endLocation='' self.wheelChair = False if WINDOWS: # noinspection PyUnresolvedReferences, PyArgumentList print("[wxpython.py] System DPI settings: %s" % str(cef.DpiAware.GetSystemDpi())) if hasattr(wx, "GetDisplayPPI"): print("[wxpython.py] wx.GetDisplayPPI = %s" % wx.GetDisplayPPI()) print("[wxpython.py] wx.GetDisplaySize = %s" % wx.GetDisplaySize()) print("[wxpython.py] MainFrame declared size: %s" % str( (WIDTH, HEIGHT))) size = scale_window_size_for_high_dpi(WIDTH, HEIGHT) print("[wxpython.py] MainFrame DPI scaled size: %s" % str(size)) wx.Frame.__init__(self, parent=None, id=wx.ID_ANY, size=size) print("[wxpython.py] MainFrame actual size: %s" % self.GetSize()) self.Bind(wx.EVT_CLOSE, self.OnClose) self.SetSize((1000, 500)) self.SetTitle("Mapomatic") self.panel_1 = wx.Panel(self, wx.ID_ANY) sizer_1 = wx.BoxSizer(wx.HORIZONTAL) sizer_2 = wx.BoxSizer(wx.VERTICAL) sizer_1.Add(sizer_2, 1, wx.EXPAND, 0) label_1 = wx.StaticText(self.panel_1, wx.ID_ANY, "Start Location") sizer_2.Add(label_1, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.BOTTOM | wx.TOP, 10) self.text_ctrl_ = wx.SearchCtrl(self.panel_1, style=wx.TE_PROCESS_ENTER) self.text_ctrl_.ShowCancelButton(True) self.text_ctrl_.AutoComplete(choices) self.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, self.on_enter, self.text_ctrl_) sizer_2.Add(self.text_ctrl_, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.BOTTOM, 10) label_2 = wx.StaticText(self.panel_1, wx.ID_ANY, "End location\n") sizer_2.Add(label_2, 0, wx.ALIGN_CENTER_HORIZONTAL, 0) self.text_ctrl_2 = wx.SearchCtrl(self.panel_1, wx.ID_ANY, "") self.text_ctrl_2.ShowCancelButton(True) self.text_ctrl_2.AutoComplete(choices) self.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, self.on_enter, self.text_ctrl_2) sizer_2.Add(self.text_ctrl_2, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.BOTTOM, 10) self.checkbox_1 = wx.CheckBox(self.panel_1, wx.ID_ANY, "Wheel Chair Access") sizer_2.Add(self.checkbox_1, 0, 0, 0) self.Bind(wx.EVT_CHECKBOX, self.on_checked, self.checkbox_1) self.button_Submit = wx.Button(self.panel_1, wx.ID_ANY, "Submit") self.Bind(wx.EVT_BUTTON, self.on_button_pressed, self.button_Submit) sizer_2.Add(self.button_Submit, 0, wx.ALIGN_CENTER_HORIZONTAL, 0) label_3 = wx.StaticText(self.panel_1, wx.ID_ANY, "Singular Building Search\n") sizer_2.Add(label_3, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.TOP, 11) self.text_ctrl__copy = wx.SearchCtrl(self.panel_1, wx.ID_ANY, "") self.text_ctrl__copy.ShowCancelButton(True) self.text_ctrl__copy.AutoComplete(choices) sizer_2.Add(self.text_ctrl__copy, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.BOTTOM, 10) self.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, self.on_Search_Enter, self.text_ctrl__copy) self.browser_panel = wx.Panel(self.panel_1, wx.ID_ANY, style=wx.BORDER_SIMPLE) self.browser_panel.SetMinSize((1000, 400)) self.browser_panel.Bind(wx.EVT_SET_FOCUS, self.OnSetFocus) self.browser_panel.Bind(wx.EVT_SIZE, self.OnSize) self.embed2() sizer_1.Add(self.browser_panel, 1, wx.EXPAND, 0) self.panel_1.SetSizer(sizer_1) self.Show() self.Layout()
def __init__(self, parent): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"TTM: Talent Analytics", pos=wx.DefaultPosition, size=wx.Size(600, 480), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) self.SetSizeHints(wx.DefaultSize, wx.DefaultSize) self.SetFont( wx.Font(9, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, "Century Gothic")) self.SetBackgroundColour(wx.Colour(0, 177, 169)) main_layout = wx.BoxSizer(wx.VERTICAL) self.txt_title = wx.StaticText(self, wx.ID_ANY, u"Top Talent Analytics", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTER_HORIZONTAL) self.txt_title.Wrap(-1) self.txt_title.SetFont( wx.Font(12, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "Century Gothic")) self.txt_title.SetForegroundColour( wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)) main_layout.Add(self.txt_title, 0, wx.ALIGN_CENTER | wx.ALL, 5) b_layout_h = wx.BoxSizer(wx.VERTICAL) b_layout_p1 = wx.StaticBoxSizer( wx.StaticBox(self, wx.ID_ANY, wx.EmptyString), wx.HORIZONTAL) layout_input = wx.StaticBoxSizer( wx.StaticBox(b_layout_p1.GetStaticBox(), wx.ID_ANY, u"input"), wx.VERTICAL) self.zhpla_picker = wx.FilePickerCtrl(layout_input.GetStaticBox(), wx.ID_ANY, wx.EmptyString, u"Select a file", u"*.*", wx.DefaultPosition, wx.DefaultSize, wx.FLP_DEFAULT_STYLE) layout_input.Add(self.zhpla_picker, 0, wx.ALL, 5) self.txt_zhplafile = wx.StaticText(layout_input.GetStaticBox(), wx.ID_ANY, u"ZHPLA file (.xlsx)", wx.DefaultPosition, wx.DefaultSize, 0) self.txt_zhplafile.Wrap(-1) layout_input.Add(self.txt_zhplafile, 0, wx.ALL, 5) self.zpdev_picker = wx.FilePickerCtrl(layout_input.GetStaticBox(), wx.ID_ANY, wx.EmptyString, u"Select a file", u"*.*", wx.DefaultPosition, wx.DefaultSize, wx.FLP_DEFAULT_STYLE) layout_input.Add(self.zpdev_picker, 0, wx.ALL, 5) self.txt_zpdevfile = wx.StaticText(layout_input.GetStaticBox(), wx.ID_ANY, u"ZPDEV main (xlsx)", wx.DefaultPosition, wx.DefaultSize, 0) self.txt_zpdevfile.Wrap(-1) layout_input.Add(self.txt_zpdevfile, 0, wx.ALL, 5) self.zpdevretire_picker = wx.FilePickerCtrl( layout_input.GetStaticBox(), wx.ID_ANY, wx.EmptyString, u"Select a file", u"*.*", wx.DefaultPosition, wx.DefaultSize, wx.FLP_DEFAULT_STYLE) layout_input.Add(self.zpdevretire_picker, 0, wx.ALL, 5) self.txt_zpdevretirefile = wx.StaticText(layout_input.GetStaticBox(), wx.ID_ANY, u"ZPDEV retire (xlsx)", wx.DefaultPosition, wx.DefaultSize, 0) self.txt_zpdevretirefile.Wrap(-1) layout_input.Add(self.txt_zpdevretirefile, 0, wx.ALL, 5) b_layout_p1.Add(layout_input, 1, wx.EXPAND, 5) layout_process = wx.StaticBoxSizer( wx.StaticBox(b_layout_p1.GetStaticBox(), wx.ID_ANY, u"select process"), wx.VERTICAL) layout_choice = wx.BoxSizer(wx.VERTICAL) self.rdbtn_clean = wx.RadioButton(layout_process.GetStaticBox(), wx.ID_ANY, u"Clean dirty db only", wx.DefaultPosition, wx.DefaultSize, 0) layout_choice.Add(self.rdbtn_clean, 0, wx.ALL, 5) self.rdbtn_combine = wx.RadioButton(layout_process.GetStaticBox(), wx.ID_ANY, u"Combine clean db only", wx.DefaultPosition, wx.DefaultSize, 0) layout_choice.Add(self.rdbtn_combine, 0, wx.ALL, 5) self.rdbtn_cleancombine = wx.RadioButton(layout_process.GetStaticBox(), wx.ID_ANY, u"Clean + combine dirty db", wx.DefaultPosition, wx.DefaultSize, 0) layout_choice.Add(self.rdbtn_cleancombine, 0, wx.ALL, 5) self.btn_autoopen = wx.CheckBox(layout_process.GetStaticBox(), wx.ID_ANY, u"Open when done", wx.DefaultPosition, wx.DefaultSize, 0) layout_choice.Add(self.btn_autoopen, 0, wx.ALL, 5) layout_process.Add(layout_choice, 1, wx.EXPAND, 5) layout_button = wx.BoxSizer(wx.VERTICAL) self.btn_run = wx.Button(layout_process.GetStaticBox(), wx.ID_ANY, u"Clean / Combine", wx.DefaultPosition, wx.Size(120, -1), 0) self.btn_run.SetForegroundColour( wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT)) self.btn_run.SetBackgroundColour( wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DLIGHT)) layout_button.Add(self.btn_run, 0, wx.ALIGN_CENTER | wx.ALL, 5) # self.txt_status = wx.StaticText(layout_process.GetStaticBox( # ), wx.ID_ANY, u"Status:", wx.DefaultPosition, wx.DefaultSize, 0) # self.txt_status.Wrap(-1) # self.txt_status.SetForegroundColour(wx.Colour(0, 98, 83)) # layout_button.Add(self.txt_status, 0, wx.ALIGN_CENTER | wx.ALL, 5) layout_process.Add(layout_button, 1, wx.EXPAND, 5) b_layout_p1.Add(layout_process, 1, wx.EXPAND, 5) layout_output = wx.StaticBoxSizer( wx.StaticBox(b_layout_p1.GetStaticBox(), wx.ID_ANY, u"output"), wx.VERTICAL) self.btn_openzhpla = wx.Button(layout_output.GetStaticBox(), wx.ID_ANY, u"zhpla", wx.DefaultPosition, wx.Size(60, -1), 0) layout_output.Add(self.btn_openzhpla, 0, wx.ALL, 5) self.btn_openzpdev = wx.Button(layout_output.GetStaticBox(), wx.ID_ANY, u"zpdev", wx.DefaultPosition, wx.Size(60, -1), 0) layout_output.Add(self.btn_openzpdev, 0, wx.ALL, 5) self.btn_openta = wx.Button(layout_output.GetStaticBox(), wx.ID_ANY, u"talent analytics", wx.DefaultPosition, wx.Size(-1, -1), 0) layout_output.Add(self.btn_openta, 0, wx.ALL, 5) self.btn_openoutputdir = wx.Button(layout_output.GetStaticBox(), wx.ID_ANY, u"Open folder", wx.DefaultPosition, wx.DefaultSize, 0) layout_output.Add(self.btn_openoutputdir, 0, wx.ALL, 5) b_layout_p1.Add(layout_output, 1, wx.EXPAND, 5) b_layout_h.Add(b_layout_p1, 1, wx.EXPAND, 5) self.txt_message = wx.StaticText(self, wx.ID_ANY, u"Welcome to TTAnalytics", wx.DefaultPosition, wx.DefaultSize, 0) self.txt_message.Wrap(-1) self.txt_message.SetForegroundColour( wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)) b_layout_h.Add(self.txt_message, 0, wx.ALL, 5) # self.txt_time_elapsed = wx.StaticText( # self, wx.ID_ANY, u"time here", wx.DefaultPosition, wx.DefaultSize, 0) # self.txt_time_elapsed.Wrap(-1) # self.txt_time_elapsed.SetFont(wx.Font( # 9, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_ITALIC, wx.FONTWEIGHT_NORMAL, False, "Century Gothic")) # self.txt_time_elapsed.SetForegroundColour( # wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DLIGHT)) # b_layout_h.Add(self.txt_time_elapsed, 0, wx.ALL, 5) main_layout.Add(b_layout_h, 1, wx.EXPAND, 5) self.SetSizer(main_layout) self.Layout() self.Centre(wx.BOTH) # Connect Events self.btn_autoopen.Bind(wx.EVT_CHECKBOX, self.autoOpen) self.btn_run.Bind(wx.EVT_BUTTON, self.processData) self.btn_openzhpla.Bind(wx.EVT_BUTTON, self.open_zhpla) self.btn_openzpdev.Bind(wx.EVT_BUTTON, self.open_zpdev) self.btn_openta.Bind(wx.EVT_BUTTON, self.open_talentAnalytics) self.btn_openoutputdir.Bind(wx.EVT_BUTTON, self.OpenOutput) # Variables self.output_zhpla = '' self.output_zpdev = '' self.output_analytics = '' self.output_folder = '' self.btn_openzhpla.Disable() self.btn_openzpdev.Disable() self.btn_openta.Disable() self.btn_openoutputdir.Disable()
def __init__(self, parent, missionoptions): self.missionoptions = missionoptions self.parent = parent self.only_call_once = False wx.lib.scrolledpanel.ScrolledPanel.__init__(self, parent) innerloopgrid = wx.FlexGridSizer(50, 2, 5, 5) self.lblInnerLoopSolver = wx.StaticText(self, -1, "Inner-loop Solver Mode") innerloopsolvertypes = [ 'Evaluate trialX', 'Monotonic Basin Hopping', 'Adaptive Constrained Differential Evolution (NOT IMPLEMNTED)', 'NLP with initial guess', 'Filament Walker (experimental)' ] self.cmbInnerLoopSolver = wx.ComboBox(self, -1, choices=innerloopsolvertypes, style=wx.CB_READONLY) self.lblNLP_solver_type = wx.StaticText(self, -1, "NLP solver") NLP_solver_types = ['SNOPT', 'WORHP'] self.cmbNLP_solver_type = wx.ComboBox(self, -1, choices=NLP_solver_types, style=wx.CB_READONLY) self.lblNLP_solver_mode = wx.StaticText(self, -1, "NLP solver mode") NLP_solver_modes = [ 'Feasible point', 'Optimize', 'Satisfy equality constraints' ] self.cmbNLP_solver_mode = wx.ComboBox(self, -1, choices=NLP_solver_modes, style=wx.CB_READONLY) self.lblquiet_NLP = wx.StaticText(self, -1, "Quiet NLP solver?") self.chkquiet_NLP = wx.CheckBox(self, -1) self.lblenable_NLP_chaperone = wx.StaticText(self, -1, "Enable NLP chaperone?") self.chkenable_NLP_chaperone = wx.CheckBox(self, -1) self.lblNLP_stop_on_goal_attain = wx.StaticText( self, -1, "Stop NLP upon attaining goal?") self.chkNLP_stop_on_goal_attain = wx.CheckBox(self, -1) self.lblNLP_objective_goal = wx.StaticText(self, -1, "NLP objective goal") self.txtNLP_objective_goal = wx.TextCtrl(self, -1, "NLP_objective_goal") self.lblquiet_MBH = wx.StaticText(self, -1, "Quiet MBH solver?") self.chkquiet_MBH = wx.CheckBox(self, -1) self.lblACE_feasible_point_finder = wx.StaticText( self, -1, "Enable ACE feasible point finder?") self.chkACE_feasible_point_finder = wx.CheckBox(self, -1) self.lblMBH_max_not_improve = wx.StaticText(self, -1, "MBH Impatience") self.txtMBH_max_not_improve = wx.TextCtrl(self, -1, "MBH_max_not_improve") self.lblMBH_max_trials = wx.StaticText( self, -1, "Maximum number of innerloop trials") self.txtMBH_max_trials = wx.TextCtrl(self, -1, "MBH_max_trials") self.lblMBH_max_run_time = wx.StaticText(self, -1, "Maximum run-time (s)") self.txtMBH_max_run_time = wx.TextCtrl(self, -1, "MBH_max_run_time") self.lblMBH_hop_distribution = wx.StaticText( self, -1, "MBH hop probability distribution") hop_distribution_choices = ["Uniform", "Cauchy", "Pareto", "Gaussian"] self.cmbMBH_hop_distribution = wx.ComboBox( self, -1, choices=hop_distribution_choices, style=wx.CB_READONLY) self.lblMBH_max_step_size = wx.StaticText( self, -1, "MBH maximum perturbation size") self.txtMBH_max_step_size = wx.TextCtrl(self, -1, "MBH_max_step_size") self.lblMBH_Pareto_alpha = wx.StaticText( self, -1, "MBH Pareto distribution alpha") self.txtMBH_Pareto_alpha = wx.TextCtrl(self, -1, "MBH_Pareto_alpha") self.lblMBH_time_hop_probability = wx.StaticText( self, -1, "Probability of MBH time hop") self.txtMBH_time_hop_probability = wx.TextCtrl( self, -1, "MBH_time_hop_probability") self.lblMBH_always_write_archive = wx.StaticText( self, -1, "Always write MBH archive file?") self.chkMBH_always_write_archive = wx.CheckBox(self, -1) self.lblMBH_write_every_improvement = wx.StaticText( self, -1, "Write output file for all MBH improvements? (for later animation)" ) self.chkMBH_write_every_improvement = wx.CheckBox(self, -1) self.lblprint_NLP_movie_frames = wx.StaticText( self, -1, "Print NLP movie frames at every major iteration?") self.chkprint_NLP_movie_frames = wx.CheckBox(self, -1) self.lblsnopt_feasibility_tolerance = wx.StaticText( self, -1, "Feasibility tolerance") self.txtsnopt_feasibility_tolerance = wx.TextCtrl( self, -1, "snopt_feasibility_tolerance") self.lblsnopt_optimality_tolerance = wx.StaticText( self, -1, "Optimality tolerance") self.txtsnopt_optimality_tolerance = wx.TextCtrl( self, -1, "snopt_optimality_tolerance") self.lblNLP_max_step = wx.StaticText(self, -1, "NLP max step") self.txtNLP_max_step = wx.TextCtrl(self, -1, "NLP_max_step") self.lblsnopt_major_iterations = wx.StaticText( self, -1, "SNOPT major iterations limit") self.txtsnopt_major_iterations = wx.TextCtrl(self, -1, "snopt_major_iterations") self.lblsnopt_minor_iterations = wx.StaticText( self, -1, "SNOPT minor iterations limit") self.txtsnopt_minor_iterations = wx.TextCtrl(self, -1, "snopt_minor_iterations") self.lblsnopt_max_run_time = wx.StaticText( self, -1, "SNOPT maximum run time (s)") self.txtsnopt_max_run_time = wx.TextCtrl(self, -1, "snopt_max_run_time") self.lblcheck_derivatives = wx.StaticText( self, -1, "Check derivatives via finite differencing?") self.chkcheck_derivatives = wx.CheckBox(self, -1) self.lblseed_MBH = wx.StaticText(self, -1, "Seed MBH?") self.chkseed_MBH = wx.CheckBox(self, -1) self.lblskip_first_nlp_run = wx.StaticText(self, -1, "Skip first NLP run?") self.chkskip_first_nlp_run = wx.CheckBox(self, -1) innerloopgrid.AddMany([ self.lblInnerLoopSolver, self.cmbInnerLoopSolver, self.lblNLP_solver_type, self.cmbNLP_solver_type, self.lblNLP_solver_mode, self.cmbNLP_solver_mode, self.lblquiet_NLP, self.chkquiet_NLP, self.lblenable_NLP_chaperone, self.chkenable_NLP_chaperone, self.lblNLP_stop_on_goal_attain, self.chkNLP_stop_on_goal_attain, self.lblNLP_objective_goal, self.txtNLP_objective_goal, self.lblquiet_MBH, self.chkquiet_MBH, self.lblACE_feasible_point_finder, self.chkACE_feasible_point_finder, self.lblMBH_max_not_improve, self.txtMBH_max_not_improve, self.lblMBH_max_trials, self.txtMBH_max_trials, self.lblMBH_max_run_time, self.txtMBH_max_run_time, self.lblMBH_hop_distribution, self.cmbMBH_hop_distribution, self.lblMBH_max_step_size, self.txtMBH_max_step_size, self.lblMBH_Pareto_alpha, self.txtMBH_Pareto_alpha, self.lblMBH_time_hop_probability, self.txtMBH_time_hop_probability, self.lblMBH_always_write_archive, self.chkMBH_always_write_archive, self.lblMBH_write_every_improvement, self.chkMBH_write_every_improvement, self.lblprint_NLP_movie_frames, self.chkprint_NLP_movie_frames, self.lblsnopt_feasibility_tolerance, self.txtsnopt_feasibility_tolerance, self.lblsnopt_optimality_tolerance, self.txtsnopt_optimality_tolerance, self.lblNLP_max_step, self.txtNLP_max_step, self.lblsnopt_major_iterations, self.txtsnopt_major_iterations, self.lblsnopt_minor_iterations, self.txtsnopt_minor_iterations, self.lblsnopt_max_run_time, self.txtsnopt_max_run_time, self.lblcheck_derivatives, self.chkcheck_derivatives, self.lblseed_MBH, self.chkseed_MBH, self.lblskip_first_nlp_run, self.chkskip_first_nlp_run ]) vboxleft = wx.BoxSizer(wx.VERTICAL) lblLeftTitle = wx.StaticText(self, -1, "Inner-Loop Solver Parameters") vboxleft.Add(lblLeftTitle) vboxleft.Add(innerloopgrid) font = self.GetFont() font.SetWeight(wx.FONTWEIGHT_BOLD) lblLeftTitle.SetFont(font) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add(vboxleft) self.lbltrialX = wx.StaticText( self, -1, "Trial decision vector or initial guess") self.btntrialX = wx.Button(self, -1, "...") trialbox = wx.GridSizer(3, 2, 0, 0) trialbox.AddMany([self.lbltrialX, self.btntrialX]) self.mainbox = wx.BoxSizer(wx.VERTICAL) self.mainbox.AddMany([hbox, trialbox]) self.SetSizer(self.mainbox) self.SetupScrolling() #bindings self.cmbInnerLoopSolver.Bind(wx.EVT_COMBOBOX, self.ChangeInnerLoopSolver) self.cmbNLP_solver_type.Bind(wx.EVT_COMBOBOX, self.ChangeNLP_solver_type) self.cmbNLP_solver_mode.Bind(wx.EVT_COMBOBOX, self.ChangeNLP_solver_mode) self.chkquiet_NLP.Bind(wx.EVT_CHECKBOX, self.Changequiet_NLP) self.chkenable_NLP_chaperone.Bind(wx.EVT_CHECKBOX, self.Changeenable_NLP_chaperone) self.chkNLP_stop_on_goal_attain.Bind( wx.EVT_CHECKBOX, self.ChangeNLP_stop_on_goal_attain) self.txtNLP_objective_goal.Bind(wx.EVT_KILL_FOCUS, self.ChangeNLP_objective_goal) self.chkquiet_MBH.Bind(wx.EVT_CHECKBOX, self.Changequiet_MBH) self.chkACE_feasible_point_finder.Bind( wx.EVT_CHECKBOX, self.ChangeACE_feasible_point_finder) self.txtMBH_max_not_improve.Bind(wx.EVT_KILL_FOCUS, self.ChangeMBH_max_not_improve) self.txtMBH_max_trials.Bind(wx.EVT_KILL_FOCUS, self.ChangeMBH_max_trials) self.txtMBH_max_run_time.Bind(wx.EVT_KILL_FOCUS, self.ChangeMBH_max_run_time) self.txtMBH_max_step_size.Bind(wx.EVT_KILL_FOCUS, self.ChangeMBH_max_step_size) self.cmbMBH_hop_distribution.Bind(wx.EVT_COMBOBOX, self.ChangeMBH_hop_distribution) self.txtMBH_Pareto_alpha.Bind(wx.EVT_KILL_FOCUS, self.ChangeMBH_Pareto_alpha) self.txtMBH_time_hop_probability.Bind( wx.EVT_KILL_FOCUS, self.ChangeMBH_time_hop_probability) self.chkMBH_always_write_archive.Bind( wx.EVT_CHECKBOX, self.ChangeMBH_always_write_archive) self.chkMBH_write_every_improvement.Bind( wx.EVT_CHECKBOX, self.ChangeMBH_write_every_improvement) self.chkprint_NLP_movie_frames.Bind(wx.EVT_CHECKBOX, self.Changeprint_NLP_movie_frames) self.txtsnopt_feasibility_tolerance.Bind( wx.EVT_KILL_FOCUS, self.Changesnopt_feasibility_tolerance) self.txtsnopt_optimality_tolerance.Bind( wx.EVT_KILL_FOCUS, self.Changesnopt_optimality_tolerance) self.txtNLP_max_step.Bind(wx.EVT_KILL_FOCUS, self.ChangeNLP_max_step) self.txtsnopt_major_iterations.Bind(wx.EVT_KILL_FOCUS, self.Changesnopt_major_iterations) self.txtsnopt_minor_iterations.Bind(wx.EVT_KILL_FOCUS, self.Changesnopt_minor_iterations) self.txtsnopt_max_run_time.Bind(wx.EVT_KILL_FOCUS, self.Changesnopt_max_run_time) self.chkcheck_derivatives.Bind(wx.EVT_CHECKBOX, self.ChangeCheckDerivatives) self.chkseed_MBH.Bind(wx.EVT_CHECKBOX, self.ChangeSeedMBH) self.chkskip_first_nlp_run.Bind(wx.EVT_CHECKBOX, self.Changeskip_first_nlp_run) self.btntrialX.Bind(wx.EVT_BUTTON, self.ClickTrialXButton)
def __init__(self, parent): wx.Dialog.__init__(self, parent, -1, style=wx.DEFAULT_DIALOG_STYLE) self.parent = parent # Bandeau titre = _(u"Import/Export de traductions au format texte") intro = _( u"Sélectionnez une langue dans la liste puis exportez ou importez les textes au format TXT." ) self.SetTitle(titre) self.ctrl_bandeau = CTRL_Bandeau.Bandeau( self, titre=titre, texte=intro, hauteurHtml=30, nomImage="Images/32x32/Traduction.png") # Langue self.box_langue_staticbox = wx.StaticBox(self, -1, _(u"Langue")) self.ctrl_langues = CTRL_Langue(self) # Exporter self.box_exporter_staticbox = wx.StaticBox(self, -1, _(u"Exporter")) self.check_nontraduits = wx.CheckBox( self, -1, _(u"Inclure uniquement les textes non traduits")) self.check_nontraduits.SetValue(True) self.bouton_exporter = CTRL_Bouton_image.CTRL( self, texte=_(u"Exporter"), cheminImage="Images/32x32/Fleche_haut.png") self.bouton_exporter.SetMinSize((400, -1)) # Importer self.box_importer_staticbox = wx.StaticBox(self, -1, _(u"Importer")) wildcard = _(u"Fichiers texte|*.txt|Tous les fichiers (*.*)|*.*") sp = wx.StandardPaths.Get() cheminDefaut = sp.GetDocumentsDir() self.ctrl_fichier_importer_original = filebrowse.FileBrowseButton( self, -1, labelText=_(u"Fichier des textes originaux :"), buttonText=_(u"Sélectionner"), toolTip=_(u"Cliquez ici pour sélectionner un fichier"), dialogTitle=_(u"Sélectionner un fichier"), fileMask=wildcard, startDirectory=cheminDefaut) self.ctrl_fichier_importer_traduction = filebrowse.FileBrowseButton( self, -1, labelText=_(u"Fichier des textes traduits :"), buttonText=_(u"Sélectionner"), toolTip=_(u"Cliquez ici pour sélectionner un fichier"), dialogTitle=_(u"Sélectionner un fichier"), fileMask=wildcard, startDirectory=cheminDefaut) self.bouton_importer = CTRL_Bouton_image.CTRL( self, texte=_(u"Importer"), cheminImage="Images/32x32/Fleche_bas.png") self.bouton_aide = CTRL_Bouton_image.CTRL( self, texte=_(u"Aide"), cheminImage="Images/32x32/Aide.png") self.bouton_fermer = CTRL_Bouton_image.CTRL( self, texte=_(u"Fermer"), cheminImage="Images/32x32/Fermer.png") self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.OnBoutonExporter, self.bouton_exporter) self.Bind(wx.EVT_BUTTON, self.OnBoutonImporter, self.bouton_importer) self.Bind(wx.EVT_BUTTON, self.OnBoutonAide, self.bouton_aide) self.Bind(wx.EVT_BUTTON, self.OnBoutonFermer, self.bouton_fermer)
def TopicTag(self): #分三个部分 #1.左侧标签栏 #2.右侧选择句子栏 f = open('TreeCtrl.txt', 'w') f.write('\n'.join(dir(wx.TreeCtrl))) f.close() self.topicpanel = wx.Panel(self.notebook, -1) #1.标签栏 #全选,反选框 self.seleteall = wx.CheckBox(self.topicpanel, label='Not/All') self.seleteinv = wx.Button(self.topicpanel, label='Inverse', size=(60, 23)) self.Bind(wx.EVT_CHECKBOX, self.OnSelectall, self.seleteall) self.Bind(wx.EVT_BUTTON, self.OnSelectinv, self.seleteinv) self.box311 = wx.BoxSizer(wx.HORIZONTAL) self.box311.Add(self.seleteall) self.box311.Add(self.seleteinv) #标签列表 self.topicList = self.maxtopic * [self.blank] self.topiccheck = [] self.allidx = [] text1 = wx.StaticText(self.topicpanel, label='Topics') for i, topic in enumerate(self.topicList): tmp = MyDragCheckBox(self.topicpanel, label=topic) tmp.SetForegroundColour(self.color[i]) tmp.Hide() self.topiccheck.append(tmp) self.box3121 = wx.BoxSizer(wx.VERTICAL) self.box3121.Add(text1, 0, wx.ALL) for i in range(0, self.maxtopic): self.box3121.Add(self.topiccheck[i], 0, wx.RESERVE_SPACE_EVEN_IF_HIDDEN) #数字列表 self.topicword = self.maxtopic * [0] self.wordspin = [] text2 = wx.StaticText(self.topicpanel, label='# of word') for i, num in enumerate(self.topicword): tmp = wx.SpinCtrl(self.topicpanel, value='0', size=(60, 17), min=50, max=800) tmp.SetForegroundColour(self.color[i]) tmp.Hide() self.wordspin.append(tmp) self.box3122 = wx.BoxSizer(wx.VERTICAL) self.box3122.Add(text2, 0, wx.EXPAND | wx.ALL) for i in range(0, self.maxtopic): self.box3122.Add(self.wordspin[i], 0, wx.RESERVE_SPACE_EVEN_IF_HIDDEN) #将标签和数字放入一个Box内 self.box312 = wx.BoxSizer(wx.HORIZONTAL) self.box312.Add(self.box3121) self.box312.Add(self.box3122) #点击blobtn按钮,会在选择块栏显示相应的按钮和块 self.blobtn = wx.Button(self.topicpanel, label='Show Blocks', style=wx.BU_EXACTFIT) self.blobtn.Bind(wx.EVT_BUTTON, self.OnBlobtn) #综述按钮 self.sumbtn = wx.Button(self.topicpanel, label='Synthesize', style=wx.BU_EXACTFIT) self.sumbtn.Bind(wx.EVT_BUTTON, self.OnSummary) #将按钮合并在一个框内 self.box313 = wx.BoxSizer(wx.HORIZONTAL) self.box313.Add(self.blobtn, 0, wx.EXPAND | wx.ALL) self.box313.Add(self.sumbtn, 0, wx.EXPAND | wx.ALL) statbox = wx.StaticBox(self.topicpanel, -1, 'Status') self.boxstat = wx.StaticBoxSizer(statbox, wx.VERTICAL) self.statinfo = wx.TextCtrl(self.topicpanel, size=(-1, 150), style=wx.TE_MULTILINE | wx.TE_READONLY) self.boxstat.Add(self.statinfo, 1, wx.ALL | wx.EXPAND) #将上述部件放入一个Box内 staticbox1 = wx.StaticBox(self.topicpanel, -1, 'Select Labels') self.box31u = wx.StaticBoxSizer(staticbox1, wx.VERTICAL) self.box31u.Add(self.box311, 0, wx.ALL | wx.EXPAND) self.box31u.Add(self.box312, 0, wx.ALL | wx.EXPAND) self.box31u.Add(self.box313, 0, wx.ALIGN_RIGHT | wx.ALIGN_BOTTOM, border=2) self.box31 = wx.BoxSizer(wx.VERTICAL) self.box31.Add(self.box31u, 0, wx.ALL | wx.EXPAND) self.box31.Add(self.boxstat, 0, wx.ALL | wx.EXPAND) #2.右侧选择句子栏 #上方带颜色的按钮 self.bbtnpanel = wx.Panel(self.topicpanel, -1) self.bbtnpanel.SetBackgroundColour((240, 240, 240, 255)) self.blockbtn = [] for i in range(0, self.maxtopic): tmp = wx.Button(self.bbtnpanel, id=100 + i) #id号用于得到事件处理 tmp.SetBackgroundColour(self.color[i]) tmp.Bind(wx.EVT_BUTTON, self.ShowBlock) tmp.Hide() self.blockbtn.append(tmp) #将上方按钮放置在GridSizer内 self.box321 = wx.GridSizer(cols=5) for i in range(0, self.maxtopic): self.box321.Add(self.blockbtn[i]) self.bbtnpanel.SetSizer(self.box321) #下方供选择句子 self.blockpanel = wx.ScrolledWindow(self.topicpanel, -1) self.blockpanel.SetBackgroundColour((240, 240, 240, 255)) self.blockpanel.SetScrollbars(1, 1, 100, 100) self.blocktext = [] self.blockcheck = [] self.blocknewsbtn = [] #联系块到新闻的按钮 tmpbox = wx.FlexGridSizer(cols=2, vgap=10, hgap=40) tmpbox.AddGrowableCol(0, 1) tmpbox.AddGrowableCol(1, 3) for i in range(0, self.maxblockcnt): tmpcheck = wx.CheckBox(self.blockpanel, -1) tmpbtn = wx.Button(self.blockpanel, 200 + i, label='Jump to news', style=wx.BU_EXACTFIT) tmpbtn.Bind(wx.EVT_BUTTON, self.Jump2News) ttbox = wx.BoxSizer(wx.VERTICAL) ttbox.Add(tmpcheck) ttbox.Add((20, 40)) ttbox.Add(tmpbtn) tmptext = wx.TextCtrl(self.blockpanel, -1, size=(270, 150), style=wx.TE_MULTILINE) tmpbox.Add(ttbox, 0, wx.ALIGN_LEFT) tmpbox.Add(tmptext, 1, wx.EXPAND | wx.ALL) tmptext.Hide() tmpcheck.Hide() tmpbtn.Hide() self.blocktext.append(tmptext) self.blockcheck.append(tmpcheck) self.blocknewsbtn.append(tmpbtn) self.blockpanel.SetSizer(tmpbox) #将按钮和CheckListCtrl放入一个垂直的box内 staticbox2 = wx.StaticBox(self.topicpanel, -1, 'Select blocks') self.box32 = wx.StaticBoxSizer(staticbox2, wx.VERTICAL) self.box32.Add(self.bbtnpanel, 0, wx.ALL | wx.EXPAND, border=2) self.box32.Add(self.blockpanel, 1, wx.ALL | wx.EXPAND, border=2) #将上述的box31、box32组合到一个box内 self.box3 = wx.BoxSizer(wx.HORIZONTAL) self.box3.Add(self.box31, 0) self.box3.Add(self.box32, 1, wx.EXPAND | wx.ALL) self.topicpanel.SetSizer(self.box3)
def __init__(self,parent): wx.Panel.__init__(self,parent,-1) self.parent = parent self.qName1 = wx.StaticText(self,-1,"Type:") self.qName2 = wx.Choice(self,-1,choices=apod_list) self.Bind(wx.EVT_CHOICE,self.ApodChoose,self.qName2) self.q1_1 = wx.StaticText(self,-1,"q1:") self.q1_2 = wx.TextCtrl(self,-1,"0.0") self.q2_1 = wx.StaticText(self,-1,"q2:") self.q2_2 = wx.TextCtrl(self,-1,"1.0") self.q3_1 = wx.StaticText(self,-1,"q3:") self.q3_2 = wx.TextCtrl(self,-1,"1.0") self.c1 = wx.StaticText(self,-1,"c") self.c2 = wx.TextCtrl(self,-1,"1.0") self.start_1 = wx.StaticText(self,-1,"Start") self.start_2 = wx.TextCtrl(self,-1,"1.0") self.size_1 = wx.StaticText(self,-1,"Size") self.size_1.Enable(False) self.size_2 = wx.TextCtrl(self,-1,"1.0") self.size_2.Enable(False) self.inv = wx.CheckBox(self,-1,"Invert") self.use_size = wx.CheckBox(self,-1,"Custom Size") self.Bind(wx.EVT_CHECKBOX,self.OnLimitCheck,self.use_size) self.points_1 = wx.StaticText(self,-1,"Number of Points:") self.points_2 = wx.TextCtrl(self,-1,"1000") self.sw_1 = wx.StaticText(self,-1,"Spectral Width:") self.sw_2 = wx.TextCtrl(self,-1,"50000.") self.b1 = wx.Button(self,10,"Draw") self.Bind(wx.EVT_BUTTON,self.OnDraw,self.b1) self.b1.SetDefault() self.b2 = wx.Button(self,20,"Clear") self.Bind(wx.EVT_BUTTON,self.OnClear,self.b2) self.b2.SetDefault() self.InitApod("SP") # layout apod_grid = wx.GridSizer(8,2) apod_grid.AddMany([self.qName1, self.qName2, self.q1_1, self.q1_2, self.q2_1, self.q2_2, self.q3_1, self.q3_2, self.c1,self.c2, self.start_1,self.start_2, self.size_1,self.size_2, self.inv,self.use_size]) data_grid = wx.GridSizer(2,2) data_grid.AddMany([self.points_1,self.points_2, self.sw_1,self.sw_2]) apod_box = wx.StaticBoxSizer(wx.StaticBox(self,-1, "Apodization Parameters")) apod_box.Add(apod_grid) data_box = wx.StaticBoxSizer(wx.StaticBox(self,-1, "Data Parameters")) data_box.Add(data_grid) button_box = wx.GridSizer(1,2) button_box.AddMany([self.b1,self.b2]) mainbox = wx.BoxSizer(wx.VERTICAL) mainbox.Add(apod_box) mainbox.Add(data_box) mainbox.Add(button_box) self.SetSizer(mainbox)
def __init__(self, parent): wx.Panel.__init__(self, parent, id=-1, style=wx.TAB_TRAVERSAL) # Jour self.liste_jours = ("lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi", "dimanche") self.box_jour_staticbox = wx.StaticBox(self, wx.ID_ANY, _(u"Jour")) self.check_jour = wx.CheckBox( self, wx.ID_ANY, _(u"Si le jour est parmi les jours cochés :")) self.label_jours_scolaire = wx.StaticText(self, wx.ID_ANY, _(u"Sem. scolaires : ")) self.check_scolaire_lundi = wx.CheckBox(self, wx.ID_ANY, u"L") self.check_scolaire_mardi = wx.CheckBox(self, wx.ID_ANY, u"M") self.check_scolaire_mercredi = wx.CheckBox(self, wx.ID_ANY, u"M") self.check_scolaire_jeudi = wx.CheckBox(self, wx.ID_ANY, u"J") self.check_scolaire_vendredi = wx.CheckBox(self, wx.ID_ANY, u"V") self.check_scolaire_samedi = wx.CheckBox(self, wx.ID_ANY, u"S") self.check_scolaire_dimanche = wx.CheckBox(self, wx.ID_ANY, u"D") self.label_jours_vacances = wx.StaticText(self, wx.ID_ANY, _(u"Sem. vacances : ")) self.check_vacances_lundi = wx.CheckBox(self, wx.ID_ANY, u"L") self.check_vacances_mardi = wx.CheckBox(self, wx.ID_ANY, u"M") self.check_vacances_mercredi = wx.CheckBox(self, wx.ID_ANY, u"M") self.check_vacances_jeudi = wx.CheckBox(self, wx.ID_ANY, u"J") self.check_vacances_vendredi = wx.CheckBox(self, wx.ID_ANY, u"V") self.check_vacances_samedi = wx.CheckBox(self, wx.ID_ANY, u"S") self.check_vacances_dimanche = wx.CheckBox(self, wx.ID_ANY, u"D") # Heure self.box_heure_staticbox = wx.StaticBox(self, wx.ID_ANY, _(u"Heure")) self.check_heure = wx.CheckBox(self, wx.ID_ANY, _(u"Si l'heure est comprise entre")) self.ctrl_heure_debut = CTRL_Saisie_heure.Heure(self) self.label_heure_et = wx.StaticText(self, wx.ID_ANY, _(u"et")) self.ctrl_heure_fin = CTRL_Saisie_heure.Heure(self) # Poste self.box_poste_staticbox = wx.StaticBox(self, wx.ID_ANY, _(u"Poste")) self.check_poste = wx.CheckBox(self, wx.ID_ANY, _(u"Si le poste est :")) try: labelPoste = _(u"Ce poste (%s)") % socket.gethostname().decode( "iso-8859-15") except: labelPoste = _(u"Ce poste") self.radio_poste_1 = wx.RadioButton(self, wx.ID_ANY, labelPoste, style=wx.RB_GROUP) self.radio_poste_2 = wx.RadioButton(self, wx.ID_ANY, _(u"Parmi les postes suivants :")) self.ctrl_postes = wx.TextCtrl(self, wx.ID_ANY, u"") #, style=wx.TE_MULTILINE) # Dernière sauvegarde self.box_derniere_staticbox = wx.StaticBox(self, wx.ID_ANY, _(u"Dernière sauvegarde")) self.check_derniere = wx.CheckBox( self, wx.ID_ANY, _(u"Si dernière sauv. date de plus de")) self.listeDelais = [ (1, _(u"1 jour")), ] for x in range(2, 31): self.listeDelais.append((x, _(u"%d jours") % x)) listeLabels = [] for valeur, label in self.listeDelais: listeLabels.append(label) self.ctrl_derniere = wx.Choice(self, wx.ID_ANY, choices=listeLabels) self.ctrl_derniere.SetSelection(0) # Utilisateur self.box_utilisateur_staticbox = wx.StaticBox(self, wx.ID_ANY, _(u"Utilisateur")) self.check_utilisateur = wx.CheckBox(self, wx.ID_ANY, _(u"Si l'utilisateur est :")) self.radio_utilisateur_1 = wx.RadioButton(self, wx.ID_ANY, _(u"Moi (%s)") % self.GetUtilisateur()[1], style=wx.RB_GROUP) self.radio_utilisateur_2 = wx.RadioButton( self, wx.ID_ANY, _(u"Parmi les utilisateurs cochés :")) self.ctrl_utilisateurs = CTRL_Utilisateurs(self) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_CHECKBOX, self.OnCheckJour, self.check_jour) self.Bind(wx.EVT_CHECKBOX, self.OnCheckHeure, self.check_heure) self.Bind(wx.EVT_CHECKBOX, self.OnCheckPoste, self.check_poste) self.Bind(wx.EVT_CHECKBOX, self.OnCheckDerniere, self.check_derniere) self.Bind(wx.EVT_CHECKBOX, self.OnCheckUtilisateur, self.check_utilisateur) self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioPoste, self.radio_poste_1) self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioPoste, self.radio_poste_2) self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioUtilisateur, self.radio_utilisateur_1) self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioUtilisateur, self.radio_utilisateur_2) # Init contrôles self.OnCheckJour(None) self.OnCheckHeure(None) self.OnCheckPoste(None) self.OnCheckDerniere(None) self.OnCheckUtilisateur(None)
def _init_ctrls(self, prnt, _availableTemplates): # generated method, don't edit wx.Frame.__init__(self, id=wxID_COMPFRAME, name='CompFrame', parent=prnt, pos=wx.Point(553, 276), size=wx.Size(656, 544), style=wx.DEFAULT_FRAME_STYLE, title=u'OSSIE Component Editor') self._init_utils() self.SetClientSize(wx.Size(856, 544)) self.SetMenuBar(self.menuBar1) # self.Center(wx.BOTH) self.Bind(wx.EVT_CLOSE, self.OnCompFrameClose) self.Bind(wx.EVT_ACTIVATE, self.OnCompFrameActivate) self.statusBarComponent = wx.StatusBar( id=wxID_COMPFRAMESTATUSBARCOMPONENT, name='statusBarComponent', parent=self, style=0) self.SetStatusBar(self.statusBarComponent) self.AddPortBtn = wx.Button(id=wxID_COMPFRAMEADDPORTBTN, label='Add Port', name='AddPortBtn', parent=self, pos=wx.Point(387, 216), size=wx.Size(100, 30), style=0) self.AddPortBtn.Bind(wx.EVT_BUTTON, self.OnAddPortBtnButton, id=wxID_COMPFRAMEADDPORTBTN) self.RemoveBtn = wx.Button(id=wxID_COMPFRAMEREMOVEBTN, label='Remove Port', name='RemoveBtn', parent=self, pos=wx.Point(387, 259), size=wx.Size(100, 30), style=0) self.RemoveBtn.Bind(wx.EVT_BUTTON, self.OnRemoveBtnButton, id=wxID_COMPFRAMEREMOVEBTN) self.addProp = wx.Button(id=wxID_COMPFRAMEADDPROP, label=u'Add Property', name=u'addProp', parent=self, pos=wx.Point(384, 356), size=wx.Size(100, 30), style=0) self.addProp.Enable(True) self.addProp.Bind(wx.EVT_BUTTON, self.OnaddPropButton, id=wxID_COMPFRAMEADDPROP) self.removeProp = wx.Button(id=wxID_COMPFRAMEREMOVEPROP, label=u'Remove Property', name=u'removeProp', parent=self, pos=wx.Point(384, 404), size=wx.Size(140, 32), style=0) self.removeProp.Enable(True) self.removeProp.Bind(wx.EVT_BUTTON, self.OnRemovePropButton, id=wxID_COMPFRAMEREMOVEPROP) self.staticText2 = wx.StaticText(id=wxID_COMPFRAMESTATICTEXT2, label='Ports', name='staticText2', parent=self, pos=wx.Point(167, 89), size=wx.Size(65, 17), style=0) self.CloseBtn = wx.Button(id=wxID_COMPFRAMECLOSEBTN, label='Close', name='CloseBtn', parent=self, pos=wx.Point(530, 424), size=wx.Size(85, 32), style=0) self.CloseBtn.Bind(wx.EVT_BUTTON, self.OnCloseBtnButton, id=wxID_COMPFRAMECLOSEBTN) self.TimingcheckBox = wx.CheckBox(id=wxID_COMPFRAMETIMINGCHECKBOX, label=u'Timing Port Support', name=u'TimingcheckBox', parent=self, pos=wx.Point(634, 126), size=wx.Size(185, 21), style=0) self.TimingcheckBox.SetValue(False) self.TimingcheckBox.Bind(wx.EVT_CHECKBOX, self.OnTimingcheckBoxCheckbox, id=wxID_COMPFRAMETIMINGCHECKBOX) self.ACEcheckBox = wx.CheckBox(id=wxID_COMPFRAMEACECHECKBOX, label=u'ACE Support', name=u'ACEcheckBox', parent=self, pos=wx.Point(634, 157), size=wx.Size(125, 21), style=0) self.ACEcheckBox.SetValue(False) self.ACEcheckBox.Bind(wx.EVT_CHECKBOX, self.OnACEcheckBoxCheckbox, id=wxID_COMPFRAMEACECHECKBOX) self.PortBox = wx.TreeCtrl(id=wxID_COMPFRAMEPORTBOX, name=u'PortBox', parent=self, pos=wx.Point(40, 112), size=wx.Size(312, 185), style=wx.SIMPLE_BORDER | wx.TR_HAS_BUTTONS | wx.TR_HIDE_ROOT) self.PortBox.SetImageList(self.imageListPorts) self.PortBox.SetBestFittingSize(wx.Size(312, 185)) self.PortBox.Bind(wx.EVT_RIGHT_UP, self.OnPortBoxRightUp) self.AssemblyCcheckBox = wx.CheckBox( id=wxID_COMPFRAMEASSEMBLYCCHECKBOX, label=u'Assembly Controller', name=u'AssemblyCcheckBox', parent=self, pos=wx.Point(384, 126), size=wx.Size(165, 21), style=0) self.AssemblyCcheckBox.SetValue(False) self.AssemblyCcheckBox.Bind(wx.EVT_CHECKBOX, self.OnAssemblyCcheckBoxCheckbox, id=wxID_COMPFRAMEASSEMBLYCCHECKBOX) self.compNameBox = wx.TextCtrl(id=wxID_COMPFRAMECOMPNAMEBOX, name=u'compNameBox', parent=self, pos=wx.Point(138, 10), size=wx.Size(215, 25), style=0, value=u'') self.staticText1 = wx.StaticText(id=wxID_COMPFRAMESTATICTEXT1, label=u'Component Name:', name='staticText1', parent=self, pos=wx.Point(24, 13), size=wx.Size(110, 17), style=0) self.compDescrBox = wx.TextCtrl(id=wxID_COMPFRAMECOMPDESCRBOX, name=u'compDescrBox', parent=self, pos=wx.Point(110, 40), size=wx.Size(243, 50), style=wx.TE_BESTWRAP | wx.TE_MULTILINE, value=u'') self.staticText1_1 = wx.StaticText(id=wxID_COMPFRAMESTATICTEXT8, label=u'Description:', name='staticText8', parent=self, pos=wx.Point(24, 43), size=wx.Size(110, 17), style=0) self.deviceChoice = wx.Choice(choices=[], id=wxID_COMPFRAMEDEVICECHOICE, name=u'deviceChoice', parent=self, pos=wx.Point(453, 93), size=wx.Size(136, 28), style=0) self.deviceChoice.SetBestFittingSize(wx.Size(136, 28)) self.deviceChoice.Bind(wx.EVT_CHOICE, self.OnDeviceChoiceChoice, id=wxID_COMPFRAMEDEVICECHOICE) self.staticText3 = wx.StaticText(id=wxID_COMPFRAMESTATICTEXT3, label=u'Waveform Deployment Settings', name='staticText3', parent=self, pos=wx.Point(384, 24), size=wx.Size(100, 35), style=wx.TE_BESTWRAP | wx.TE_MULTILINE) self.staticText3.SetFont( wx.Font(8, wx.SWISS, wx.NORMAL, wx.BOLD, True, u'Sans')) self.nodeChoice = wx.Choice(choices=[], id=wxID_COMPFRAMENODECHOICE, name=u'nodeChoice', parent=self, pos=wx.Point(453, 60), size=wx.Size(136, 28), style=0) self.nodeChoice.Bind(wx.EVT_CHOICE, self.OnNodeChoiceChoice, id=wxID_COMPFRAMENODECHOICE) self.staticText4 = wx.StaticText(id=wxID_COMPFRAMESTATICTEXT4, label=u'Node', name='staticText4', parent=self, pos=wx.Point(384, 65), size=wx.Size(41, 17), style=0) self.staticText5 = wx.StaticText(id=wxID_COMPFRAMESTATICTEXT5, label=u'Device', name='staticText5', parent=self, pos=wx.Point(384, 98), size=wx.Size(51, 17), style=0) self.staticText6 = wx.StaticText(id=wxID_COMPFRAMESTATICTEXT6, label=u'Component Generation Options', name='staticText6', parent=self, pos=wx.Point(634, 24), size=wx.Size(100, 35), style=wx.TE_BESTWRAP | wx.TE_MULTILINE) self.staticText6.SetFont( wx.Font(8, wx.SWISS, wx.NORMAL, wx.BOLD, True, u'Sans')) self.staticText7 = wx.StaticText(id=wxID_COMPFRAMESTATICTEXT7, label=u'Template', name='staticText7', parent=self, pos=wx.Point(634, 65), size=wx.Size(222, 17), style=0) self.propList = wx.ListView(id=wxID_COMPFRAMEPROPLIST, name=u'propList', parent=self, pos=wx.Point(40, 320), size=wx.Size(312, 160), style=wx.LC_SINGLE_SEL | wx.VSCROLL | wx.LC_REPORT | wx.LC_VRULES | wx.LC_HRULES | wx.SIMPLE_BORDER) self.propList.SetBestFittingSize(wx.Size(312, 160)) self._init_coll_propList_Columns(self.propList) #self.propList.Bind(wx.EVT_RIGHT_UP, self.OnPropListRightUp) self.propList.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, self.OnPropListListItemRightClick) self.propList.Bind(wx.EVT_LEFT_DCLICK, self.OnPropListLeftDclick) self.staticLine1 = wx.StaticLine(id=wxID_COMPFRAMESTATICLINE1, name='staticLine1', parent=self, pos=wx.Point(610, 17), size=wx.Size(1, 200), style=wx.LI_VERTICAL) self.templateChoice = wx.Choice(choices=_availableTemplates, id=wxID_COMPFRAMETEMPLATECHOICE, name=u'templateChoice', parent=self, pos=wx.Point(703, 60), size=wx.Size(136, 28), style=0) self.templateChoice.SetBestFittingSize(wx.Size(136, 28)) self.templateChoice.Bind(wx.EVT_CHOICE, self.OnTemplateChoiceChoice, id=wxID_COMPFRAMETEMPLATECHOICE)
def __init__(self, parent, log): wx.Panel.__init__(self, parent) self.log = log self.label1 = "Click here to show pane" self.label2 = "Click here to hide pane" title = wx.StaticText(self, label="PyCollapsiblePane") title.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) title.SetForegroundColour("blue") self.cpStyle = wx.CP_NO_TLW_RESIZE self.cp = cp = PCP.PyCollapsiblePane(self, label=self.label1, agwStyle=self.cpStyle) self.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.OnPaneChanged, cp) self.MakePaneContent(cp.GetPane()) self.btnRB = radioBox = wx.RadioBox(self, -1, "Button Types", choices=choices, style=wx.RA_SPECIFY_ROWS) self.static1 = wx.StaticText(self, -1, "Collapsed Button Text:") self.static2 = wx.StaticText(self, -1, "Expanded Button Text:") self.buttonText1 = wx.TextCtrl(self, -1, self.label1) self.buttonText2 = wx.TextCtrl(self, -1, self.label2) self.updateButton = wx.Button(self, -1, "Update!") sbox = wx.StaticBox(self, -1, 'Styles') sboxsizer = wx.StaticBoxSizer(sbox, wx.VERTICAL) self.styleCBs = list() for styleName in styles: cb = wx.CheckBox(self, -1, styleName) if styleName == "CP_NO_TLW_RESIZE": cb.SetValue(True) cb.Disable() cb.Bind(wx.EVT_CHECKBOX, self.OnStyleChoice) self.styleCBs.append(cb) sboxsizer.Add(cb, 0, wx.ALL, 4) self.gtkText = wx.StaticText(self, -1, "Expander Size") self.gtkChoice = wx.ComboBox(self, -1, choices=gtkChoices) self.gtkChoice.SetSelection(0) self.gtkText.Enable(False) self.gtkChoice.Enable(False) sizer = wx.BoxSizer(wx.VERTICAL) radioSizer = wx.BoxSizer(wx.HORIZONTAL) dummySizer = wx.BoxSizer(wx.VERTICAL) dummySizer.Add(self.gtkText, 0, wx.EXPAND | wx.BOTTOM, 2) dummySizer.Add(self.gtkChoice, 0, wx.EXPAND) radioSizer.Add(radioBox, 0, wx.EXPAND) radioSizer.Add(sboxsizer, 0, wx.EXPAND | wx.LEFT, 10) radioSizer.Add(dummySizer, 0, wx.ALIGN_BOTTOM | wx.LEFT, 10) self.SetSizer(sizer) sizer.Add((0, 10)) sizer.Add(title, 0, wx.LEFT | wx.RIGHT, 25) sizer.Add((0, 10)) sizer.Add(radioSizer, 0, wx.LEFT, 25) sizer.Add((0, 10)) subSizer = wx.FlexGridSizer(2, 3, 5, 5) subSizer.Add(self.static1, 0, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 5) subSizer.Add(self.buttonText1, 0, wx.EXPAND) subSizer.Add((0, 0)) subSizer.Add(self.static2, 0, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 5) subSizer.Add(self.buttonText2, 0, wx.EXPAND) subSizer.Add(self.updateButton, 0, wx.LEFT | wx.RIGHT, 10) subSizer.AddGrowableCol(1) sizer.Add(subSizer, 0, wx.EXPAND | wx.LEFT, 20) sizer.Add((0, 15)) sizer.Add(cp, 0, wx.RIGHT | wx.LEFT | wx.EXPAND, 20) self.btn = wx.Button(self, label=btnlbl1) sizer.Add(self.btn, 0, wx.ALL, 25) self.Bind(wx.EVT_BUTTON, self.OnToggle, self.btn) self.Bind(wx.EVT_BUTTON, self.OnUpdate, self.updateButton) self.Bind(wx.EVT_RADIOBOX, self.OnButtonChoice) self.Bind(wx.EVT_COMBOBOX, self.OnUserChoice, self.gtkChoice)
def __init__(self, klass, base_classes=None, message="Select Class", toplevel=True, options=None, defaults=None): pos = wx.GetMousePosition() wx.Dialog.__init__(self, common.main, -1, _(message), pos) self.standalone = self.base = None if base_classes: # base class self.base = wx.RadioBox(self, -1, ("base class"), choices=base_classes, style=wx.RA_VERTICAL) self.base.SetSelection(0) self.number = 1 self.class_names = set(_get_all_class_names(common.root)) self.toplevel_names = set(c.name for c in common.root.children) self.toplevel = toplevel # if this is True, the name must be unique, as the generated class will have it # class self._klass = klass if common.root.language.lower() != 'xrc': klass = self.get_next_class_name(klass) self.klass = wx.TextCtrl(self, -1, klass) self.klass.Bind(wx.EVT_TEXT, self.on_text) # for validation # for frame or standalone? this is used by the derived class below and just for menu bar and tool bar if self.parent_property and self.parent: # self.parent must be set by the derived class in this case; here we check whether it is set already choices = [ "Add to %s '%s'" % (self.parent.WX_CLASS[2:], self.parent.name), "Standalone" ] self.standalone = wx.RadioBox(self, -1, ("Type"), choices=choices, style=wx.RA_VERTICAL) self.standalone.Bind(wx.EVT_RADIOBOX, self.on_standalone) if self.parent.properties[self.parent_property].value: self.standalone.SetSelection(1) self.standalone.Disable() else: self.standalone.SetSelection(0) self.klass.Disable() # layout szr = wx.BoxSizer(wx.VERTICAL) if self.standalone: szr.Add(self.standalone, 0, wx.ALL | wx.EXPAND, 5) if self.base: szr.Add(self.base, 0, wx.ALL | wx.EXPAND, 5) hszr = wx.BoxSizer(wx.HORIZONTAL) hszr.Add(wx.StaticText( self, -1, _("class"), ), 0, wx.EXPAND | wx.ALL, 3) hszr.Add(self.klass, 2) szr.Add(hszr, 0, wx.EXPAND | wx.ALL, 5) # options if options: line = wx.StaticLine(self, -1, size=(20, -1), style=wx.LI_HORIZONTAL) szr.Add(line, 0, wx.EXPAND | wx.ALL, 5) self.options = [] for o, option in enumerate(options): cb = wx.CheckBox(self, -1, _(option)) cb.SetValue(defaults and defaults[o]) szr.Add(cb, 0, wx.ALL, 5) self.options.append(cb) line = wx.StaticLine(self, -1, size=(20, -1), style=wx.LI_HORIZONTAL) szr.Add(line, 0, wx.EXPAND | wx.TOP | wx.LEFT, 5) # buttons btnbox = wx.StdDialogButtonSizer() self.btnOK = btnOK = wx.Button(self, wx.ID_OK) #, _('OK')) btnOK.SetDefault() btnCANCEL = wx.Button(self, wx.ID_CANCEL) #, _('Cancel')) btnbox.AddButton(btnOK) #, 0, wx.ALL, 3) btnbox.AddButton(btnCANCEL) #, 0, wx.ALL, 3) btnbox.Realize() szr.Add(btnbox, 0, wx.ALL | wx.ALIGN_CENTER, 5) self.SetAutoLayout(True) self.SetSizer(szr) szr.Fit(self)
def __init__ (self, *args, **kwds): # begin wxGlade: PAIMEIpstalker.__init__ kwds["style"] = wx.TAB_TRAVERSAL wx.Panel.__init__(self, *args, **kwds) self.log_splitter = wx.SplitterWindow(self, -1, style=wx.SP_3D|wx.SP_BORDER) self.log_window = wx.Panel(self.log_splitter, -1) self.top_window = wx.Panel(self.log_splitter, -1) self.hits_column = wx.SplitterWindow(self.top_window, -1, style=wx.SP_3D|wx.SP_BORDER) self.hit_dereference = wx.Panel(self.hits_column, -1) self.hit_list = wx.Panel(self.hits_column, -1) self.hit_list_container_staticbox = wx.StaticBox(self.hit_list, -1, "Data Exploration") self.log_container_staticbox = wx.StaticBox(self.hit_dereference, -1, "Dereferenced Data") self.pydbg_column_staticbox = wx.StaticBox(self.top_window, -1, "Data Capture") self.targets_column_staticbox = wx.StaticBox(self.top_window, -1, "Data Sources") self.retrieve_targets = wx.Button(self.top_window, -1, "Refresh Target List") self.targets = _PAIMEIpstalker.TargetsTreeCtrl.TargetsTreeCtrl(self.top_window, -1, top=self, style=wx.TR_HAS_BUTTONS|wx.TR_LINES_AT_ROOT|wx.TR_DEFAULT_STYLE|wx.SUNKEN_BORDER) self.pida_modules_static = wx.StaticText(self.top_window, -1, "PIDA Modules") self.pida_modules_list = _PAIMEIpstalker.PIDAModulesListCtrl.PIDAModulesListCtrl(self.top_window, -1, top=self, style=wx.LC_REPORT|wx.SUNKEN_BORDER) self.add_module = wx.Button(self.top_window, -1, "Add Module(s)") self.hits = _PAIMEIpstalker.HitsListCtrl.HitsListCtrl(self.hit_list, -1, top=self, style=wx.LC_REPORT|wx.LC_HRULES|wx.SUNKEN_BORDER) self.coverage_functions_static = wx.StaticText(self.hit_list, -1, "Functions:") self.coverage_functions = wx.Gauge(self.hit_list, -1, 100, style=wx.GA_HORIZONTAL|wx.GA_SMOOTH) self.basic_blocks_coverage_static = wx.StaticText(self.hit_list, -1, "Basic Blocks:") self.coverage_basic_blocks = wx.Gauge(self.hit_list, -1, 100, style=wx.GA_HORIZONTAL|wx.GA_SMOOTH) self.hit_details = wx.TextCtrl(self.hit_dereference, -1, "", style=wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL) self.retrieve_list = wx.Button(self.top_window, -1, "Refresh Process List") self.process_list = _PAIMEIpstalker.ProcessListCtrl.ProcessListCtrl(self.top_window, -1, top=self, style=wx.LC_REPORT|wx.SUNKEN_BORDER) self.load_target = filebrowse.FileBrowseButton(self.top_window, -1, labelText="Load: ", fileMask="*.exe", fileMode=wx.OPEN, toolTip="Specify the target executable to load") self.coverage_depth = wx.RadioBox(self.top_window, -1, "Coverage Depth", choices=["Functions", "Basic Blocks"], majorDimension=0, style=wx.RA_SPECIFY_ROWS) self.restore_breakpoints = wx.CheckBox(self.top_window, -1, "Restore BPs") self.heavy = wx.CheckBox(self.top_window, -1, "Heavy") self.ignore_first_chance = wx.CheckBox(self.top_window, -1, "Unhandled Only") self.attach_detach = wx.Button(self.top_window, -1, "Start Stalking") self.log = wx.TextCtrl(self.log_window, -1, "", style=wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_LINEWRAP) self.__set_properties() self.__do_layout() # end wxGlade self.list_book = kwds["parent"] # handle to list book. self.main_frame = self.list_book.top # handle to top most frame. # default status message. self.status_msg = "Process Stalker" # log window bindings. self.Bind(wx.EVT_TEXT_MAXLEN, self.OnMaxLogLengthReached, self.log) # targets / tags tree ctrl. self.Bind(wx.EVT_BUTTON, self.targets.on_retrieve_targets, self.retrieve_targets) self.targets.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.targets.on_target_activated) self.targets.Bind(wx.EVT_TREE_SEL_CHANGED, self.targets.on_target_sel_changed) self.targets.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.targets.on_target_right_click) self.targets.Bind(wx.EVT_RIGHT_UP, self.targets.on_target_right_click) self.targets.Bind(wx.EVT_RIGHT_DOWN, self.targets.on_target_right_down) # pida modules list ctrl. self.Bind(wx.EVT_BUTTON, self.pida_modules_list.on_add_module, self.add_module) self.pida_modules_list.Bind(wx.EVT_COMMAND_RIGHT_CLICK, self.pida_modules_list.on_right_click) self.pida_modules_list.Bind(wx.EVT_RIGHT_UP, self.pida_modules_list.on_right_click) self.pida_modules_list.Bind(wx.EVT_RIGHT_DOWN, self.pida_modules_list.on_right_down) # hit list ctrl. self.hits.Bind(wx.EVT_LIST_ITEM_SELECTED, self.hits.on_select) # process list ctrl. self.Bind(wx.EVT_BUTTON, self.process_list.on_retrieve_list, self.retrieve_list) self.Bind(wx.EVT_BUTTON, self.process_list.on_attach_detach, self.attach_detach) self.process_list.Bind(wx.EVT_LIST_ITEM_SELECTED, self.process_list.on_select) # unselect targets self.targets.UnselectAll() self.msg("PaiMei Process Stalker") self.msg("Module by Pedram Amini\n")