Changeset 6137b150 in sasview
- Timestamp:
- Jun 9, 2010 4:45:37 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:
- 1b43306
- Parents:
- 16f60cb
- Location:
- calculatorview/perspectives/calculator
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
calculatorview/perspectives/calculator/aperture_editor.py
rad6f597 r6137b150 21 21 def __init__(self, parent=None, manager=None,aperture=None, *args, **kwds): 22 22 """ 23 23 Dialog allows to enter values for aperture 24 24 """ 25 25 kwds['size'] =(PANEL_WIDTH, PANEL_HEIGHT) … … 37 37 def _define_structure(self): 38 38 """ 39 39 define initial sizer 40 40 """ 41 41 self.main_sizer = wx.BoxSizer(wx.VERTICAL) … … 52 52 def _layout_name(self): 53 53 """ 54 54 Do the layout for aperture name related widgets 55 55 """ 56 56 #Aperture name [string] … … 61 61 def _layout_type(self): 62 62 """ 63 63 Do the layout for aperture type related widgets 64 64 """ 65 65 #Aperture type [string] … … 71 71 def _layout_distance(self): 72 72 """ 73 73 Do the layout for aperture distance related widgets 74 74 """ 75 75 #Aperture distance [float] … … 84 84 def _layout_size_name(self): 85 85 """ 86 86 Do the layout for size name related widgets 87 87 """ 88 88 # Size name [string] … … 94 94 def _layout_size(self): 95 95 """ 96 96 Do the layout for aperture size related widgets 97 97 """ 98 98 #Aperture size [Vector] … … 118 118 def _layout_button(self): 119 119 """ 120 120 Do the layout for the button widgets 121 121 """ 122 122 self.bt_apply = wx.Button(self, -1,'Apply') … … 134 134 def _do_layout(self, data=None): 135 135 """ 136 136 Draw the current panel 137 137 """ 138 138 self._define_structure() … … 161 161 def set_manager(self, manager): 162 162 """ 163 163 Set manager of this window 164 164 """ 165 165 self.manager = manager … … 167 167 def reset_aperture(self): 168 168 """ 169 169 put the default value of the detector back to the current aperture 170 170 """ 171 171 self._aperture.name = self._reset_aperture.name … … 181 181 def set_values(self): 182 182 """ 183 184 183 take the aperture values of the current data and display them 184 through the panel 185 185 """ 186 186 aperture = self._aperture … … 204 204 def get_aperture(self): 205 205 """ 206 206 return the current aperture 207 207 """ 208 208 return self._aperture … … 210 210 def get_notes(self): 211 211 """ 212 212 return notes 213 213 """ 214 214 return self._notes … … 216 216 def on_change_name(self): 217 217 """ 218 218 Change name 219 219 """ 220 220 #Change the name of the aperture … … 229 229 def on_change_type(self): 230 230 """ 231 231 Change aperture type 232 232 """ 233 233 #Change type … … 239 239 def on_change_distance(self): 240 240 """ 241 241 Change distance of the aperture 242 242 """ 243 243 #Change distance … … 264 264 def on_change_size_name(self): 265 265 """ 266 266 Change the size's name 267 267 """ 268 268 #Change size name … … 274 274 def on_change_size(self): 275 275 """ 276 276 Change aperture size 277 277 """ 278 278 #Change x coordinate … … 330 330 def on_click_apply(self, event): 331 331 """ 332 332 Apply user values to the aperture 333 333 """ 334 334 self.on_change_name() … … 343 343 def on_click_cancel(self, event): 344 344 """ 345 345 reset the current aperture to its initial values 346 346 """ 347 347 self.reset_aperture() -
calculatorview/perspectives/calculator/calculator.py
r91f151a r6137b150 1 """2 This software was developed by the University of Tennessee as part of the3 Distributed Data Analysis of Neutron Scattering Experiments (DANSE)4 project funded by the US National Science Foundation.5 1 6 See the license text in license.txt 7 8 copyright 2010, University of Tennessee 9 """ 2 ################################################################################ 3 #This software was developed by the University of Tennessee as part of the 4 #Distributed Data Analysis of Neutron Scattering Experiments (DANSE) 5 #project funded by the US National Science Foundation. 6 # 7 #See the license text in license.txt 8 # 9 #copyright 2010, University of Tennessee 10 ################################################################################ 10 11 11 12 import wx … … 14 15 class Plugin: 15 16 """ 16 17 17 This class defines the interface for a Plugin class 18 for calculator perspective 18 19 """ 19 20 20 21 def __init__(self, standalone=True): 21 22 """ 22 23 Abstract class for gui_manager Plugins. 23 24 """ 24 25 ## Plug-in name. It will appear on the application menu. … … 36 37 def populate_menu(self, id, owner): 37 38 """ 38 Create and return the list of application menu 39 items for the plug-in. 40 41 @param id: deprecated. Un-used. 42 @param parent: parent window 43 @return: plug-in menu 39 Create and return the list of application menu 40 items for the plug-in. 41 42 :param id: deprecated. Un-used. 43 :param parent: parent window 44 45 :return: plug-in menu 46 44 47 """ 45 48 return [] … … 47 50 def get_panels(self, parent): 48 51 """ 49 Create and return the list of wx.Panels for your plug-in. 50 Define the plug-in perspective. 51 52 Panels should inherit from DefaultPanel defined below, 53 or should present the same interface. They must define 54 "window_caption" and "window_name". 55 56 @param parent: parent window 57 @return: list of panels 52 Create and return the list of wx.Panels for your plug-in. 53 Define the plug-in perspective. 54 55 Panels should inherit from DefaultPanel defined below, 56 or should present the same interface. They must define 57 "window_caption" and "window_name". 58 59 :param parent: parent window 60 61 :return: list of panels 62 58 63 """ 59 64 ## Save a reference to the parent … … 65 70 def help(self, evt): 66 71 """ 67 Show a general help dialog. 68 TODO: replace the text with a nice image 72 Show a general help dialog. 73 74 :TODO: replace the text with a nice image 69 75 provide more hint on the SLD calculator 70 76 """ … … 75 81 def get_context_menu(self, graph=None): 76 82 """ 77 This method is optional. 83 This method is optional. 84 85 When the context menu of a plot is rendered, the 86 get_context_menu method will be called to give you a 87 chance to add a menu item to the context menu. 78 88 79 When the context menu of a plot is rendered, the 80 get_context_menu method will be called to give you a 81 chance to add a menu item to the context menu. 82 83 A ref to a Graph object is passed so that you can 84 investigate the plot content and decide whether you 85 need to add items to the context menu. 86 87 This method returns a list of menu items. 88 Each item is itself a list defining the text to 89 appear in the menu, a tool-tip help text, and a 90 call-back method. 89 A ref to a Graph object is passed so that you can 90 investigate the plot content and decide whether you 91 need to add items to the context menu. 92 93 This method returns a list of menu items. 94 Each item is itself a list defining the text to 95 appear in the menu, a tool-tip help text, and a 96 call-back method. 91 97 92 98 @param graph: the Graph object to which we attach the context menu … … 97 103 def get_perspective(self): 98 104 """ 99 105 Get the list of panel names for this perspective 100 106 """ 101 107 return self.perspective … … 104 110 def get_tools(self): 105 111 """ 106 112 Returns a set of menu entries for tools 107 113 """ 108 114 sld_help = "Provides computation related to Scattering Length Density" … … 111 117 return [("SLD Calculator", sld_help, self.on_calculate_sld), 112 118 ("Slit Size Calculator", slit_length_help, 113 self.on_calculate_slit_size), 114 ("Data Editor", data_editor_help, 115 self.on_edit_data)] 119 self.on_calculate_slit_size)]#, 120 #("Data Editor", data_editor_help, self.on_edit_data)] 116 121 117 122 def on_edit_data(self, event): 118 123 """ 119 124 Edit meta data 120 125 """ 121 126 from data_editor import DataEditorWindow … … 125 130 def on_calculate_sld(self, event): 126 131 """ 127 132 Compute the scattering length density of molecula 128 133 """ 129 134 from sld_panel import SldWindow … … 133 138 def on_calculate_slit_size(self, event): 134 139 """ 135 140 Compute the slit size a given data 136 141 """ 137 142 from slit_length_calculator_panel import SlitLengthCalculatorWindow … … 141 146 def on_perspective(self, event): 142 147 """ 143 Call back function for the perspective menu item. 144 We notify the parent window that the perspective 145 has changed. 146 @param event: menu event 148 Call back function for the perspective menu item. 149 We notify the parent window that the perspective 150 has changed. 151 152 :param event: menu event 153 147 154 """ 148 155 self.parent.set_perspective(self.perspective) … … 151 158 def post_init(self): 152 159 """ 153 160 Post initialization call back to close the loose ends 154 161 """ 155 162 pass -
calculatorview/perspectives/calculator/collimation_editor.py
rc5dca87 r6137b150 22 22 23 23 class CollimationDialog(wx.Dialog): 24 """ 25 """ 24 26 def __init__(self, parent=None, manager=None, 25 27 collimation=[], *args, **kwds): … … 40 42 def _define_structure(self): 41 43 """ 42 44 define initial sizer 43 45 """ 44 46 self.main_sizer = wx.BoxSizer(wx.VERTICAL) … … 63 65 def _layout_collimation(self): 64 66 """ 65 67 Do the layout for collimation related widgets 66 68 """ 67 69 collimation_name_txt = wx.StaticText(self, -1, "Collimation:") … … 97 99 def _layout_name(self): 98 100 """ 99 101 Do the layout for collimation name related widgets 100 102 """ 101 103 #Collimation name [string] … … 107 109 def _layout_length(self): 108 110 """ 109 111 Do the layout for length related widgets 110 112 """ 111 113 #Collimation length … … 121 123 def _layout_button(self): 122 124 """ 123 125 Do the layout for the button widgets 124 126 """ 125 127 self.bt_apply = wx.Button(self, -1,'Apply') … … 136 138 def _layout_aperture(self): 137 139 """ 138 140 Do the layout for aperture related widgets 139 141 """ 140 142 aperture_name_txt = wx.StaticText(self, -1, "Aperture:") … … 170 172 def _do_layout(self, data=None): 171 173 """ 172 174 Draw the current panel 173 175 """ 174 176 self._define_structure() … … 206 208 def fill_collimation_combox(self): 207 209 """ 208 210 fill the current combobox with the available collimation 209 211 """ 210 212 if self._collimation is None or self._collimation == []: … … 218 220 def add_collimation(self, event): 219 221 """ 220 222 Append empty collimation to data's list of collimation 221 223 """ 222 224 … … 236 238 def remove_collimation(self, event): 237 239 """ 238 240 Remove collimation to data's list of collimation 239 241 """ 240 242 if self.collimation_cbox.IsEnabled(): … … 263 265 def on_select_collimation(self, event): 264 266 """ 265 267 fill the control on the panel according to the current selected collimation 266 268 """ 267 269 self.set_values() … … 271 273 def enable_collimation(self): 272 274 """ 273 275 Enable /disable widgets related to collimation 274 276 """ 275 277 if self._collimation is not None and self.collimation_cbox.GetCount() > 0: … … 291 293 def reset_collimation_combobox(self, edited_collimation): 292 294 """ 293 295 take all edited editor and reset clientdata of collimation combo box 294 296 """ 295 297 for position in range(self.collimation_cbox.GetCount()): … … 303 305 def add_aperture(self, event): 304 306 """ 305 307 Append empty aperture to data's list of aperture 306 308 """ 307 309 collimation, _, _ = self.get_current_collimation() … … 317 319 def edit_aperture(self, event): 318 320 """ 319 321 Edit the selected aperture 320 322 """ 321 323 if self._collimation is None or not self.aperture_cbox.IsEnabled(): … … 331 333 def remove_aperture(self, event): 332 334 """ 333 335 Remove aperture to data's list of aperture 334 336 """ 335 337 if self._collimation is None or not self._collimation: … … 354 356 def set_aperture(self, aperture): 355 357 """ 356 358 set aperture for data 357 359 """ 358 360 if self._collimation is None or not self._collimation: … … 368 370 def enable_aperture(self): 369 371 """ 370 372 Enable /disable widgets crelated to aperture 371 373 """ 372 374 collimation, _, _ = self.get_current_collimation() … … 390 392 def reset_aperture_combobox(self, edited_aperture): 391 393 """ 392 394 take all edited editor and reset clientdata of aperture combo box 393 395 """ 394 396 for position in range(self.aperture_cbox.GetCount()): … … 402 404 def fill_aperture_combox(self): 403 405 """ 404 406 fill the current combobox with the available aperture 405 407 """ 406 408 self.aperture_cbox.Clear() … … 416 418 def set_manager(self, manager): 417 419 """ 418 420 Set manager of this window 419 421 """ 420 422 self.manager = manager … … 422 424 def set_values(self): 423 425 """ 424 425 426 take the collimation values of the current data and display them 427 through the panel 426 428 """ 427 429 collimation, _, _ = self.get_current_collimation() … … 441 443 def get_collimation(self): 442 444 """ 443 445 return the current collimation 444 446 """ 445 447 return self._collimation … … 447 449 def get_notes(self): 448 450 """ 449 451 return notes 450 452 """ 451 453 return self._notes … … 453 455 def on_change_name(self): 454 456 """ 455 457 Change name 456 458 """ 457 459 collimation, collimation_name, position = self.get_current_collimation() … … 472 474 def on_change_length(self): 473 475 """ 474 476 Change the length 475 477 """ 476 478 collimation, collimation_name, position = self.get_current_collimation() … … 501 503 def on_click_apply(self, event): 502 504 """ 503 505 Apply user values to the collimation 504 506 """ 505 507 self.on_change_name() … … 511 513 def on_click_cancel(self, event): 512 514 """ 513 515 leave the collimation as it is and close 514 516 """ 515 517 self._collimation = deepcopy(self._reset_collimation)
Note: See TracChangeset
for help on using the changeset viewer.