def __createGuiElements(self, config): self.fontLabel = wx.StaticText(self, -1, _("Font")) self.fontPicker = wx.FontPickerCtrl(self, -1) self.lineNumbersCheckBox = wx.CheckBox(self, -1, _("Show line numbers")) self.tabWidthLabel = wx.StaticText(self, -1, _("Tab width")) self.tabWidthSpin = wx.SpinCtrl(self, -1, str(config.TAB_WIDTH_DEFAULT), min=self.MIN_TAB_WIDTH, max=self.MAX_TAB_WIDTH, style=wx.SP_ARROW_KEYS | wx.TE_AUTO_URL) # Настройки для клавиш Home / End self.homeEndLabel = wx.StaticText( self, -1, _(u"Home / End keys moves the cursor \nto the beginning / end of ") ) self.homeEndCombo = wx.ComboBox(self, -1, style=wx.CB_DROPDOWN | wx.CB_READONLY) self.homeEndCombo.SetMinSize((200, -1)) self.homeEndCombo.AppendItems([_(u"Line"), _(u"Paragraph")]) # Цвет шрифта self.fontColorLabel = wx.StaticText(self, label=_(u"Font color")) self.fontColorPicker = wx.ColourPickerCtrl(self, style=wx.CLRP_SHOW_LABEL) # Цвет фона self.backColorLabel = wx.StaticText(self, label=_(u"Background color")) self.backColorPicker = wx.ColourPickerCtrl(self, style=wx.CLRP_SHOW_LABEL)
def create_stylestoolbar(self, toolbar): "build toolbar with buttons to change styles" self.textcolour = wx.BLACK self.fontpicker = wx.FontPickerCtrl(toolbar, style=wx.FNTP_FONTDESC_AS_LABEL) self.fontpicker.Bind(wx.EVT_FONTPICKER_CHANGED, self.editor.text_font) toolbar.AddControl(self.fontpicker) self.fgcselect = csel.ColourSelect(toolbar, colour=self.textcolour) self.fgcselect.Bind(csel.EVT_COLOURSELECT, self.editor.text_color) toolbar.AddControl(self.fgcselect) bmp = wx.Bitmap(14, 14) self.fgcset = wxlb.GenBitmapButton(toolbar, bitmap=bmp, size=(22, 22)) self.changebitmapbuttoncolour(self.fgcset, self.textcolour) self.fgcset.Bind(wx.EVT_BUTTON, self.editor.set_text_color) toolbar.AddControl(self.fgcset) self.backgroundcolour = wx.WHITE self.bgcselect = csel.ColourSelect(toolbar, colour=self.backgroundcolour, size=(24, 24)) self.bgcselect.Bind(csel.EVT_COLOURSELECT, self.editor.background_color) toolbar.AddControl(self.bgcselect) bmp = wx.Bitmap(16, 16) self.bgcset = wxlb.GenBitmapButton(toolbar, bitmap=bmp, size=(24, 24)) self.changebitmapbuttoncolour(self.bgcset, self.backgroundcolour) self.bgcset.Bind(wx.EVT_BUTTON, self.editor.set_background_color) toolbar.AddControl(self.bgcset)
def __init__(self, parent): super(ConfigPanel, self).__init__(parent) self.picker = wx.FontPickerCtrl(self) self.__DoLayout() self.Bind(wx.EVT_FONTPICKER_CHANGED, self.OnFontPicker)
def createFontPanel(self): fcp = wx.Panel(self.book) font = wx.Font(prefs.get('font')) fgcolour = prefs.get('fgcolour') bgcolour = prefs.get('bgcolour') # output sample/controls fcp.sample = ExpandoTextCtrl(fcp, style=wx.TE_READONLY | wx.TE_RICH | wx.TE_MULTILINE, size=wx.Size(400, -1)) fcp.font_ctrl = wx.FontPickerCtrl(fcp, style=wx.FNTP_FONTDESC_AS_LABEL | wx.FNTP_USEFONT_FOR_LABEL, font=font) fcp.theme_picker = wx.Choice(fcp, choices=Theme.all_theme_names()) fcp.ansi_checkbox = wx.CheckBox(fcp, -1, 'Use ANSI colors') # TODO - get and set these two at display time not create time fcp.theme = prefs.get('theme') fcp.theme_picker.SetSelection(fcp.theme_picker.FindString(fcp.theme)) if prefs.get('use_ansi'): fcp.ansi_checkbox.SetValue(True) fcp.theme_picker.Enable() else: fcp.ansi_checkbox.SetValue(False) fcp.theme_picker.Disable() ansi_sizer = wx.BoxSizer(wx.HORIZONTAL) ansi_sizer.Add(fcp.ansi_checkbox, 0, wx.ALL | wx.EXPAND | wx.ALIGN_CENTER) ansi_sizer.Add(fcp.theme_picker, 0, wx.ALL | wx.EXPAND | wx.ALIGN_CENTER) panel_sizer = wx.BoxSizer(wx.VERTICAL) panel_sizer.Add(fcp.sample, 0, wx.RIGHT | wx.LEFT | wx.EXPAND | wx.TOP, 10) panel_sizer.AddSpacer(10) panel_sizer.Add(fcp.font_ctrl, 0, wx.EXPAND, 0) panel_sizer.AddSpacer(10) panel_sizer.Add(ansi_sizer, 0, wx.RIGHT | wx.LEFT | wx.EXPAND, 10) self.Bind(wx.EVT_FONTPICKER_CHANGED, self.update_sample_text, fcp.font_ctrl) self.Bind(wx.EVT_CHOICE, self.update_sample_text, fcp.theme_picker) self.Bind(wx.EVT_CHECKBOX, self.update_sample_text, fcp.ansi_checkbox) self.Bind(EVT_ETC_LAYOUT_NEEDED, self.resize_everything, fcp.sample) fcp.SetSizer(panel_sizer) fcp.Layout() return fcp
def __createGuiElements(self): self.sharedTextLabel = wx.StaticText( self, -1, _("This options for text printing only"), style=wx.ALIGN_CENTRE) self.fontLabel = wx.StaticText(self, -1, _("Font")) self.fontPicker = wx.FontPickerCtrl(self, -1) self.pageOptionsBtn = wx.Button(self, -1, _("Page Options..."))
def toolbarItem(self, parent, onActivate): font = wx.Font(18, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, faceName="Arial") self.picker = wx.FontPickerCtrl(parent, style=wx.FNTP_FONTDESC_AS_LABEL) self.picker.SetSelectedFont(font) return self.picker
def __init__(self, parent): super(ConfigPanel, self).__init__(parent) # Attributes self.picker = wx.FontPickerCtrl(self) # Setup self.__DoLayout() # Event Handlers self.Bind(wx.EVT_FONTPICKER_CHANGED, self.OnFontPicker)
def __init__(self, attribute, window, aguidata, **kwargs): control = wx.Panel(window, size=wx.Size(30, WX_STANDARD_HEIGHT)) sizer = wx.BoxSizer(orient=wx.VERTICAL) picker = wx.FontPickerCtrl(control) # checkbox.Bind(wx.EVT_CHECKBOX, self.apply) # checkbox.Bind(wx.EVT_SET_FOCUS, self.focus) # checkbox.Bind(wx.EVT_KILL_FOCUS, self.unfocus) self.picker = picker # line = wx.StaticLine(control) sizer.Add(picker, 1) # sizer.Add(line,flag=wx.EXPAND) control.SetSizer(sizer) kwargs['control_widget'] = control Base.__init__(self, attribute, window, aguidata, **kwargs)
def makeToolBar(self): """Creates the tool bar.""" self.toolbar = toolbar = self.CreateToolBar() self.font_picker = wx.FontPickerCtrl(toolbar, -1) toolbar.AddControl(control=self.font_picker) toolbar.Realize() #menu_bar = wx.MenuBar() # Associate menu/toolbar items with their handlers. #self.ID_ = wx.NewId() #menu_handlers = [ # (self.ID_FONT_CHANGED, self.onFontChanged), #] #for combo in menu_handlers: # mid, handler = combo[:2] # self.Bind(wx.EVT_MENU, handler, id=mid) self.Bind(wx.EVT_FONTPICKER_CHANGED, self.OnFontPickerChanged, self.font_picker)
def _createGuiElements(self): # Font elements self.fontLabel = wx.StaticText(self, -1, _("Font")) self.fontPicker = wx.FontPickerCtrl(self, -1) # Html improver self.improverLabel = wx.StaticText(self, -1, _("Paragraphs separator")) self.improverComboBox = wx.ComboBox(self, -1, style=wx.CB_READONLY | wx.CB_DROPDOWN) # User's styles elements self.userStyleLabel = wx.StaticText(self, -1, _("Additional styles (CSS):")) self.userStyleTextBox = wx.TextCtrl(self, -1, "", style=wx.TE_PROCESS_ENTER | wx.TE_MULTILINE | wx.HSCROLL | wx.TE_LINEWRAP | wx.TE_WORDWRAP)
def __init__( self, parent ): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"NewFont", pos = wx.DefaultPosition, size = wx.Size( -1,-1 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) self.SetForegroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_WINDOWTEXT ) ) self.SetBackgroundColour( wx.Colour( 255, 255, 255 ) ) bSizer6 = wx.BoxSizer( wx.VERTICAL ) fgSizer4 = wx.FlexGridSizer( 0, 2, 0, 0 ) fgSizer4.SetFlexibleDirection( wx.BOTH ) fgSizer4.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) bSizer9 = wx.BoxSizer( wx.VERTICAL ) fgSizer7 = wx.FlexGridSizer( 0, 5, 0, 0 ) fgSizer7.SetFlexibleDirection( wx.BOTH ) fgSizer7.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) bSizer101 = wx.BoxSizer( wx.VERTICAL ) self.fontPicker = wx.FontPickerCtrl( self, wx.ID_ANY, wx.Font( 24, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, "Arial" ), wx.DefaultPosition, wx.Size( 120,-1 ), wx.FNTP_FONTDESC_AS_LABEL ) self.fontPicker.SetMaxPointSize( 100 ) bSizer101.Add( self.fontPicker, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) fgSizer8 = wx.FlexGridSizer( 0, 2, 0, 0 ) fgSizer8.SetFlexibleDirection( wx.BOTH ) fgSizer8.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.Textctrl_PreviewUnicode = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 60,-1 ), 0 ) fgSizer8.Add( self.Textctrl_PreviewUnicode, 0, wx.ALL, 5 ) self.Text_Preview = wx.StaticText( self, wx.ID_ANY, u"X", wx.DefaultPosition, wx.DefaultSize, 0 ) self.Text_Preview.Wrap( -1 ) fgSizer8.Add( self.Text_Preview, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) bSizer101.Add( fgSizer8, 1, wx.EXPAND, 5 ) self.Text_OffsetUD = wx.StaticText( self, wx.ID_ANY, u"Offset UD = 0", wx.DefaultPosition, wx.DefaultSize, 0 ) self.Text_OffsetUD.Wrap( -1 ) bSizer101.Add( self.Text_OffsetUD, 0, wx.ALL, 5 ) self.Text_OffsetLR = wx.StaticText( self, wx.ID_ANY, u"Offset LR = 0", wx.DefaultPosition, wx.DefaultSize, 0 ) self.Text_OffsetLR.Wrap( -1 ) bSizer101.Add( self.Text_OffsetLR, 0, wx.ALL, 5 ) fgSizer7.Add( bSizer101, 1, wx.EXPAND, 5 ) self.Button_Left = wx.Button( self, wx.ID_ANY, u"←", wx.DefaultPosition, wx.Size( 20,40 ), 0 ) fgSizer7.Add( self.Button_Left, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) bSizer8 = wx.BoxSizer( wx.VERTICAL ) self.Button_Up = wx.Button( self, wx.ID_ANY, u"↑", wx.DefaultPosition, wx.Size( 40,20 ), 0 ) bSizer8.Add( self.Button_Up, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 5 ) self.m_bitmap3 = wx.StaticBitmap( self, wx.ID_ANY, wx.NullBitmap, wx.DefaultPosition, wx.Size( 64,64 ), 0 ) bSizer8.Add( self.m_bitmap3, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 5 ) self.Button_Down = wx.Button( self, wx.ID_ANY, u"↓", wx.DefaultPosition, wx.Size( 40,20 ), 0 ) bSizer8.Add( self.Button_Down, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 5 ) fgSizer7.Add( bSizer8, 0, 0, 5 ) self.Button_Right = wx.Button( self, wx.ID_ANY, u"→", wx.DefaultPosition, wx.Size( 20,40 ), 0 ) fgSizer7.Add( self.Button_Right, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) bSizer9.Add( fgSizer7, 0, 0, 5 ) fgSizer2 = wx.FlexGridSizer( 0, 4, 0, 0 ) fgSizer2.SetFlexibleDirection( wx.BOTH ) fgSizer2.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.m_staticText8 = wx.StaticText( self, wx.ID_ANY, u"Unicode Block", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText8.Wrap( -1 ) fgSizer2.Add( self.m_staticText8, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) self.textbox_unicode_start = wx.TextCtrl( self, wx.ID_ANY, u"0x0000", wx.DefaultPosition, wx.Size( 60,-1 ), 0 ) self.textbox_unicode_start.SetMaxLength( 6 ) fgSizer2.Add( self.textbox_unicode_start, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) self.m_staticText9 = wx.StaticText( self, wx.ID_ANY, u"to", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText9.Wrap( -1 ) fgSizer2.Add( self.m_staticText9, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) self.textbox_unicode_end = wx.TextCtrl( self, wx.ID_ANY, u"0x0000", wx.DefaultPosition, wx.Size( 60,-1 ), 0 ) self.textbox_unicode_end.SetMaxLength( 6 ) fgSizer2.Add( self.textbox_unicode_end, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) bSizer9.Add( fgSizer2, 1, wx.EXPAND, 5 ) fgSizer4.Add( bSizer9, 1, wx.EXPAND, 5 ) bSizer10 = wx.BoxSizer( wx.VERTICAL ) self.m_button8 = wx.Button( self, wx.ID_ANY, u"OK", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer10.Add( self.m_button8, 0, wx.ALL, 5 ) self.m_button9 = wx.Button( self, wx.ID_ANY, u"Cancel", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer10.Add( self.m_button9, 0, wx.ALL, 5 ) fgSizer4.Add( bSizer10, 1, wx.EXPAND, 5 ) bSizer6.Add( fgSizer4, 1, wx.EXPAND, 5 ) self.SetSizer( bSizer6 ) self.Layout() bSizer6.Fit( self ) self.Centre( wx.BOTH ) # Connect Events self.Bind( wx.EVT_CLOSE, self.FrameOnClose_Cb ) self.fontPicker.Bind( wx.EVT_FONTPICKER_CHANGED, self.OnFontChanged_Cb ) self.Textctrl_PreviewUnicode.Bind( wx.EVT_TEXT, self.Textctrl_PreviewUnicode_Ontext_CB ) self.Button_Left.Bind( wx.EVT_BUTTON, self.Button_Left_CB ) self.Button_Up.Bind( wx.EVT_BUTTON, self.Button_Up_CB ) self.Button_Down.Bind( wx.EVT_BUTTON, self.Button_Down_CB ) self.Button_Right.Bind( wx.EVT_BUTTON, self.Button_Right_CB ) self.m_button8.Bind( wx.EVT_BUTTON, self.ButtonOK_Cb ) self.m_button9.Bind( wx.EVT_BUTTON, self.ButtonCancel_Cb )
def __init__(self, parent, log): self.log = log wx.Panel.__init__(self, parent, -1) box = wx.BoxSizer(wx.VERTICAL) title = wx.StaticText(self, -1, "Picker Controls") title.SetFont(wx.FFont(24, wx.FONTFAMILY_SWISS, wx.FONTFLAG_BOLD)) title.SetForegroundColour("navy") box.Add(title, 0, wx.ALIGN_CENTER|wx.ALL, 5) #print(title.GetBestSize(), title.GetMinSize(), title.GetSize()) box.Add(wx.StaticLine(self), 0, wx.EXPAND) fgs = wx.FlexGridSizer(cols=4, hgap=5, vgap=5) fgs.AddGrowableCol(3) fgs.Add((10,10)) # spacer lbl = wx.StaticText(self, -1, "default style") lbl.SetFont(wx.FFont(12, wx.FONTFAMILY_SWISS, wx.FONTFLAG_BOLD)) fgs.Add(lbl) fgs.Add((10,10)) # spacer lbl = wx.StaticText(self, -1, "with textctrl") lbl.SetFont(wx.FFont(12, wx.FONTFAMILY_SWISS, wx.FONTFLAG_BOLD)) fgs.Add(lbl, 0, wx.ALIGN_CENTER) fgs.Add(wx.StaticText(self, -1, "wx.ColourPickerCtrl:"), 0, wx.ALIGN_CENTER_VERTICAL) cp1 = wx.ColourPickerCtrl(self) fgs.Add(cp1, 0, wx.ALIGN_CENTER) fgs.Add((10,10)) # spacer cp2 = wx.ColourPickerCtrl(self, style=wx.CLRP_USE_TEXTCTRL) cp2.SetTextCtrlProportion(5) fgs.Add(cp2, 0, wx.EXPAND) fgs.Add(wx.StaticText(self, -1, " with label:"), 0, wx.ALIGN_CENTER_VERTICAL) cp3 = wx.ColourPickerCtrl(self, style=wx.CLRP_SHOW_LABEL) fgs.Add(cp3, 0, wx.ALIGN_CENTER) fgs.Add((10,10)) # spacer fgs.Add((10,10)) # spacer self.Bind(wx.EVT_COLOURPICKER_CHANGED, self.OnPickColor, cp1) self.Bind(wx.EVT_COLOURPICKER_CHANGED, self.OnPickColor, cp2) self.Bind(wx.EVT_COLOURPICKER_CHANGED, self.OnPickColor, cp3) fgs.Add(wx.StaticText(self, -1, "wx.DirPickerCtrl:"), 0, wx.ALIGN_CENTER_VERTICAL) dp1 = wx.DirPickerCtrl(self) fgs.Add(dp1, 0, wx.ALIGN_CENTER) fgs.Add((10,10)) # spacer dp2 = wx.DirPickerCtrl(self, style=wx.DIRP_USE_TEXTCTRL) dp2.SetTextCtrlProportion(2) fgs.Add(dp2, 0, wx.EXPAND) self.Bind(wx.EVT_DIRPICKER_CHANGED, self.OnPickFileDir, dp1) self.Bind(wx.EVT_DIRPICKER_CHANGED, self.OnPickFileDir, dp2) fgs.Add(wx.StaticText(self, -1, "wx.FilePickerCtrl:"), 0, wx.ALIGN_CENTER_VERTICAL) fp1 = wx.FilePickerCtrl(self) fgs.Add(fp1, 0, wx.ALIGN_CENTER) fgs.Add((10,10)) # spacer fp2 = wx.FilePickerCtrl(self, style=wx.FLP_USE_TEXTCTRL) fp2.SetTextCtrlProportion(2) fgs.Add(fp2, 0, wx.EXPAND) self.Bind(wx.EVT_FILEPICKER_CHANGED, self.OnPickFileDir, fp1) self.Bind(wx.EVT_FILEPICKER_CHANGED, self.OnPickFileDir, fp2) fgs.Add(wx.StaticText(self, -1, "wx.FontPickerCtrl:"), 0, wx.ALIGN_CENTER_VERTICAL) fnt1 = wx.FontPickerCtrl(self, style=wx.FNTP_FONTDESC_AS_LABEL) fgs.Add(fnt1, 0, wx.ALIGN_CENTER) fgs.Add((10,10)) # spacer fnt2 = wx.FontPickerCtrl(self, style=wx.FNTP_FONTDESC_AS_LABEL|wx.FNTP_USE_TEXTCTRL) fnt2.SetTextCtrlProportion(2) fgs.Add(fnt2, 0, wx.EXPAND) self.Bind(wx.EVT_FONTPICKER_CHANGED, self.OnPickFont, fnt1) self.Bind(wx.EVT_FONTPICKER_CHANGED, self.OnPickFont, fnt2) box.Add(fgs, 1, wx.EXPAND|wx.ALL, 5) self.SetSizer(box)
def __init__(self, app, parent=None): self.app = app wx.Frame.__init__(self, parent, wx.ID_ANY, title = self.app.NAME + ' Preferences', \ style = wx.MINIMIZE_BOX | wx.CLOSE_BOX | wx.CAPTION | wx.SYSTEM_MENU) panel = wx.Panel(parent=self, id=wx.ID_ANY) borderSizer = wx.BoxSizer(wx.VERTICAL) panel.SetSizer(borderSizer) panelSizer = wx.FlexGridSizer(14, 2, metrics.size('relatedControls'), metrics.size('relatedControls')) borderSizer.Add(panelSizer, flag=wx.ALL, border=metrics.size('windowBorder')) self.editorFont = wx.FontPickerCtrl(panel, style=wx.FNTP_FONTDESC_AS_LABEL) self.editorFont.SetSelectedFont(self.getPrefFont('windowed')) self.editorFont.Bind(wx.EVT_FONTPICKER_CHANGED, lambda e: self.saveFontPref('windowed', \ self.editorFont.GetSelectedFont())) self.monoFont = wx.FontPickerCtrl(panel, style=wx.FNTP_FONTDESC_AS_LABEL) self.monoFont.SetSelectedFont(self.getPrefFont('monospace')) self.monoFont.Bind(wx.EVT_FONTPICKER_CHANGED, lambda e: self.saveFontPref('monospace', \ self.monoFont.GetSelectedFont())) self.fsFont = wx.FontPickerCtrl(panel, style=wx.FNTP_FONTDESC_AS_LABEL) self.fsFont.SetSelectedFont(self.getPrefFont('fs')) self.fsFont.Bind(wx.EVT_FONTPICKER_CHANGED, lambda e: self.saveFontPref('fs', \ self.fsFont.GetSelectedFont())) self.fsTextColor = wx.ColourPickerCtrl(panel) self.fsTextColor.SetColour(self.app.config.Read('fsTextColor')) self.fsTextColor.Bind(wx.EVT_COLOURPICKER_CHANGED, lambda e: self.savePref('fsTextColor', \ self.fsTextColor.GetColour())) self.fsBgColor = wx.ColourPickerCtrl(panel) self.fsBgColor.SetColour(self.app.config.Read('fsBgColor')) self.fsBgColor.Bind(wx.EVT_COLOURPICKER_CHANGED, lambda e: self.savePref('fsBgColor', \ self.fsBgColor.GetColour())) fsLineHeightPanel = wx.Panel(panel) fsLineHeightSizer = wx.BoxSizer(wx.HORIZONTAL) fsLineHeightPanel.SetSizer(fsLineHeightSizer) self.fsLineHeight = wx.ComboBox(fsLineHeightPanel, choices=('100', '125', '150', '175', '200')) self.fsLineHeight.Bind( wx.EVT_TEXT, lambda e: self.savePref( 'fsLineHeight', int(self.fsLineHeight.GetValue()))) self.fsLineHeight.SetValue(str( self.app.config.ReadInt('fslineHeight'))) fsLineHeightSizer.Add(self.fsLineHeight, flag=wx.ALIGN_CENTER_VERTICAL) fsLineHeightSizer.Add(wx.StaticText(fsLineHeightPanel, label='%'), flag=wx.ALIGN_CENTER_VERTICAL) def checkbox(self, name, label, panel=panel): setattr(self, name, wx.CheckBox(panel, label=label)) attr = getattr(self, name) attr.Bind(wx.EVT_CHECKBOX, lambda e, name=name, attr=attr: self.savePref( name, attr.GetValue())) attr.SetValue(self.app.config.ReadBool(name)) checkbox(self, "fastStoryPanel", 'Faster but rougher story map display') checkbox(self, "flatDesign", 'Flat Design(TM) mode') checkbox(self, "imageArrows", 'Connector arrows for images and stylesheets') checkbox(self, "displayArrows", 'Connector arrows for <<display>>ed passages') checkbox(self, "createPassagePrompt", 'Offer to create new passages for broken links') checkbox(self, "importImagePrompt", 'Offer to import externally linked images') checkbox(self, "passageWarnings", 'Warn about possible passage code errors') panelSizer.Add(wx.StaticText(panel, label='Normal Font'), flag=wx.ALIGN_CENTER_VERTICAL) panelSizer.Add(self.editorFont) panelSizer.Add(wx.StaticText(panel, label='Monospace Font'), flag=wx.ALIGN_CENTER_VERTICAL) panelSizer.Add(self.monoFont) panelSizer.Add(wx.StaticText(panel, label='Fullscreen Editor Font'), flag=wx.ALIGN_CENTER_VERTICAL) panelSizer.Add(self.fsFont) panelSizer.Add(wx.StaticText(panel, label='Fullscreen Editor Text Color'), flag=wx.ALIGN_CENTER_VERTICAL) panelSizer.Add(self.fsTextColor) panelSizer.Add(wx.StaticText(panel, label = 'Fullscreen Editor Background Color'), \ flag = wx.ALIGN_CENTER_VERTICAL) panelSizer.Add(self.fsBgColor) panelSizer.Add(wx.StaticText(panel, label='Fullscreen Editor Line Spacing'), flag=wx.ALIGN_CENTER_VERTICAL) panelSizer.Add(fsLineHeightPanel, flag=wx.ALIGN_CENTER_VERTICAL) panelSizer.Add(self.fastStoryPanel) # pylint: disable=no-member panelSizer.Add((1, 2)) panelSizer.Add(self.flatDesign) # pylint: disable=no-member panelSizer.Add((1, 2)) panelSizer.Add(self.imageArrows) # pylint: disable=no-member panelSizer.Add((1, 2)) panelSizer.Add(self.displayArrows) # pylint: disable=no-member panelSizer.Add((1, 2)) panelSizer.Add(wx.StaticText(panel, label='When closing a passage:'), flag=wx.ALIGN_CENTER_VERTICAL) panelSizer.Add((1, 2)) panelSizer.Add(self.createPassagePrompt) # pylint: disable=no-member panelSizer.Add((1, 2)) panelSizer.Add(self.importImagePrompt) # pylint: disable=no-member panelSizer.Add((1, 2)) panelSizer.Add(self.passageWarnings) # pylint: disable=no-member panelSizer.Fit(self) borderSizer.Fit(self) self.SetIcon(self.app.icon) self.Show() self.panelSizer = panelSizer self.borderSizer = borderSizer
def on_choose_font(self, event): with wx.Dialog(self.choice_panel.Parent, title="Measurement appearance") as dlg: labels = [] def add_label(sizer, label): ctrl = wx.StaticText(dlg, label=label) sizer.Add(ctrl, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL) labels.append(ctrl) sizer.AddSpacer(2) dlg.Sizer = wx.BoxSizer(wx.VERTICAL) sizer = wx.BoxSizer(wx.VERTICAL) dlg.Sizer.Add(sizer, 0, wx.EXPAND | wx.ALL, 5) subsizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(subsizer, 0, wx.EXPAND) sizer.AddSpacer(2) add_label(subsizer, "Font") font_picker = wx.FontPickerCtrl(dlg) font_picker.SetSelectedFont(self.font) font_picker.SetPickerCtrlGrowable(True) font_picker.Bind(wx.EVT_FONTPICKER_CHANGED, lambda event: dlg.Layout()) subsizer.Add(font_picker, 0, wx.ALIGN_LEFT) # # Foreground color # subsizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(subsizer, 0, wx.EXPAND) sizer.AddSpacer(2) add_label(subsizer, "Text color") foreground_color = ColourSelect(dlg, colour=self.foreground_color) subsizer.Add(foreground_color, 0, wx.ALIGN_LEFT) # # Background color and alpha # subsizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(subsizer, 0, wx.EXPAND) sizer.AddSpacer(2) add_label(subsizer, "Background color") background_color = ColourSelect(dlg, colour=self.background_color) subsizer.Add(background_color, 0, wx.ALIGN_LEFT) subsizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(subsizer, 0, wx.EXPAND) sizer.AddSpacer(2) add_label(subsizer, "Alpha") alpha = wx.Slider(dlg, value=self.background_alpha * 100, minValue=0, maxValue=100, style=wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_LABELS) alpha.SetMinSize(wx.Size(200, alpha.GetMinSize()[0])) subsizer.Add(alpha, 0, wx.EXPAND) subsizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(subsizer, 0, wx.EXPAND) sizer.AddSpacer(2) add_label(subsizer, "Box shape") box_style = wx.Choice(dlg, choices=[ "circle", "round", "roundtooth", "sawtooth", "square" ]) box_style.SetStringSelection(self.box_style) subsizer.Add(box_style, 0, wx.ALIGN_LEFT) subsizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(subsizer, 0, wx.EXPAND) sizer.AddSpacer(2) add_label(subsizer, "Precision") precision = wx.SpinCtrl(dlg, value=str(self.precision), min=0) subsizer.AddSpacer(2) subsizer.Add(precision, 0, wx.ALIGN_LEFT) width = 0 for label in labels: width = max(width, label.GetBestSize()[0]) for label in labels: label.SetMinSize(wx.Size(width, label.GetBestSize()[1])) button_sizer = wx.StdDialogButtonSizer() dlg.Sizer.Add(button_sizer, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5) button_sizer.AddButton(wx.Button(dlg, wx.ID_OK)) button_sizer.AddButton(wx.Button(dlg, wx.ID_CANCEL)) button_sizer.Realize() dlg.Fit() if dlg.ShowModal() == wx.ID_OK: self.font = font_picker.GetSelectedFont() self.foreground_color = foreground_color.GetColour() self.background_color = background_color.GetColour() self.background_alpha = float(alpha.Value) / 100 self.box_style = box_style.GetStringSelection() self.precision = precision.Value self.on_change(event)
def __init__(self, app, parent=None): self.app = app wx.Frame.__init__(self, parent, wx.ID_ANY, title = self.app.NAME + ' Preferences', \ style = wx.MINIMIZE_BOX | wx.CLOSE_BOX | wx.CAPTION | wx.SYSTEM_MENU) panel = wx.Panel(parent=self, id=wx.ID_ANY) borderSizer = wx.BoxSizer(wx.VERTICAL) panel.SetSizer(borderSizer) panelSizer = wx.FlexGridSizer(6, 2, metrics.size('relatedControls'), metrics.size('relatedControls')) borderSizer.Add(panelSizer, flag=wx.ALL, border=metrics.size('windowBorder')) self.editorFont = wx.FontPickerCtrl(panel, style=wx.FNTP_FONTDESC_AS_LABEL) self.editorFont.SetSelectedFont(self.getPrefFont('windowed')) self.editorFont.Bind(wx.EVT_FONTPICKER_CHANGED, lambda e: self.saveFontPref('windowed', \ self.editorFont.GetSelectedFont())) self.fsFont = wx.FontPickerCtrl(panel, style=wx.FNTP_FONTDESC_AS_LABEL) self.fsFont.SetSelectedFont(self.getPrefFont('fs')) self.fsFont.Bind(wx.EVT_FONTPICKER_CHANGED, lambda e: self.saveFontPref('fs', \ self.fsFont.GetSelectedFont())) self.fsTextColor = wx.ColourPickerCtrl(panel) self.fsTextColor.SetColour(self.app.config.Read('fsTextColor')) self.fsTextColor.Bind(wx.EVT_COLOURPICKER_CHANGED, lambda e: self.savePref('fsTextColor', \ self.fsTextColor.GetColour())) self.fsBgColor = wx.ColourPickerCtrl(panel) self.fsBgColor.SetColour(self.app.config.Read('fsBgColor')) self.fsBgColor.Bind(wx.EVT_COLOURPICKER_CHANGED, lambda e: self.savePref('fsBgColor', \ self.fsBgColor.GetColour())) fsLineHeightPanel = wx.Panel(panel) fsLineHeightSizer = wx.BoxSizer(wx.HORIZONTAL) fsLineHeightPanel.SetSizer(fsLineHeightSizer) self.fsLineHeight = wx.ComboBox(fsLineHeightPanel, choices=('100', '125', '150', '175', '200')) self.fsLineHeight.Bind( wx.EVT_TEXT, lambda e: self.savePref( 'fsLineHeight', int(self.fsLineHeight.GetValue()))) self.fsLineHeight.SetValue(str( self.app.config.ReadInt('fslineHeight'))) fsLineHeightSizer.Add(self.fsLineHeight, flag=wx.ALIGN_CENTER_VERTICAL) fsLineHeightSizer.Add(wx.StaticText(fsLineHeightPanel, label='%'), flag=wx.ALIGN_CENTER_VERTICAL) self.fastStoryPanel = wx.CheckBox( panel, label='Faster but rougher story map display') self.fastStoryPanel.Bind(wx.EVT_CHECKBOX, lambda e: self.savePref('fastStoryPanel', \ self.fastStoryPanel.GetValue())) self.fastStoryPanel.SetValue( self.app.config.ReadBool('fastStoryPanel')) panelSizer.Add(wx.StaticText(panel, label='Windowed Editor Font'), flag=wx.ALIGN_CENTER_VERTICAL) panelSizer.Add(self.editorFont) panelSizer.Add(wx.StaticText(panel, label='Fullscreen Editor Font'), flag=wx.ALIGN_CENTER_VERTICAL) panelSizer.Add(self.fsFont) panelSizer.Add(wx.StaticText(panel, label='Fullscreen Editor Text Color'), flag=wx.ALIGN_CENTER_VERTICAL) panelSizer.Add(self.fsTextColor) panelSizer.Add(wx.StaticText(panel, label = 'Fullscreen Editor Background Color'), \ flag = wx.ALIGN_CENTER_VERTICAL) panelSizer.Add(self.fsBgColor) panelSizer.Add(wx.StaticText(panel, label='Fullscreen Editor Line Spacing'), flag=wx.ALIGN_CENTER_VERTICAL) panelSizer.Add(fsLineHeightPanel, flag=wx.ALIGN_CENTER_VERTICAL) panelSizer.Add(self.fastStoryPanel) panelSizer.Fit(self) borderSizer.Fit(self) self.SetIcon(self.app.icon) self.Show()
def __init__( self, parent ): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.Size( 500,463 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) bSizer2 = wx.BoxSizer( wx.VERTICAL ) self.m_listbook1 = wx.Listbook( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LB_DEFAULT ) self.m_scrolledWindow3 = wx.ScrolledWindow( self.m_listbook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.HSCROLL|wx.VSCROLL ) self.m_scrolledWindow3.SetScrollRate( 5, 5 ) gSizer4 = wx.GridSizer( 0, 2, 0, 0 ) self.m_htmlWin2 = wx.html.HtmlWindow( self.m_scrolledWindow3, wx.ID_ANY, wx.DefaultPosition, wx.Size( 100,100 ), wx.html.HW_SCROLLBAR_AUTO ) gSizer4.Add( self.m_htmlWin2, 0, wx.ALL, 5 ) self.m_richText1 = wx.richtext.RichTextCtrl( self.m_scrolledWindow3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0|wx.VSCROLL|wx.HSCROLL|wx.NO_BORDER|wx.WANTS_CHARS ) gSizer4.Add( self.m_richText1, 1, wx.EXPAND |wx.ALL, 5 ) self.m_toggleBtn1 = wx.ToggleButton( self.m_scrolledWindow3, wx.ID_ANY, u"Toggle me!", wx.DefaultPosition, wx.DefaultSize, 0 ) gSizer4.Add( self.m_toggleBtn1, 0, wx.ALL, 5 ) self.m_searchCtrl2 = wx.SearchCtrl( self.m_scrolledWindow3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_searchCtrl2.ShowSearchButton( True ) self.m_searchCtrl2.ShowCancelButton( False ) gSizer4.Add( self.m_searchCtrl2, 0, wx.ALL, 5 ) self.m_colourPicker1 = wx.ColourPickerCtrl( self.m_scrolledWindow3, wx.ID_ANY, wx.BLACK, wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE ) gSizer4.Add( self.m_colourPicker1, 0, wx.ALL, 5 ) self.m_fontPicker1 = wx.FontPickerCtrl( self.m_scrolledWindow3, wx.ID_ANY, wx.NullFont, wx.DefaultPosition, wx.DefaultSize, wx.FNTP_DEFAULT_STYLE ) self.m_fontPicker1.SetMaxPointSize( 100 ) gSizer4.Add( self.m_fontPicker1, 0, wx.ALL, 5 ) self.m_filePicker1 = wx.FilePickerCtrl( self.m_scrolledWindow3, wx.ID_ANY, u"D:\\python\\mywindows.py", u"Select a file", u"*.*", wx.DefaultPosition, wx.DefaultSize, wx.FLP_DEFAULT_STYLE ) gSizer4.Add( self.m_filePicker1, 0, wx.ALL, 5 ) self.m_dirPicker1 = wx.DirPickerCtrl( self.m_scrolledWindow3, wx.ID_ANY, u"D:\\python", u"Select a folder", wx.DefaultPosition, wx.DefaultSize, wx.DIRP_DEFAULT_STYLE ) gSizer4.Add( self.m_dirPicker1, 0, wx.ALL, 5 ) self.m_datePicker1 = wx.adv.DatePickerCtrl( self.m_scrolledWindow3, wx.ID_ANY, wx.DefaultDateTime, wx.DefaultPosition, wx.DefaultSize, wx.adv.DP_DEFAULT ) gSizer4.Add( self.m_datePicker1, 0, wx.ALL, 5 ) self.m_calendar1 = wx.adv.CalendarCtrl( self.m_scrolledWindow3, wx.ID_ANY, wx.DefaultDateTime, wx.DefaultPosition, wx.DefaultSize, wx.adv.CAL_SHOW_HOLIDAYS ) gSizer4.Add( self.m_calendar1, 0, wx.ALL, 5 ) self.m_scrolledWindow3.SetSizer( gSizer4 ) self.m_scrolledWindow3.Layout() gSizer4.Fit( self.m_scrolledWindow3 ) self.m_listbook1.AddPage( self.m_scrolledWindow3, u"a page", False ) self.m_scrolledWindow4 = wx.ScrolledWindow( self.m_listbook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.HSCROLL|wx.VSCROLL ) self.m_scrolledWindow4.SetScrollRate( 5, 5 ) gSizer5 = wx.GridSizer( 0, 2, 0, 0 ) self.m_scrollBar1 = wx.ScrollBar( self.m_scrolledWindow4, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.SB_HORIZONTAL ) gSizer5.Add( self.m_scrollBar1, 0, wx.ALL, 5 ) self.m_spinCtrl1 = wx.SpinCtrl( self.m_scrolledWindow4, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 10, 2 ) gSizer5.Add( self.m_spinCtrl1, 0, wx.ALL, 5 ) self.m_spinCtrlDouble2 = wx.SpinCtrlDouble( self.m_scrolledWindow4, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 100, 4.000000, 1 ) self.m_spinCtrlDouble2.SetDigits( 0 ) gSizer5.Add( self.m_spinCtrlDouble2, 0, wx.ALL, 5 ) self.m_spinBtn1 = wx.SpinButton( self.m_scrolledWindow4, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 ) gSizer5.Add( self.m_spinBtn1, 0, wx.ALL, 5 ) self.m_hyperlink1 = wx.adv.HyperlinkCtrl( self.m_scrolledWindow4, wx.ID_ANY, u"xxx", u"http://teaching.bo-yuan.net/", wx.DefaultPosition, wx.DefaultSize, wx.adv.HL_DEFAULT_STYLE ) gSizer5.Add( self.m_hyperlink1, 0, wx.ALL, 5 ) self.m_genericDirCtrl2 = wx.GenericDirCtrl( self.m_scrolledWindow4, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.DIRCTRL_3D_INTERNAL|wx.SUNKEN_BORDER, wx.EmptyString, 0 ) self.m_genericDirCtrl2.ShowHidden( False ) gSizer5.Add( self.m_genericDirCtrl2, 1, wx.EXPAND |wx.ALL, 5 ) self.m_scrolledWindow4.SetSizer( gSizer5 ) self.m_scrolledWindow4.Layout() gSizer5.Fit( self.m_scrolledWindow4 ) self.m_listbook1.AddPage( self.m_scrolledWindow4, u"a page", False ) self.m_scrolledWindow5 = wx.ScrolledWindow( self.m_listbook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.HSCROLL|wx.VSCROLL ) self.m_scrolledWindow5.SetScrollRate( 5, 5 ) gSizer6 = wx.GridSizer( 0, 2, 0, 0 ) self.m_treeCtrl1 = wx.TreeCtrl( self.m_scrolledWindow5, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TR_DEFAULT_STYLE ) gSizer6.Add( self.m_treeCtrl1, 0, wx.ALL, 5 ) self.m_grid1 = wx.grid.Grid( self.m_scrolledWindow5, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 ) # Grid self.m_grid1.CreateGrid( 5, 5 ) self.m_grid1.EnableEditing( True ) self.m_grid1.EnableGridLines( True ) self.m_grid1.EnableDragGridSize( False ) self.m_grid1.SetMargins( 0, 0 ) # Columns self.m_grid1.EnableDragColMove( False ) self.m_grid1.EnableDragColSize( True ) self.m_grid1.SetColLabelSize( 30 ) self.m_grid1.SetColLabelAlignment( wx.ALIGN_CENTER, wx.ALIGN_CENTER ) # Rows self.m_grid1.EnableDragRowSize( True ) self.m_grid1.SetRowLabelSize( 80 ) self.m_grid1.SetRowLabelAlignment( wx.ALIGN_CENTER, wx.ALIGN_CENTER ) # Label Appearance # Cell Defaults self.m_grid1.SetDefaultCellAlignment( wx.ALIGN_LEFT, wx.ALIGN_TOP ) gSizer6.Add( self.m_grid1, 0, wx.ALL, 5 ) m_checkList2Choices = [u"aaa", u"bbb", u"ccc"] self.m_checkList2 = wx.CheckListBox( self.m_scrolledWindow5, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_checkList2Choices, 0 ) gSizer6.Add( self.m_checkList2, 0, wx.ALL, 5 ) self.m_scrolledWindow5.SetSizer( gSizer6 ) self.m_scrolledWindow5.Layout() gSizer6.Fit( self.m_scrolledWindow5 ) self.m_listbook1.AddPage( self.m_scrolledWindow5, u"a page", True ) bSizer2.Add( self.m_listbook1, 1, wx.EXPAND |wx.ALL, 5 ) self.m_choicebook1 = wx.Choicebook( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.CHB_DEFAULT ) self.m_panel8 = wx.Panel( self.m_choicebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) self.m_choicebook1.AddPage( self.m_panel8, u"a page", True ) self.m_panel9 = wx.Panel( self.m_choicebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) self.m_choicebook1.AddPage( self.m_panel9, u"a page", False ) self.m_panel10 = wx.Panel( self.m_choicebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) self.m_choicebook1.AddPage( self.m_panel10, u"a page", False ) bSizer2.Add( self.m_choicebook1, 1, wx.EXPAND |wx.ALL, 5 ) self.SetSizer( bSizer2 ) self.Layout() self.m_timer1 = wx.Timer() self.m_timer1.SetOwner( self, wx.ID_ANY ) self.Centre( wx.BOTH )
def __init__( self, parent ): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = _("Preferences"), pos = wx.DefaultPosition, size = wx.Size( 752,413 ), style = wx.DEFAULT_FRAME_STYLE|wx.STAY_ON_TOP|wx.TAB_TRAVERSAL ) self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize ) bSizer19 = wx.BoxSizer( wx.VERTICAL ) self.m_splitter9 = wx.SplitterWindow( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.SP_3D ) self.m_splitter9.Bind( wx.EVT_IDLE, self.m_splitter9OnIdle ) self.m_panel24 = wx.Panel( self.m_splitter9, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) bSizer20 = wx.BoxSizer( wx.VERTICAL ) listBoxPreferencesChoices = [ _("Appearance"), _("Source Code Font/Size"), _("Auto-completion"), _("Auto-insert"), _("Open/Save files"), _("Highlight"), _("Upgrade") ] self.listBoxPreferences = wx.ListBox( self.m_panel24, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, listBoxPreferencesChoices, 0 ) bSizer20.Add( self.listBoxPreferences, 1, wx.ALL|wx.EXPAND, 5 ) self.m_panel24.SetSizer( bSizer20 ) self.m_panel24.Layout() bSizer20.Fit( self.m_panel24 ) self.m_panel25 = wx.Panel( self.m_splitter9, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) bSizer21 = wx.BoxSizer( wx.VERTICAL ) self.staticTextPage = wx.StaticText( self.m_panel25, wx.ID_ANY, _("Appearance"), wx.DefaultPosition, wx.DefaultSize, 0 ) self.staticTextPage.Wrap( -1 ) self.staticTextPage.SetFont( wx.Font( 12, 70, 90, 92, False, wx.EmptyString ) ) bSizer21.Add( self.staticTextPage, 0, wx.TOP|wx.RIGHT|wx.LEFT, 5 ) self.auinotebookPreferences = wx.aui.AuiNotebook( self.m_panel25, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0|wx.NO_BORDER ) self.appearance = wx.Panel( self.auinotebookPreferences, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) fgSizer3 = wx.FlexGridSizer( 2, 2, 0, 0 ) fgSizer3.AddGrowableCol( 1 ) fgSizer3.AddGrowableRow( 1 ) fgSizer3.SetFlexibleDirection( wx.BOTH ) fgSizer3.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.m_staticText6 = wx.StaticText( self.appearance, wx.ID_ANY, _("Theme"), wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText6.Wrap( -1 ) fgSizer3.Add( self.m_staticText6, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) choiceThemeChoices = [] self.choiceTheme = wx.Choice( self.appearance, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, choiceThemeChoices, 0 ) self.choiceTheme.SetSelection( 0 ) fgSizer3.Add( self.choiceTheme, 0, wx.ALL|wx.EXPAND, 5 ) fgSizer3.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) self.appearance.SetSizer( fgSizer3 ) self.appearance.Layout() fgSizer3.Fit( self.appearance ) self.auinotebookPreferences.AddPage( self.appearance, _("appearance"), False, wx.NullBitmap ) self.souce_code_font_size = wx.Panel( self.auinotebookPreferences, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) fgSizer4 = wx.FlexGridSizer( 2, 2, 0, 0 ) fgSizer4.AddGrowableCol( 1 ) fgSizer4.AddGrowableRow( 2 ) fgSizer4.AddGrowableRow( 4 ) fgSizer4.SetFlexibleDirection( wx.BOTH ) fgSizer4.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.radioBtnSourcedefault = wx.RadioButton( self.souce_code_font_size, wx.ID_ANY, _("Use default"), wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer4.Add( self.radioBtnSourcedefault, 0, wx.ALL, 5 ) fgSizer4.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) self.radioBtnSourceselected = wx.RadioButton( self.souce_code_font_size, wx.ID_ANY, _("Use selected"), wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer4.Add( self.radioBtnSourceselected, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) self.fontPickerSource = wx.FontPickerCtrl( self.souce_code_font_size, wx.ID_ANY, wx.Font( 12, 70, 90, 90, False, "Ubuntu Mono" ), wx.DefaultPosition, wx.DefaultSize, wx.FNTP_DEFAULT_STYLE ) self.fontPickerSource.SetMaxPointSize( 100 ) fgSizer4.Add( self.fontPickerSource, 0, wx.ALL|wx.EXPAND, 5 ) fgSizer4.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) fgSizer4.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) self.m_staticText8 = wx.StaticText( self.souce_code_font_size, wx.ID_ANY, _("Tab size"), wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText8.Wrap( -1 ) fgSizer4.Add( self.m_staticText8, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) self.spinCtrlSource = wx.SpinCtrl( self.souce_code_font_size, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 2, 10, 4 ) fgSizer4.Add( self.spinCtrlSource, 0, wx.ALL|wx.EXPAND, 5 ) fgSizer4.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) fgSizer4.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) self.souce_code_font_size.SetSizer( fgSizer4 ) self.souce_code_font_size.Layout() fgSizer4.Fit( self.souce_code_font_size ) self.auinotebookPreferences.AddPage( self.souce_code_font_size, _("souce_code_font_size"), False, wx.NullBitmap ) self.auto_completion = wx.Panel( self.auinotebookPreferences, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) fgSizer5 = wx.FlexGridSizer( 2, 2, 0, 0 ) fgSizer5.AddGrowableCol( 1 ) fgSizer5.SetFlexibleDirection( wx.BOTH ) fgSizer5.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.m_staticText19 = wx.StaticText( self.auto_completion, wx.ID_ANY, _("Source completion"), wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText19.Wrap( -1 ) self.m_staticText19.SetFont( wx.Font( wx.NORMAL_FONT.GetPointSize(), 70, 90, 92, False, wx.EmptyString ) ) fgSizer5.Add( self.m_staticText19, 0, wx.ALL, 5 ) fgSizer5.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) self.radioBtnCompleterEn = wx.RadioButton( self.auto_completion, wx.ID_ANY, _("After characters"), wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer5.Add( self.radioBtnCompleterEn, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) self.spinCtrlCompleterCount = wx.SpinCtrl( self.auto_completion, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 10, 2 ) fgSizer5.Add( self.spinCtrlCompleterCount, 0, wx.ALL|wx.EXPAND|wx.LEFT, 5 ) self.radioBtnCompleterDis = wx.RadioButton( self.auto_completion, wx.ID_ANY, _("Disable auto-completer"), wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer5.Add( self.radioBtnCompleterDis, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) fgSizer5.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) self.m_staticText12 = wx.StaticText( self.auto_completion, wx.ID_ANY, _("Items count"), wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText12.Wrap( -1 ) fgSizer5.Add( self.m_staticText12, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) self.spinCtrlItemsCompleterCount = wx.SpinCtrl( self.auto_completion, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 5, 30, 15 ) fgSizer5.Add( self.spinCtrlItemsCompleterCount, 0, wx.ALL|wx.EXPAND, 5 ) self.checkBoxInsertParenthesis = wx.CheckBox( self.auto_completion, wx.ID_ANY, _("Insert arguments with \"(\""), wx.DefaultPosition, wx.DefaultSize, 0 ) self.checkBoxInsertParenthesis.SetValue(True) fgSizer5.Add( self.checkBoxInsertParenthesis, 0, wx.ALL, 5 ) self.auto_completion.SetSizer( fgSizer5 ) self.auto_completion.Layout() fgSizer5.Fit( self.auto_completion ) self.auinotebookPreferences.AddPage( self.auto_completion, _("autocompletion"), False, wx.NullBitmap ) self.auto_insert = wx.Panel( self.auinotebookPreferences, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) fgSizer6 = wx.FlexGridSizer( 2, 2, 0, 0 ) fgSizer6.AddGrowableCol( 1 ) fgSizer6.SetFlexibleDirection( wx.BOTH ) fgSizer6.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.m_staticText15 = wx.StaticText( self.auto_insert, wx.ID_ANY, _("Auto-close"), wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText15.Wrap( -1 ) self.m_staticText15.SetFont( wx.Font( wx.NORMAL_FONT.GetPointSize(), 70, 90, 92, False, wx.EmptyString ) ) fgSizer6.Add( self.m_staticText15, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) self.checkBoxBrackets = wx.CheckBox( self.auto_insert, wx.ID_ANY, _("Brackets: []"), wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer6.Add( self.checkBoxBrackets, 0, wx.EXPAND|wx.RIGHT|wx.LEFT, 5 ) fgSizer6.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) self.checkBoxDoubleCuotes = wx.CheckBox( self.auto_insert, wx.ID_ANY, _("Double quotes: \"\""), wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer6.Add( self.checkBoxDoubleCuotes, 0, wx.EXPAND|wx.RIGHT|wx.LEFT, 5 ) fgSizer6.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) self.checkBoxKeys = wx.CheckBox( self.auto_insert, wx.ID_ANY, _("Keys: {}"), wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer6.Add( self.checkBoxKeys, 0, wx.EXPAND|wx.RIGHT|wx.LEFT, 5 ) fgSizer6.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) self.checkBoxParentheses = wx.CheckBox( self.auto_insert, wx.ID_ANY, _("Parentheses: ()"), wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer6.Add( self.checkBoxParentheses, 0, wx.EXPAND|wx.RIGHT|wx.LEFT, 5 ) fgSizer6.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) self.checkBoxSingleCuotes = wx.CheckBox( self.auto_insert, wx.ID_ANY, _("Single quotes: ''"), wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer6.Add( self.checkBoxSingleCuotes, 0, wx.EXPAND|wx.RIGHT|wx.LEFT, 5 ) self.auto_insert.SetSizer( fgSizer6 ) self.auto_insert.Layout() fgSizer6.Fit( self.auto_insert ) self.auinotebookPreferences.AddPage( self.auto_insert, _("auto_insert"), False, wx.NullBitmap ) self.open_save_files = wx.Panel( self.auinotebookPreferences, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) gSizer1 = wx.GridSizer( 2, 2, 0, 0 ) sbSizer5 = wx.StaticBoxSizer( wx.StaticBox( self.open_save_files, wx.ID_ANY, _("New file") ), wx.VERTICAL ) self.m_panel36 = wx.Panel( self.open_save_files, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) bSizer28 = wx.BoxSizer( wx.VERTICAL ) self.radioBtnFileTemplate = wx.RadioButton( self.m_panel36, wx.ID_ANY, _("With template"), wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer28.Add( self.radioBtnFileTemplate, 0, wx.ALL, 5 ) self.radioBtnFileEmpty = wx.RadioButton( self.m_panel36, wx.ID_ANY, _("Empty"), wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer28.Add( self.radioBtnFileEmpty, 0, wx.ALL, 5 ) self.m_panel36.SetSizer( bSizer28 ) self.m_panel36.Layout() bSizer28.Fit( self.m_panel36 ) sbSizer5.Add( self.m_panel36, 1, wx.EXPAND, 5 ) gSizer1.Add( sbSizer5, 1, wx.EXPAND|wx.ALL, 5 ) sbSizer6 = wx.StaticBoxSizer( wx.StaticBox( self.open_save_files, wx.ID_ANY, _("Auto-save") ), wx.VERTICAL ) self.m_panel37 = wx.Panel( self.open_save_files, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) fgSizer8 = wx.FlexGridSizer( 2, 2, 0, 0 ) fgSizer8.SetFlexibleDirection( wx.BOTH ) fgSizer8.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.radioBtnSaveEach = wx.RadioButton( self.m_panel37, wx.ID_ANY, _("Each (sec)"), wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer8.Add( self.radioBtnSaveEach, 0, wx.ALL, 5 ) self.spinCtrlSaveTime = wx.SpinCtrl( self.m_panel37, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 10, 300, 10 ) fgSizer8.Add( self.spinCtrlSaveTime, 0, wx.ALL, 5 ) self.radioBtnSaveNever = wx.RadioButton( self.m_panel37, wx.ID_ANY, _("Never"), wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer8.Add( self.radioBtnSaveNever, 0, wx.ALL, 5 ) self.m_panel37.SetSizer( fgSizer8 ) self.m_panel37.Layout() fgSizer8.Fit( self.m_panel37 ) sbSizer6.Add( self.m_panel37, 1, wx.EXPAND, 5 ) gSizer1.Add( sbSizer6, 1, wx.EXPAND|wx.ALL, 5 ) sbSizer8 = wx.StaticBoxSizer( wx.StaticBox( self.open_save_files, wx.ID_ANY, _("Open last files") ), wx.VERTICAL ) self.m_panel38 = wx.Panel( self.open_save_files, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) bSizer30 = wx.BoxSizer( wx.VERTICAL ) self.radioBtnOpenAll = wx.RadioButton( self.m_panel38, wx.ID_ANY, _("All existing files"), wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer30.Add( self.radioBtnOpenAll, 0, wx.ALL, 5 ) self.radioBtnOpenNever = wx.RadioButton( self.m_panel38, wx.ID_ANY, _("Never"), wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer30.Add( self.radioBtnOpenNever, 0, wx.ALL, 5 ) self.m_panel38.SetSizer( bSizer30 ) self.m_panel38.Layout() bSizer30.Fit( self.m_panel38 ) sbSizer8.Add( self.m_panel38, 1, wx.EXPAND, 5 ) gSizer1.Add( sbSizer8, 1, wx.EXPAND|wx.ALL, 5 ) self.open_save_files.SetSizer( gSizer1 ) self.open_save_files.Layout() gSizer1.Fit( self.open_save_files ) self.auinotebookPreferences.AddPage( self.open_save_files, _("open_save_files"), True, wx.NullBitmap ) self.highlight = wx.Panel( self.auinotebookPreferences, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) fgSizer7 = wx.FlexGridSizer( 2, 2, 0, 0 ) fgSizer7.AddGrowableCol( 0 ) fgSizer7.SetFlexibleDirection( wx.BOTH ) fgSizer7.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.textCtrlSearch = wx.TextCtrl( self.highlight, wx.ID_ANY, _("Search and Replace"), wx.DefaultPosition, wx.Size( -1,-1 ), wx.TE_READONLY ) self.textCtrlSearch.SetBackgroundColour( wx.Colour( 251, 251, 104 ) ) fgSizer7.Add( self.textCtrlSearch, 0, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 10 ) self.colourPickerSearch = wx.ColourPickerCtrl( self.highlight, wx.ID_ANY, wx.Colour( 251, 251, 104 ), wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE ) fgSizer7.Add( self.colourPickerSearch, 0, wx.ALL, 5 ) self.textCtrlCodeNav = wx.TextCtrl( self.highlight, wx.ID_ANY, _("Code Navigation"), wx.DefaultPosition, wx.DefaultSize, wx.TE_READONLY ) self.textCtrlCodeNav.SetBackgroundColour( wx.Colour( 130, 184, 226 ) ) fgSizer7.Add( self.textCtrlCodeNav, 0, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 10 ) self.colourPickerCodeNav = wx.ColourPickerCtrl( self.highlight, wx.ID_ANY, wx.Colour( 130, 184, 226 ), wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE ) fgSizer7.Add( self.colourPickerCodeNav, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) self.textCtrlCurrentLine = wx.TextCtrl( self.highlight, wx.ID_ANY, _("Selection"), wx.DefaultPosition, wx.DefaultSize, wx.TE_READONLY ) self.textCtrlCurrentLine.SetBackgroundColour( wx.Colour( 240, 119, 70 ) ) fgSizer7.Add( self.textCtrlCurrentLine, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 10 ) self.colourPickerCurrentLine = wx.ColourPickerCtrl( self.highlight, wx.ID_ANY, wx.Colour( 204, 230, 239 ), wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE ) fgSizer7.Add( self.colourPickerCurrentLine, 0, wx.ALL, 5 ) self.highlight.SetSizer( fgSizer7 ) self.highlight.Layout() fgSizer7.Fit( self.highlight ) self.auinotebookPreferences.AddPage( self.highlight, _("highligh"), False, wx.NullBitmap ) self.upgrade = wx.Panel( self.auinotebookPreferences, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) bSizer33 = wx.BoxSizer( wx.VERTICAL ) self.checkBoxUpgrade = wx.CheckBox( self.upgrade, wx.ID_ANY, _("Check for updates at startup"), wx.DefaultPosition, wx.DefaultSize, 0 ) self.checkBoxUpgrade.SetValue(True) bSizer33.Add( self.checkBoxUpgrade, 0, wx.ALL|wx.EXPAND, 5 ) self.upgrade.SetSizer( bSizer33 ) self.upgrade.Layout() bSizer33.Fit( self.upgrade ) self.auinotebookPreferences.AddPage( self.upgrade, _("a page"), False, wx.NullBitmap ) bSizer21.Add( self.auinotebookPreferences, 1, wx.EXPAND |wx.ALL, 5 ) self.m_panel25.SetSizer( bSizer21 ) self.m_panel25.Layout() bSizer21.Fit( self.m_panel25 ) self.m_splitter9.SplitVertically( self.m_panel24, self.m_panel25, 203 ) bSizer19.Add( self.m_splitter9, 1, wx.EXPAND, 5 ) self.m_panel29 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) fgSizer2 = wx.FlexGridSizer( 1, 4, 0, 0 ) fgSizer2.AddGrowableCol( 1 ) fgSizer2.SetFlexibleDirection( wx.BOTH ) fgSizer2.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.buttonRestore = wx.Button( self.m_panel29, wx.ID_ANY, _("Restore Defaults"), wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer2.Add( self.buttonRestore, 0, wx.ALL, 5 ) fgSizer2.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) self.buttonApply = wx.Button( self.m_panel29, wx.ID_ANY, _("Apply"), wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer2.Add( self.buttonApply, 0, wx.ALL, 5 ) self.buttonCancel = wx.Button( self.m_panel29, wx.ID_ANY, _("Cancel"), wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer2.Add( self.buttonCancel, 0, wx.ALL, 5 ) self.m_panel29.SetSizer( fgSizer2 ) self.m_panel29.Layout() fgSizer2.Fit( self.m_panel29 ) bSizer19.Add( self.m_panel29, 0, wx.EXPAND, 5 ) self.SetSizer( bSizer19 ) self.Layout() self.Centre( wx.BOTH )
def __init__( self, parent ): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.Size( 980,746 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) gSizer2 = wx.GridSizer( 0, 2, 0, 0 ) self.m_auinotebook4 = wx.aui.AuiNotebook( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.aui.AUI_NB_DEFAULT_STYLE ) self.m_panel75 = wx.Panel( self.m_auinotebook4, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) bSizer3 = wx.BoxSizer( wx.VERTICAL ) self.m_button4 = wx.Button( self.m_panel75, wx.ID_ANY, u"MyButton", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer3.Add( self.m_button4, 0, wx.ALL, 5 ) self.m_button5 = wx.Button( self.m_panel75, wx.ID_ANY, u"MyButton", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer3.Add( self.m_button5, 0, wx.ALL, 5 ) self.m_button6 = wx.Button( self.m_panel75, wx.ID_ANY, u"MyButton", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer3.Add( self.m_button6, 0, wx.ALL, 5 ) self.m_button7 = wx.Button( self.m_panel75, wx.ID_ANY, u"MyButton", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer3.Add( self.m_button7, 0, wx.ALL, 5 ) m_comboBox3Choices = [ u"1", u"2", u"3", u"4", u"5", wx.EmptyString, wx.EmptyString ] self.m_comboBox3 = wx.ComboBox( self.m_panel75, wx.ID_ANY, u"4", wx.DefaultPosition, wx.DefaultSize, m_comboBox3Choices, 0 ) self.m_comboBox3.SetSelection( 3 ) bSizer3.Add( self.m_comboBox3, 0, wx.ALL, 5 ) self.m_bcomboBox1 = wx.combo.BitmapComboBox( self.m_panel75, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, "", 0 ) bSizer3.Add( self.m_bcomboBox1, 0, wx.ALL, 5 ) self.m_bcomboBox2 = wx.combo.BitmapComboBox( self.m_panel75, wx.ID_ANY, u"Combo!", wx.DefaultPosition, wx.DefaultSize, "", 0 ) bSizer3.Add( self.m_bcomboBox2, 0, wx.ALL, 5 ) self.m_checkBox1 = wx.CheckBox( self.m_panel75, wx.ID_ANY, u"Check Me!", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer3.Add( self.m_checkBox1, 0, wx.ALL, 5 ) m_choice1Choices = [] self.m_choice1 = wx.Choice( self.m_panel75, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_choice1Choices, 0 ) self.m_choice1.SetSelection( 0 ) bSizer3.Add( self.m_choice1, 0, wx.ALL, 5 ) m_listBox1Choices = [] self.m_listBox1 = wx.ListBox( self.m_panel75, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_listBox1Choices, 0 ) bSizer3.Add( self.m_listBox1, 0, wx.ALL, 5 ) self.m_panel75.SetSizer( bSizer3 ) self.m_panel75.Layout() bSizer3.Fit( self.m_panel75 ) self.m_auinotebook4.AddPage( self.m_panel75, u"a page", False, wx.NullBitmap ) self.m_panel76 = wx.Panel( self.m_auinotebook4, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 ) fgSizer1.SetFlexibleDirection( wx.BOTH ) fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.m_checkBox2 = wx.CheckBox( self.m_panel76, wx.ID_ANY, u"Check Me!", wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer1.Add( self.m_checkBox2, 0, wx.ALL, 5 ) self.m_checkBox3 = wx.CheckBox( self.m_panel76, wx.ID_ANY, u"Check Me!", wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer1.Add( self.m_checkBox3, 0, wx.ALL, 5 ) self.m_checkBox4 = wx.CheckBox( self.m_panel76, wx.ID_ANY, u"Check Me!", wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer1.Add( self.m_checkBox4, 0, wx.ALL, 5 ) self.m_checkBox5 = wx.CheckBox( self.m_panel76, wx.ID_ANY, u"Check Me!", wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer1.Add( self.m_checkBox5, 0, wx.ALL, 5 ) self.m_checkBox6 = wx.CheckBox( self.m_panel76, wx.ID_ANY, u"Check Me!", wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer1.Add( self.m_checkBox6, 0, wx.ALL, 5 ) self.m_checkBox7 = wx.CheckBox( self.m_panel76, wx.ID_ANY, u"Check Me!", wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer1.Add( self.m_checkBox7, 0, wx.ALL, 5 ) self.m_checkBox8 = wx.CheckBox( self.m_panel76, wx.ID_ANY, u"Check Me!", wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer1.Add( self.m_checkBox8, 0, wx.ALL, 5 ) self.m_checkBox9 = wx.CheckBox( self.m_panel76, wx.ID_ANY, u"Check Me!", wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer1.Add( self.m_checkBox9, 0, wx.ALL, 5 ) self.m_checkBox10 = wx.CheckBox( self.m_panel76, wx.ID_ANY, u"Check Me!", wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer1.Add( self.m_checkBox10, 0, wx.ALL, 5 ) self.m_checkBox11 = wx.CheckBox( self.m_panel76, wx.ID_ANY, u"Check Me!", wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer1.Add( self.m_checkBox11, 0, wx.ALL, 5 ) self.m_panel76.SetSizer( fgSizer1 ) self.m_panel76.Layout() fgSizer1.Fit( self.m_panel76 ) self.m_auinotebook4.AddPage( self.m_panel76, u"a page", False, wx.NullBitmap ) self.m_panel77 = wx.Panel( self.m_auinotebook4, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) gSizer4 = wx.GridSizer( 0, 2, 0, 0 ) self.m_toggleBtn1 = wx.ToggleButton( self.m_panel77, wx.ID_ANY, u"Toggle me!", wx.DefaultPosition, wx.DefaultSize, 0 ) gSizer4.Add( self.m_toggleBtn1, 0, wx.ALL, 5 ) self.m_searchCtrl1 = wx.SearchCtrl( self.m_panel77, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_searchCtrl1.ShowSearchButton( True ) self.m_searchCtrl1.ShowCancelButton( False ) gSizer4.Add( self.m_searchCtrl1, 0, wx.ALL, 5 ) self.m_colourPicker1 = wx.ColourPickerCtrl( self.m_panel77, wx.ID_ANY, wx.BLACK, wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE ) gSizer4.Add( self.m_colourPicker1, 0, wx.ALL, 5 ) self.m_fontPicker1 = wx.FontPickerCtrl( self.m_panel77, wx.ID_ANY, wx.NullFont, wx.DefaultPosition, wx.DefaultSize, wx.FNTP_DEFAULT_STYLE ) self.m_fontPicker1.SetMaxPointSize( 100 ) gSizer4.Add( self.m_fontPicker1, 0, wx.ALL, 5 ) self.m_filePicker1 = wx.FilePickerCtrl( self.m_panel77, wx.ID_ANY, wx.EmptyString, u"Select a file", u"*.*", wx.DefaultPosition, wx.DefaultSize, wx.FLP_DEFAULT_STYLE ) gSizer4.Add( self.m_filePicker1, 0, wx.ALL, 5 ) self.m_dirPicker1 = wx.DirPickerCtrl( self.m_panel77, wx.ID_ANY, wx.EmptyString, u"Select a folder", wx.DefaultPosition, wx.DefaultSize, wx.DIRP_DEFAULT_STYLE ) gSizer4.Add( self.m_dirPicker1, 0, wx.ALL, 5 ) self.m_datePicker1 = wx.adv.DatePickerCtrl( self.m_panel77, wx.ID_ANY, wx.DefaultDateTime, wx.DefaultPosition, wx.DefaultSize, wx.adv.DP_DEFAULT ) gSizer4.Add( self.m_datePicker1, 0, wx.ALL, 5 ) self.m_timePicker1 = wx.TimePickerCtrl( self.m_panel77, wx.ID_ANY, wx.DefaultDateTime, wx.DefaultPosition, wx.DefaultSize, wx.TP_DEFAULT ) gSizer4.Add( self.m_timePicker1, 0, wx.ALL, 5 ) self.m_calendar1 = wx.adv.CalendarCtrl( self.m_panel77, wx.ID_ANY, wx.DefaultDateTime, wx.DefaultPosition, wx.DefaultSize, wx.adv.CAL_SHOW_HOLIDAYS ) gSizer4.Add( self.m_calendar1, 0, wx.ALL, 5 ) self.m_scrollBar1 = wx.ScrollBar( self.m_panel77, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.SB_HORIZONTAL ) gSizer4.Add( self.m_scrollBar1, 0, wx.ALL, 5 ) self.m_panel77.SetSizer( gSizer4 ) self.m_panel77.Layout() gSizer4.Fit( self.m_panel77 ) self.m_auinotebook4.AddPage( self.m_panel77, u"a page", False, wx.NullBitmap ) self.m_panel79 = wx.Panel( self.m_auinotebook4, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) fgSizer2 = wx.FlexGridSizer( 0, 2, 0, 0 ) fgSizer2.SetFlexibleDirection( wx.BOTH ) fgSizer2.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.m_checkBox13 = wx.CheckBox( self.m_panel79, wx.ID_ANY, u"Check Me!", wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer2.Add( self.m_checkBox13, 0, wx.ALL, 5 ) m_radioBox3Choices = [ u"Radio Button" ] self.m_radioBox3 = wx.RadioBox( self.m_panel79, wx.ID_ANY, u"wxRadioBox", wx.DefaultPosition, wx.DefaultSize, m_radioBox3Choices, 1, wx.RA_SPECIFY_COLS ) self.m_radioBox3.SetSelection( 0 ) fgSizer2.Add( self.m_radioBox3, 0, wx.ALL, 5 ) self.m_radioBtn1 = wx.RadioButton( self.m_panel79, wx.ID_ANY, u"RadioBtn", wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer2.Add( self.m_radioBtn1, 0, wx.ALL, 5 ) self.m_staticline1 = wx.StaticLine( self.m_panel79, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) fgSizer2.Add( self.m_staticline1, 0, wx.EXPAND |wx.ALL, 5 ) self.m_slider1 = wx.Slider( self.m_panel79, wx.ID_ANY, 5, 0, 100, wx.DefaultPosition, wx.DefaultSize, wx.SL_HORIZONTAL ) fgSizer2.Add( self.m_slider1, 0, wx.ALL, 5 ) self.m_gauge1 = wx.Gauge( self.m_panel79, wx.ID_ANY, 100, wx.DefaultPosition, wx.DefaultSize, wx.GA_HORIZONTAL ) self.m_gauge1.SetValue( 60 ) fgSizer2.Add( self.m_gauge1, 0, wx.ALL, 5 ) self.m_panel79.SetSizer( fgSizer2 ) self.m_panel79.Layout() fgSizer2.Fit( self.m_panel79 ) self.m_auinotebook4.AddPage( self.m_panel79, u"a page", False, wx.NullBitmap ) self.m_panel78 = wx.Panel( self.m_auinotebook4, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) self.m_auinotebook4.AddPage( self.m_panel78, u"a page", False, wx.NullBitmap ) self.m_panel80 = wx.Panel( self.m_auinotebook4, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) self.m_auinotebook4.AddPage( self.m_panel80, u"a page", True, wx.NullBitmap ) self.m_panel81 = wx.Panel( self.m_auinotebook4, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) self.m_auinotebook4.AddPage( self.m_panel81, u"a page", False, wx.NullBitmap ) self.m_panel82 = wx.Panel( self.m_auinotebook4, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) self.m_auinotebook4.AddPage( self.m_panel82, u"a page", False, wx.NullBitmap ) self.m_panel83 = wx.Panel( self.m_auinotebook4, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) self.m_auinotebook4.AddPage( self.m_panel83, u"a page", False, wx.NullBitmap ) self.m_panel84 = wx.Panel( self.m_auinotebook4, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) self.m_auinotebook4.AddPage( self.m_panel84, u"a page", False, wx.NullBitmap ) gSizer2.Add( self.m_auinotebook4, 1, wx.EXPAND |wx.ALL, 5 ) self.m_auinotebook9 = wx.aui.AuiNotebook( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.aui.AUI_NB_DEFAULT_STYLE ) self.m_panel86 = wx.Panel( self.m_auinotebook9, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) gSizer5 = wx.GridSizer( 0, 2, 0, 0 ) self.m_scrollBar2 = wx.ScrollBar( self.m_panel86, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.SB_HORIZONTAL ) gSizer5.Add( self.m_scrollBar2, 0, wx.ALL, 5 ) self.m_spinCtrl1 = wx.SpinCtrl( self.m_panel86, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 10, 0 ) gSizer5.Add( self.m_spinCtrl1, 0, wx.ALL, 5 ) self.m_spinBtn1 = wx.SpinButton( self.m_panel86, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 ) gSizer5.Add( self.m_spinBtn1, 0, wx.ALL, 5 ) self.m_hyperlink1 = wx.adv.HyperlinkCtrl( self.m_panel86, wx.ID_ANY, u"wxFB Website", u"http://www.wxformbuilder.org", wx.DefaultPosition, wx.DefaultSize, wx.adv.HL_DEFAULT_STYLE ) gSizer5.Add( self.m_hyperlink1, 0, wx.ALL, 5 ) self.m_hyperlink2 = wx.adv.HyperlinkCtrl( self.m_panel86, wx.ID_ANY, u"wxFB Website", u"http://www.wxformbuilder.org", wx.DefaultPosition, wx.DefaultSize, wx.adv.HL_DEFAULT_STYLE ) gSizer5.Add( self.m_hyperlink2, 0, wx.ALL, 5 ) self.m_grid1 = wx.grid.Grid( self.m_panel86, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 ) # Grid self.m_grid1.CreateGrid( 5, 5 ) self.m_grid1.EnableEditing( True ) self.m_grid1.EnableGridLines( True ) self.m_grid1.EnableDragGridSize( False ) self.m_grid1.SetMargins( 0, 0 ) # Columns self.m_grid1.EnableDragColMove( False ) self.m_grid1.EnableDragColSize( True ) self.m_grid1.SetColLabelSize( 30 ) self.m_grid1.SetColLabelAlignment( wx.ALIGN_CENTER, wx.ALIGN_CENTER ) # Rows self.m_grid1.EnableDragRowSize( True ) self.m_grid1.SetRowLabelSize( 80 ) self.m_grid1.SetRowLabelAlignment( wx.ALIGN_CENTER, wx.ALIGN_CENTER ) # Label Appearance # Cell Defaults self.m_grid1.SetDefaultCellAlignment( wx.ALIGN_LEFT, wx.ALIGN_TOP ) gSizer5.Add( self.m_grid1, 0, wx.ALL, 5 ) gSizer5.Add( self.m_customControl1, 0, wx.ALL, 5 ) self.m_genericDirCtrl1 = wx.GenericDirCtrl( self.m_panel86, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.DIRCTRL_3D_INTERNAL|wx.SUNKEN_BORDER, wx.EmptyString, 0 ) self.m_genericDirCtrl1.ShowHidden( False ) gSizer5.Add( self.m_genericDirCtrl1, 1, wx.EXPAND |wx.ALL, 5 ) gSizer5.Add( self.m_customControl2, 0, wx.ALL, 5 ) self.m_panel86.SetSizer( gSizer5 ) self.m_panel86.Layout() gSizer5.Fit( self.m_panel86 ) self.m_auinotebook9.AddPage( self.m_panel86, u"a page", False, wx.NullBitmap ) self.m_panel87 = wx.Panel( self.m_auinotebook9, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) self.m_auinotebook9.AddPage( self.m_panel87, u"a page", True, wx.NullBitmap ) self.m_panel88 = wx.Panel( self.m_auinotebook9, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) bSizer4 = wx.BoxSizer( wx.VERTICAL ) self.m_grid2 = wx.grid.Grid( self.m_panel88, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 ) # Grid self.m_grid2.CreateGrid( 5, 5 ) self.m_grid2.EnableEditing( True ) self.m_grid2.EnableGridLines( True ) self.m_grid2.EnableDragGridSize( False ) self.m_grid2.SetMargins( 0, 0 ) # Columns self.m_grid2.EnableDragColMove( False ) self.m_grid2.EnableDragColSize( True ) self.m_grid2.SetColLabelSize( 30 ) self.m_grid2.SetColLabelAlignment( wx.ALIGN_CENTER, wx.ALIGN_CENTER ) # Rows self.m_grid2.EnableDragRowSize( True ) self.m_grid2.SetRowLabelSize( 80 ) self.m_grid2.SetRowLabelAlignment( wx.ALIGN_CENTER, wx.ALIGN_CENTER ) # Label Appearance # Cell Defaults self.m_grid2.SetDefaultCellAlignment( wx.ALIGN_LEFT, wx.ALIGN_TOP ) bSizer4.Add( self.m_grid2, 0, wx.ALL, 5 ) m_checkList2Choices = [] self.m_checkList2 = wx.CheckListBox( self.m_panel88, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_checkList2Choices, 0 ) bSizer4.Add( self.m_checkList2, 0, wx.ALL, 5 ) self.m_treeListCtrl1 = wx.dataview.TreeListCtrl( self.m_panel88, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.dataview.TL_DEFAULT_STYLE ) self.m_treeListCtrl1.AppendColumn( u"Column1", wx.COL_WIDTH_DEFAULT, wx.ALIGN_LEFT, wx.COL_RESIZABLE ) bSizer4.Add( self.m_treeListCtrl1, 1, wx.EXPAND |wx.ALL, 5 ) self.m_dataViewListCtrl1 = wx.dataview.DataViewListCtrl( self.m_panel88, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer4.Add( self.m_dataViewListCtrl1, 0, wx.ALL, 5 ) self.m_panel88.SetSizer( bSizer4 ) self.m_panel88.Layout() bSizer4.Fit( self.m_panel88 ) self.m_auinotebook9.AddPage( self.m_panel88, u"a page", False, wx.NullBitmap ) gSizer2.Add( self.m_auinotebook9, 1, wx.EXPAND |wx.ALL, 5 ) self.SetSizer( gSizer2 ) self.Layout() self.m_timer1 = wx.Timer() self.m_timer1.SetOwner( self, wx.ID_ANY ) self.m_menu11 = wx.Menu() self.Bind( wx.EVT_RIGHT_DOWN, self.MyFrame1OnContextMenu ) self.m_statusBar2 = self.CreateStatusBar( 1, wx.STB_SIZEGRIP, wx.ID_ANY ) self.m_menubar2 = wx.MenuBar( 0 ) self.m_menu9 = wx.Menu() self.m_menu4 = wx.Menu() self.m_menu9.AppendSubMenu( self.m_menu4, u"開啟" ) self.m_menu6 = wx.Menu() self.m_menu9.AppendSubMenu( self.m_menu6, u"結束" ) self.m_menu91 = wx.Menu() self.m_menuItem12 = wx.MenuItem( self.m_menu91, wx.ID_ANY, u"不給你按", wx.EmptyString, wx.ITEM_NORMAL ) self.m_menu91.Append( self.m_menuItem12 ) self.m_menuItem12.Enable( False ) self.m_menu9.AppendSubMenu( self.m_menu91, u"存檔" ) self.m_menubar2.Append( self.m_menu9, u"檔案" ) self.m_menu10 = wx.Menu() self.m_menubar2.Append( self.m_menu10, u"編輯" ) self.SetMenuBar( self.m_menubar2 ) self.m_toolBar3 = self.CreateToolBar( wx.TB_HORIZONTAL, wx.ID_ANY ) self.m_tool1 = self.m_toolBar3.AddLabelTool( wx.ID_ANY, u"tool", wx.NullBitmap, wx.NullBitmap, wx.ITEM_NORMAL, wx.EmptyString, wx.EmptyString, None ) self.m_toolBar3.Realize() self.Centre( wx.BOTH )
def BuildPanes(self): pickerPanel = wx.Panel(self) box1 = wx.BoxSizer(wx.VERTICAL) fgs = wx.FlexGridSizer(cols=2, hgap=5, vgap=5) fgs.Add(wx.StaticText(pickerPanel, -1, "wx.ColourPickerCtrl:"), 0, wx.ALIGN_CENTER_VERTICAL) cp1 = wx.ColourPickerCtrl(pickerPanel, name="ColourPicker1") fgs.Add(cp1, 0, wx.ALIGN_CENTER) fgs.Add(wx.StaticText(pickerPanel, -1, " with label:"), 0, wx.ALIGN_CENTER_VERTICAL) cp3 = wx.ColourPickerCtrl(pickerPanel, style=wx.CLRP_SHOW_LABEL, name="ColourPicker2") fgs.Add(cp3, 0, wx.ALIGN_CENTER) fgs.Add(wx.StaticText(pickerPanel, -1, "wx.DirPickerCtrl:"), 0, wx.ALIGN_CENTER_VERTICAL) dp1 = wx.DirPickerCtrl(pickerPanel, name="DirPicker1") fgs.Add(dp1, 0, wx.ALIGN_CENTER) fgs.Add(wx.StaticText(pickerPanel, -1, "wx.FilePickerCtrl:"), 0, wx.ALIGN_CENTER_VERTICAL) fp1 = wx.FilePickerCtrl(pickerPanel, name="FilePicker1") fgs.Add(fp1, 0, wx.ALIGN_CENTER) fgs.Add(wx.StaticText(pickerPanel, -1, "wx.FontPickerCtrl:"), 0, wx.ALIGN_CENTER_VERTICAL) fnt1 = wx.FontPickerCtrl(pickerPanel, style=wx.FNTP_FONTDESC_AS_LABEL, name="FontPicker1") fgs.Add(fnt1, 0, wx.ALIGN_CENTER) box1.Add(fgs, 1, wx.EXPAND | wx.ALL, 5) pickerPanel.SetSizer(box1) box1.Layout() otherPanel = wx.Panel(self) box2 = wx.BoxSizer(wx.VERTICAL) radiobox = wx.RadioBox(otherPanel, -1, "RadioBox", choices=_sampleList, majorDimension=2, style=wx.RA_SPECIFY_COLS, name="RadioBox1") toggle = wx.ToggleButton(otherPanel, -1, "ToggleButton", name="Toggle1") combo = wx.ComboBox(otherPanel, -1, choices=_sampleList, style=wx.CB_DROPDOWN | wx.CB_READONLY, name="ComboBox1") boldFont = wx.Font(8, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, 0, "") box2 = wx.BoxSizer(wx.HORIZONTAL) box2.Add((0, 0), 1) box2.Add(radiobox, 0, wx.ALL | wx.ALIGN_CENTER, 5) box2.Add((20, 0)) sizer_1 = wx.BoxSizer(wx.VERTICAL) sizer_1.Add((20, 20), 1) sizer_1.Add(toggle, 0, wx.ALL, 5) sizer_1.Add((0, 10)) label_1 = wx.StaticText(otherPanel, -1, "ComboBox") label_1.SetFont(boldFont) sizer_1.Add(label_1, 0, wx.ALL, 5) sizer_1.Add(combo, 0, wx.LEFT | wx.RIGHT, 5) sizer_1.Add((20, 20), 1) box2.Add(sizer_1, 1, wx.EXPAND | wx.ALIGN_CENTER, 0) box2.Add((0, 0), 1, 1) otherPanel.SetSizer(box2) otherPanel2 = wx.Panel(self) box3 = wx.BoxSizer(wx.VERTICAL) gs1 = wx.FlexGridSizer(2, 3, 5, 10) slider = wx.Slider(otherPanel2, -1, 3, 0, 10, style=wx.SL_HORIZONTAL | wx.SL_LABELS, name="Slider1") spinctrl = wx.SpinCtrl(otherPanel2, -1, "20", min=0, max=100, name="SpinCtrl1") floatspin = FS.FloatSpin(otherPanel2, -1, value=150, min_val=20, max_val=200, name="FloatSpin1") floatspin.SetDigits(2) label_2 = wx.StaticText(otherPanel2, -1, "Slider") label_2.SetFont(boldFont) gs1.Add(label_2, 0, wx.ALIGN_CENTER_VERTICAL, 0) label_3 = wx.StaticText(otherPanel2, -1, "SpinCtrl") label_3.SetFont(boldFont) gs1.Add(label_3, 0, wx.ALIGN_CENTER_VERTICAL, 0) label_4 = wx.StaticText(otherPanel2, -1, "FloatSpin") label_4.SetFont(boldFont) gs1.Add(label_4, 0, wx.ALIGN_CENTER_VERTICAL, 0) gs1.Add(slider, 0, wx.ALIGN_CENTER_VERTICAL, 0) gs1.Add(spinctrl, 0, wx.ALIGN_CENTER_VERTICAL, 0) gs1.Add(floatspin, 0, wx.ALIGN_CENTER_VERTICAL, 0) gs1.AddGrowableCol(0) gs1.AddGrowableCol(1) gs1.AddGrowableCol(2) box3.Add(gs1, 1, wx.EXPAND | wx.ALL, 5) otherPanel2.SetSizer(box3) self._auiMgr.AddPane( pickerPanel, AUI.AuiPaneInfo().Name("DummyPanel1").Caption( "Pickers").Left().MinSize(wx.Size(300, -1)).FloatingSize( wx.Size(300, 300))) self._auiMgr.AddPane( otherPanel, AUI.AuiPaneInfo().Name("DummyPanel2").CenterPane()) self._auiMgr.AddPane( otherPanel2, AUI.AuiPaneInfo().Name("DummyPanel3").Bottom().BestSize( wx.Size(-1, 200)).Caption("Slider & Spins").FloatingSize( wx.Size(300, 300))) self._auiMgr.Update()
def CreateControl(self): """create the control""" if self.window != None or self.IsSeparator(): return style = self.ctrl_type if style == self.controls.default: style = self.controls.editbox if isinstance(self.formatter, EnumFormatter) or \ isinstance(self.formatter, ChoiceFormatter): style = self.controls.choice elif isinstance(self.formatter, BoolFormatter): style = self.controls.checkbox elif isinstance(self.formatter, PathFormatter): if self.formatter.types == 'file': style = self.controls.file elif self.formatter.types == 'folder': style = self.controls.folder elif isinstance(self.formatter, ColorFormatter): style = self.controls.color elif isinstance(self.formatter, FontFormatter): style = self.controls.font elif isinstance(self.formatter, DateFormatter): style = self.controls.date if isinstance(self.formatter, TimeFormatter): style = self.controls.time win = None if style == self.controls.editbox: style = wx.TE_PROCESS_ENTER sz = self.GetMinSize() if sz.y > 50: style = wx.TE_MULTILINE win = wx.TextCtrl(self.grid, wx.ID_ANY, self.GetValueAsString(), style=style) if self.formatter: validator = TextValidator(self, 'value', self.formatter, False, None) win.SetValidator(validator) if style & wx.TE_PROCESS_ENTER: win.Bind(wx.EVT_TEXT_ENTER, self.OnPropTextEnter) elif style == self.controls.choice: win = wx.Choice(self.grid, wx.ID_ANY) if self.formatter: validator = SelectorValidator(self, 'value', self.formatter, True) win.SetValidator(validator) elif style == self.controls.file: win = wx.Button(self.grid, wx.ID_ANY, self.GetValueAsString()) win.Bind(wx.EVT_BUTTON, self.OnSelectFile) elif style == self.controls.folder: win = wx.Button(self.grid, wx.ID_ANY, self.GetValueAsString()) win.Bind(wx.EVT_BUTTON, self.OnSelectFolder) elif style == self.controls.slider: win = wx.Slider(self.grid, wx.ID_ANY, value=int(self.value), style=wx.SL_LABELS | wx.SL_HORIZONTAL | wx.SL_TOP) if self.formatter: validator = SpinSliderValidator(self, 'value', self.formatter, True) win.SetValidator(validator) elif style == self.controls.spin: win = wx.SpinCtrl(self.grid, wx.ID_ANY, value=str(self.value), style=wx.SP_ARROW_KEYS) if self.formatter: validator = SpinSliderValidator(self, 'value', self.formatter, True) win.SetValidator(validator) elif style == self.controls.checkbox: win = wx.CheckBox(self.grid, wx.ID_ANY) win.SetValue(int(self.value) != 0) elif style == self.controls.radiobox: choices = [] if self.formatter and hasattr(self.formatter, 'validValues'): choices = [x[1] for x in self.formatter.validValues()] win = wx.RadioBox(self.grid, wx.ID_ANY, "", wx.DefaultPosition, wx.DefaultSize, choices, 5, wx.RA_SPECIFY_COLS) if self.formatter: validator = RadioBoxValidator(self, 'value', self.formatter, True) win.SetValidator(validator) elif style == self.controls.color: win = wx.ColourPickerCtrl(self.grid, wx.ID_ANY, wx.BLACK, style=wx.CLRP_DEFAULT_STYLE | wx.CLRP_SHOW_LABEL) try: win.SetColour(self.value) except ValueError: pass elif style == self.controls.font: win = wx.FontPickerCtrl(self.grid, wx.ID_ANY) try: if self.value: win.SetSelectedFont(self.value) except ValueError: pass elif style == self.controls.date: win = wx.adv.DatePickerCtrl(self.grid, wx.ID_ANY) try: win.SetValue(self.value) except ValueError: pass elif style == self.controls.time: win = wx.adv.TimePickerCtrl(self.grid, wx.ID_ANY) try: win.SetValue(self.value) except ValueError: pass if win: if win.GetValidator(): win.GetValidator().TransferToWindow() self.window = win # the window size may be larger than the value rect, notify parent # grid to update it self.Resize() self.LayoutControl() self.window.SetFocus() self.window.Bind(wx.EVT_KILL_FOCUS, self.OnKillFocus)
def display(self): """Handles display.""" sizer = wx.GridBagSizer() header = ScaledStaticText(self, label='Settings', font=self.config.get_font('large'), conf=self.config) text1 = ScaledStaticText(self, label='Theme: ', font=self.config.get_font('medium'), conf=self.config) self.theme_selection = wx.Choice(self, choices=self.config.get_theme_list(), size=(120, 40)) add_themes = SimpleButton(self, label='Add New Theme', config=self.config, size=(120, 40)) self.save_widgets = CheckBox(self, 'Save Widgets//On Exit', self.config.save_widgets_on_exit, self.config) text2 = ScaledStaticText(self, label='Small Font', font=self.config.get_font('medium'), conf=self.config) text3 = ScaledStaticText(self, label='Medium Font', font=self.config.get_font('medium'), conf=self.config) text4 = ScaledStaticText(self, label='Large Font', font=self.config.get_font('medium'), conf=self.config) self.font_picker_small = wx.FontPickerCtrl( self, font=self.config.get_font('small'), size=(200, 40)) self.font_picker_medium = wx.FontPickerCtrl( self, font=self.config.get_font('medium'), size=(200, 40)) self.font_picker_large = wx.FontPickerCtrl( self, font=self.config.get_font('large'), size=(200, 40)) self.font_picker_small.SetBackgroundColour( self.config.get_color('menu')) self.font_picker_medium.SetBackgroundColour( self.config.get_color('menu')) self.font_picker_large.SetBackgroundColour( self.config.get_color('menu')) for index, theme in enumerate(self.theme_selection.GetItems()): if theme == self.config.get_current_theme(): self.theme_selection.SetSelection(index) break sizer.Add(header, pos=(0, 0), span=(1, 2), flag=wx.EXPAND | wx.ALL, border=60) sizer.Add(text1, pos=(1, 0), flag=wx.EXPAND | wx.LEFT, border=20) sizer.Add(self.theme_selection, pos=(1, 1), flag=wx.EXPAND | wx.RIGHT, border=40) sizer.Add(add_themes, pos=(2, 1), flag=wx.EXPAND | wx.RIGHT, border=40) sizer.Add((-1, 60), pos=(3, 0), span=(1, 2), flag=wx.EXPAND) sizer.Add(text2, pos=(4, 0), flag=wx.EXPAND | wx.LEFT, border=20) sizer.Add(text3, pos=(5, 0), flag=wx.EXPAND | wx.LEFT, border=20) sizer.Add(text4, pos=(6, 0), flag=wx.EXPAND | wx.LEFT, border=20) sizer.Add(self.font_picker_small, pos=(4, 1), flag=wx.EXPAND | wx.RIGHT, border=40) sizer.Add(self.font_picker_medium, pos=(5, 1), flag=wx.EXPAND | wx.RIGHT, border=40) sizer.Add(self.font_picker_large, pos=(6, 1), flag=wx.EXPAND | wx.RIGHT, border=40) sizer.Add((-1, 60), pos=(7, 0), span=(1, 2), flag=wx.EXPAND) sizer.Add(self.save_widgets, pos=(8, 0), flag=wx.EXPAND) for i in range(2): sizer.AddGrowableCol(i) self.SetSizer(sizer) self.Layout()
def test_pickersFont(self): p = wx.FontPickerCtrl(self.frame, font=wx.NORMAL_FONT)
def __init__(self, parent, size=wx.DefaultSize): super(panel_style, self).__init__(parent=parent, size=size) self.frame = parent self.SetBackgroundColour(wx.Colour(150, 150, 150)) sizer_base = wx.BoxSizer(wx.VERTICAL) self.SetSizer(sizer_base) sizer_pen = wx.BoxSizer(wx.HORIZONTAL) sizer_base.Add(sizer_pen, 0, wx.ALL | wx.ALIGN_CENTER, 5) self.button_color_pen = button_color(self, size=wx.Size(40, 40), style=wx.SUNKEN_BORDER) self.button_color_pen.Bind(wx.EVT_BUTTON, self.on_color_pick) sizer_pen.Add(self.button_color_pen, 0, wx.ALL | wx.ALIGN_CENTER, 5) self.slider_pen = wx.Slider(self, size=wx.Size(90, 10), value=255, minValue=0, maxValue=255) self.slider_pen.Bind(wx.EVT_SCROLL, self.on_slider_scroll) sizer_pen.Add(self.slider_pen, 0, wx.ALL | wx.ALIGN_CENTER, 5) sizer_brush = wx.BoxSizer(wx.HORIZONTAL) sizer_base.Add(sizer_brush, 0, wx.ALL | wx.ALIGN_CENTER, 5) self.button_color_brush = button_color(self, size=wx.Size(40, 40), style=wx.SUNKEN_BORDER) self.button_color_brush.Bind(wx.EVT_BUTTON, self.on_color_pick) sizer_brush.Add(self.button_color_brush, 0, wx.ALL | wx.ALIGN_CENTER, 5) self.slider_brush = wx.Slider(self, size=wx.Size(90, 10), value=255, minValue=0, maxValue=255) self.slider_brush.Bind(wx.EVT_SCROLL, self.on_slider_scroll) sizer_brush.Add(self.slider_brush, 0, wx.ALL | wx.ALIGN_CENTER, 5) self.panel_line = panel_line(self, size=(200, 20)) sizer_base.Add(self.panel_line, 0, wx.ALL | wx.ALIGN_CENTER, 5) self.spin_line = wx.SpinCtrl(self, size=(200, -1), min=0, max=1000, initial=5) self.spin_line.Bind(wx.EVT_SPINCTRL, self.on_spin_line) sizer_base.Add(self.spin_line, 0, wx.ALL | wx.ALIGN_CENTER, 5) self.choice_line = wx.Choice( self, size=(200, -1), choices=[ "solid", "dot", "long_dash", "dot_dash", "user_dash", "transparent", "bdiagonal_hatch", "cross_diag_hatch", "fdiagonal_hatch", "cross_hatch", "horizontal_hatch", "vertical_hatch", "first_hatch", "last_hatch" ], ) self.choice_line.SetSelection(0) self.choice_line.Bind(wx.EVT_CHOICE, self.on_choice_line) sizer_base.Add(self.choice_line, 0, wx.ALL | wx.ALIGN_CENTER, 5) self.panel_brush = panel_brush(self, size=(200, 20)) sizer_base.Add(self.panel_brush, 0, wx.ALL | wx.ALIGN_CENTER, 5) self.choice_brush = wx.Choice( self, size=(200, -1), choices=[ "solid", "transparent", "bdiagonal_hatch", "cross_diag_hatch", "fdiagonal_hatch", "cross_hatch", "horizontal_hatch", "vertical_hatch", "first_hatch", "last_hatch" ], ) self.choice_brush.SetSelection(0) self.choice_brush.Bind(wx.EVT_CHOICE, self.on_choice_brush) sizer_base.Add(self.choice_brush, 0, wx.ALL | wx.ALIGN_CENTER, 5) self.fontctrl = wx.FontPickerCtrl(self, size=(200, -1)) sizer_base.Add(self.fontctrl, 0, wx.ALL | wx.ALIGN_CENTER, 5) self.fontctrl.Bind(wx.EVT_FONTPICKER_CHANGED, self.on_fontctrl) self.SetAutoLayout(1) self.SetupScrolling()