Changeset ad6f597 in sasview for calculatorview/perspectives
- 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
- Location:
- calculatorview/perspectives/calculator
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
calculatorview/perspectives/calculator/aperture_editor.py
r91f151a rad6f597 20 20 class ApertureDialog(wx.Dialog): 21 21 def __init__(self, parent=None, manager=None,aperture=None, *args, **kwds): 22 try:23 kwds['size'] =(PANEL_WIDTH, PANEL_HEIGHT)24 kwds['title'] = "Aperture Editor"25 wx.Dialog.__init__(self, parent=parent, *args, **kwds)26 self.parent = parent27 self.manager = manager28 self._aperture = aperture29 self._reset_aperture = deepcopy(aperture)30 self._notes = ""31 self_description = "Edit aperture"32 self._do_layout()33 self.set_values()34 except:35 print "error", sys.exc_value36 22 """ 23 Dialog allows to enter values for aperture 24 """ 25 kwds['size'] =(PANEL_WIDTH, PANEL_HEIGHT) 26 kwds['title'] = "Aperture Editor" 27 wx.Dialog.__init__(self, parent=parent, *args, **kwds) 28 self.parent = parent 29 self.manager = manager 30 self._aperture = aperture 31 self._reset_aperture = deepcopy(aperture) 32 self._notes = "" 33 self_description = "Edit aperture" 34 self._do_layout() 35 self.set_values() 36 37 37 def _define_structure(self): 38 38 """ … … 316 316 self._notes += "%s to %s \n"%(self._aperture.size.z, 317 317 z_aperture_size) 318 self._aperture. aperture_size.z = float(z_aperture_size)318 self._aperture.size.z = float(z_aperture_size) 319 319 else: 320 320 self._notes += "Error: Expected a float for the offset 's x " … … 356 356 loader = Loader() 357 357 # Load data 358 data = loader.load("MAR07232_rest.ASC") 359 360 if len(data.collimation) == 0: 361 from DataLoader.data_info import Collimation 362 collimation = Collimation() 363 from DataLoader.data_info import Aperture 364 aperture = Aperture() 365 dlg = ApertureDialog(aperture=aperture) 366 dlg.ShowModal() 367 else: 368 for collimation in data.collimation: 369 for aperture in collimation: 370 dlg = ApertureDialog(aperture=aperture) 371 dlg.ShowModal() 372 break 358 from DataLoader.data_info import Aperture 359 aperture = Aperture() 360 dlg = ApertureDialog(aperture=aperture) 361 dlg.ShowModal() 373 362 app.MainLoop() 374 363 -
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() -
calculatorview/perspectives/calculator/detector_editor.py
r91f151a rad6f597 3 3 import sys 4 4 from copy import deepcopy 5 from DataLoader.loader import Loader6 5 from DataLoader.data_info import Detector 7 6 from sans.guiframe.utils import check_float … … 15 14 else: 16 15 _STATICBOX_WIDTH = 480 17 PANEL_WIDTH = 5 3018 PANEL_HEIGHT = 4 5016 PANEL_WIDTH = 550 17 PANEL_HEIGHT = 480 19 18 FONT_VARIANT = 1 20 19 … … 805 804 if __name__ == "__main__": 806 805 app = wx.App() 807 # Instantiate a loader 808 loader = Loader() 809 # Load data 810 output = loader.load("MAR07232_rest.ASC") 811 dlg = DetectorDialog(detector=output.detector) 806 detector = Detector() 807 dlg = DetectorDialog(detector=[detector]) 812 808 dlg.ShowModal() 813 809 app.MainLoop() -
calculatorview/perspectives/calculator/sample_editor.py
r91f151a rad6f597 3 3 import sys 4 4 from copy import deepcopy 5 from DataLoader.loader import Loader6 5 from sans.guiframe.utils import check_float 7 6 … … 14 13 else: 15 14 _STATICBOX_WIDTH = 480 16 PANEL_WIDTH = 5 3015 PANEL_WIDTH = 550 17 16 PANEL_HEIGHT = 430 18 17 FONT_VARIANT = 1 … … 519 518 520 519 app = wx.App() 521 # Instantiate a loader 522 loader = Loader() 523 # Load data 524 data = loader.load("MAR07232_rest.ASC") 525 #print output 526 dlg = SampleDialog(sample=data.sample) 520 from DataLoader.data_info import Sample 521 sample = Sample() 522 dlg = SampleDialog(sample=sample) 527 523 dlg.ShowModal() 528 #print dlg.get_sample()529 524 app.MainLoop() 530 525 -
calculatorview/perspectives/calculator/source_editor.py
r91f151a rad6f597 3 3 import sys 4 4 from copy import deepcopy 5 from DataLoader.loader import Loader6 5 from sans.guiframe.utils import check_float 7 6 _BOX_WIDTH = 60 … … 14 13 else: 15 14 _STATICBOX_WIDTH = 480 16 PANEL_WIDTH = 5 3015 PANEL_WIDTH = 550 17 16 PANEL_HEIGHT = 430 18 17 FONT_VARIANT = 1 … … 21 20 def __init__(self, parent=None, manager=None, source=None, *args, **kwds): 22 21 kwds['title'] = "Source Editor" 23 kwds['size'] = (PANEL_WIDTH, PANEL_HEIGHT)22 kwds['size'] = (PANEL_WIDTH, PANEL_HEIGHT) 24 23 wx.Dialog.__init__(self, parent=parent, *args, **kwds) 25 24 … … 497 496 if __name__ =="__main__": 498 497 app = wx.App() 499 # Instantiate a loader 500 loader = Loader() 501 # Load data 502 data = loader.load("MAR07232_rest.ASC") 503 dlg = SourceDialog(source=data.source) 498 from DataLoader.data_info import Source 499 source = Source() 500 dlg = SourceDialog(source=source) 504 501 dlg.ShowModal() 505 502 app.MainLoop()
Note: See TracChangeset
for help on using the changeset viewer.