Changeset 03314e7 in sasview
- Timestamp:
- Feb 11, 2011 6:53:48 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:
- 44ad7f5
- Parents:
- 229da98
- Location:
- guiframe
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/events.py
r52b8b74 r03314e7 24 24 ##event for the panel on focus 25 25 (PanelOnFocusEvent, EVT_PANEL_ON_FOCUS) = wx.lib.newevent.NewEvent() 26 # event to update state of each perspectives after state file is loaded 27 (InvStateUpdateEvent, EVT_INVSTATE_UPDATE) = wx.lib.newevent.NewEvent() 28 (FitStateUpdateEvent, EVT_FITSTATE_UPDATE) = wx.lib.newevent.NewEvent() 26 -
guiframe/gui_manager.py
reec8dbb r03314e7 149 149 #Register add extra data on the same panel event on load 150 150 self.Bind(EVT_PANEL_ON_FOCUS, self.set_panel_on_focus) 151 152 151 152 def get_toolbar(self): 153 """ 154 """ 155 return self._toolbar 156 153 157 def set_panel_on_focus(self, event): 154 158 """ … … 163 167 panel_name = self.panel_on_focus.window_caption 164 168 self._data_panel.set_panel_on_focus(panel_name) 165 #update toolbar166 self._update_toolbar_helper()167 #update edit menu168 self.enable_edit_menu()169 #update toolbar 170 self._update_toolbar_helper() 171 #update edit menu 172 self.enable_edit_menu() 169 173 170 174 def build_gui(self): … … 932 936 return new_plot 933 937 934 def get_data(self, path , format=None):938 def get_data(self, path): 935 939 """ 936 940 """ … … 949 953 message=log_msg, path=path) 950 954 return 951 try: 952 #reading a state file 953 for plug in self.plugins: 954 reader, ext = plug.get_extensions() 955 if reader is not None: 956 #read the state of the single plugin 957 if extension == ext: 958 reader.read(path) 959 return 960 elif extension == '.svs': 961 reader.read(path) 962 except: 963 raise 964 965 def load_update(self, output=None, message=""): 966 """ 967 print update on the status bar 968 """ 969 if message != "": 970 wx.PostEvent(self, StatusEvent(status=message, 971 type="progress", 972 info="warning")) 973 974 def load_complete(self, output, message="", error_message="", 975 extension=None, path=None): 976 """ 977 post message to status bar and return list of data 978 """ 979 wx.PostEvent(self, StatusEvent(status=message, 980 info="warning", 981 type="stop")) 982 if error_message != "": 983 self.load_error(error_message) 984 #send a list of available data to plotting plugin 985 available_data = [] 986 if self._data_manager is not None: 987 self._data_manager.add_data(output) 988 temp = self._data_manager.get_selected_data() 989 for data_state in temp.values(): 990 available_data.append(data_state.data) 955 991 956 #reading a state file 992 957 for plug in self.plugins: 993 #plug.on_set_state_helper(event=None) 994 _, ext = plug.get_extensions() 995 plug.set_state(state=None, datainfo=available_data) 996 997 958 reader, ext = plug.get_extensions() 959 if reader is not None: 960 #read the state of the single plugin 961 if extension == ext: 962 reader.read(path) 963 return 964 elif extension == '.svs': 965 reader.read(path) 966 998 967 style = self.__gui_style & GUIFRAME.MANAGER_ON 999 968 if style == GUIFRAME.MANAGER_ON: … … 1002 971 self._data_panel.load_data_list(data_state) 1003 972 self._mgr.GetPane(self._data_panel.window_name).Show(True) 1004 973 1005 974 def _on_open_state(self, event): 1006 975 """ … … 1028 997 if basename.endswith('.svs'): 1029 998 #remove panels for new states 1030 for item in self.panels: 1031 try: 1032 self.panels[item].clear_panel() 1033 except: 1034 pass 999 for plug in self.plugins: 1000 plug.clear_panel() 1001 self.panel_on_focus = None 1002 1035 1003 self.get_data(path) 1036 1004 … … 1579 1547 if self.panel_on_focus is not None: 1580 1548 self.panel_on_focus.on_reset(event) 1549 1550 def enable_undo(self): 1551 """ 1552 enable undo related control 1553 """ 1554 if self.panel_on_focus is not None: 1555 self._toolbar.enable_undo(self.panel_on_focus) 1556 1557 def enable_redo(self): 1558 """ 1559 enable redo 1560 """ 1561 if self.panel_on_focus is not None: 1562 self._toolbar.enable_redo(self.panel_on_focus) 1563 1564 def enable_bookmark(self): 1565 """ 1566 Bookmark 1567 """ 1568 if self.panel_on_focus is not None: 1569 self._toolbar.enable_bookmark(self.panel_on_focus) 1570 1571 def enable_save(self): 1572 """ 1573 save 1574 """ 1575 if self.panel_on_focus is not None: 1576 self._toolbar.enable_save(self.panel_on_focus) 1577 1578 def enable_preview(self): 1579 """ 1580 preview 1581 """ 1582 if self.panel_on_focus is not None: 1583 self._toolbar.enable_preview(self.panel_on_focus) 1584 1585 def enable_print(self): 1586 """ 1587 print 1588 """ 1589 if self.panel_on_focus is not None: 1590 self._toolbar.enable_print(self.panel_on_focus) 1591 1592 def enable_zoom(self): 1593 """ 1594 zoom 1595 """ 1596 if self.panel_on_focus is not None: 1597 self._toolbar.enable_zoom(self.panel_on_focus) 1598 1599 def enable_zoom_in(self): 1600 """ 1601 zoom in 1602 """ 1603 if self.panel_on_focus is not None: 1604 self._toolbar.enable_zoom_in(self.panel_on_focus) 1605 1606 def enable_zoom_out(self): 1607 """ 1608 zoom out 1609 """ 1610 if self.panel_on_focus is not None: 1611 self._toolbar.enable_zoom_out(self.panel_on_focus) 1612 1613 def enable_drag(self, event=None): 1614 """ 1615 drag 1616 """ 1617 if self.panel_on_focus is not None: 1618 self._toolbar.enable_drag(self.panel_on_focus) 1619 1620 def enable_reset(self): 1621 """ 1622 reset the current panel 1623 """ 1624 if self.panel_on_focus is not None: 1625 self._toolbar.enable_reset(self.panel_on_focus) 1581 1626 1582 1627 class DefaultPanel(wx.Panel, PanelBase): -
guiframe/gui_toolbar.py
r568658b r03314e7 196 196 self.EnableTool(GUIFRAME_ID.RESET_ID, panel.get_reset_flag()) 197 197 self.Realize() 198 198 199 def enable_undo(self, panel): 200 self.EnableTool(GUIFRAME_ID.PRINT_ID, panel.get_print_flag()) 201 self.Realize() 202 203 def enable_redo(self, panel): 204 self.EnableTool(GUIFRAME_ID.REDO_ID, panel.get_redo_flag()) 205 self.Realize() 206 207 def enable_print(self, panel): 208 self.EnableTool(GUIFRAME_ID.PRINT_ID, panel.get_print_flag()) 209 self.Realize() 210 211 def enable_zoom(self, panel): 212 self.EnableTool(GUIFRAME_ID.ZOOM_ID, panel.get_zoom_flag()) 213 self.Realize() 214 215 def enable_zoom_in(self, panel): 216 self.EnableTool(GUIFRAME_ID.ZOOM_IN_ID, panel.get_zoom_in_flag()) 217 self.Realize() 218 219 def enable_zoom_out(self, panel): 220 self.EnableTool(GUIFRAME_ID.ZOOM_OUT_ID, panel.get_zoom_out_flag()) 221 self.Realize() 222 223 def enable_bookmark(self, panel): 224 self.EnableTool(GUIFRAME_ID.BOOKMARK_ID, panel.get_bookmark_flag()) 225 self.Realize() 226 227 def enable_save(self, panel): 228 self.EnableTool(GUIFRAME_ID.SAVE_ID, panel.get_save_flag()) 229 self.Realize() 230 231 def enable_reset(self, panel): 232 self.EnableTool(GUIFRAME_ID.RESET_ID, panel.get_reset_flag()) 233 self.Realize() 234 235 def enable_preview(self, panel): 236 self.EnableTool(GUIFRAME_ID.PREVIEW_ID, panel.get_preview_flag()) 237 self.Realize() 199 238 200 239 -
guiframe/panel_base.py
rd20771f r03314e7 10 10 #copyright 2008, University of Tennessee 11 11 ################################################################################ 12 12 13 13 14 from sans.guiframe.events import PanelOnFocusEvent … … 32 33 #panel manager 33 34 self._manager = None 34 35 self.parent = parent 35 36 self._print_flag = False 36 37 self._undo_flag = False … … 44 45 self._drag_flag = False 45 46 self._reset_flag = False 46 self.parent = parent 47 self._has_changed = False 48 47 49 self.Bind(wx.EVT_LEFT_DOWN, self.on_set_focus) 48 50 self.Bind(wx.EVT_TEXT_ENTER, self.on_set_focus) 49 51 self.Bind(wx.EVT_MIDDLE_DOWN, self.on_set_focus) 50 52 self.Bind(wx.EVT_RIGHT_DOWN, self.on_set_focus) 51 53 54 def has_changed(self): 55 """ 56 """ 57 return self._has_changed 58 52 59 def _set_print_flag(self, flag=True): 53 60 """ … … 55 62 be printed 56 63 """ 64 if flag == self._print_flag: 65 self._has_changed = False 66 return 67 self._has_changed = True 57 68 self._print_flag = flag 58 self.on_set_focus(event=None) 59 69 if self._manager is not None and self._manager.parent is not None: 70 self._manager.parent.enable_print() 71 60 72 def get_print_flag(self): 61 73 """ … … 69 81 current action done can be canceled 70 82 """ 83 if flag == self._undo_flag: 84 self._has_changed = False 85 return 86 self._has_changed = True 71 87 self._undo_flag = flag 72 self.on_set_focus(event=None) 73 88 if self._manager is not None and self._manager.parent is not None: 89 self._manager.parent.enable_undo() 90 74 91 def get_undo_flag(self): 75 92 """ … … 83 100 action done can be recovered 84 101 """ 102 if flag == self._redo_flag: 103 self._has_changed = False 104 return 105 self._has_changed = True 85 106 self._redo_flag = flag 86 self.on_set_focus(event=None) 87 107 if self._manager is not None and self._manager.parent is not None: 108 self._manager.parent.enable_redo() 109 88 110 def get_redo_flag(self): 89 111 """ … … 91 113 """ 92 114 return self._redo_flag 93 94 115 95 116 def _set_zoomed_in_flag(self, flag=True): … … 98 119 can be zoomed in 99 120 """ 121 if self._zoom_in_flag == flag: 122 self._has_changed = False 123 return 124 self._has_changed = True 100 125 self._zoom_in_flag = flag 101 self.on_set_focus(event=None)102 103 126 if self._manager is not None and self._manager.parent is not None: 127 self._manager.parent.enable_zoom_in() 128 104 129 def get_zoom_in_flag(self): 105 130 """ … … 113 138 can be zoomed out 114 139 """ 140 if self._zoom_out_flag == flag: 141 self._has_changed = False 142 return 143 self._has_changed = True 115 144 self._zoom_out_flag = flag 116 self.on_set_focus(event=None) 145 if self._manager is not None and self._manager.parent is not None: 146 self._manager.parent.enable_zoom_out() 117 147 118 148 def get_zoom_out_flag(self): … … 127 157 can be zoomed 128 158 """ 159 if flag == self._zoom_flag: 160 self._has_changed = False 161 return 162 self._has_changed = True 129 163 self._zoom_flag = flag 130 self.on_set_focus(event=None) 131 164 if self._manager is not None and self._manager.parent is not None: 165 self._manager.parent.enable_zoom() 166 132 167 def get_zoom_flag(self): 133 168 """ … … 141 176 can be bookmarked 142 177 """ 178 if flag == self._bookmark_flag: 179 self._has_changed = False 180 return 181 self._has_changed = True 143 182 self._bookmark_flag = flag 144 self.on_set_focus(event=None) 183 if self._manager is not None and self._manager.parent is not None: 184 self._manager.parent.enable_bookmark() 145 185 146 186 def get_bookmark_flag(self): … … 155 195 can be previewed 156 196 """ 197 if flag == self._preview_flag: 198 self._has_changed = False 199 return 200 self._has_changed = True 157 201 self._preview_flag = flag 158 self.on_set_focus(event=None) 159 202 if self._manager is not None and self._manager.parent is not None: 203 self._manager.parent.enable_preview() 204 160 205 def get_preview_flag(self): 161 206 """ … … 169 214 can be saved 170 215 """ 216 if flag == self._save_flag: 217 self._has_changed = False 218 return 219 self._has_changed = True 171 220 self._save_flag = flag 172 self.on_set_focus(event=None) 221 if self._manager is not None and self._manager.parent is not None: 222 self._manager.parent.enable_save() 173 223 174 224 def get_save_flag(self): … … 183 233 dragging motion is possible 184 234 """ 235 if self._drag_flag == flag: 236 self._has_changed = False 237 return 238 self._has_changed = True 185 239 self._drag_flag = flag 240 if self._manager is not None and self._manager.parent is not None: 241 self._manager.parent.enable_drag() 186 242 187 243 def get_drag_flag(self): … … 196 252 can be reset 197 253 """ 254 if self._reset_flag == flag: 255 self._has_changed = False 256 return 257 self._has_changed = True 198 258 self._reset_flag = flag 259 if self._manager is not None and self._manager.parent is not None: 260 self._manager.parent.enable_reset() 199 261 200 262 def get_reset_flag(self): -
guiframe/plugin_base.py
r75fbd17 r03314e7 48 48 self.perspective = [] 49 49 50 def clear_panel(self): 51 """ 52 clear all related panels 53 """ 50 54 def get_extensions(self): 51 55 """
Note: See TracChangeset
for help on using the changeset viewer.