Changeset 4e4d3bb in sasview for guiframe/gui_toolbar.py
- Timestamp:
- Feb 14, 2011 3:14:27 PM (14 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 18ec684
- Parents:
- 982e953
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/gui_toolbar.py
r041cf9e r4e4d3bb 3 3 import os 4 4 from wx import ToolBar as Tbar 5 6 5 from wx.lib.platebtn import PlateButton 7 6 from sans.guiframe.gui_style import GUIFRAME_ID 8 7 from sans.guiframe.gui_style import GUIFRAME_ICON 8 from wx.lib.platebtn import PB_STYLE_SQUARE, PB_STYLE_DROPARROW 9 9 10 10 … … 28 28 Tbar.__init__(self, parent, *args, **kwds) 29 29 self.parent = parent 30 self._bookmark_menu = None 31 self._bookmark_bt = None 30 32 self.do_layout() 31 33 self.on_bind_button() … … 44 46 disable_save_bmp,button_type, shortHelp='Save') 45 47 self.AddSeparator() 46 bookmark_im = GUIFRAME_ICON.BOOKMARK_ICON47 bookmark_im.Rescale(tbar_size[0], tbar_size[1], wx.IMAGE_QUALITY_HIGH)48 bookmark_bmp = bookmark_im.ConvertToBitmap()49 #disable_bookmark_bmp = clear_image(bookmark_im).ConvertToBitmap()50 disable_bookmark_bmp = wx.NullBitmap51 self.AddLabelTool(GUIFRAME_ID.BOOKMARK_ID, 'Bookmark', bookmark_bmp,52 disable_bookmark_bmp, button_type,'Bookmark')53 self.AddSeparator()54 48 zoom_in_im = GUIFRAME_ICON.ZOOM_IN_ICON 55 49 zoom_in_im.Rescale(tbar_size[0], tbar_size[1], wx.IMAGE_QUALITY_HIGH) … … 139 133 self.button_panel.SetToolTipString(hint) 140 134 self.AddControl(self.button_panel) 135 self._bookmark_bt = PlateButton(self, -1, 'bookmark', 136 GUIFRAME_ICON.BOOKMARK_ICON.ConvertToBitmap(), 137 style=PB_STYLE_SQUARE|PB_STYLE_DROPARROW) 138 self._bookmark_bt.Disable() 139 self._bookmark_menu = wx.Menu() 140 id = wx.NewId() 141 self._bookmark_menu.Append(id, 'Add bookmark') 142 self._bookmark_menu.AppendSeparator() 143 wx.EVT_MENU(self, id, self.on_bookmark) 144 145 self._bookmark_bt.SetMenu(self._bookmark_menu) 146 self.AddControl(self._bookmark_bt) 141 147 142 148 self.SetToolBitmapSize(tbar_size) … … 147 153 """ 148 154 if self.parent is not None: 155 149 156 self.parent.Bind(wx.EVT_TOOL, self.parent.on_redo_panel, 150 157 id=GUIFRAME_ID.REDO_ID) 151 158 self.parent.Bind(wx.EVT_TOOL, self.parent.on_undo_panel, 152 159 id=GUIFRAME_ID.UNDO_ID) 153 self.parent.Bind(wx.EVT_TOOL, self.parent.on_bookmark_panel,154 id=GUIFRAME_ID.BOOKMARK_ID)155 160 self.parent.Bind(wx.EVT_TOOL, self.parent.on_save_panel, 156 161 id=GUIFRAME_ID.SAVE_ID) … … 186 191 self.EnableTool(GUIFRAME_ID.ZOOM_IN_ID, False) 187 192 self.EnableTool(GUIFRAME_ID.ZOOM_OUT_ID, False) 188 self.EnableTool(GUIFRAME_ID.BOOKMARK_ID, False)189 193 self.EnableTool(GUIFRAME_ID.PREVIEW_ID, False) 190 194 self.EnableTool(GUIFRAME_ID.SAVE_ID, False) 191 195 self.EnableTool(GUIFRAME_ID.DRAG_ID, False) 192 196 self.EnableTool(GUIFRAME_ID.RESET_ID, False) 197 self._bookmark_bt.Disable() 198 193 199 else: 194 200 self.EnableTool(GUIFRAME_ID.PRINT_ID, panel.get_print_flag()) … … 198 204 self.EnableTool(GUIFRAME_ID.ZOOM_IN_ID, panel.get_zoom_in_flag()) 199 205 self.EnableTool(GUIFRAME_ID.ZOOM_OUT_ID, panel.get_zoom_out_flag()) 200 self.EnableTool(GUIFRAME_ID.BOOKMARK_ID, panel.get_bookmark_flag())201 206 self.EnableTool(GUIFRAME_ID.PREVIEW_ID, panel.get_preview_flag()) 202 207 self.EnableTool(GUIFRAME_ID.SAVE_ID, panel.get_save_flag()) 203 208 self.EnableTool(GUIFRAME_ID.DRAG_ID, panel.get_drag_flag()) 204 209 self.EnableTool(GUIFRAME_ID.RESET_ID, panel.get_reset_flag()) 210 self._bookmark_bt.Enable(panel.get_bookmark_flag()) 205 211 self.Realize() 206 212 … … 230 236 231 237 def enable_bookmark(self, panel): 232 self.EnableTool(GUIFRAME_ID.BOOKMARK_ID, panel.get_bookmark_flag()) 238 flag = panel.get_bookmark_flag() 239 self._bookmark_bt.Enable(flag) 233 240 self.Realize() 234 241 … … 244 251 self.EnableTool(GUIFRAME_ID.PREVIEW_ID, panel.get_preview_flag()) 245 252 self.Realize() 246 247 253 254 def on_bookmark(self, event): 255 """ 256 add book mark 257 """ 258 if self.parent is not None: 259 self.parent.on_bookmark_panel(event) 260 261 def append_bookmark(self, event): 262 """ 263 receive item to append on the toolbar button bookmark 264 """ 265 title = event.title 266 hint = event.hint 267 handler = event.handler 268 id = wx.NewId() 269 self._bookmark_menu.Append(id, str(title), str(hint)) 270 wx.EVT_MENU(self, id, handler) 271
Note: See TracChangeset
for help on using the changeset viewer.