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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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() 
Note: See TracChangeset for help on using the changeset viewer.