def build_toolbar(mw): tb = mw.CreateToolBar(wal.TBFLAGS) icon_size = config.toolbar_icon_size tb.SetToolBitmapSize(config.toolbar_size) for items in BUTTONS: if items is None: tb.AddSeparator() else: for item in items: action = mw.app.actions[item] aid = action.action_id label_txt = wal.tr(action.get_tooltip_text()) hlp_txt = wal.tr(action.get_descr_text()) bmp = action.get_icon(icon_size, wal.ART_TOOLBAR) if not bmp: continue if wal.IS_MSW: tb.AddLabelTool(aid, label_txt, bmp, bmpDisabled=wal.disabled_bmp(bmp), shortHelp=hlp_txt) else: tb.AddLabelTool(aid, label_txt, bmp, shortHelp=hlp_txt) action.register_as_tool(tb) tb.Realize() return tb
def update(self): for widget in self.widgets: if not wal.IS_WX2: if widget not in self.menuitem: widget.update() else: widget.update() if self.toolbar is not None and not wal.IS_MAC: self.toolbar.EnableTool(self.action_id, self.enabled) self.toolbar.SetToolShortHelp(self.action_id, wal.tr(self.get_descr_text()))