Ignore:
Timestamp:
Jan 21, 2011 12:44:46 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:
f444b20
Parents:
8dc02d8b
Message:

working on loading for prview

File:
1 edited

Legend:

Unmodified
Added
Removed
  • prview/perspectives/pr/inversion_panel.py

    r3e41f43 r75df58b  
    1010import logging 
    1111from wx.lib.scrolledpanel import ScrolledPanel 
    12 from sans.guicomm.events import StatusEvent     
     12from sans.guiframe.events import StatusEvent    
     13from sans.guiframe.panel_base import PanelBase  
    1314from inversion_state import InversionState 
    1415from pr_widgets import PrTextCtrl 
     
    1819 
    1920 
    20 class InversionControl(ScrolledPanel): 
     21class InversionControl(ScrolledPanel, PanelBase): 
    2122    """ 
    2223    """ 
     
    3536        """ 
    3637        ScrolledPanel.__init__(self, parent, id=id, **kwargs) 
     38        PanelBase.__init__(self) 
    3739        self.SetupScrolling() 
    3840         
     
    7274        self.alpha_estimate_ctl = None 
    7375        self.nterms_estimate_ctl = None 
    74          
    7576        ## D_max distance explorator 
    7677        self.distance_explorator_ctl = None 
    77          
    7878        ## Data manager 
    7979        self.manager   = None 
    80          
    8180        ## Standalone flage 
    8281        self.standalone = standalone 
    83          
    8482        ## Default file location for save 
    8583        self._default_save_location = os.getcwd() 
    86          
    87          
    8884        # Default width 
    8985        self._default_width = 350 
     
    578574        hint_msg = "Radius of gyration for the computed P(r)." 
    579575        self.rg_ctl.SetToolTipString(hint_msg) 
    580         self.iq0_ctl   = OutputTextCtrl(self, -1, size=(60,20)) 
     576        self.iq0_ctl   = OutputTextCtrl(self, -1, size=(60, 20)) 
    581577        hint_msg = "Scattering intensity at Q=0 for the computed P(r)." 
    582578        self.iq0_ctl.SetToolTipString(hint_msg) 
    583         self.bck_ctl   = OutputTextCtrl(self, -1, size=(60,20)) 
     579        self.bck_ctl   = OutputTextCtrl(self, -1, size=(60, 20)) 
    584580        self.bck_ctl.SetToolTipString("Value of estimated constant background.") 
    585581         
     
    592588        label_pos_err = wx.StaticText(self, -1, "1-sigma positive fraction") 
    593589         
    594         self.time_ctl = OutputTextCtrl(self, -1, size=(60,20)) 
     590        self.time_ctl = OutputTextCtrl(self, -1, size=(60, 20)) 
    595591        hint_msg = "Computation time for the last inversion, in seconds." 
    596592        self.time_ctl.SetToolTipString(hint_msg) 
    597593         
    598         self.chi2_ctl = OutputTextCtrl(self, -1, size=(60,20)) 
     594        self.chi2_ctl = OutputTextCtrl(self, -1, size=(60, 20)) 
    599595        self.chi2_ctl.SetToolTipString("Chi^2 over degrees of freedom.") 
    600596         
    601597        # Oscillation parameter 
    602         self.osc_ctl = OutputTextCtrl(self, -1, size=(60,20)) 
     598        self.osc_ctl = OutputTextCtrl(self, -1, size=(60, 20)) 
    603599        hint_msg = "Oscillation parameter. P(r) for a sphere has an " 
    604600        hint_msg += " oscillation parameter of 1.1." 
     
    606602         
    607603        # Positive fraction figure of merit 
    608         self.pos_ctl = OutputTextCtrl(self, -1, size=(60,20)) 
     604        self.pos_ctl = OutputTextCtrl(self, -1, size=(60, 20)) 
    609605        hint_msg = "Fraction of P(r) that is positive. " 
    610606        hint_msg += "Theoretically, P(r) is defined positive." 
     
    612608         
    613609        # 1-simga positive fraction figure of merit 
    614         self.pos_err_ctl = OutputTextCtrl(self, -1, size=(60,20)) 
     610        self.pos_err_ctl = OutputTextCtrl(self, -1, size=(60, 20)) 
    615611        message  = "Fraction of P(r) that is at least 1 standard deviation" 
    616612        message += " greater than zero.\n" 
     
    775771        height = 0 
    776772        width  = 0 
    777          
    778773        flag = True 
    779          
    780          
    781774        # Read slit height 
    782775        try: 
     
    917910            wx.PostEvent(self.parent, StatusEvent(status=message)) 
    918911         
    919     def _change_file(self, evt=None, filepath=None): 
     912    def _change_file(self, evt=None, filepath=None, data=None): 
    920913        """ 
    921914        Choose a new input file for I(q) 
    922915        """ 
    923         import os 
    924         if not self.manager==None: 
    925             path = self.manager.choose_file(path=filepath) 
    926              
    927             if path and os.path.isfile(path): 
    928                 self.plot_data.SetValue(str(path)) 
    929                 try: 
    930                     self.manager.show_data(path, reset=True) 
    931                     self._on_pars_changed(None) 
    932                  
    933                     # Perform inversion 
    934                     if self.standalone == True: 
    935                         self._on_invert(None) 
    936                 except: 
    937                     # Invalid data 
    938                     msg = "InversionControl._change_file: %s" % sys.exc_value 
    939                     logging.error(msg)                     
     916        if not self.manager is None: 
     917            self.plot_data.SetValue(str(data.name)) 
     918            try: 
     919                self.manager.show_data(data=data, reset=True) 
     920                self._on_pars_changed(None) 
     921                self._on_invert(None) 
     922            except: 
     923                msg = "InversionControl._change_file: %s" % sys.exc_value 
     924                logging.error(msg)                     
    940925 
    941926class HelpDialog(wx.Dialog): 
     
    954939        explanation = help() 
    955940            
    956         label_explain = wx.StaticText(self, -1, explanation, size=(350,320)) 
     941        label_explain = wx.StaticText(self, -1, explanation, size=(350, 320)) 
    957942             
    958943        vbox.Add(label_explain, 0, wx.ALL|wx.EXPAND, 15) 
     
    991976         
    992977        label_npts = wx.StaticText(self, -1, "Number of points") 
    993         self.npts_ctl = PrTextCtrl(self, -1, size=(100,20)) 
     978        self.npts_ctl = PrTextCtrl(self, -1, size=(100, 20)) 
    994979                  
    995         pars_sizer = wx.GridBagSizer(5,5) 
     980        pars_sizer = wx.GridBagSizer(5, 5) 
    996981        iy = 0 
    997         pars_sizer.Add(label_npts,      (iy,0), (1,1), wx.LEFT, 15) 
    998         pars_sizer.Add(self.npts_ctl,   (iy,1), (1,1), wx.RIGHT, 0) 
     982        pars_sizer.Add(label_npts, (iy, 0), (1, 1), wx.LEFT, 15) 
     983        pars_sizer.Add(self.npts_ctl, (iy, 1), (1, 1), wx.RIGHT, 0) 
    999984         
    1000985        vbox.Add(pars_sizer, 0, wx.ALL|wx.EXPAND, 15) 
    1001  
    1002986 
    1003987        static_line = wx.StaticLine(self, -1) 
Note: See TracChangeset for help on using the changeset viewer.