Changeset ad6f597 in sasview for calculatorview/perspectives/calculator/collimation_editor.py
- Timestamp:
- May 4, 2010 12:51:49 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:
- 85e665e
- Parents:
- 90b23e1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
calculatorview/perspectives/calculator/collimation_editor.py
r91f151a rad6f597 11 11 12 12 if sys.platform.count("win32")>0: 13 _STATICBOX_WIDTH = 45013 _STATICBOX_WIDTH = 500 14 14 PANEL_WIDTH = 530 15 15 PANEL_HEIGHT = 430 16 16 FONT_VARIANT = 0 17 17 else: 18 _STATICBOX_WIDTH = 48018 _STATICBOX_WIDTH = 550 19 19 PANEL_WIDTH = 600 20 20 PANEL_HEIGHT = 480 … … 24 24 def __init__(self, parent=None, manager=None, 25 25 collimation=[], *args, **kwds): 26 try: 27 kwds['size'] =(PANEL_WIDTH, PANEL_HEIGHT) 28 kwds['title'] = "Collimation Editor" 29 wx.Dialog.__init__(self, parent=parent, *args, **kwds) 30 self.parent = parent 31 self.manager = manager 32 self._collimation = collimation 33 self._reset_collimation = deepcopy(collimation) 34 self._notes = "" 35 self._description = "Edit collimation" 36 self._do_layout() 37 self.set_values() 38 except: 39 print "error", sys.exc_value 40 26 """ 27 """ 28 kwds['size'] =(PANEL_WIDTH, PANEL_HEIGHT) 29 kwds['title'] = "Collimation Editor" 30 wx.Dialog.__init__(self, parent=parent, *args, **kwds) 31 self.parent = parent 32 self.manager = manager 33 self._collimation = collimation 34 self._reset_collimation = deepcopy(collimation) 35 self._notes = "" 36 self._description = "Edit collimation" 37 self._do_layout() 38 self.set_values() 39 41 40 def _define_structure(self): 42 41 """ … … 49 48 collimation_box = wx.StaticBox(self, -1, "Edit Number of Collimations") 50 49 self.collimation_sizer = wx.StaticBoxSizer(collimation_box, wx.VERTICAL) 50 self.collimation_sizer.SetMinSize((_STATICBOX_WIDTH, -1)) 51 51 self.collimation_button_sizer = wx.BoxSizer(wx.HORIZONTAL) 52 52 self.collimation_hint_sizer = wx.BoxSizer(wx.HORIZONTAL) … … 228 228 self.collimation_cbox.SetSelection(position) 229 229 self.enable_collimation() 230 self.bt_add_aperture.Enable() 230 231 231 232 def remove_collimation(self, event): … … 234 235 """ 235 236 if self.collimation_cbox.IsEnabled(): 236 if self.collimation_cbox.GetCount() > 1:237 if self.collimation_cbox.GetCount() > 0: 237 238 position = self.collimation_cbox.GetCurrentSelection() 238 239 collimation = self.collimation_cbox.GetClientData(position) … … 258 259 n_collimation = self.collimation_cbox.GetCount() 259 260 collimation_hint_txt = 'collimations available: %s '%str(n_collimation) 260 if len(self._collimation) > 1:261 if len(self._collimation) > 0: 261 262 self.bt_remove_collimation.Enable() 262 263 else: … … 265 266 self.collimation_cbox.Disable() 266 267 self.bt_remove_collimation.Disable() 268 self.bt_add_aperture.Disable() 267 269 collimation_hint_txt = 'No collimation is available for this data.' 268 270 self.collimation_txt.SetLabel(collimation_hint_txt) … … 313 315 Remove aperture to data's list of aperture 314 316 """ 315 if self._collimation is None :317 if self._collimation is None or not self._collimation: 316 318 return 317 319 collimation, _, _ = self.get_current_collimation() … … 336 338 set aperture for data 337 339 """ 338 if self._collimation is None :340 if self._collimation is None or not self._collimation: 339 341 return 340 342 collimation, _, _ = self.get_current_collimation() … … 345 347 self.reset_aperture_combobox(edited_aperture=aperture) 346 348 return 349 347 350 def enable_aperture(self): 348 351 """ … … 406 409 collimation, _, _ = self.get_current_collimation() 407 410 if collimation is None: 411 self.bt_add_aperture.Disable() 412 self.length_tcl.SetValue("") 413 self.name_tcl.SetValue("") 414 self.length_unit_tcl.SetValue("") 408 415 return 409 416 #Name … … 488 495 leave the collimation as it is and close 489 496 """ 490 self. reset_collimation()497 self._collimation = deepcopy(self._reset_collimation) 491 498 self.set_values() 492 499 if self.manager is not None: … … 497 504 498 505 app = wx.App() 499 # Instantiate a loader 500 loader = Loader() 501 # Load data 502 data = loader.load("MAR07232_rest.ASC") 503 dlg = CollimationDialog(collimation=data.collimation) 506 507 dlg = CollimationDialog(collimation=[Collimation()]) 504 508 dlg.ShowModal() 505 509 app.MainLoop()
Note: See TracChangeset
for help on using the changeset viewer.