def MakeToolBar(self): def doBind(item, handler, updateUI=None): self.Bind(wx.EVT_TOOL, handler, item) if updateUI is not None: self.Bind(wx.EVT_UPDATE_UI, updateUI, item) tbar = self.CreateToolBar() doBind( tbar.AddTool(-1, images.get_rt_openBitmap(), shortHelpString="Open"), self.OnFileOpen) doBind( tbar.AddTool(-1, images.get_rt_saveBitmap(), shortHelpString="Save"), self.OnFileSave) tbar.AddSeparator() doBind( tbar.AddTool(wx.ID_CUT, images.get_rt_cutBitmap(), shortHelpString="Cut"), self.ForwardEvent, self.ForwardEvent) doBind( tbar.AddTool(wx.ID_COPY, images.get_rt_copyBitmap(), shortHelpString="Copy"), self.ForwardEvent, self.ForwardEvent) doBind( tbar.AddTool(wx.ID_PASTE, images.get_rt_pasteBitmap(), shortHelpString="Paste"), self.ForwardEvent, self.ForwardEvent) tbar.AddSeparator() doBind( tbar.AddTool(wx.ID_UNDO, images.get_rt_undoBitmap(), shortHelpString="Undo"), self.ForwardEvent, self.ForwardEvent) doBind( tbar.AddTool(wx.ID_REDO, images.get_rt_redoBitmap(), shortHelpString="Redo"), self.ForwardEvent, self.ForwardEvent) tbar.AddSeparator() doBind( tbar.AddTool(-1, images.get_rt_boldBitmap(), isToggle=True, shortHelpString="Bold"), self.OnBold, self.OnUpdateBold) doBind( tbar.AddTool(-1, images.get_rt_italicBitmap(), isToggle=True, shortHelpString="Italic"), self.OnItalic, self.OnUpdateItalic) doBind( tbar.AddTool(-1, images.get_rt_underlineBitmap(), isToggle=True, shortHelpString="Underline"), self.OnUnderline, self.OnUpdateUnderline) tbar.AddSeparator() doBind( tbar.AddTool(-1, images.get_rt_alignleftBitmap(), isToggle=True, shortHelpString="Align Left"), self.OnAlignLeft, self.OnUpdateAlignLeft) doBind( tbar.AddTool(-1, images.get_rt_centreBitmap(), isToggle=True, shortHelpString="Center"), self.OnAlignCenter, self.OnUpdateAlignCenter) doBind( tbar.AddTool(-1, images.get_rt_alignrightBitmap(), isToggle=True, shortHelpString="Align Right"), self.OnAlignRight, self.OnUpdateAlignRight) tbar.AddSeparator() doBind( tbar.AddTool(-1, images.get_rt_indentlessBitmap(), shortHelpString="Indent Less"), self.OnIndentLess) doBind( tbar.AddTool(-1, images.get_rt_indentmoreBitmap(), shortHelpString="Indent More"), self.OnIndentMore) tbar.AddSeparator() doBind( tbar.AddTool(-1, images.get_rt_fontBitmap(), shortHelpString="Font"), self.OnFont) doBind( tbar.AddTool(-1, images.get_rt_colourBitmap(), shortHelpString="Font Colour"), self.OnColour) tbar.Realize()
def MakeToolBar(self): def doBind(item, handler, updateUI=None): self.Bind(wx.EVT_TOOL, handler, item) if updateUI is not None: self.Bind(wx.EVT_UPDATE_UI, updateUI, item) tbar = self.CreateToolBar() doBind( tbar.AddTool(-1, images.get_rt_openBitmap(), shortHelpString=u'Abrir'), self.OnFileOpen) doBind( tbar.AddTool(-1, images.get_rt_saveBitmap(), shortHelpString=u'Guardar'), self.OnFileSave) tbar.AddSeparator() doBind( tbar.AddTool(wx.ID_CUT, images.get_rt_cutBitmap(), shortHelpString=u'Cortar'), self.ForwardEvent, self.ForwardEvent) doBind( tbar.AddTool(wx.ID_COPY, images.get_rt_copyBitmap(), shortHelpString=u'Copiar'), self.ForwardEvent, self.ForwardEvent) doBind( tbar.AddTool(wx.ID_PASTE, images.get_rt_pasteBitmap(), shortHelpString=u'Pegar'), self.ForwardEvent, self.ForwardEvent) tbar.AddSeparator() doBind( tbar.AddTool(wx.ID_UNDO, images.get_rt_undoBitmap(), shortHelpString=u'Deshacer'), self.ForwardEvent, self.ForwardEvent) doBind( tbar.AddTool(wx.ID_REDO, images.get_rt_redoBitmap(), shortHelpString=u'Rehacer'), self.ForwardEvent, self.ForwardEvent) tbar.AddSeparator() doBind( tbar.AddTool(-1, images.get_rt_boldBitmap(), isToggle=True, shortHelpString=u'Negrita'), self.OnBold, self.OnUpdateBold) doBind( tbar.AddTool(-1, images.get_rt_italicBitmap(), isToggle=True, shortHelpString=u'Cursiva'), self.OnItalic, self.OnUpdateItalic) doBind( tbar.AddTool(-1, images.get_rt_underlineBitmap(), isToggle=True, shortHelpString=u'Subrayado'), self.OnUnderline, self.OnUpdateUnderline) tbar.AddSeparator() doBind( tbar.AddTool(-1, images.get_rt_alignleftBitmap(), isToggle=True, shortHelpString=u'Alineación izquierda'), self.OnAlignLeft, self.OnUpdateAlignLeft) doBind( tbar.AddTool(-1, images.get_rt_centreBitmap(), isToggle=True, shortHelpString=u'Centrado'), self.OnAlignCenter, self.OnUpdateAlignCenter) doBind( tbar.AddTool(-1, images.get_rt_alignrightBitmap(), isToggle=True, shortHelpString=u'Alineación derecha'), self.OnAlignRight, self.OnUpdateAlignRight) tbar.AddSeparator() doBind( tbar.AddTool(-1, images.get_rt_indentlessBitmap(), shortHelpString=u'Indentar más'), self.OnIndentLess) doBind( tbar.AddTool(-1, images.get_rt_indentmoreBitmap(), shortHelpString=u'Indentar menos'), self.OnIndentMore) tbar.AddSeparator() doBind( tbar.AddTool(-1, images.get_rt_fontBitmap(), shortHelpString=u'Fuente'), self.OnFont) doBind( tbar.AddTool(-1, images.get_rt_colourBitmap(), shortHelpString=u'Color de fuente'), self.OnColour) tbar.Realize()