def create_toolbar(self): # create the toolbar self.toolbar = wx.ToolBar(self.toolbarpanel, style=wx.TB_FLAT|wx.TB_NODIVIDER|wx.TB_HORZ_TEXT) self.toolbar.SetToolBitmapSize((16, 16)) force_mask = False if osutils.is_msw() and not osutils.is_win2000(): force_mask = not guiutil.is_xp_styled() self.tooltip_config.add_to_toolbar(self.toolbar, permanent=False) self.tooltip_config.bind_to_toolbar(self.toolbar) # self.toolbar.AddSeparator() self.gui_anchor = self.toolbar.AddLabelTool(wx.ID_ANY, _("Anchor"), bmp("anchor.png", force_mask=force_mask), shortHelp=_("Don't hide this tooltip")) self.gui_copy = self.toolbar.AddLabelTool(wx.ID_ANY, _("Copy All"), bmp("page_copy.png", force_mask=force_mask), shortHelp=_("Copy tooltip text (with links)")) self.toolbar.Bind(wx.EVT_TOOL, self.stay_on_top, id=self.gui_anchor.Id) self.toolbar.Bind(wx.EVT_TOOL, self.copy_all, id=self.gui_copy.Id) self.toolbar.Realize()
def create_toolbar(self): # create the toolbar self.toolbar = wx.ToolBar(self.toolbarpanel, style=wx.TB_FLAT | wx.TB_NODIVIDER | wx.TB_HORZ_TEXT) self.toolbar.SetToolBitmapSize((16, 16)) force_mask = False if osutils.is_msw() and not osutils.is_win2000(): force_mask = not guiutil.is_xp_styled() self.tooltip_config.add_to_toolbar(self.toolbar, permanent=False) self.tooltip_config.bind_to_toolbar(self.toolbar) # self.toolbar.AddSeparator() self.gui_anchor = self.toolbar.AddLabelTool( wx.ID_ANY, _("Anchor"), bmp("anchor.png", force_mask=force_mask), shortHelp=_("Don't hide this tooltip")) self.gui_copy = self.toolbar.AddLabelTool( wx.ID_ANY, _("Copy All"), bmp("page_copy.png", force_mask=force_mask), shortHelp=_("Copy tooltip text (with links)")) self.toolbar.Bind(wx.EVT_TOOL, self.stay_on_top, id=self.gui_anchor.Id) self.toolbar.Bind(wx.EVT_TOOL, self.copy_all, id=self.gui_copy.Id) self.toolbar.Realize()
def bmp(f, force_mask=False): # load and process image image = wx.Image(config.graphics_path + f) if osutils.is_win2000() or force_mask: image.ConvertAlphaToMask() return wx.BitmapFromImage(image)
def load_icons(): global icons wx.InitAllImageHandlers() icons = wx.IconBundle() for item in "16 32 48 64 128".split(): path = config.graphics_path icon = wx.Image("%(path)sbible-%(item)sx%(item)s.png" % locals()) if icon.IsOk(): # on windows 2000, transparency is 1 bit, so convert it # to one bit if osutils.is_win2000(): icon.ConvertAlphaToMask() bmp = wx.BitmapFromImage(icon) icons.AddIcon(wx.IconFromBitmap(bmp)) dprint(MESSAGE, "Loaded icon")