def CreateToolbar(self): # toolbar = wx.ToolBar(self, style=wx.TB_VERTICAL|wx.TB_TEXT|wx.TB_FLAT) toolbar = wx.ToolBar(self) # style=wx.TB_TEXT|wx.TB_FLAT) # toolbar.AddTool(wx.ID _ANY, "t")#, wx.BitmapFromBuffer(wx.ART_FILE_OPEN)) toolbar.SetToolBitmapSize((16, 16)) for label, help, icon in [ ("New", "Create new sequence file", "psu_png"), ("Open", "Open File", "open"), ("Save", "Save File", "save"), ("Save As", "Save File As...", "save"), ("Undo", "Undo action", "save"), ("Redo", "Redo action", "save"), ("Run", "Run Sequence", "save"), ("Instruments", "Create Instrument Presets", "save") ]: if label in ["Instruments"]: toolbar.AddStretchableSpace() try: bmp = theme.GetBitmap(icon) except: bmp = wx.Bitmap(16, 16) tool = toolbar.AddTool(wx.ID_ANY, label=label, bitmap=bmp, shortHelp=help) self.Bind(wx.EVT_TOOL, self.OnMenuAndToolBar, tool) if label == "Import": toolbar.AddSeparator() if label == "Save As": toolbar.AddSeparator() if label == "Fullscreen": toolbar.AddSeparator() toolbar.Realize() self.SetToolBar(toolbar)
def pageI2c(self): self.listSensors = wx.ListCtrl(self.i2c, -1, style=wx.LC_REPORT | wx.LC_SINGLE_SEL | wx.LC_HRULES, size=(-1, 200)) self.listSensors.InsertColumn(0, ' ', width=16) self.listSensors.InsertColumn(1, _('Name'), width=120) self.listSensors.InsertColumn(2, _('Address'), width=60) self.listSensors.InsertColumn(3, _('Magnitude'), width=90) self.listSensors.InsertColumn(4, _('Signal K key'), width=220) self.listSensors.InsertColumn(5, _('Rate'), width=40) self.listSensors.InsertColumn(6, _('Offset'), width=50) self.listSensors.InsertColumn(7, _('Raw'), width=40) self.listSensors.InsertColumn(8, _('Sensor Settings'), width=200) self.listSensors.InsertColumn(9, _('Magnitude Settings'), width=200) self.listSensors.Bind(wx.EVT_LIST_ITEM_SELECTED, self.onListSensorsSelected) self.listSensors.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.onListSensorsDeselected) self.listSensors.SetTextColour(wx.BLACK) self.toolbar2 = wx.ToolBar(self.i2c, style=wx.TB_TEXT | wx.TB_VERTICAL) self.addButton = self.toolbar2.AddTool( 201, _('Add'), wx.Bitmap(self.currentdir + "/data/i2c.png")) self.Bind(wx.EVT_TOOL, self.OnAddButton, self.addButton) self.removeButton = self.toolbar2.AddTool( 203, _('Remove'), wx.Bitmap(self.currentdir + "/data/cancel.png")) self.Bind(wx.EVT_TOOL, self.OnRemoveButton, self.removeButton) self.toolbar2.AddSeparator() self.editButton = self.toolbar2.AddTool( 202, _('Edit'), wx.Bitmap(self.currentdir + "/data/edit.png")) self.Bind(wx.EVT_TOOL, self.OnEditButton, self.editButton) sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(self.listSensors, 1, wx.EXPAND, 0) sizer.Add(self.toolbar2, 0) self.i2c.SetSizer(sizer)
def __createToolBar(self, parent, id): imagesDir = getImagesDir() toolbar = wx.ToolBar(parent, id, style=wx.TB_DOCKABLE) self.ID_ATTACH = toolbar.AddTool( wx.ID_ANY, _(u"Attach Files…"), wx.Bitmap(os.path.join(imagesDir, "attach.png"), wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, _(u"Attach Files…"), "").GetId() self.ID_REMOVE = toolbar.AddTool( wx.ID_ANY, _(u"Remove Files…"), wx.Bitmap(os.path.join(imagesDir, "delete.png"), wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, _(u"Remove Files…"), "").GetId() toolbar.AddSeparator() self.ID_PASTE = toolbar.AddTool( wx.ID_ANY, _(u"Paste"), wx.Bitmap(os.path.join(imagesDir, "paste.png"), wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, _(u"Paste"), "").GetId() self.ID_EXECUTE = toolbar.AddTool( wx.ID_ANY, _(u"Execute"), wx.Bitmap(os.path.join(imagesDir, "execute.png"), wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, _(u"Execute"), "").GetId() self.ID_OPEN_FOLDER = toolbar.AddTool( wx.ID_ANY, _(u"Open Attachments Folder"), wx.Bitmap(os.path.join(imagesDir, "folder.png"), wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, _(u"Open Attachments Folder"), "").GetId() toolbar.Realize() return toolbar
def __init__(self, *args, **kwds): # begin wxGlade: MyFrame.__init__ kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.SetSize((400, 300)) self.SetTitle("frame") # Menu Bar self.frame_menubar = wx.MenuBar() wxglade_tmp_menu = wx.Menu() self.frame_menubar.item1 = wxglade_tmp_menu.Append( wx.ID_ANY, "My Menu Item 1", "") self.Bind(wx.EVT_MENU, self.on_menu_item1, self.frame_menubar.item1) item = wxglade_tmp_menu.Append(wx.ID_ANY, "My Menu Item 1", "without attribute name") self.Bind(wx.EVT_MENU, self.on_menu_item2, item) self.frame_menubar.Append(wxglade_tmp_menu, "Menu 1") self.SetMenuBar(self.frame_menubar) # Menu Bar end # Tool Bar self.frame_toolbar = wx.ToolBar(self, -1) tool = self.frame_toolbar.AddTool( wx.ID_ANY, "My Tool", wx.Bitmap("..\\..\\icons\\button.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, "", "") self.Bind(wx.EVT_TOOL, self.on_my_tool, id=tool.GetId()) self.SetToolBar(self.frame_toolbar) self.frame_toolbar.Realize() # Tool Bar end sizer_1 = wx.BoxSizer(wx.VERTICAL) sizer_1.Add((0, 0), 0, 0, 0) self.SetSizer(sizer_1) self.Layout()
def _init_ctrls(self, prnt): # generated method, don't edit wx.Frame.__init__(self, id=wxID_VENTPRINCFRAME, name=u'ventPrincFrame', parent=prnt, pos=wx.Point(416, 206), size=wx.Size(960, 533), style=wx.SYSTEM_MENU | wx.CAPTION | wx.MINIMIZE | wx.CLOSE_BOX, title=u'oracleMON') self.SetClientSize(wx.Size(960, 533)) self.SetToolTipString(u'oracleMON') self.Center(wx.BOTH) self.toolBar1 = wx.ToolBar(id=wxID_VENTPRINCFRAMETOOLBAR1, name='toolBar1', parent=self, pos=wx.Point(0, 0), size=wx.Size(368, 48), style=wx.TB_HORIZONTAL | wx.NO_BORDER) self.SetToolBar(self.toolBar1) self.statusBar1 = wx.StatusBar(id=wxID_VENTPRINCFRAMESTATUSBAR1, name='statusBar1', parent=self, style=1) self.statusBar1.SetStatusText(u'Desconectado') self.statusBar1.SetThemeEnabled(False) self.statusBar1.SetLabel(u'') self.statusBar1.SetHelpText(u'') self.statusBar1.SetToolTipString(u'Estado de la conexion') self._init_coll_statusBar1_Fields(self.statusBar1) self.SetStatusBar(self.statusBar1) self._init_coll_toolBar1_Tools(self.toolBar1) self._init_sizers()
def pageConnections(self): self.listConnections = wx.ListCtrl(self.connections, -1, style=wx.LC_REPORT | wx.LC_SINGLE_SEL | wx.LC_HRULES, size=(-1, 200)) self.listConnections.InsertColumn(0, _('Sensor'), width=220) self.listConnections.InsertColumn(1, _('Port'), width=100) self.listConnections.InsertColumn(2, _('SK connection ID'), width=240) self.listConnections.Bind(wx.EVT_LIST_ITEM_SELECTED, self.onlistConnectionsSelected) self.listConnections.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.onlistConnectionsDeselected) self.toolbar4 = wx.ToolBar(self.connections, style=wx.TB_TEXT | wx.TB_VERTICAL) self.editConnButton = self.toolbar4.AddTool( 402, _('Edit Port'), wx.Bitmap(self.currentdir + "/data/edit.png")) self.Bind(wx.EVT_TOOL, self.OnEditConnButton, self.editConnButton) self.toolbar4.AddSeparator() skConnections = self.toolbar4.AddTool( 403, _('Add Connection'), wx.Bitmap(self.currentdir + "/data/sk.png")) self.Bind(wx.EVT_TOOL, self.OnSkConnections, skConnections) self.editSKButton = self.toolbar4.AddTool( 401, _('Edit connection'), wx.Bitmap(self.currentdir + "/data/edit.png")) self.Bind(wx.EVT_TOOL, self.OnEditSKButton, self.editSKButton) self.removeConnButton = self.toolbar4.AddTool( 404, _('Remove connection'), wx.Bitmap(self.currentdir + "/data/cancel.png")) self.Bind(wx.EVT_TOOL, self.OnRemoveConnButton, self.removeConnButton) vbox = wx.BoxSizer(wx.HORIZONTAL) vbox.Add(self.listConnections, 1, wx.EXPAND, 0) vbox.Add(self.toolbar4, 0, wx.EXPAND, 0) self.connections.SetSizer(vbox)
def __init__(self, *args, **kwds): # begin wxGlade: Frame186.__init__ wx.Frame.__init__(self, *args, **kwds) # Menu Bar self.Bug186_Frame_menubar = wx.MenuBar() global myMagicMenu myMagicMenu = wx.NewId() self.File = wx.Menu() self.File.Append(myMagicMenu, _("Magic"), "", wx.ITEM_NORMAL) self.Bug186_Frame_menubar.Append(self.File, _("File")) self.SetMenuBar(self.Bug186_Frame_menubar) # Menu Bar end # Tool Bar self.Bug186_Frame_toolbar = wx.ToolBar(self, -1) self.SetToolBar(self.Bug186_Frame_toolbar) global myMagicTool myMagicTool = wx.NewId() self.Bug186_Frame_toolbar.AddLabelTool(myMagicTool, _("Magic"), wx.EmptyBitmap(32, 32), wx.NullBitmap, wx.ITEM_NORMAL, _("Do a MAGIC action"), _("It's really MAGIC")) # Tool Bar end self.text_ctrl_1 = wx.TextCtrl(self, wx.ID_ANY, _("Id: automatic (default behaviour)")) self.text_ctrl_2 = wx.TextCtrl(self, 12123, _("Id: numeric value \"12123\"")) self.text_ctrl_3 = wx.TextCtrl( self, wx.ID_ANY, _("Id: predefined identify: \"wxID_ANY\"")) global myButtonId myButtonId = wx.NewId() self.text_ctrl_4 = wx.TextCtrl( self, myButtonId, _("Id: variable assignment \"myButtonId=?\"")) self.__set_properties() self.__do_layout()
def __init__(self, parent): wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.Size(573, 307), style=wx.TAB_TRAVERSAL) bSizer80 = wx.BoxSizer(wx.VERTICAL) self.m_toolBar2 = wx.ToolBar(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TB_HORIZONTAL) self.m_toolBar2.AddLabelTool( LOG_SAVE, u"tool", wx.ArtProvider.GetBitmap(wx.ART_FILE_SAVE_AS, ), wx.NullBitmap, wx.ITEM_NORMAL, u"Save As...", u"Save statistics to a file", None) self.m_toolBar2.AddLabelTool(LOG_CLEAR, u"tool", wx.ArtProvider.GetBitmap(wx.ART_CUT, ), wx.NullBitmap, wx.ITEM_NORMAL, u"Clear results", u"Clear results", None) self.m_toolBar2.Realize() bSizer80.Add(self.m_toolBar2, 0, wx.EXPAND, 5) self.m_textCtrlLog = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.HSCROLL | wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH | wx.TE_RICH2) bSizer80.Add(self.m_textCtrlLog, 1, wx.ALL | wx.EXPAND, 0) self.SetSizer(bSizer80) self.Layout() # Connect Events self.Bind(wx.EVT_TOOL, self.onToolClicked, id=LOG_SAVE) self.Bind(wx.EVT_TOOL, self.onToolClicked, id=LOG_CLEAR)
def InitToolbar(self): toolbar = wx.ToolBar(self)#, style=wx.TB_NODIVIDER) tbBack = toolbar.AddLabelTool( wx.ID_ANY, 'Back', wx.Bitmap(Resource.GetFileName('arrow-left.png'))) self.Bind(wx.EVT_TOOL, self.OnBack, tbBack) self.tcInvoiceId = wx.TextCtrl(toolbar,size=wx.Size(80,-1)) self.tcInvoiceId.Bind(wx.EVT_KEY_UP, self.OnInvoiceId) toolbar.AddControl(self.tcInvoiceId) tbForward = toolbar.AddLabelTool( wx.ID_ANY, 'Forward', wx.Bitmap(Resource.GetFileName('arrow-right.png'))) self.Bind(wx.EVT_TOOL, self.OnForward, tbForward) tbPrint = toolbar.AddLabelTool( wx.ID_ANY, 'Print', wx.Bitmap(Resource.GetFileName('print.png'))) self.Bind(wx.EVT_TOOL, self.OnPrint, tbPrint) toolbar.Realize() self.toolbar = toolbar
def make_toolbar(self): self.ID_TB_CATEEDIT = wx.NewId() self.ID_TB_INCOME = wx.NewId() self.ID_TB_PAYOUT = wx.NewId() self.ID_TB_CYCLE = wx.NewId() self.ID_TB_SYNC = wx.NewId() self.toolbar = wx.ToolBar(self, -1, wx.DefaultPosition, wx.Size(48,48), wx.TB_HORIZONTAL|wx.TB_FLAT|wx.TB_TEXT) self.toolbar.SetToolBitmapSize(wx.Size (48, 48)) #self.toolbar.AddLabelTool(self.ID_TB_CATEEDIT, _('Add Category')+'(&T)', load_bitmap(os.path.join(self.bmpdir, 'categories.png')), shortHelp=_('Add Category'), longHelp=_('Add Category')) self.toolbar.AddLabelTool(self.ID_TB_CATEEDIT, _('Add Category')+'(&T)', load_bitmap(os.path.join(self.bmpdir, 'categories.png')), shortHelp=_('Add Category')) self.toolbar.AddLabelTool(self.ID_TB_INCOME, _('Add Income')+'(&I)', load_bitmap(os.path.join(self.bmpdir, 'cashin.png')), shortHelp=_('Add Income'), longHelp=_('Add Income')) self.toolbar.AddLabelTool(self.ID_TB_PAYOUT, _("Add Payout")+'(&P)', load_bitmap(os.path.join(self.bmpdir, 'cashout.png')), shortHelp=_("Add Payout"), longHelp=_("Add Payout")) self.toolbar.AddLabelTool(self.ID_TB_CYCLE, _("Add Record Cycle")+'(&C)', load_bitmap(os.path.join(self.bmpdir, 'cycle.png')), shortHelp=_("Record Cycle"), longHelp=_("Record Cycle")) #self.toolbar.AddLabelTool(self.ID_TB_SYNC, _("Sync")+'(&Y)', load_bitmap(os.path.join(self.bmpdir, 'sync.png')), shortHelp=_("Sync user data"), longHelp=_("Sync user data")) self.toolbar.Realize () self.SetToolBar(self.toolbar) self.Bind(wx.EVT_TOOL, self.OnCateEdit, id=self.ID_TB_CATEEDIT) self.Bind(wx.EVT_TOOL, self.OnIncome, id=self.ID_TB_INCOME) self.Bind(wx.EVT_TOOL, self.OnPayout, id=self.ID_TB_PAYOUT) self.Bind(wx.EVT_TOOL, self.OnCycle, id=self.ID_TB_CYCLE)
def toolbar(self): self.toolbar = wx.ToolBar(self.frame) self.toolbar.SetBackgroundColour( wx.SystemSettings.GetColour(wx.SYS_COLOUR_APPWORKSPACE)) self.text_ctrl = wx.TextCtrl(self.toolbar) self.text_ctrl.SetHint("Search") bmp = wx.ArtProvider.GetBitmap(wx.ART_UNDO) self.frame.SetToolBar(self.toolbar) self.toogle_list_btn = self.toolbar.AddCheckTool( wx.ID_ANY, 'Toogle list view', bmp) self.toolbar.AddStretchableSpace() self.toolbar.AddControl(self.text_ctrl) self.refresh = self.toolbar.AddTool(wx.ID_ANY, 'Refresh', bmp) self.frame.Bind(wx.EVT_TEXT, self.refresh_action, self.text_ctrl) self.frame.Bind(wx.EVT_TOOL, self.refresh_action, self.refresh) self.frame.Bind(wx.EVT_TOOL, self.toogle_list_action, self.toogle_list_btn) self.toolbar.Realize()
def _createtoolbar(self): self.ToolBar = wx.ToolBar(self, style=wx.TB_TEXT|wx.TB_HORIZONTAL|wx.TB_TOP) img = wx.ArtProvider.GetBitmap(wx.ART_NEW) self.ToolBar.AddLabelTool(1, _('New'), img) self.ToolBar.AddSeparator() img = wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN) self.ToolBar.AddLabelTool(2, _('Open'), img) img = wx.ArtProvider.GetBitmap(wx.ART_FILE_SAVE) self.ToolBar.AddLabelTool(3, _('Save'), img) self.ToolBar.AddSeparator() img = wx.ArtProvider.GetBitmap(wx.ART_NEW_DIR) self.ToolBar.AddLabelTool(4, _('Mount'), img) img = wx.ArtProvider.GetBitmap(wx.ART_DELETE) self.ToolBar.AddLabelTool(5, _('Umount'), img) self.ToolBar.Realize() self.Bind(wx.EVT_TOOL, self.new, id=_TB_NEW) self.Bind(wx.EVT_TOOL, self.open, id=_TB_OPEN) self.Bind(wx.EVT_TOOL, self.save, id=_TB_SAVE) self.Bind(wx.EVT_TOOL, self.mount, id=_TB_MOUNT) self.Bind(wx.EVT_TOOL, self.umount, id=_TB_UMOUNT)
def __init__(self): """Constructor""" #wx.Frame.__init__( self, parent, ID, title, wx.DefaultPosition, wx.Size( 350, 250 ) ) wx.Frame.__init__(self,None,-1,'MyFrame.py',size=(500,300)) vbox = wx.BoxSizer( wx.VERTICAL ) toolbar = wx.ToolBar( self, -1, style=wx.TB_HORIZONTAL | wx.NO_BORDER ) toolbar.AddSimpleTool( 1, wx.Image( 'stock_new.png', wx.BITMAP_TYPE_PNG ).ConvertToBitmap(), 'New', '' ) toolbar.AddSimpleTool( 2, wx.Image( 'stock_open.png', wx.BITMAP_TYPE_PNG ).ConvertToBitmap(), 'Open', '' ) toolbar.AddSimpleTool( 3, wx.Image( 'stock_save.png', wx.BITMAP_TYPE_PNG ).ConvertToBitmap(), 'Save', '' ) toolbar.AddSeparator() toolbar.AddSimpleTool( 4, wx.Image( 'stock_exit.png', wx.BITMAP_TYPE_PNG ).ConvertToBitmap(), 'Exit', '' ) toolbar.Realize() vbox.Add( toolbar, 0, border=5 ) self.SetSizer( vbox ) self.statusbar = self.CreateStatusBar() self.Centre() wx.EVT_TOOL( self, 1, self.OnNew ) wx.EVT_TOOL( self, 2, self.OnOpen ) wx.EVT_TOOL( self, 3, self.OnSave ) wx.EVT_TOOL( self, 4, self.OnExit )
def __init__(self, *args, **kwds): # begin wxGlade: MyFrame.__init__ kwds["style"] = kwds.get("style", 0) wx.Frame.__init__(self, *args, **kwds) self.SetSize((200, 200)) # Tool Bar self.frame_1_toolbar = wx.ToolBar(self, -1) self.SetToolBar(self.frame_1_toolbar) self.frame_1_toolbar.AddTool( wx.ID_UP, "UpDown", wx.ArtProvider.GetBitmap(wx.ART_GO_UP, wx.ART_OTHER, (32, 32)), wx.ArtProvider.GetBitmap(wx.ART_GO_DOWN, wx.ART_OTHER, (32, 32)), wx.ITEM_CHECK, "Up or Down", "Up or Down") # Tool Bar end self.label_1 = wx.StaticText( self, wx.ID_ANY, "placeholder - every design\nneeds a toplevel window", style=wx.ALIGN_CENTER) self.__set_properties() self.__do_layout()
def pageApps(self): self.listApps = wx.ListCtrl(self.apps, -1, style=wx.LC_REPORT | wx.LC_SINGLE_SEL | wx.LC_HRULES, size=(-1, 200)) self.listApps.InsertColumn(0, _('Name'), width=320) self.listApps.InsertColumn(1, _('status'), width=365) self.listApps.Bind(wx.EVT_LIST_ITEM_SELECTED, self.onListAppsSelected) self.listApps.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.onListAppsDeselected) self.listApps.SetTextColour(wx.BLACK) self.toolbar2 = wx.ToolBar(self.apps, style=wx.TB_TEXT | wx.TB_VERTICAL) self.editButton = self.toolbar2.AddTool( 201, _('Edit'), wx.Bitmap(self.currentdir + "/data/edit.png")) self.Bind(wx.EVT_TOOL, self.OnEditButton, self.editButton) self.showButton = self.toolbar2.AddTool( 202, _('Open'), wx.Bitmap(self.currentdir + "/data/show.png")) self.Bind(wx.EVT_TOOL, self.OnShowButton, self.showButton) self.toolbar2.AddSeparator() toolInstall = self.toolbar2.AddTool( 203, _('Install'), wx.Bitmap(self.currentdir + "/data/install.png")) self.Bind(wx.EVT_TOOL, self.OnToolInstall, toolInstall) toolUninstall = self.toolbar2.AddTool( 205, _('Uninstall'), wx.Bitmap(self.currentdir + "/data/uninstall.png")) self.Bind(wx.EVT_TOOL, self.OnToolUninstall, toolUninstall) sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(self.listApps, 1, wx.EXPAND, 0) sizer.Add(self.toolbar2, 0) self.apps.SetSizer(sizer) self.OnRefreshButton()
def updateToolbarActions(self, auimgr): needed = {} order = [] for title, items in self.menus.iteritems(): if title == 'root': # Ignore the root menu -- it only contains other menus continue # Delay construction of toolbars until we know that the toolbar # is needed for weight, action, separator in items: if isinstance(action, str): # Ignore submenu definitions -- toolbars don't have subtoolbars pass elif action.icon is not None: if title not in needed: needed[title] = True order.append(title) if title not in self.title_to_toolbar: tb = wx.ToolBar(self.frame, -1, wx.DefaultPosition, wx.DefaultSize, wx.TB_FLAT | wx.TB_NODIVIDER) tb.SetToolBitmapSize(wx.Size(16, 16)) self.title_to_toolbar[title] = tb dprint(tb) toolbar = self.title_to_toolbar[title] if separator and toolbar.GetToolsCount() > 0: toolbar.AddSeparator() action.insertIntoToolbar(toolbar) for title in order: tb = self.title_to_toolbar[title] tb.Realize() dprint("Realized %s: %s" % (title, tb)) auimgr.AddPane( tb, wx.aui.AuiPaneInfo().Name(title).Caption(title).ToolbarPane(). Top().LeftDockable(False).RightDockable(False))
def pageowire(self): self.listSensors = wx.ListCtrl(self.owire, -1, style=wx.LC_REPORT | wx.LC_SINGLE_SEL | wx.LC_HRULES, size=(-1, 200)) self.listSensors.InsertColumn(0, ' ', width=16) self.listSensors.InsertColumn(1, _('SensorID'), width=130) self.listSensors.InsertColumn(2, _('Name'), width=130) self.listSensors.InsertColumn(3, _('Value'), width=70) self.listSensors.InsertColumn(4, _('SignalK Key'), width=300) self.listSensors.Bind(wx.EVT_LIST_ITEM_SELECTED, self.onListSensorsSelected) self.listSensors.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.onListSensorsDeselected) self.toolbar2 = wx.ToolBar(self.owire, style=wx.TB_TEXT | wx.TB_VERTICAL) self.addButton = self.toolbar2.AddTool( 201, _('Add'), wx.Bitmap(self.currentdir + "/data/add.png")) self.Bind(wx.EVT_TOOL, self.OnAddButton, self.addButton) self.editButton = self.toolbar2.AddTool( 202, _('Edit'), wx.Bitmap(self.currentdir + "/data/edit.png")) self.Bind(wx.EVT_TOOL, self.OnEditButton, self.editButton) self.removeButton = self.toolbar2.AddTool( 203, _('Remove'), wx.Bitmap(self.currentdir + "/data/remove.png")) self.Bind(wx.EVT_TOOL, self.OnRemoveButton, self.removeButton) self.loadButton = self.toolbar2.AddTool( 204, _('Refresh Value'), wx.Bitmap(self.currentdir + "/data/edit.png")) self.Bind(wx.EVT_TOOL, self.OnLoadButton, self.loadButton) sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(self.listSensors, 1, wx.EXPAND, 0) sizer.Add(self.toolbar2, 0, wx.EXPAND, 0) self.owire.SetSizer(sizer)
def create_toolbar(self): self.toolbar = wx.ToolBar(self.materials_panel, style=wx.TB_FLAT | wx.TB_HORIZONTAL) dpi_scale_factor = wx.GetDisplayPPI()[0] / 96. tb_bmp_size = int(dpi_scale_factor * 20) newid = wx.NewId() self.toolbar.AddTool(newid, label='Add', bitmap=wx.Bitmap(img.add.GetImage().Scale( tb_bmp_size, tb_bmp_size)), shortHelp='Add a material to the list') self.materials_panel.Bind(wx.EVT_TOOL, self.material_add, id=newid) newid = wx.NewId() self.toolbar.AddTool(newid, label='Delete', bitmap=wx.Bitmap(img.delete.GetImage().Scale( tb_bmp_size, tb_bmp_size)), shortHelp='Delete selected materials') self.materials_panel.Bind(wx.EVT_TOOL, self.material_delete, id=newid) newid = wx.NewId() self.toolbar.AddTool(newid, label='Apply', bitmap=wx.Bitmap(img.start_fit.GetImage().Scale( tb_bmp_size, tb_bmp_size)), shortHelp='New Layer/Apply to Layer') self.materials_panel.Bind(wx.EVT_TOOL, self.material_apply, id=newid) # self.sizer_hor=wx.BoxSizer(wx.HORIZONTAL) self.sizer_vert.Add(self.toolbar, proportion=0, flag=wx.EXPAND, border=2) self.toolbar.Realize()
def AddToolbar(self): self.tool_ids = {} self.toolbar = wx.ToolBar(self, -1, style=wx.TB_HORIZONTAL | wx.TB_FLAT) def add_tool(name, toggle=False): name_nodash = name.replace("-", "") id = getattr(ID, name_nodash) self.tool_ids[id] = name_nodash self.toolbar.AddSimpleTool(id, LoadIcon('toolbar', name), name, isToggle=toggle) if toggle: self.toolbar.ToggleTool(id, config[name]) self.MakeConfigFunc(name) add_tool('Clear-Flame') add_tool('Add-Xform') add_tool('Add-Final-Xform') add_tool('Duplicate-Xform') add_tool('Delete-Xform') add_tool('Zoom-In') add_tool('Zoom-Out') add_tool('Zoom-To-Fit') add_tool('World-Pivot', True) add_tool('Lock-Axes', True) add_tool('Variation-Preview', True) add_tool('Edit-Post-Xform', True) self.toolbar.Realize() return self.toolbar
def __init__(self): """Constructor""" #self.load() self.annotationProject = AnnotationProject( "/home/ndocquier/Documents/test/pyDragAndDrop/gs/Extrait") wx.Frame.__init__(self, None, size=(600, 450)) self.panel = MainPanel(self) self.Center() file_drop_target = FileAnnotationDropTarget(self.panel) self.panel.SetDropTarget(file_drop_target) # - - - - # Toolbar # - - - - tb = wx.ToolBar(self, -1) self.ToolBar = tb #buttons to manage current page prevBut = tb.AddTool(101, wx.Bitmap("icon/icone_stepBackward.png")) nextBut = tb.AddTool(102, wx.Bitmap("icon/icone_stepForward.png")) saveBut = tb.AddTool(103, wx.Bitmap("icon/icone_save.png")) loadBut = tb.AddTool(104, wx.Bitmap("icon/icone_open.png")) exportBut = tb.AddTool(105, wx.Bitmap("icon/icone_generate.png")) tb.Bind(wx.EVT_TOOL, self.prevPage, source=prevBut) tb.Bind(wx.EVT_TOOL, self.nextPage, source=nextBut) tb.Bind(wx.EVT_TOOL, self.save, source=saveBut) tb.Bind(wx.EVT_TOOL, self.load, source=loadBut) tb.Bind(wx.EVT_TOOL, self.export, source=exportBut) tb.Realize() # - - - - self.pageId = 1 self.updatePage() print "RELOAD"
def _toolBar(self): self.tool_bitmap_size = (32, 32) self.frame_toolbar = wx.ToolBar(self, -1, style=wx.TB_FLAT) self.SetToolBar(self.frame_toolbar) self.frame_toolbar.SetToolBitmapSize(self.tool_bitmap_size) tools_item_other = [ self.add_tool('ART_FILE_OPEN', _("Open"), _("Open an action list"), self.on_menu_file_open)] tools_item = [ self.add_tool('ART_EXECUTABLE_FILE', _("Execute"), _("Execute the action"), self.on_menu_tools_execute)] self.frame_toolbar.AddSeparator() tools_item_other.extend([ self.add_tool('ART_ADD_BOOKMARK', _("Add"), _("Add an action"), self.on_menu_edit_add)]) tools_item.extend([ self.add_tool('ART_DEL_BOOKMARK', _("Remove"), _("Remove the selected action"), self.on_menu_edit_remove), self.add_tool('ART_GO_UP', _("Up"), _("Move the selected action up"), self.on_menu_edit_up), self.add_tool('ART_GO_DOWN', _("Down"), _("Move the selected action down"), self.on_menu_edit_down)]) self.frame_toolbar.AddSeparator() tools_item_other.extend([ self.add_tool('ART_FIND', _("Image Inspector"), _("Look up exif and iptc tags"), self.on_menu_tools_image_inspector)]) self.frame_toolbar.AddSeparator() self.toolbar_description = self.add_tool('ART_TIP', _("Description"), _("Show description of the action list"), self.on_menu_view_description, item=wx.ITEM_CHECK) tools_item.extend([self.toolbar_description]) self.tools_item = [tool.GetId() for tool in tools_item] self.tools_all = tools_item + \ [tool.GetId() for tool in tools_item_other] self._menu_toolbar_state = True self.frame_toolbar.Realize()
def _CreateToolBar(self): '''创建工具栏''' bmp_open = wx.Bitmap('res/open_16.png', wx.BITMAP_TYPE_ANY) # 请自备按钮图片 bmp_save = wx.Bitmap('res/save_16.png', wx.BITMAP_TYPE_ANY) # 请自备按钮图片 bmp_help = wx.Bitmap('res/help_16.png', wx.BITMAP_TYPE_ANY) # 请自备按钮图片 bmp_about = wx.Bitmap('res/about_16.png', wx.BITMAP_TYPE_ANY) # 请自备按钮图片 self.tb = wx.ToolBar(self) self.tb.SetToolBitmapSize((16, 16)) self.tb.AddLabelTool(self.id_open, u'打开文件', bmp_open, shortHelp=u'打开', longHelp=u'打开文件') self.tb.AddLabelTool(self.id_save, u'保存文件', bmp_save, shortHelp=u'保存', longHelp=u'保存文件') self.tb.AddSeparator() self.tb.AddLabelTool(self.id_help, u'帮助', bmp_help, shortHelp=u'帮助', longHelp=u'帮助') self.tb.AddLabelTool(self.id_about, u'关于', bmp_about, shortHelp=u'关于', longHelp=u'关于...') #self.Bind(wx.EVT_TOOL_RCLICKED, self.OnOpen, id=self.id_open) self.tb.Realize()
def __init__(self, *args, **kwds): # begin wxGlade: MyFrame.__init__ kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) # Menu Bar self.frame_menubar = wx.MenuBar() wxglade_tmp_menu = wx.Menu() self.frame_menubar.Append(wxglade_tmp_menu, "File") self.SetMenuBar(self.frame_menubar) # Menu Bar end # Tool Bar self.frame_toolbar = wx.ToolBar(self, -1) self.SetToolBar(self.frame_toolbar) # Tool Bar end self.grid1 = wx.grid.Grid(self, wx.ID_ANY, size=(1, 1)) self.ClearB1 = wx.Button(self, wx.ID_ANY, "Clear") self.grid2 = wx.grid.Grid(self, wx.ID_ANY, size=(1, 1)) self.ClearB2 = wx.Button(self, wx.ID_ANY, "Clear") self.ExecuteB = wx.Button(self, wx.ID_ANY, "Execute") self.__set_properties() self.__do_layout()
def __init__(self, parent, title): wx.Frame.__init__(self, parent, title=title) # toolbar self.toolbar = wx.ToolBar(self) self.toolbar.Realize() # spliter window self.spw = wx.SplitterWindow(self, style=wx.SP_LIVE_UPDATE) # panel self.pnlFM1 = InnoFileMgr(self.spw) self.pnlFM2 = InnoFileMgr(self.spw) self.spw.SetMinimumPaneSize(200) self.spw.SplitVertically(self.pnlFM1, self.pnlFM2, 0) # event binding self.Bind(wx.EVT_CLOSE, self.OnClose) self.Bind(wx.EVT_CHAR, self.OnChar) self.pnlFM1.Bind(wx.EVT_CHAR_HOOK, self.OnCharFM1) self.pnlFM2.Bind(wx.EVT_CHAR_HOOK, self.OnCharFM2) # sizer sizer_h = wx.BoxSizer(wx.HORIZONTAL) sizer_h.Add(self.spw, 1, wx.EXPAND) sizer_v = wx.BoxSizer(wx.VERTICAL) sizer_v.Add(self.toolbar, 0, wx.ALL | wx.EXPAND, 4) sizer_v.Add(sizer_h, 1, wx.EXPAND) self.SetSizer(sizer_v) self.SetAutoLayout(1) #sizer.Fit(self) self.SetSize((1200, 800)) self.Show()
def InitUI(self): menubar = wx.MenuBar() viewMenu = wx.Menu() self.shst = viewMenu.Append(wx.ID_ANY, 'Show statusbar', 'Show Statusbar', kind=wx.ITEM_CHECK) self.shtl = viewMenu.Append(wx.ID_ANY, 'Show toolbar', 'Show Toolbar', kind=wx.ITEM_CHECK) viewMenu.Check(self.shst.GetId(), True) viewMenu.Check(self.shtl.GetId(), True) self.Bind(wx.EVT_MENU, self.ToggleStatusBar, self.shst) self.Bind(wx.EVT_MENU, self.ToggleToolBar, self.shtl) menubar.Append(viewMenu, '&View') self.SetMenuBar(menubar) self.toolbar = self.CreateToolBar() image = wx.Bitmap(wx.Bitmap('../data/image/exit.jpg').ConvertToImage().Scale(50, 50, wx.IMAGE_QUALITY_HIGH)) self.toolbar.AddTool(wx.ID_UNDO, 'Exit', image) self.toolbar.Realize() self.statusbar = self.CreateStatusBar() self.statusbar.SetStatusText('Ready') self.SetSize((450, 350)) self.SetTitle('Check menu item') self.Centre() toolbar1 = wx.ToolBar(self) toolbar1.AddTool(wx.ID_ANY, '', wx.Bitmap(wx.Bitmap('../data/image/exit.jpg').ConvertToImage().Scale(50, 50, wx.IMAGE_QUALITY_HIGH))) toolbar1.AddTool(wx.ID_ANY, '', wx.Bitmap(wx.Bitmap('../data/image/exit.jpg').ConvertToImage().Scale(50, 50, wx.IMAGE_QUALITY_HIGH))) toolbar1.AddTool(wx.ID_ANY, '', wx.Bitmap(wx.Bitmap('../data/image/exit.jpg').ConvertToImage().Scale(50, 50, wx.IMAGE_QUALITY_HIGH))) toolbar1.Realize()
def _init_ctrls(self, prnt): # generated method, don't edit if prnt != None: style = wx.DEFAULT_FRAME_STYLE | wx.FRAME_FLOAT_ON_PARENT else: style = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, id=wxID_FRAME1, name='', parent=prnt, pos=wx.Point(509, 289), size=wx.Size(730, 644), style=style, title='Template editor') self.SetClientSize(wx.Size(712, 599)) self.toolBar1 = wx.ToolBar(id=wxID_FRAME1TOOLBAR1, name='toolBar1', parent=self, pos=wx.Point(0, 0), size=wx.Size(712, 28), style=wx.TB_FLAT | wx.TB_HORIZONTAL) self.toolBar1.SetConstraints( LayoutAnchors(self.toolBar1, True, True, True, False)) self.toolBar1.SetToolBitmapSize(wx.Size(22, 22)) self.SetToolBar(self.toolBar1) self.editor = Editor(id=wx.NewId(), parent=self, enh_menu=False, style=wx.TE_MULTILINE | wx.BORDER_THEME) self.editor.SetAutoLayout(True) self.editor.SetConstraints( LayoutAnchors(self.editor, True, True, True, True))
def create_command_toolbar(self, parent: wx.Window): toolbar = wx.ToolBar(parent, size=(200, -1), style=wx.TB_HORIZONTAL | wx.TB_BOTTOM) bitmap = wx.Bitmap(os.path.join(self.image_path24, "Add.png")) toolbar.AddTool(ID_COMMAND_ADD, _("Add Command"), bitmap) self.Bind(wx.EVT_TOOL, self.on_add_command, id=ID_COMMAND_ADD) bitmap = wx.Bitmap(os.path.join(self.image_path24, "Delete.png")) toolbar.AddTool(ID_COMMAND_DELETE, _("Delete Command"), bitmap) self.Bind(wx.EVT_TOOL, self.on_delete_command, id=ID_COMMAND_DELETE) bitmap = wx.Bitmap(os.path.join(self.image_path24, "Down.png")) toolbar.AddTool(ID_COMMAND_DOWN, _("Move Down"), bitmap) self.Bind(wx.EVT_TOOL, self.on_move_down_command, id=ID_COMMAND_DOWN) bitmap = wx.Bitmap(os.path.join(self.image_path24, "Up.png")) toolbar.AddTool(ID_COMMAND_UP, _("Move Up"), bitmap) self.Bind(wx.EVT_TOOL, self.on_move_up_command, id=ID_COMMAND_UP) toolbar.Realize() return toolbar
def InitToolbar(self): toolbar = wx.ToolBar(self, wx.ID_ANY, pos=(0, 0)) self.ToolBar = toolbar new_tb = toolbar.AddTool(wx.ID_NEW, "New", wx.Bitmap('res/icon/file.png')) open_tb = toolbar.AddTool(wx.ID_OPEN, "Open", wx.Bitmap('res/icon/folder-open.png')) save_tb = toolbar.AddTool(wx.ID_SAVE, "Save", wx.Bitmap('res/icon/save.png')) exit_tb = toolbar.AddTool(wx.ID_EXIT, "Exit", wx.Bitmap('res/icon/sign-out-alt.png')) # run_tb = toolbar.AddTool(wx.ID_EXECUTE, "Run", wx.Bitmap('res/icon/play.png')) stop_tb = toolbar.AddTool(wx.ID_STOP, "Stop", wx.Bitmap('res/icon/stop.png')) toolbar.EnableTool(wx.ID_STOP, False) toolbar.EnableTool(wx.ID_EXECUTE, False) toolbar.Bind(wx.EVT_TOOL, self.control_panel.OnNew, new_tb) toolbar.Bind(wx.EVT_TOOL, self.control_panel.OnOpen, open_tb) toolbar.Bind(wx.EVT_TOOL, self.control_panel.OnSave, save_tb) toolbar.Bind(wx.EVT_TOOL, self.control_panel.OnExit, exit_tb) # toolbar.Bind(wx.EVT_TOOL, self.control_panel.OnRun, run_tb) # AsyncBind(run_tb, wx.EVT_TOOL, self.control_panel.OnRun) toolbar.Bind(wx.EVT_TOOL, self.control_panel.OnStop, stop_tb) toolbar.Realize()
def pageSystemd(self): self.started = False self.listSystemd = CheckListCtrl(self.systemd, 152) self.listSystemd.InsertColumn(0, _('Autostart'), width=90) self.listSystemd.InsertColumn(1, _('Process'), width=150) self.listSystemd.InsertColumn(2, _('Status'), width=150) self.listSystemd.InsertColumn(3, ' ', width=150) self.listSystemd.Bind(wx.EVT_LIST_ITEM_SELECTED, self.onListSystemdSelected) self.listSystemd.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.onListSystemdDeselected) self.listSystemd.SetTextColour(wx.BLACK) self.listSystemd.OnCheckItem = self.OnCheckItem self.toolbar3 = wx.ToolBar(self.systemd, style=wx.TB_TEXT | wx.TB_VERTICAL) self.start = self.toolbar3.AddTool( 301, _('Start'), wx.Bitmap(self.currentdir + "/data/start.png")) self.Bind(wx.EVT_TOOL, self.onStart, self.start) self.stop = self.toolbar3.AddTool( 302, _('Stop'), wx.Bitmap(self.currentdir + "/data/stop.png")) self.Bind(wx.EVT_TOOL, self.onStop, self.stop) self.restart = self.toolbar3.AddTool( 303, _('Restart'), wx.Bitmap(self.currentdir + "/data/restart.png")) self.Bind(wx.EVT_TOOL, self.onRestart, self.restart) sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(self.listSystemd, 1, wx.EXPAND, 0) sizer.Add(self.toolbar3, 0) self.systemd.SetSizer(sizer) self.started = True
def __init__(self, parent=None, ID=-1, pos=wx.DefaultPosition, size=(0,0), style=wx.TAB_TRAVERSAL|wx.RAISED_BORDER, navs=None, wtype=None): wx.Panel.__init__(self, parent, ID, pos, size, style) # Create the different navigators here #self.SetBackgroundColour(wx.Colour(128,128,128)) self.SetBackgroundColour('black') # Add a sizer here for the panel instance (hope this work as a notebook page) sizer = wx.BoxSizer(wx.HORIZONTAL) # This is where the date and size windows are added # i.e. determine which one to use then create it self.subbook = SubBook(self, -1, navs=navs) # Add the tagcloud window self.tagcloud = wx.Panel(self, -1,style=wx.NO_BORDER) self.tagcloud.SetBackgroundColour('white') # ------------------------------------------------ # WIP: a toolbar for the tagcloud window bar = wx.ToolBar(self.tagcloud, style=wx.TB_FLAT) bar.AddLabelTool(100, "Test", wx.ArtProvider_GetBitmap(wx.ART_QUESTION)) bar.AddLabelTool(200, "Test", wx.ArtProvider_GetBitmap(wx.ART_QUESTION)) bar.AddLabelTool(300, "Test", wx.ArtProvider_GetBitmap(wx.ART_QUESTION)) bar.Realize() tagsizer = wx.BoxSizer(wx.VERTICAL) tagsizer.Add(bar, 0, wx.EXPAND | wx.ALL | wx.ALIGN_CENTER, 3) tagsizer.Add(wx.Panel(self.tagcloud, -1), wx.EXPAND | wx.ALL | wx.ALIGN_CENTER, 3) self.tagcloud.SetSizer(tagsizer) # ------------------------------------------------ # Stick all into the sizer sizer.Add(self.subbook, 3, wx.EXPAND | wx.ALL | wx.ALIGN_CENTER, 3) sizer.Add(self.tagcloud, 1, wx.EXPAND | wx.ALL | wx.ALIGN_CENTER, 3) self.SetSizer(sizer)