def CreateStdDialogButtonSizer(self, flags): """ Creates a StdDialogButtonSizer with standard buttons. **Parameters:** * flags: a bit list of the following flags: wx.OK, wx.CANCEL, wx.YES, wx.NO, wx.HELP, wx.NO_DEFAULT. **Note:** * The sizer lays out the buttons in a manner appropriate to the platform. """ sizer = StdDialogButtonSizer() no = yes = ok = None if flags & wx.OK: # Remove unwanted flags... flags &= ~(wx.YES | wx.NO | wx.NO_DEFAULT) if flags & wx.OK: ok = buttons.ThemedGenBitmapTextButton(self, wx.ID_OK, _ok.GetBitmap(), _("OK"), size=(-1, 28)) sizer.AddButton(ok) if flags & wx.CANCEL: cancel = buttons.ThemedGenBitmapTextButton(self, wx.ID_CANCEL, _cancel.GetBitmap(), _("Cancel"), size=(-1, 28)) sizer.AddButton(cancel) if flags & wx.YES: yes = buttons.ThemedGenBitmapTextButton(self, wx.ID_YES, _yes.GetBitmap(), _("Yes"), size=(-1, 28)) sizer.AddButton(yes) if flags & wx.NO: no = buttons.ThemedGenBitmapTextButton(self, wx.ID_NO, _no.GetBitmap(), _("No"), size=(-1, 28)) sizer.AddButton(no) if flags & wx.HELP: help = buttons.ThemedGenBitmapTextButton(self, wx.ID_HELP, _help.GetBitmap(), _("Help"), size=(-1, 28)) sizer.AddButton(help) if flags & wx.NO_DEFAULT: if no: no.SetDefault() no.SetFocus() else: if ok: ok.SetDefault() ok.SetFocus() elif yes: yes.SetDefault() yes.SetFocus() if flags & wx.OK: self.SetAffirmativeId(wx.ID_OK) elif flags & wx.YES: self.SetAffirmativeId(wx.ID_YES) sizer.Realize() return sizer
def CreateButtons(self): """ Creates the ``OK``, ``Cancel`` and ``Make New Folder`` bitmap buttons. """ # Build a couple of fancy buttons self.newButton = buttons.ThemedGenBitmapTextButton(self, wx.ID_NEW, _new.GetBitmap(), _("Make New Folder"), size=(-1, 28)) self.okButton = buttons.ThemedGenBitmapTextButton(self, wx.ID_OK, _ok.GetBitmap(), _("OK"), size=(-1, 28)) self.cancelButton = buttons.ThemedGenBitmapTextButton(self, wx.ID_CANCEL, _cancel.GetBitmap(), _("Cancel"), size=(-1, 28))
def add_execute_analysis(self, box, method): """Create and add the analysis execution GUI element to the given box. @param box: The box element to pack the analysis execution GUI element into. @type box: wx.BoxSizer instance @param method: The method to execute when the button is clicked. @type method: method @return: The button. @rtype: wx.lib.buttons.ThemedGenBitmapTextButton instance """ # A horizontal sizer for the contents. sizer = wx.BoxSizer(wx.HORIZONTAL) # The button. button = buttons.ThemedGenBitmapTextButton(self, -1, None, " Execute") button.SetBitmapLabel( wx.Bitmap(IMAGE_PATH + 'relax_start.gif', wx.BITMAP_TYPE_ANY)) button.SetFont(font.normal) self.gui.Bind(wx.EVT_BUTTON, method, button) sizer.Add(button, 0, wx.ADJUST_MINSIZE, 0) # Add the element to the box. box.Add(sizer, 0, wx.ALIGN_RIGHT, 0) # Return the button. return button
def MakeButton(self): if self.cpStyle & wx.CP_GTK_EXPANDER: return None selection = self.btnRB.GetSelection() if selection == 0: # standard wx.Button btn = wx.Button(self.cp, -1, self.label1) elif selection == 1: # buttons.GenButton btn = buttons.GenButton(self.cp, -1, self.label1) elif selection == 2: # buttons.GenBitmapButton bmp = images.Smiles.GetBitmap() btn = buttons.GenBitmapButton(self.cp, -1, bmp) elif selection == 3: # buttons.GenBitmapTextButton bmp = images.Mondrian.GetBitmap() btn = buttons.GenBitmapTextButton(self.cp, -1, bmp, self.label1) elif selection == 4: # buttons.ThemedGenButton btn = buttons.ThemedGenButton(self.cp, -1, self.label1) elif selection == 5: # buttons.ThemedGenBitmapTextButton bmp = images.Mondrian.GetBitmap() btn = buttons.ThemedGenBitmapTextButton(self.cp, -1, bmp, self.label1) return btn
def __init__(self, parent): """Build the results frame. @param parent: The parent wx object. @type parent: wx object """ # Initialise the base frame. wx.Frame.__init__(self, parent=parent, style=wx.DEFAULT_FRAME_STYLE) # Set up the window icon. self.SetIcons(relax_icons) # Set the window title, size, etc. self.SetTitle("Results viewer") self.SetSize(self.size) # Place all elements within a panel (to remove the dark grey in MS Windows). self.main_panel = wx.Panel(self, -1) # Pack a sizer into the panel. box_main = wx.BoxSizer(wx.HORIZONTAL) self.main_panel.SetSizer(box_main) # Build the central sizer, with borders. box_centre = add_border(box_main, border=self.border, packing=wx.VERTICAL) # Build the data pipe selector. self.build_pipe_sel(box_centre) # Spacer. box_centre.AddSpacer(self.border) # Add the list of results files. self.add_files(box_centre) # Spacer. box_centre.AddSpacer(self.border) # Add the open button. self.button_open = buttons.ThemedGenBitmapTextButton(self.main_panel, -1, None, " Open") self.button_open.SetBitmapLabel(wx.Bitmap(fetch_icon('oxygen.actions.document-open', "22x22"), wx.BITMAP_TYPE_ANY)) self.button_open.SetFont(font.normal) self.button_open.SetMinSize((103, 33)) self.Bind(wx.EVT_BUTTON, self.open_result_file, self.button_open) box_centre.Add(self.button_open, 0, wx.ALIGN_RIGHT|wx.ADJUST_MINSIZE, 5) # Relayout the main panel. self.main_panel.Layout() self.main_panel.Refresh() # Bind some events. self.Bind(wx.EVT_COMBOBOX, self.switch_pipes, self.pipe_name) self.Bind(wx.EVT_CLOSE, self.handler_close) # Initialise observer name. self.name = 'results viewer'
def __init__(self, parent): """ Default class constructor. **Parameters:** * parent: the widget parent. """ wx.Panel.__init__(self, parent) self.MainFrame = wx.GetTopLevelParent(self) # Add the fancy list at the bottom self.list = BaseListCtrl(self, columnNames=[_("Time "), _("Compiler Messages")], name="messages") # Create 3 themed bitmap buttons dryBmp = self.MainFrame.CreateBitmap("dry") compileBmp = self.MainFrame.CreateBitmap("compile") killBmp = self.MainFrame.CreateBitmap("kill") # This is a bit tailored over py2exe, but it's the only one I know self.dryrun = buttons.ThemedGenBitmapTextButton(self, -1, dryBmp, _("Dry Run"), size=(-1, 25)) self.compile = buttons.ThemedGenBitmapTextButton(self, -1, compileBmp, _("Compile"), size=(-1, 25)) self.kill = buttons.ThemedGenBitmapTextButton(self, -1, killBmp, _("Kill"), size=(-1, 25)) # The animation control ani = wx.animate.Animation(os.path.normpath(self.MainFrame.installDir +"/images/throbber.gif")) self.throb = wx.animate.AnimationCtrl(self, -1, ani) self.throb.SetUseWindowBackgroundColour() # Store an id for the popup menu self.popupId = wx.NewId() # Fo the hard work on other methods self.SetProperties() self.LayoutItems() self.BindEvents()
def add_button_open(self, box, parent, icon=fetch_icon('oxygen.actions.document-open', "16x16"), text=" Change", fn=None, width=-1, height=-1): """Add a button for opening and changing files and directories. @param box: The box element to pack the control into. @type box: wx.BoxSizer instance @param parent: The parent GUI element. @type parent: wx object @keyword icon: The path of the icon to use for the button. @type icon: str @keyword text: The text to display on the button. @type text: str @keyword fn: The function or method to execute when clicking on the button. @type fn: func @keyword width: The minimum width of the control. @type width: int @keyword height: The minimum height of the control. @type height: int @return: The button. @rtype: wx.lib.buttons.ThemedGenBitmapTextButton instance """ # The button. button = buttons.ThemedGenBitmapTextButton(parent, -1, None, str_to_gui(text)) button.SetBitmapLabel(wx.Bitmap(icon, wx.BITMAP_TYPE_ANY)) # The font and button properties. button.SetMinSize((width, height)) button.SetFont(font.normal) # Bind the click. self.gui.Bind(wx.EVT_BUTTON, fn, button) # Add the button to the box. box.Add(button, 0, wx.ALIGN_CENTER_VERTICAL | wx.ADJUST_MINSIZE, 0) # Return the button. return button
def test_lib_buttons2(self): btn = buttons.ThemedGenButton(self.frame, label='label') btn = buttons.ThemedGenButton(self.frame, -1, 'label', (10,10), (100,-1), wx.BU_LEFT) bmp = wx.Bitmap(pngFile) btn = buttons.ThemedGenBitmapButton(self.frame, bitmap=bmp) btn = buttons.ThemedGenBitmapTextButton(self.frame, label='label', bitmap=bmp) btn.SetBitmapFocus(bmp) btn.SetBitmapDisabled(bmp) btn.SetBitmapSelected(bmp) btn = buttons.ThemedGenBitmapToggleButton(self.frame, bitmap=bmp) btn.SetToggle(True) self.assertTrue(btn.GetValue()) self.assertEqual(btn.GetBitmapLabel(), bmp)
def InitUI(self): panel = wx.Panel(self) bmp = wx.ArtProvider.GetBitmap(wx.ART_INFORMATION, wx.ART_OTHER, (25, 25)) btn1 = buttons.ThemedGenBitmapTextButton(panel, -1, bmp, label='Information', style=wx.TOP, size=(110, 90), pos=(50, 10)) btn2 = wx.Button(panel, -1, label='information', pos=(50, 120), size=(100, 90), style=wx.TOP) btn2.SetBitmap(bmp, wx.TOP)
def _build_buttons(self): """Construct the buttons for all pages of the wizard.""" # Single page or a wizard? single_page = True if self._num_pages > 1: single_page = False # Loop over each page. for i in range(self._num_pages): # The back button (only for multi-pages, after the first). if not single_page and i > 0: # Create the button. button = buttons.ThemedGenBitmapTextButton( self, -1, None, self.TEXT_BACK) button.SetBitmapLabel( wx.Bitmap(self.ICON_BACK, wx.BITMAP_TYPE_ANY)) button.SetFont(font.normal) button.SetToolTip(wx.ToolTip("Return to the previous page.")) button.SetMinSize(self._size_button) self._button_sizers[i].Add(button, 0, wx.ADJUST_MINSIZE, 0) self.Bind(wx.EVT_BUTTON, self._go_back, button) self._buttons[i]['back'] = button # Spacer. self._button_sizers[i].AddSpacer(5) # The apply button. if self._button_apply_flag[i]: # Create the button. button = buttons.ThemedGenBitmapTextButton( self, -1, None, self.TEXT_APPLY) button.SetBitmapLabel( wx.Bitmap(self.ICON_APPLY, wx.BITMAP_TYPE_ANY)) button.SetFont(font.normal) if single_page: button.SetToolTip( wx.ToolTip( "Apply the operation and leave the window open.")) else: button.SetToolTip( wx.ToolTip( "Apply the operation and stay on the current page." )) button.SetMinSize(self._size_button) self._button_sizers[i].Add(button, 0, wx.ADJUST_MINSIZE, 0) self.Bind(wx.EVT_BUTTON, self._pages[i]._apply, button) self._buttons[i]['apply'] = button # Spacer. self._button_sizers[i].AddSpacer(5) # The skip button. if self._button_skip_flag[i]: # Create the button. button = buttons.ThemedGenBitmapTextButton( self, -1, None, self.TEXT_SKIP) button.SetBitmapLabel( wx.Bitmap(self.ICON_SKIP, wx.BITMAP_TYPE_ANY)) button.SetFont(font.normal) button.SetToolTip( wx.ToolTip( "Skip the operation and move to the next page.")) button.SetMinSize(self._size_button) self._button_sizers[i].Add(button, 0, wx.ADJUST_MINSIZE, 0) self.Bind(wx.EVT_BUTTON, self._skip, button) self._buttons[i]['skip'] = button # Spacer. self._button_sizers[i].AddSpacer(5) # The next button (only for multi-pages, excluding the last). if not single_page and i < self._num_pages - 1: # Create the button. button = buttons.ThemedGenBitmapTextButton( self, -1, None, self.TEXT_NEXT) button.SetBitmapLabel( wx.Bitmap(self.ICON_NEXT, wx.BITMAP_TYPE_ANY)) button.SetFont(font.normal) button.SetToolTip( wx.ToolTip( "Apply the operation and move to the next page.")) button.SetMinSize(self._size_button) self._button_sizers[i].Add(button, 0, wx.ADJUST_MINSIZE, 0) self.Bind(wx.EVT_BUTTON, self._go_next, button) self._buttons[i]['next'] = button # The OK button (only for single pages). if single_page: button = buttons.ThemedGenBitmapTextButton( self, -1, None, self.TEXT_OK) button.SetBitmapLabel( wx.Bitmap(self.ICON_OK, wx.BITMAP_TYPE_ANY)) button.SetFont(font.normal) button.SetToolTip( wx.ToolTip("Apply the operation and close the window.")) button.SetMinSize(self._size_button) self._button_sizers[i].Add(button, 0, wx.ADJUST_MINSIZE, 0) self.Bind(wx.EVT_BUTTON, self._ok, button) self._buttons[i]['ok'] = button # The finish button (only for the last page with multi-pages). if not single_page and i == self._num_pages - 1: button = buttons.ThemedGenBitmapTextButton( self, -1, None, self.TEXT_FINISH) button.SetBitmapLabel( wx.Bitmap(self.ICON_FINISH, wx.BITMAP_TYPE_ANY)) button.SetFont(font.normal) button.SetToolTip( wx.ToolTip("Apply the operation and close the wizard.")) button.SetMinSize(self._size_button) self._button_sizers[i].Add(button, 0, wx.ADJUST_MINSIZE, 0) self.Bind(wx.EVT_BUTTON, self._ok, button) self._buttons[i]['finish'] = button # Spacer. self._button_sizers[i].AddSpacer(15) # The cancel button. button = buttons.ThemedGenBitmapTextButton(self, -1, None, self.TEXT_CANCEL) button.SetBitmapLabel( wx.Bitmap(self.ICON_CANCEL, wx.BITMAP_TYPE_ANY)) button.SetFont(font.normal) if single_page: button.SetToolTip( wx.ToolTip("Abort the operation and close the window.")) else: button.SetToolTip( wx.ToolTip("Abort the operation and close the wizard.")) button.SetMinSize(self._size_button) self._button_sizers[i].Add(button, 0, wx.ADJUST_MINSIZE, 0) self.Bind(wx.EVT_BUTTON, self._cancel, button) self._buttons[i]['cancel'] = button # Flag to suppress later button addition. self._buttons_built = True
def __init__(self, parent): wx.Frame.__init__(self, parent, style=wx.DEFAULT_FRAME_STYLE) self.mainPanel = scrolled.ScrolledPanel(self, -1) self.headerSizer_staticbox = wx.StaticBox(self.mainPanel, -1, "Header") self.bodySizer_staticbox = wx.StaticBox(self.mainPanel, -1, "Message Body") self.footerSizer_staticbox = wx.StaticBox(self.mainPanel, -1, "Footer") self.otherSizer_staticbox = wx.StaticBox(self.mainPanel, -1, "Other Options") self.toolTipSizer_staticbox = wx.StaticBox(self.mainPanel, -1, "SuperToolTip Preview") self.colourSizer_staticbox = wx.StaticBox(self.mainPanel, -1, "Colours") self.stylesRadio = wx.RadioButton(self.mainPanel, -1, "Predefined", style=wx.RB_GROUP) self.stylesCombo = wx.ComboBox(self.mainPanel, -1, choices=STT.GetStyleKeys(), style=wx.CB_DROPDOWN|wx.CB_READONLY) self.customStyles = wx.RadioButton(self.mainPanel, -1, "Custom ") self.topColourPicker = wx.ColourPickerCtrl(self.mainPanel, col=wx.WHITE) system = wx.SystemSettings_GetColour(wx.SYS_COLOUR_ACTIVECAPTION) r, g, b = system self.middleColourPicker = wx.ColourPickerCtrl(self.mainPanel, col=wx.Colour((255-r)/2, (255-g)/2, (255-b)/2)) self.bottomColourPicker = wx.ColourPickerCtrl(self.mainPanel, col=system) self.headerCheck = wx.CheckBox(self.mainPanel, -1, "Show Header") self.headerText = wx.TextCtrl(self.mainPanel, -1, "Merge And Center") self.headerBitmap = wx.StaticBitmap(self.mainPanel, -1, wx.Bitmap(os.path.normpath(os.path.join(bitmapDir, "sttheader.png")), wx.BITMAP_TYPE_PNG)) self.headerFilePicker = wx.FilePickerCtrl(self.mainPanel, path=os.path.normpath(os.path.join(bitmapDir, "sttheader.png")), style=wx.FLP_USE_TEXTCTRL) self.headerLineCheck = wx.CheckBox(self.mainPanel, -1, "Draw Line After Header") self.bodyBitmap = wx.StaticBitmap(self.mainPanel, -1, wx.Bitmap(os.path.normpath(os.path.join(bitmapDir, "sttfont.png")), wx.BITMAP_TYPE_PNG)) msg = "</b>A Bold Title\n\nJoins the selected cells into one larger cell\nand centers the contents in the new cell.\n" \ "This is often used to create labels that span\nmultiple columns.\n\n</l>I am a link{http://xoomer.alice.it/infinity77}" self.bodyText = wx.TextCtrl(self.mainPanel, -1, msg, style=wx.TE_MULTILINE) self.includeCheck = wx.CheckBox(self.mainPanel, -1, "Include Body Image") self.footerCheck = wx.CheckBox(self.mainPanel, -1, "Show Footer") self.footerText = wx.TextCtrl(self.mainPanel, -1, "Press F1 for more help") self.footerBitmap = wx.StaticBitmap(self.mainPanel, -1, wx.Bitmap(os.path.normpath(os.path.join(bitmapDir, "stthelp.png")), wx.BITMAP_TYPE_PNG)) self.footerFilePicker = wx.FilePickerCtrl(self.mainPanel, path=os.path.normpath(os.path.join(bitmapDir,"stthelp.png")), style=wx.FLP_USE_TEXTCTRL) self.footerLineCheck = wx.CheckBox(self.mainPanel, -1, "Draw Line Before Footer") self.dropShadow = wx.CheckBox(self.mainPanel, -1, "Rounded Corners And Drop Shadow (Windows XP Only)") self.useFade = wx.CheckBox(self.mainPanel, -1, "Fade In/Fade Out Effects (Windows XP Only)") self.endTimer = wx.SpinCtrl(self.mainPanel, -1, "5") btnBmp = wx.Bitmap(os.path.normpath(os.path.join(bitmapDir,"sttbutton.png")), wx.BITMAP_TYPE_PNG) self.toolTipButton = buttons.ThemedGenBitmapTextButton(self.mainPanel, -1, btnBmp, " Big Test Button ", size=(-1, 130)) self.generateTip = wx.Button(self.mainPanel, -1, "Generate SuperToolTip") self.CreateMenuBar() self.SetProperties() self.DoLayout() self.mainPanel.SetupScrolling() self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioColours, self.stylesRadio) self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioColours, self.customStyles) self.Bind(wx.EVT_CHECKBOX, self.OnShowHeader, self.headerCheck) self.Bind(wx.EVT_CHECKBOX, self.OnShowFooter, self.footerCheck) self.generateTip.Bind(wx.EVT_BUTTON, self.OnGenerateTip) self.Bind(wx.EVT_FILEPICKER_CHANGED, self.OnPickBitmap, self.headerFilePicker) self.Bind(wx.EVT_FILEPICKER_CHANGED, self.OnPickBitmap, self.footerFilePicker) self.enableWidgets = {} self.enableWidgets[self.headerCheck] = [self.headerBitmap, self.headerFilePicker, self.headerLineCheck, self.headerText] self.enableWidgets[self.footerCheck] = [self.footerBitmap, self.footerFilePicker, self.footerLineCheck, self.footerText] self.enableWidgets[self.customStyles] = [self.stylesCombo, self.topColourPicker, self.middleColourPicker, self.bottomColourPicker] self.enableWidgets[self.stylesRadio] = [self.stylesCombo, self.topColourPicker, self.middleColourPicker, self.bottomColourPicker] self.SetSize((700, 600)) self.CenterOnScreen() self.Show()
def _build_default(self): """Build the default GUI element.""" # A static box to hold all the widgets. box = wx.StaticBox(self.parent, -1, "The free file format settings:") box.SetFont(font.subtitle) # Init. main_sizer = wx.StaticBoxSizer(box, wx.HORIZONTAL) field_sizer = wx.BoxSizer(wx.VERTICAL) button_sizer = wx.BoxSizer(wx.VERTICAL) # The border of the widget. border = wx.BoxSizer() # Place the box sizer inside the border. border.Add(main_sizer, 1, wx.ALL | wx.EXPAND, 0) # Add to the main sizer (followed by stretchable spacing). self.sizer.Add(border, 0, wx.EXPAND) self.sizer.AddStretchSpacer() # Calculate the divider position. divider = self.parent._div_left - border.GetMinSize( )[0] / 2 - self.padding # The columns. self.spin_id_col = Value(name='spin_id_col', parent=self.parent, value_type='int', sizer=field_sizer, desc="spin ID column", divider=divider, padding=self.padding, spacer=self.spacer, can_be_none=True) self.mol_name_col = Value(name='mol_name_col', parent=self.parent, value_type='int', sizer=field_sizer, desc="Molecule name column:", divider=divider, padding=self.padding, spacer=self.spacer, can_be_none=True) self.res_num_col = Value(name='res_num_col', parent=self.parent, value_type='int', sizer=field_sizer, desc="Residue number column:", divider=divider, padding=self.padding, spacer=self.spacer, can_be_none=True) self.res_name_col = Value(name='res_name_col', parent=self.parent, value_type='int', sizer=field_sizer, desc="Residue name column:", divider=divider, padding=self.padding, spacer=self.spacer, can_be_none=True) self.spin_num_col = Value(name='spin_num_col', parent=self.parent, value_type='int', sizer=field_sizer, desc="Spin number column:", divider=divider, padding=self.padding, spacer=self.spacer, can_be_none=True) self.spin_name_col = Value(name='spin_name_col', parent=self.parent, value_type='int', sizer=field_sizer, desc="Spin name column:", divider=divider, padding=self.padding, spacer=self.spacer, can_be_none=True) if self.data_cols: self.data_col = Value(name='data_col', parent=self.parent, value_type='int', sizer=field_sizer, desc="Data column:", divider=divider, padding=self.padding, spacer=self.spacer, can_be_none=True) self.error_col = Value(name='error_col', parent=self.parent, value_type='int', sizer=field_sizer, desc="Error column:", divider=divider, padding=self.padding, spacer=self.spacer, can_be_none=True) # The column separator. self.sep = Value(name='sep', parent=self.parent, element_type='combo', value_type='str', sizer=field_sizer, desc="Column separator:", combo_choices=["white space", ",", ";", ":", ""], divider=divider, padding=self.padding, spacer=self.spacer, read_only=False, can_be_none=True) # Add the field sizer to the main sizer. main_sizer.Add(field_sizer, 1, wx.ALL | wx.EXPAND, 0) # Set the values. self.set_vals() # Buttons! if self.save_flag or self.reset_flag: # Add a save button. if self.save_flag: # Build the button. button = buttons.ThemedGenBitmapTextButton( self.parent, -1, None, "") button.SetBitmapLabel( wx.Bitmap( fetch_icon('oxygen.actions.document-save', "22x22"), wx.BITMAP_TYPE_ANY)) button.SetFont(font.normal) button.SetToolTip( wx.ToolTip( "Save the free file format settings within the relax data store." )) button.SetMinSize(self.size_square_button) # Add the button. button_sizer.Add(button, 0, wx.ADJUST_MINSIZE, 0) # Padding. button_sizer.AddSpacer(self.padding) # Bind the click event. self.parent.Bind(wx.EVT_BUTTON, self.save, button) # Add a reset button. if self.reset_flag: # Build the button. button = buttons.ThemedGenBitmapTextButton( self.parent, -1, None, "") button.SetBitmapLabel( wx.Bitmap( fetch_icon('oxygen.actions.edit-delete', "22x22"), wx.BITMAP_TYPE_ANY)) button.SetFont(font.normal) button.SetToolTip( wx.ToolTip( "Reset the free file format settings to the original values." )) button.SetMinSize(self.size_square_button) # Add the button. button_sizer.Add(button, 0, wx.ADJUST_MINSIZE, 0) # Bind the click event. self.parent.Bind(wx.EVT_BUTTON, self.reset, button) # Add the button sizer to the widget (with spacing). main_sizer.AddSpacer(self.padding) main_sizer.Add(button_sizer, 0, wx.ALL, 0)
def __init__(self): wx.Frame.__init__(self, None, title='aaa', size=(839, 626), name='frame', style=541072384) self.启动窗口 = wx.Panel(self) self.Centre() self.按钮4 = wx.Button(self.启动窗口, size=(129, 52), pos=(12, 505), label='按钮', name='button') self.按钮4.Bind(wx.事件_按钮_被点击, self.按钮4_按钮被单击) self.编辑框4 = wx.TextCtrl(self.启动窗口, size=(159, 45), pos=(155, 508), value='1234567890', name='text', style=0) self.编辑框4.Bind(wx.EVT_TEXT, self.编辑框4_内容被改变) self.按钮5 = wx.Button(self.启动窗口, size=(80, 32), pos=(21, 9), label='按钮', name='button') self.标签2 = wx.StaticText(self.启动窗口, size=(80, 24), pos=(118, 9), label='标签', name='staticText', style=2321) self.编辑框5 = wx.TextCtrl(self.启动窗口, size=(80, 22), pos=(269, 12), value='', name='text', style=0) self.单选框2 = wx.RadioButton(self.启动窗口, size=(80, 24), pos=(378, 22), name='radioButton', label='单选框') self.多选框2 = wx.CheckBox(self.启动窗口, size=(80, 24), pos=(488, 15), name='check', label='多选框', style=12288) self.图片框3 = wx.StaticBitmap(self.启动窗口, size=(64, 64), pos=(596, 20), name='staticBitmap', style=0) self.组合框2 = wx.ComboBox(self.启动窗口, value='', pos=(17, 76), name='comboBox', choices=[], style=16) self.组合框2.SetSize((100, 22)) self.进度条2 = wx.Gauge(self.启动窗口, range=100, size=(120, 24), pos=(141, 73), name='gauge', style=4) self.进度条2.SetValue(0) self.滑块条2 = wx.Slider(self.启动窗口, size=(120, 22), pos=(292, 83), name='slider', minValue=1, maxValue=100, value=1, style=4) self.滑块条2.SetTickFreq(10) self.滑块条2.SetPageSize(5) self.整数微调框2 = wx.SpinCtrl(self.启动窗口, size=(60, 24), pos=(458, 78), name='wxSpinCtrl', min=0, max=100, initial=0, style=0) self.整数微调框2.SetBase(10) self.动画框2 = wx.adv.AnimationCtrl(self.启动窗口, size=(64, 64), pos=(26, 138), name='animationctrl', style=2097152) self.列表框2 = wx.ListBox(self.启动窗口, size=(100, 50), pos=(137, 152), name='listBox', choices=[], style=32) self.选择列表框2 = wx.CheckListBox(self.启动窗口, size=(100, 50), pos=(288, 155), name='listBox', choices=[], style=0) self.图形按钮2 = wx.BitmapButton(self.启动窗口, size=(80, 32), pos=(416, 155), name='button') # self.超级链接框4 = wx.adv.HyperlinkCtrl(self.启动窗口, size=(60, 22), pos=(541, 167), name='hyperlink', label='易起玩', # url='www.012.plus', style=1) self.排序列表框2 = wx.adv.EditableListBox(self.启动窗口, size=(170, 140), pos=(638, 138), name='editableListBox', label='', style=1792) self.排序列表框2.SetStrings([]) self.引导按钮2 = wx.adv.CommandLinkButton(self.启动窗口, size=(110, 50), pos=(55, 260), name='button', mainLabel='标签内容', note='描述内容') self.日历框2 = wx.adv.CalendarCtrl(self.启动窗口, size=(246, 163), pos=(232, 271), name='CalendarCtrl', style=1) self.日期框2 = wx.adv.DatePickerCtrl(self.启动窗口, size=(100, 24), pos=(505, 286), name='datectrl', style=2) self.时间框2 = wx.adv.TimePickerCtrl(self.启动窗口, size=(70, 24), pos=(499, 340), name='timectrl') self.时间框2.SetTime(17, 2, 43) self.超级列表框2 = wx.ListCtrl(self.启动窗口, size=(100, 80), pos=(516, 391), name='listCtrl', style=8227) self.横向滚动条2 = wx.ScrollBar(self.启动窗口, size=(60, 20), pos=(389, 474), name='scrollBar', style=4) self.横向滚动条2.SetScrollbar(0, 1, 2, 1, True) self.纵向滚动条2 = wx.ScrollBar(self.启动窗口, size=(20, 60), pos=(463, 458), name='scrollBar', style=8) self.纵向滚动条2.SetScrollbar(0, 1, 2, 1, True) self.分组单选框2 = wx.RadioBox(self.启动窗口, size=(120, 60), pos=(52, 365), label='单选项', choices=['示例1', '示例2'], majorDimension=0, name='radioBox', style=4) self.颜色选择器2 = wx.ColourPickerCtrl(self.启动窗口, size=(80, 28), pos=(76, 207), colour=(0, 0, 0, 255), name='colourpicker', style=0) self.图文按钮2 = lib_button.ThemedGenBitmapTextButton(self.启动窗口, size=(100, 32), pos=(208, 230), bitmap=None, label='图文按钮', name='genbutton') self.图文按钮L2 = lib_gb.GradientButton(self.启动窗口, size=(100, 32), pos=(359, 228), bitmap=None, label='图文按钮L', name='gradientbutton') self.图文按钮L2.SetForegroundColour((255, 255, 255, 255)) self.超级链接框L2 = lib_hyperlink.HyperLinkCtrl(self.启动窗口, size=(80, 22), pos=(503, 234), name='staticText', label='易起玩', URL='www.012.plus') 超级链接框L2_字体 = wx.Font(9, 70, 90, 400, True, 'Microsoft YaHei UI', -1) self.超级链接框L2.SetFont(超级链接框L2_字体) self.超级链接框L2.SetForegroundColour((0, 0, 255, 255)) self.小数微调框2 = lib_fs.FloatSpin(self.启动窗口, size=(80, -1), pos=(631, 310), name='FloatSpin', min_val=0, max_val=5.0, increment=0.1, value=1.1, agwStyle=4) self.小数微调框2.SetDigits(1) self.时钟2 = wx.时钟(self) self.时钟2.启动(1000) self.Bind(wx.EVT_TIMER, self.时钟2_周期事件, self.时钟2)
def __init__(self, parent, projectName, creationDate): """ Default class constructor. **Parameters:** * projectName: the name of the project we are working on * creationDate: the date and time the project was created """ BaseBuilderPanel.__init__(self, parent, projectName, creationDate, name="py2app") # I need this flag otherwise all the widgets start sending changed # events when I first populate the full panel self.created = False # A whole bunch of static box sizers self.commonSizer_staticbox = wx.StaticBox(self, -1, _("Common Options")) self.includesSizer_staticbox = wx.StaticBox(self, -1, _("Includes")) self.packagesSizer_staticbox = wx.StaticBox(self, -1, _("Packages")) self.excludesSizer_staticbox = wx.StaticBox(self, -1, _("Excludes")) self.dylibExcludesSizer_staticbox = wx.StaticBox(self, -1, _("Dylib/Frameworks Excludes")) self.datamodelsSizer_staticbox = wx.StaticBox(self, -1, _("XC Data Models")) self.frameworksSizer_staticbox = wx.StaticBox(self, -1, _("Dylib/Frameworks Includes")) self.datafile_staticbox = wx.StaticBox(self, -1, _("Resources")) self.otherSizer_staticbox = wx.StaticBox(self, -1, _("Other Options")) # A simple label that holds information about the project transdict = dict(projectName=projectName, creationDate=creationDate) self.label = wx.StaticText(self, -1, _("Py2app options for: %(projectName)s (Created: %(creationDate)s)")%transdict) # A combobox to choose the application extension self.extensionCombo = MultiComboBox(self, [".app", ".plugin"], wx.CB_DROPDOWN|wx.CB_READONLY, self.GetName(), "extension") # The file picker that allows us to pick the script to be compiled by py2app self.scriptPicker = wx.FilePickerCtrl(self, style=wx.FLP_USE_TEXTCTRL, wildcard=_pywild, name="script") # A checkbox that enables the user to choose a different name for the # distribution directory. Default is unchecked, that means dist_dir="dist" self.distChoice = wx.CheckBox(self, -1, _("Dist Directory"), name="dist_dir_choice") # The name of the distribution directory (if enabled) self.distTextCtrl = wx.TextCtrl(self, -1, "dist", name="dist_dir") # Optimization level for py2app 1 for "python -O", 2 for "python -OO", # 0 to disable self.optimizeCombo = MultiComboBox(self, ["0", "1", "2"], wx.CB_DROPDOWN|wx.CB_READONLY, self.GetName(), "optimize") # The icon picker that allows us to pick the application icon self.iconPicker = wx.FilePickerCtrl(self, style=wx.FLP_USE_TEXTCTRL, wildcard=_iconwild, name="iconfile") # A picker for the PList file self.pListPicker = wx.FilePickerCtrl(self, style=wx.FLP_USE_TEXTCTRL, wildcard=_plistwild, name="plist") # To add/edit PList code self.pListChoice = wx.CheckBox(self, -1, _("PList Code"), name="plistCode_choice") editBmp = self.MainFrame.CreateBitmap("edit_add") removeBmp = self.MainFrame.CreateBitmap("remove") self.pListAddButton = buttons.ThemedGenBitmapTextButton(self, -1, editBmp, _("Add/Edit"), size=(-1, 25), name="plistCode") self.pListRemoveButton = buttons.ThemedGenBitmapTextButton(self, -1, removeBmp, _("Remove"), size=(-1, 25), name="plistRemove") # A list control for the "includes" option, a comma separated list of # modules to include self.includeList = BaseListCtrl(self, columnNames=[_("Python Modules")], name="includes") # A list control for the "packages" option, a comma separated list of # packages to include self.packagesList = BaseListCtrl(self, columnNames=[_("Python Packages")], name="packages") # A list control for the "frameworks" option, a comma separated list of # frameworks/dylibs to include self.frameworksList = BaseListCtrl(self, columnNames=[_("Dylib/Frameworks Names")], name="frameworks") # A list control for the "excludes" option, a comma separated list of # modules to exclude self.excludeList = BaseListCtrl(self, columnNames=[_("Python Modules")], name="excludes") # A list control for the "dylib_excludes" option, a comma separated list of # dylibs/frameworks to exclude self.dylibExcludeList = BaseListCtrl(self, columnNames=[_("Dylib/Frameworks Names")], name="dylib_excludes") # A list control for the "xcdatamodels" option, a comma separated list of # xcdatamodels to compile and include self.datamodelsList = BaseListCtrl(self, columnNames=[_("XC Data Models Names")], name="datamodels") # A list control for the "resources" option. "resources" should contain # a sequence of (target-dir, files) tuples, where files is a sequence of # files to be copied self.datafileList = BaseListCtrl(self, columnNames=[_("Files Path")], name="resources") # output module dependency graph self.graphCheck = wx.CheckBox(self, -1, "Graph", name="graph") # This command line switch instructs py2app to create a python module cross # reference and display it in the webbrowser. This allows to answer question # why a certain module has been included, or if you can exclude a certain module # and it's dependencies. Also, the html page includes links which will even # allow to view the source code of a module in the browser, for easy inspection. self.crossRefCheck = wx.CheckBox(self, -1, "Cross-Reference", name="xref") # Do not strip debug and local symbols from output self.noStripCheck = wx.CheckBox(self, -1, "No Strip", name="no_strip") # Do not change to the data directory (Contents/Resources) [forced for plugins] self.noChdirCheck = wx.CheckBox(self, -1, "No Chdir", name="no_chdir") # Depend on an existing installation of Python 2.4 self.semiStandaloneCheck = wx.CheckBox(self, -1, "Semi Standalone", name="semi_standalone") # Use argv emulation (disabled for plugins) self.argvEmulationCheck = wx.CheckBox(self, -1, "Argv Emulation", name="argv_emulation") # Allow PYTHONPATH to effect the interpreter's environment self.usePythonPathCheck = wx.CheckBox(self, -1, "Use PYTHONPATH", name="use_pythonpath") # Include the system and user site-packages into sys.path self.sitePackagesCheck= wx.CheckBox(self, -1, "Site Packages", name="site_packages") # Force application to run translated on i386 (LSPrefersPPC=True) self.preferPPCCheck= wx.CheckBox(self, -1, "Prefer PPC", name="prefer_ppc") # Drop to pdb console after the module finding phase is complete self.debugModuleGraphCheck= wx.CheckBox(self, -1, "Debug Modulegraph", name="debug_modulegraph") # Skip macholib phase (app will not be standalone!) self.skipMacholibCheck= wx.CheckBox(self, -1, "Debug Skip Macholib", name="debug_skip_macholib") # Hold a reference to all the list controls, to speed up things later self.listCtrls = [self.includeList, self.packagesList, self.frameworksList, self.excludeList, self.dylibExcludeList, self.datamodelsList, self.datafileList] # Do the hard work... quite a few to layout :-D self.LayoutItems() self.SetProperties() self.BindEvents() wx.CallAfter(self.EnableMacPList) self.Bind(wx.EVT_BUTTON, self.OnPListAdd, self.pListAddButton) self.Bind(wx.EVT_BUTTON, self.OnPListRemove, self.pListRemoveButton)