- 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
- Location:
- guiframe
- Files:
-
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/events.py
r03314e7 r4e4d3bb 24 24 ##event for the panel on focus 25 25 (PanelOnFocusEvent, EVT_PANEL_ON_FOCUS) = wx.lib.newevent.NewEvent() 26 #book mark event 27 (AppendBookmarkEvent, EVT_APPEND_BOOKMARK) = wx.lib.newevent.NewEvent() 26 28 -
guiframe/gui_manager.py
r03314e7 r4e4d3bb 38 38 39 39 from sans.guiframe.events import EVT_STATUS 40 from sans.guiframe.events import EVT_APPEND_BOOKMARK 40 41 from sans.guiframe.events import EVT_PANEL_ON_FOCUS 41 42 from sans.guiframe.events import StatusEvent … … 149 150 #Register add extra data on the same panel event on load 150 151 self.Bind(EVT_PANEL_ON_FOCUS, self.set_panel_on_focus) 152 self.Bind(EVT_APPEND_BOOKMARK, self.append_bookmark) 151 153 152 154 def get_toolbar(self): … … 755 757 'Redo the previous action') 756 758 wx.EVT_MENU(self, GUIFRAME_ID.REDO_ID, self.on_redo_panel) 757 self._edit_menu.AppendSeparator()758 self._edit_menu.Append(GUIFRAME_ID.BOOKMARK_ID, '&Bookmark',759 'bookmark current panel')760 wx.EVT_MENU(self, GUIFRAME_ID.BOOKMARK_ID, self.on_bookmark_panel)759 #self._edit_menu.AppendSeparator() 760 #self._edit_menu.Append(GUIFRAME_ID.BOOKMARK_ID, '&Bookmark', 761 # 'bookmark current panel') 762 #wx.EVT_MENU(self, GUIFRAME_ID.BOOKMARK_ID, self.append_bookmark) 761 763 self._edit_menu.Append(GUIFRAME_ID.SAVE_ID, '&Save As', 762 764 'Save current panel into file') … … 1439 1441 flag = self.panel_on_focus.get_redo_flag() 1440 1442 self._edit_menu.Enable(GUIFRAME_ID.REDO_ID, flag) 1441 flag = self.panel_on_focus.get_bookmark_flag()1442 self._edit_menu.Enable(GUIFRAME_ID.BOOKMARK_ID, flag)1443 #flag = self.panel_on_focus.get_bookmark_flag() 1444 #self._edit_menu.Enable(GUIFRAME_ID.BOOKMARK_ID, flag) 1443 1445 flag = self.panel_on_focus.get_save_flag() 1444 1446 self._edit_menu.Enable(GUIFRAME_ID.SAVE_ID, flag) … … 1461 1463 self._edit_menu.Enable(GUIFRAME_ID.UNDO_ID, flag) 1462 1464 self._edit_menu.Enable(GUIFRAME_ID.REDO_ID, flag) 1463 self._edit_menu.Enable(GUIFRAME_ID.BOOKMARK_ID, flag)1465 #self._edit_menu.Enable(GUIFRAME_ID.BOOKMARK_ID, flag) 1464 1466 self._edit_menu.Enable(GUIFRAME_ID.SAVE_ID, flag) 1465 1467 self._edit_menu.Enable(GUIFRAME_ID.PRINT_ID, flag) … … 1487 1489 def on_bookmark_panel(self, event=None): 1488 1490 """ 1491 bookmark panel 1492 """ 1493 if self.panel_on_focus is not None: 1494 self.panel_on_focus.on_bookmark(event) 1495 1496 def append_bookmark(self, event=None): 1497 """ 1489 1498 Bookmark available information of the panel on focus 1490 1499 """ 1491 if self.panel_on_focus is not None: 1492 self.panel_on_focus.on_bookmark(event) 1500 self._toolbar.append_bookmark(event) 1493 1501 1494 1502 def on_save_panel(self, event=None): -
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.