Changeset ad6f597 in sasview for calculatorview/perspectives


Ignore:
Timestamp:
May 4, 2010 12:51:49 PM (14 years ago)
Author:
Gervaise Alina <gervyh@…>
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
Message:

working on data editor

Location:
calculatorview/perspectives/calculator
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • calculatorview/perspectives/calculator/aperture_editor.py

    r91f151a rad6f597  
    2020class ApertureDialog(wx.Dialog): 
    2121    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 = parent 
    27             self.manager = manager 
    28             self._aperture = aperture 
    29             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_value 
    36          
     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       
    3737    def _define_structure(self): 
    3838        """ 
     
    316316                    self._notes += "%s to %s \n"%(self._aperture.size.z, 
    317317                                                   z_aperture_size) 
    318                     self._aperture.aperture_size.z  = float(z_aperture_size) 
     318                    self._aperture.size.z  = float(z_aperture_size) 
    319319            else: 
    320320                self._notes += "Error: Expected a float for the offset 's x " 
     
    356356    loader = Loader() 
    357357    # 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() 
    373362    app.MainLoop() 
    374363  
  • calculatorview/perspectives/calculator/collimation_editor.py

    r91f151a rad6f597  
    1111 
    1212if sys.platform.count("win32")>0: 
    13     _STATICBOX_WIDTH = 450 
     13    _STATICBOX_WIDTH = 500 
    1414    PANEL_WIDTH = 530 
    1515    PANEL_HEIGHT = 430 
    1616    FONT_VARIANT = 0 
    1717else: 
    18     _STATICBOX_WIDTH = 480 
     18    _STATICBOX_WIDTH = 550 
    1919    PANEL_WIDTH = 600 
    2020    PANEL_HEIGHT = 480 
     
    2424    def __init__(self, parent=None, manager=None, 
    2525                 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  
    4140    def _define_structure(self): 
    4241        """ 
     
    4948        collimation_box = wx.StaticBox(self, -1, "Edit Number of Collimations") 
    5049        self.collimation_sizer = wx.StaticBoxSizer(collimation_box, wx.VERTICAL) 
     50        self.collimation_sizer.SetMinSize((_STATICBOX_WIDTH, -1)) 
    5151        self.collimation_button_sizer = wx.BoxSizer(wx.HORIZONTAL) 
    5252        self.collimation_hint_sizer = wx.BoxSizer(wx.HORIZONTAL) 
     
    228228        self.collimation_cbox.SetSelection(position)  
    229229        self.enable_collimation()  
     230        self.bt_add_aperture.Enable() 
    230231         
    231232    def remove_collimation(self, event): 
     
    234235        """ 
    235236        if self.collimation_cbox.IsEnabled(): 
    236             if self.collimation_cbox.GetCount() > 1: 
     237            if self.collimation_cbox.GetCount() > 0: 
    237238                position = self.collimation_cbox.GetCurrentSelection() 
    238239                collimation = self.collimation_cbox.GetClientData(position) 
     
    258259            n_collimation = self.collimation_cbox.GetCount() 
    259260            collimation_hint_txt = 'collimations available: %s '%str(n_collimation) 
    260             if len(self._collimation) > 1: 
     261            if len(self._collimation) > 0: 
    261262                self.bt_remove_collimation.Enable() 
    262263            else: 
     
    265266            self.collimation_cbox.Disable() 
    266267            self.bt_remove_collimation.Disable() 
     268            self.bt_add_aperture.Disable() 
    267269            collimation_hint_txt = 'No collimation is available for this data.' 
    268270        self.collimation_txt.SetLabel(collimation_hint_txt) 
     
    313315            Remove aperture to data's list of aperture 
    314316        """ 
    315         if self._collimation is None: 
     317        if self._collimation is None or not self._collimation: 
    316318            return 
    317319        collimation, _, _ = self.get_current_collimation() 
     
    336338            set aperture for data 
    337339        """ 
    338         if self._collimation is None: 
     340        if self._collimation is None or not self._collimation: 
    339341            return 
    340342        collimation, _, _ = self.get_current_collimation() 
     
    345347                    self.reset_aperture_combobox(edited_aperture=aperture) 
    346348                    return 
     349                 
    347350    def enable_aperture(self): 
    348351        """ 
     
    406409        collimation, _, _ = self.get_current_collimation() 
    407410        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("") 
    408415            return 
    409416        #Name 
     
    488495            leave the collimation as it is and close 
    489496        """ 
    490         self.reset_collimation() 
     497        self._collimation = deepcopy(self._reset_collimation) 
    491498        self.set_values() 
    492499        if self.manager is not None: 
     
    497504 
    498505    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()]) 
    504508    dlg.ShowModal() 
    505509    app.MainLoop() 
  • calculatorview/perspectives/calculator/detector_editor.py

    r91f151a rad6f597  
    33import sys 
    44from copy import deepcopy 
    5 from DataLoader.loader import Loader 
    65from DataLoader.data_info import Detector 
    76from sans.guiframe.utils import check_float 
     
    1514else: 
    1615    _STATICBOX_WIDTH = 480 
    17     PANEL_WIDTH = 530 
    18     PANEL_HEIGHT = 450 
     16    PANEL_WIDTH = 550 
     17    PANEL_HEIGHT = 480 
    1918    FONT_VARIANT = 1 
    2019     
     
    805804if __name__ == "__main__": 
    806805    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]) 
    812808    dlg.ShowModal() 
    813809    app.MainLoop() 
  • calculatorview/perspectives/calculator/sample_editor.py

    r91f151a rad6f597  
    33import sys 
    44from copy import deepcopy 
    5 from DataLoader.loader import Loader 
    65from sans.guiframe.utils import check_float 
    76 
     
    1413else: 
    1514    _STATICBOX_WIDTH = 480 
    16     PANEL_WIDTH = 530 
     15    PANEL_WIDTH = 550 
    1716    PANEL_HEIGHT = 430 
    1817    FONT_VARIANT = 1 
     
    519518     
    520519    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) 
    527523    dlg.ShowModal() 
    528     #print dlg.get_sample() 
    529524    app.MainLoop() 
    530525  
  • calculatorview/perspectives/calculator/source_editor.py

    r91f151a rad6f597  
    33import sys 
    44from copy import deepcopy 
    5 from DataLoader.loader import Loader 
    65from sans.guiframe.utils import check_float 
    76_BOX_WIDTH = 60 
     
    1413else: 
    1514    _STATICBOX_WIDTH = 480 
    16     PANEL_WIDTH = 530 
     15    PANEL_WIDTH = 550 
    1716    PANEL_HEIGHT = 430 
    1817    FONT_VARIANT = 1 
     
    2120    def __init__(self, parent=None, manager=None, source=None, *args, **kwds): 
    2221        kwds['title'] = "Source Editor" 
    23         kwds['size'] =(PANEL_WIDTH, PANEL_HEIGHT) 
     22        kwds['size'] = (PANEL_WIDTH, PANEL_HEIGHT) 
    2423        wx.Dialog.__init__(self, parent=parent, *args, **kwds) 
    2524         
     
    497496if __name__ =="__main__": 
    498497    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) 
    504501    dlg.ShowModal() 
    505502    app.MainLoop() 
Note: See TracChangeset for help on using the changeset viewer.