Changeset c5dca87 in sasview for calculatorview/perspectives


Ignore:
Timestamp:
May 6, 2010 11:44:57 AM (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:
e6093db
Parents:
85e665e
Message:

working on data editor

Location:
calculatorview/perspectives/calculator
Files:
2 edited

Legend:

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

    r85e665e rc5dca87  
    6969        collimation_name_txt.SetToolTipString(hint_collimation_txt)  
    7070        self.collimation_cbox = wx.ComboBox(self, -1, style=wx.CB_READONLY) 
     71        wx.EVT_COMBOBOX(self.collimation_cbox, -1, self.on_select_collimation)  
    7172        hint_collimation_name_txt = 'Name of collimations.' 
    7273        self.collimation_cbox.SetToolTipString(hint_collimation_name_txt)  
     
    229230        self.enable_collimation()  
    230231        self.bt_add_aperture.Enable() 
     232        self.fill_aperture_combox() 
     233        self.enable_aperture() 
    231234        self.set_values() 
    232235         
     
    258261        self.enable_aperture() 
    259262         
     263    def on_select_collimation(self, event): 
     264        """ 
     265           fill the control on the panel according to the current  selected collimation  
     266        """ 
     267        self.set_values() 
     268        self.fill_aperture_combox() 
     269        self.enable_aperture() 
     270     
    260271    def enable_collimation(self): 
    261272        """ 
     
    366377            n_aperture = self.aperture_cbox.GetCount() 
    367378            aperture_hint_txt = 'apertures available: %s '%str(n_aperture) 
    368             if len(collimation.aperture) > 1: 
     379            if len(collimation.aperture) > 0: 
    369380                self.bt_remove_aperture.Enable() 
    370381            else: 
     
    393404            fill the current combobox with the available aperture 
    394405        """ 
     406        self.aperture_cbox.Clear() 
    395407        collimation, _, _ = self.get_current_collimation() 
    396408        if collimation is None or not collimation.aperture: 
    397409            return 
    398          
    399410        for aperture in collimation.aperture: 
    400411            pos = self.aperture_cbox.Append(str(aperture.name)) 
  • calculatorview/perspectives/calculator/data_editor.py

    r0c0d458 rc5dca87  
    1414from sans.guicomm.events import StatusEvent 
    1515 
    16 _BOX_WIDTH = 76 
     16 
    1717_QMIN_DEFAULT = 0.001 
    1818_QMAX_DEFAULT = 0.13 
     
    2323    PANEL_HEIGTH = 350 
    2424    FONT_VARIANT = 0 
     25    _BOX_WIDTH = 51 
    2526    ON_MAC = False 
    2627else: 
     28    _BOX_WIDTH = 76 
    2729    PANEL_WIDTH = 550 
    2830    PANEL_HEIGTH = 400 
     
    194196            Do the layout for the button widgets 
    195197        """  
    196         self.bt_summary = wx.Button(self, -1, "View", size=(_BOX_WIDTH*2/3,-1)) 
     198        self.bt_summary = wx.Button(self, -1, "View", size=(_BOX_WIDTH,-1)) 
    197199        self.bt_summary.SetToolTipString("View final changes on data.") 
    198200        self.bt_summary.Bind(wx.EVT_BUTTON, self.on_click_view) 
    199201         
    200         self.bt_save = wx.Button(self, -1, "Save As", size=(_BOX_WIDTH*2/3,-1)) 
     202        self.bt_save = wx.Button(self, -1, "Save As", size=(_BOX_WIDTH,-1)) 
    201203        self.bt_save.SetToolTipString("Save changes in a file.") 
    202204        self.bt_save.Bind(wx.EVT_BUTTON, self.on_click_save) 
    203205         
    204         self.bt_apply = wx.Button(self, -1, "Apply", size=(_BOX_WIDTH*2/3,-1)) 
     206        self.bt_apply = wx.Button(self, -1, "Apply", size=(_BOX_WIDTH,-1)) 
    205207        self.bt_apply.SetToolTipString("Save changes into the imported data.") 
    206208        self.bt_apply.Bind(wx.EVT_BUTTON, self.on_click_apply) 
    207209       
    208         self.bt_reset = wx.Button(self, -1,'Reset', size=(_BOX_WIDTH*2/3,-1)) 
     210        self.bt_reset = wx.Button(self, -1,'Reset', size=(_BOX_WIDTH,-1)) 
    209211        self.bt_reset.Bind(wx.EVT_BUTTON, self.on_click_reset) 
    210212        self.bt_reset.SetToolTipString("Reset data to its initial state.") 
    211213         
    212         self.bt_close = wx.Button(self, -1,'Close', size=(_BOX_WIDTH*2/3,-1)) 
     214        self.bt_close = wx.Button(self, -1,'Close', size=(_BOX_WIDTH,-1)) 
    213215        self.bt_close.Bind(wx.EVT_BUTTON, self.on_close) 
    214216        self.bt_close.SetToolTipString("Close this panel.") 
     
    555557            Save change into a file 
    556558        """ 
    557         data, data_name, position = self.get_current_data() 
    558         if data is None: 
     559        if not self._data: 
    559560            return 
    560561        self.on_change_run(event=None) 
    561562        self.on_change_title(event=None) 
    562          
    563         if issubclass(data.__class__, Data2D): 
    564             msg = "No conventional writing format for \n\n" 
    565             msg += "Data2D at this time.\n" 
    566             dlg = wx.MessageDialog(None, msg, 'Error Loading File', 
    567                                          wx.OK | wx.ICON_EXCLAMATION) 
    568             dlg.ShowModal()    
    569             return  
    570              
    571563        path = None 
    572564        wildcard = "CanSAS 1D files(*.xml)|*.xml"  
     
    574566                            self._default_save_location, "",wildcard , wx.SAVE) 
    575567        
    576         if dlg.ShowModal() == wx.ID_OK: 
    577             path = dlg.GetPath() 
    578             mypath = os.path.basename(path) 
    579             loader = Loader()  
    580             format = ".xml" 
    581             if os.path.splitext(mypath)[1].lower() ==format: 
    582                 loader.save( path, data, format) 
    583             try: 
    584                 self._default_save_location = os.path.dirname(path) 
    585             except: 
    586                 pass     
    587         dlg.Destroy() 
     568        for data in self._data: 
     569            if issubclass(data.__class__, Data2D): 
     570                msg = "No conventional writing format for \n\n" 
     571                msg += "Data2D at this time.\n" 
     572                dlg = wx.MessageDialog(None, msg, 'Error Loading File', 
     573                                             wx.OK | wx.ICON_EXCLAMATION) 
     574                dlg.ShowModal()    
     575            else: 
     576                if dlg.ShowModal() == wx.ID_OK: 
     577                    path = dlg.GetPath() 
     578                    mypath = os.path.basename(path) 
     579                    loader = Loader()  
     580                    format = ".xml" 
     581                    if os.path.splitext(mypath)[1].lower() ==format: 
     582                        loader.save( path, data, format) 
     583                    try: 
     584                        self._default_save_location = os.path.dirname(path) 
     585                    except: 
     586                        pass     
     587                    dlg.Destroy() 
    588588         
    589589    def on_click_view(self, event): 
Note: See TracChangeset for help on using the changeset viewer.