Changeset d7a39e5 in sasview for invariantview/perspectives/invariant/invariant.py
- Timestamp:
- Jun 3, 2010 1:09:19 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:
- 7e4a6ff
- Parents:
- d955bf19
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
invariantview/perspectives/invariant/invariant.py
r8f2069d5 rd7a39e5 1 """ 2 This software was developed by the University of Tennessee as part of the 3 Distributed Data Analysis of Neutron Scattering Experiments (DANSE) 4 project funded by the US National Science Foundation. 5 6 See the license text in license.txt 7 8 copyright 2009, University of Tennessee 9 """ 1 2 3 4 ################################################################################ 5 #This software was developed by the University of Tennessee as part of the 6 #Distributed Data Analysis of Neutron Scattering Experiments (DANSE) 7 #project funded by the US National Science Foundation. 8 # 9 #See the license text in license.txt 10 # 11 #copyright 2009, University of Tennessee 12 ################################################################################ 13 10 14 import wx 11 15 … … 17 21 from sans.guicomm.events import NewPlotEvent, StatusEvent 18 22 from sans.guicomm.events import ERR_DATA 23 19 24 class Plugin: 20 25 """ 21 22 26 This class defines the interface for invariant Plugin class 27 that can be used by the gui_manager. 23 28 24 29 """ … … 26 31 def __init__(self, standalone=False): 27 32 """ 28 33 Abstract class for gui_manager Plugins. 29 34 """ 30 35 ## Plug-in name. It will appear on the application menu. … … 41 46 def populate_menu(self, id, parent): 42 47 """ 43 Create and return the list of application menu 44 items for the plug-in. 45 46 @param id: deprecated. Un-used. 47 @param parent: parent window 48 @return: plug-in menu 48 Create and return the list of application menu 49 items for the plug-in. 50 51 :param id: deprecated. Un-used. 52 :param parent: parent window 53 54 :return: plug-in menu 55 49 56 """ 50 57 return [] … … 52 59 def help(self, evt): 53 60 """ 54 Show a general help dialog. 55 TODO: replace the text with a nice image 56 provide more hint on the SLD calculator 61 Show a general help dialog. 62 57 63 """ 58 64 from help_panel import HelpWindow … … 62 68 def get_panels(self, parent): 63 69 """ 64 Create and return the list of wx.Panels for your plug-in. 65 Define the plug-in perspective. 66 67 Panels should inherit from DefaultPanel defined below, 68 or should present the same interface. They must define 69 "window_caption" and "window_name". 70 71 @param parent: parent window 72 @return: list of panels 70 Create and return the list of wx.Panels for your plug-in. 71 Define the plug-in perspective. 72 73 Panels should inherit from DefaultPanel defined below, 74 or should present the same interface. They must define 75 "window_caption" and "window_name". 76 77 :param parent: parent window 78 79 :return: list of panels 80 73 81 """ 74 82 ## Save a reference to the parent … … 85 93 def get_tools(self): 86 94 """ 87 95 Returns a set of menu entries for tools 88 96 """ 89 97 return [] … … 92 100 def get_context_menu(self, graph=None): 93 101 """ 94 This method is optional. 95 96 When the context menu of a plot is rendered, the 97 get_context_menu method will be called to give you a 98 chance to add a menu item to the context menu. 99 100 A ref to a Graph object is passed so that you can 101 investigate the plot content and decide whether you 102 need to add items to the context menu. 103 104 This method returns a list of menu items. 105 Each item is itself a list defining the text to 106 appear in the menu, a tool-tip help text, and a 107 call-back method. 108 109 @param graph: the Graph object to which we attach the context menu 110 @return: a list of menu items with call-back function 102 This method is optional. 103 104 When the context menu of a plot is rendered, the 105 get_context_menu method will be called to give you a 106 chance to add a menu item to the context menu. 107 108 A ref to a Graph object is passed so that you can 109 investigate the plot content and decide whether you 110 need to add items to the context menu. 111 112 This method returns a list of menu items. 113 Each item is itself a list defining the text to 114 appear in the menu, a tool-tip help text, and a 115 call-back method. 116 117 :param graph: the Graph object to which we attach the context menu 118 119 :return: a list of menu items with call-back function 120 111 121 """ 112 122 self.graph = graph … … 127 137 def get_perspective(self): 128 138 """ 129 139 Get the list of panel names for this perspective 130 140 """ 131 141 return self.perspective … … 133 143 def on_perspective(self, event): 134 144 """ 135 Call back function for the perspective menu item. 136 We notify the parent window that the perspective 137 has changed. 138 @param event: menu event 145 Call back function for the perspective menu item. 146 We notify the parent window that the perspective 147 has changed. 148 149 :param event: menu event 150 139 151 """ 140 152 self.parent.set_perspective(self.perspective) … … 142 154 def post_init(self): 143 155 """ 144 156 Post initialization call back to close the loose ends 145 157 """ 146 158 pass … … 148 160 def set_default_perspective(self): 149 161 """ 150 151 152 153 162 Call back method that True to notify the parent that the current plug-in 163 can be set as default perspective. 164 when returning False, the plug-in is not candidate for an automatic 165 default perspective setting 154 166 """ 155 167 return False … … 157 169 def copy_data(self, item, dy=None): 158 170 """ 159 160 161 @param return171 receive a data 1D and the list of errors on dy 172 and create a new data1D data 173 162 174 """ 163 175 id = None … … 179 191 def _on_data_error(self, event): 180 192 """ 181 182 193 receives and event from plotting plu-gins to store the data name and 194 their errors of y coordinates for 1Data hide and show error 183 195 """ 184 196 self.err_dy = event.err_dy … … 186 198 def _compute_invariant(self, event): 187 199 """ 188 200 Open the invariant panel to invariant computation 189 201 """ 190 202 self.panel = event.GetEventObject() … … 208 220 def plot_theory(self, data=None, name=None): 209 221 """ 210 Receive a data set and post a NewPlotEvent to parent. 211 @param data: extrapolated data to be plotted 212 @param name: Data's name to use for the legend 222 Receive a data set and post a NewPlotEvent to parent. 223 224 :param data: extrapolated data to be plotted 225 :param name: Data's name to use for the legend 226 213 227 """ 214 228 if data is None: … … 235 249 def plot_data(self, scale, background): 236 250 """ 237 251 replot the current data if the user enters a new scale or background 238 252 """ 239 253 new_plot = scale * self.__data - background
Note: See TracChangeset
for help on using the changeset viewer.