Changeset f07b2e9 in sasview


Ignore:
Timestamp:
Apr 28, 2015 9:28:12 AM (9 years ago)
Author:
smk78
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:
f85875a
Parents:
b78707b0 (diff), 5265420 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of https://github.com/SasView/sasview

Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • src/sas/data_util/calcthread.py

    r79492222 r373d4ee  
    8484    should be implemented vary from framework to framework. 
    8585 
    86     For wx, something like the following is needed: :: 
     86    For wx, something like the following is needed:: 
    8787 
    8888        import wx, wx.lib.newevent 
  • src/sas/guiframe/plugin_base.py

    r0fa825c r373d4ee  
    1313################################################################################ 
    1414 
    15 class PluginBase: 
     15class PluginBase(object): 
    1616    """ 
    1717    This class defines the interface for a Plugin class 
     
    3636    def __init__(self, name="Test_plugin", standalone=True): 
    3737        """ 
    38             Abstract class for gui_manager Plugins. 
     38        Abstract class for gui_manager Plugins. 
    3939        """ 
    4040        # Define if the plugin is local to Viewerframe  and always active 
  • src/sas/perspectives/fitting/basepage.py

    racf8e4a5 r373d4ee  
    398398            batch_menu.Enable(self.batch_on and flag) 
    399399 
    400     class ModelTextCtrl(wx.TextCtrl): 
    401         """ 
    402         Text control for model and fit parameters. 
    403         Binds the appropriate events for user interactions. 
    404         Default callback methods can be overwritten on initialization 
    405  
    406         :param kill_focus_callback: callback method for EVT_KILL_FOCUS event 
    407         :param set_focus_callback:  callback method for EVT_SET_FOCUS event 
    408         :param mouse_up_callback:   callback method for EVT_LEFT_UP event 
    409         :param text_enter_callback: callback method for EVT_TEXT_ENTER event 
    410  
    411         """ 
    412         ## Set to True when the mouse is clicked while whole string is selected 
    413         full_selection = False 
    414         ## Call back for EVT_SET_FOCUS events 
    415         _on_set_focus_callback = None 
    416  
    417         def __init__(self, parent, id=-1, 
    418                      value=wx.EmptyString, 
    419                      pos=wx.DefaultPosition, 
    420                      size=wx.DefaultSize, 
    421                      style=0, 
    422                      validator=wx.DefaultValidator, 
    423                      name=wx.TextCtrlNameStr, 
    424                      kill_focus_callback=None, 
    425                      set_focus_callback=None, 
    426                      mouse_up_callback=None, 
    427                      text_enter_callback=None): 
    428  
    429             wx.TextCtrl.__init__(self, parent, id, value, pos, 
    430                                  size, style, validator, name) 
    431  
    432             # Bind appropriate events 
    433             self._on_set_focus_callback = parent.onSetFocus \ 
    434                       if set_focus_callback is None else set_focus_callback 
    435             self.Bind(wx.EVT_SET_FOCUS, self._on_set_focus) 
    436             self.Bind(wx.EVT_KILL_FOCUS, self._silent_kill_focus \ 
    437                       if kill_focus_callback is None else kill_focus_callback) 
    438             self.Bind(wx.EVT_TEXT_ENTER, parent._onparamEnter \ 
    439                       if text_enter_callback is None else text_enter_callback) 
    440             if not ON_MAC: 
    441                 self.Bind(wx.EVT_LEFT_UP, self._highlight_text \ 
    442                           if mouse_up_callback is None else mouse_up_callback) 
    443  
    444         def _on_set_focus(self, event): 
    445             """ 
    446             Catch when the text control is set in focus to highlight the whole 
    447             text if necessary 
    448  
    449             :param event: mouse event 
    450  
    451             """ 
    452             event.Skip() 
    453             self.full_selection = True 
    454             return self._on_set_focus_callback(event) 
    455  
    456         def _highlight_text(self, event): 
    457             """ 
    458             Highlight text of a TextCtrl only of no text has be selected 
    459  
    460             :param event: mouse event 
    461  
    462             """ 
    463             # Make sure the mouse event is available to other listeners 
    464             event.Skip() 
    465             control = event.GetEventObject() 
    466             if self.full_selection: 
    467                 self.full_selection = False 
    468                 # Check that we have a TextCtrl 
    469                 if issubclass(control.__class__, wx.TextCtrl): 
    470                     # Check whether text has been selected, 
    471                     # if not, select the whole string 
    472                     (start, end) = control.GetSelection() 
    473                     if start == end: 
    474                         control.SetSelection(-1, -1) 
    475  
    476         def _silent_kill_focus(self, event): 
    477             """ 
    478             Save the state of the page 
    479             """ 
    480  
    481             event.Skip() 
    482             #pass 
    483  
    484400    def set_page_info(self, page_info): 
    485401        """ 
     
    16801596                                                  draw=False) 
    16811597                elif not self._is_2D(): 
     1598                    enable_smearer = not self.disable_smearer.GetValue() 
    16821599                    self._manager.set_smearer(smearer=temp_smearer, 
    16831600                                              qmin=float(self.qmin_x), 
     
    16851602                                              fid=self.data.id, 
    16861603                                              qmax=float(self.qmax_x), 
    1687                             enable_smearer=not self.disable_smearer.GetValue(), 
    1688                                                  draw=False) 
     1604                                              enable_smearer=enable_smearer, 
     1605                                              draw=False) 
    16891606                    if self.data != None: 
    16901607                        index_data = ((self.qmin_x <= self.data.x) & \ 
     
    37743691        toggle view of model from 1D to 2D  or 2D from 1D if implemented 
    37753692        """ 
     3693 
     3694class ModelTextCtrl(wx.TextCtrl): 
     3695    """ 
     3696    Text control for model and fit parameters. 
     3697    Binds the appropriate events for user interactions. 
     3698    Default callback methods can be overwritten on initialization 
     3699 
     3700    :param kill_focus_callback: callback method for EVT_KILL_FOCUS event 
     3701    :param set_focus_callback:  callback method for EVT_SET_FOCUS event 
     3702    :param mouse_up_callback:   callback method for EVT_LEFT_UP event 
     3703    :param text_enter_callback: callback method for EVT_TEXT_ENTER event 
     3704 
     3705    """ 
     3706    ## Set to True when the mouse is clicked while whole string is selected 
     3707    full_selection = False 
     3708    ## Call back for EVT_SET_FOCUS events 
     3709    _on_set_focus_callback = None 
     3710 
     3711    def __init__(self, parent, id=-1, 
     3712                 value=wx.EmptyString, 
     3713                 pos=wx.DefaultPosition, 
     3714                 size=wx.DefaultSize, 
     3715                 style=0, 
     3716                 validator=wx.DefaultValidator, 
     3717                 name=wx.TextCtrlNameStr, 
     3718                 kill_focus_callback=None, 
     3719                 set_focus_callback=None, 
     3720                 mouse_up_callback=None, 
     3721                 text_enter_callback=None): 
     3722 
     3723        wx.TextCtrl.__init__(self, parent, id, value, pos, 
     3724                             size, style, validator, name) 
     3725 
     3726        # Bind appropriate events 
     3727        self._on_set_focus_callback = parent.onSetFocus \ 
     3728            if set_focus_callback is None else set_focus_callback 
     3729        self.Bind(wx.EVT_SET_FOCUS, self._on_set_focus) 
     3730        self.Bind(wx.EVT_KILL_FOCUS, self._silent_kill_focus \ 
     3731            if kill_focus_callback is None else kill_focus_callback) 
     3732        self.Bind(wx.EVT_TEXT_ENTER, parent._onparamEnter \ 
     3733            if text_enter_callback is None else text_enter_callback) 
     3734        if not ON_MAC: 
     3735            self.Bind(wx.EVT_LEFT_UP, self._highlight_text \ 
     3736                if mouse_up_callback is None else mouse_up_callback) 
     3737 
     3738    def _on_set_focus(self, event): 
     3739        """ 
     3740        Catch when the text control is set in focus to highlight the whole 
     3741        text if necessary 
     3742 
     3743        :param event: mouse event 
     3744 
     3745        """ 
     3746        event.Skip() 
     3747        self.full_selection = True 
     3748        return self._on_set_focus_callback(event) 
     3749 
     3750    def _highlight_text(self, event): 
     3751        """ 
     3752        Highlight text of a TextCtrl only of no text has be selected 
     3753 
     3754        :param event: mouse event 
     3755 
     3756        """ 
     3757        # Make sure the mouse event is available to other listeners 
     3758        event.Skip() 
     3759        control = event.GetEventObject() 
     3760        if self.full_selection: 
     3761            self.full_selection = False 
     3762            # Check that we have a TextCtrl 
     3763            if issubclass(control.__class__, wx.TextCtrl): 
     3764                # Check whether text has been selected, 
     3765                # if not, select the whole string 
     3766                (start, end) = control.GetSelection() 
     3767                if start == end: 
     3768                    control.SetSelection(-1, -1) 
     3769 
     3770    def _silent_kill_focus(self, event): 
     3771        """ 
     3772        Save the state of the page 
     3773        """ 
     3774 
     3775        event.Skip() 
     3776        #pass 
     3777 
  • src/sas/perspectives/fitting/batchfitpage.py

    r2f4b430 r373d4ee  
    122122#         self.sizer5.Clear(True) 
    123123#       
    124 #         self.qmin  = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20),  
     124#         self.qmin  = ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20), 
    125125#                                           style=wx.TE_PROCESS_ENTER,  
    126126#                                     text_enter_callback = self._onQrangeEnter) 
     
    128128#         self.qmin.SetToolTipString("Minimun value of Q in linear scale.") 
    129129#       
    130 #         self.qmax  = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20),  
     130#         self.qmax  = ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20), 
    131131#                                           style=wx.TE_PROCESS_ENTER,  
    132132#                                         text_enter_callback=self._onQrangeEnter) 
  • src/sas/perspectives/fitting/fitpage.py

    r85ccd3a r5265420  
    2626from sas.perspectives.fitting.basepage import PageInfoEvent as PageInfoEvent 
    2727from sas.models.qsmearing import smear_selection 
     28from .basepage import ModelTextCtrl 
    2829 
    2930 
     
    284285 
    285286        #textcntrl for custom resolution 
    286         self.smear_pinhole_max = self.ModelTextCtrl(self, -1, 
     287        self.smear_pinhole_max = ModelTextCtrl(self, -1, 
    287288                            size=(_BOX_WIDTH - 25, 20), 
    288289                            style=wx.TE_PROCESS_ENTER, 
    289290                            text_enter_callback=self.onPinholeSmear) 
    290         self.smear_pinhole_min = self.ModelTextCtrl(self, -1, 
     291        self.smear_pinhole_min = ModelTextCtrl(self, -1, 
    291292                            size=(_BOX_WIDTH - 25, 20), 
    292293                            style=wx.TE_PROCESS_ENTER, 
    293294                            text_enter_callback=self.onPinholeSmear) 
    294         self.smear_slit_height = self.ModelTextCtrl(self, -1, 
     295        self.smear_slit_height = ModelTextCtrl(self, -1, 
    295296                            size=(_BOX_WIDTH - 25, 20), 
    296297                            style=wx.TE_PROCESS_ENTER, 
    297298                            text_enter_callback=self.onSlitSmear) 
    298         self.smear_slit_width = self.ModelTextCtrl(self, -1, 
     299        self.smear_slit_width = ModelTextCtrl(self, -1, 
    299300                            size=(_BOX_WIDTH - 25, 20), 
    300301                            style=wx.TE_PROCESS_ENTER, 
     
    303304        ## smear 
    304305        self.smear_data_left = BGTextCtrl(self, -1, 
    305                                          size=(_BOX_WIDTH - 25, 20), style=0) 
     306                                          size=(_BOX_WIDTH - 25, 20), style=0) 
    306307        self.smear_data_left.SetValue(str(self.dq_l)) 
    307308        self.smear_data_right = BGTextCtrl(self, -1, 
    308                                         size=(_BOX_WIDTH - 25, 20), style=0) 
     309                                           size=(_BOX_WIDTH - 25, 20), style=0) 
    309310        self.smear_data_right.SetValue(str(self.dq_r)) 
    310311 
     
    355356        self.Npts_fit.SetToolTipString(\ 
    356357                            " Npts : number of points selected for fitting") 
    357         self.Npts_total = self.ModelTextCtrl(self, -1, 
    358                         size=(_BOX_WIDTH, 20), 
    359                         style=wx.TE_PROCESS_ENTER, 
    360                         text_enter_callback=self._onQrangeEnter) 
     358        self.Npts_total = ModelTextCtrl(self, -1, 
     359                            size=(_BOX_WIDTH, 20), 
     360                            style=wx.TE_PROCESS_ENTER, 
     361                            text_enter_callback=self._onQrangeEnter) 
    361362        self.Npts_total.SetValue(format_number(self.npts_x)) 
    362363        self.Npts_total.SetToolTipString(\ 
     
    515516        self.sizer5.Clear(True) 
    516517 
    517         self.qmin = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20), 
    518                                     style=wx.TE_PROCESS_ENTER, 
    519                                     set_focus_callback=self.qrang_set_focus, 
    520                                     text_enter_callback=self._onQrangeEnter, 
    521                                     name='qmin') 
     518        self.qmin = ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20), 
     519                                  style=wx.TE_PROCESS_ENTER, 
     520                                  set_focus_callback=self.qrang_set_focus, 
     521                                  text_enter_callback=self._onQrangeEnter, 
     522                                  name='qmin') 
    522523        self.qmin.SetValue(str(self.qmin_x)) 
    523524        q_tip = "Click outside of the axes\n to remove the lines." 
     
    526527        self.qmin.SetToolTipString(qmin_tip) 
    527528 
    528         self.qmax = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20), 
    529                                        style=wx.TE_PROCESS_ENTER, 
    530                                        set_focus_callback=self.qrang_set_focus, 
    531                                        text_enter_callback=self._onQrangeEnter, 
    532                                        name='qmax') 
     529        self.qmax = ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20), 
     530                                  style=wx.TE_PROCESS_ENTER, 
     531                                  set_focus_callback=self.qrang_set_focus, 
     532                                  text_enter_callback=self._onQrangeEnter, 
     533                                  name='qmax') 
    533534        self.qmax.SetValue(str(self.qmax_x)) 
    534535        qmax_tip = "Maximum value of Q.\n" 
     
    686687                        ix = 1 
    687688                        value = self.model.getParam(name1) 
    688                         ctl1 = self.ModelTextCtrl(self, -1, 
    689                                                   size=(_BOX_WIDTH / 1.3, 20), 
    690                                                   style=wx.TE_PROCESS_ENTER) 
     689                        ctl1 = ModelTextCtrl(self, -1, 
     690                                             size=(_BOX_WIDTH / 1.3, 20), 
     691                                             style=wx.TE_PROCESS_ENTER) 
    691692                        ctl1.SetLabel('PD[ratio]') 
    692693                        poly_text = "Polydispersity (STD/mean) of %s\n" % item 
     
    715716 
    716717                        ix = 4 
    717                         ctl3 = self.ModelTextCtrl(self, -1, 
    718                                                   size=(_BOX_WIDTH / 2, 20), 
    719                                                   style=wx.TE_PROCESS_ENTER, 
    720                                 text_enter_callback=self._onparamRangeEnter) 
     718                        ctl3 = ModelTextCtrl(self, -1, 
     719                                             size=(_BOX_WIDTH / 2, 20), 
     720                                             style=wx.TE_PROCESS_ENTER, 
     721                            text_enter_callback=self._onparamRangeEnter) 
    721722 
    722723                        self.sizer4_4.Add(ctl3, (iy, ix), (1, 1), 
     
    724725 
    725726                        ix = 5 
    726                         ctl4 = self.ModelTextCtrl(self, -1, 
    727                                                   size=(_BOX_WIDTH / 2, 20), 
    728                                                   style=wx.TE_PROCESS_ENTER, 
     727                        ctl4 = ModelTextCtrl(self, -1, 
     728                                             size=(_BOX_WIDTH / 2, 20), 
     729                                             style=wx.TE_PROCESS_ENTER, 
    729730                            text_enter_callback=self._onparamRangeEnter) 
    730731 
     
    738739                        ix = 6 
    739740                        value = self.model.getParam(name2) 
    740                         Tctl = self.ModelTextCtrl(self, -1, 
    741                                                   size=(_BOX_WIDTH / 2.2, 20), 
    742                                                   style=wx.TE_PROCESS_ENTER) 
     741                        Tctl = ModelTextCtrl(self, -1, 
     742                                             size=(_BOX_WIDTH / 2.2, 20), 
     743                                             style=wx.TE_PROCESS_ENTER) 
    743744 
    744745                        Tctl.SetValue(str(format_number(value))) 
     
    750751                        ix = 7 
    751752                        value = self.model.getParam(name3) 
    752                         Tct2 = self.ModelTextCtrl(self, -1, 
    753                                                   size=(_BOX_WIDTH / 2.2, 20), 
    754                                                   style=wx.TE_PROCESS_ENTER) 
     753                        Tct2 = ModelTextCtrl(self, -1, 
     754                                             size=(_BOX_WIDTH / 2.2, 20), 
     755                                             style=wx.TE_PROCESS_ENTER) 
    755756 
    756757                        Tct2.SetValue(str(format_number(value))) 
     
    811812                        ix = 1 
    812813                        value = self.model.getParam(name1) 
    813                         ctl1 = self.ModelTextCtrl(self, -1, 
    814                                                   size=(_BOX_WIDTH / 1.3, 20), 
    815                                                   style=wx.TE_PROCESS_ENTER) 
     814                        ctl1 = ModelTextCtrl(self, -1, 
     815                                             size=(_BOX_WIDTH / 1.3, 20), 
     816                                             style=wx.TE_PROCESS_ENTER) 
    816817                        poly_tip = "Absolute Sigma for %s." % item 
    817818                        ctl1.SetToolTipString(poly_tip) 
     
    859860 
    860861                        ix = 4 
    861                         ctl3 = self.ModelTextCtrl(self, -1, 
    862                                                   size=(_BOX_WIDTH / 2, 20), 
    863                                                   style=wx.TE_PROCESS_ENTER, 
     862                        ctl3 = ModelTextCtrl(self, -1, 
     863                                             size=(_BOX_WIDTH / 2, 20), 
     864                                             style=wx.TE_PROCESS_ENTER, 
    864865                                text_enter_callback=self._onparamRangeEnter) 
    865866 
     
    870871 
    871872                        ix = 5 
    872                         ctl4 = self.ModelTextCtrl(self, -1, 
    873                             size=(_BOX_WIDTH / 2, 20), 
    874                             style=wx.TE_PROCESS_ENTER, 
     873                        ctl4 = ModelTextCtrl(self, -1, 
     874                                             size=(_BOX_WIDTH / 2, 20), 
     875                                             style=wx.TE_PROCESS_ENTER, 
    875876                            text_enter_callback=self._onparamRangeEnter) 
    876877                        self.sizer4_4.Add(ctl4, (iy, ix), (1, 1), 
     
    886887                        ix = 6 
    887888                        value = self.model.getParam(name2) 
    888                         Tctl = self.ModelTextCtrl(self, -1, 
    889                                                  size=(_BOX_WIDTH / 2.2, 20), 
    890                                                  style=wx.TE_PROCESS_ENTER) 
     889                        Tctl = ModelTextCtrl(self, -1, 
     890                                             size=(_BOX_WIDTH / 2.2, 20), 
     891                                             style=wx.TE_PROCESS_ENTER) 
    891892 
    892893                        Tctl.SetValue(str(format_number(value))) 
     
    906907                        ix = 7 
    907908                        value = self.model.getParam(name3) 
    908                         Tct2 = self.ModelTextCtrl(self, -1, 
    909                                                   size=(_BOX_WIDTH / 2.2, 20), 
    910                                                   style=wx.TE_PROCESS_ENTER) 
     909                        Tct2 = ModelTextCtrl(self, -1, 
     910                                             size=(_BOX_WIDTH / 2.2, 20), 
     911                                             style=wx.TE_PROCESS_ENTER) 
    911912 
    912913                        Tct2.SetValue(str(format_number(value))) 
     
    10611062            label = "Fit" 
    10621063            color = "black" 
    1063         self.btFit.Enable(False) 
     1064        #self.btFit.Enable(False) 
    10641065        self.btFit.SetLabel(label) 
    10651066        self.btFit.SetForegroundColour(color) 
     
    11401141        self.state.formfactorcombobox = self.formfactorbox.GetLabel() 
    11411142        self.enable_fit_button() 
    1142         if self.model != None: 
     1143        if self.model is not None: 
    11431144            self.m_name = self.model.name 
    11441145            self.state.m_name = self.m_name 
     
    11521153                    self._keep.Enable(not self.batch_on) 
    11531154                    self._set_save_flag(True) 
    1154             # Reset smearer, model and data 
    1155             if not copy_flag: 
    1156                 self.disable_smearer.SetValue(True) 
    1157                 self.enable_smearer.SetValue(False) 
    11581155 
    11591156            # more disables for 2D 
     
    11621159            try: 
    11631160                # update smearer sizer 
    1164                 #if not self.enable_smearer.GetValue(): 
    1165                 #    self.disable_smearer.SetValue(True) 
    11661161                self.onSmear(None) 
    11671162                temp_smear = None 
     
    12681263                elif self.data.__class__.__name__ != "Data2D" and \ 
    12691264                        not self.enable2D: 
     1265                    enable_smearer = not self.disable_smearer.GetValue() 
    12701266                    self._manager.set_smearer(smearer=temp_smearer, 
    12711267                                              fid=self.data.id, 
     
    12731269                                              qmin=float(self.qmin_x), 
    12741270                                              qmax=float(self.qmax_x), 
    1275                             enable_smearer=not self.disable_smearer.GetValue(), 
    1276                                             draw=True) 
     1271                                              enable_smearer=enable_smearer, 
     1272                                              draw=True) 
    12771273                if flag: 
    12781274                    #self.compute_chisqr(smearer= temp_smearer) 
     
    17721768        self.current_smearer = smear_selection(data, self.model) 
    17731769        flag = self.disable_smearer.GetValue() 
    1774         self.disable_smearer.SetValue(flag) 
    1775         if self.current_smearer == None: 
     1770        if self.current_smearer is None: 
    17761771            self.enable_smearer.Disable() 
    17771772        else: 
     
    19591954        if flag: 
    19601955            #set model view button 
    1961             if not self.enable_smearer.GetValue(): 
    1962                     self.disable_smearer.SetValue(True) 
    19631956            self.onSmear(None) 
    19641957 
     
    21322125                            if numpy.isfinite(float(cov[ind])): 
    21332126                                val_err = format_number(cov[ind], True) 
    2134                                 if not self.is_mac: 
    2135                                     item[3].Show(True) 
    2136                                     item[4].Show(True) 
    2137                                     item[4].SetForegroundColour(wx.BLACK) 
    2138                                 item[4].SetValue(val_err) 
    2139                                 has_error = True 
    2140                             else: 
    2141                                 val_err = 'NaN' 
    2142                                 if not self.is_mac: 
    2143                                     item[3].Show(True) 
    2144                                     item[4].Show(True) 
    2145                                     item[4].SetForegroundColour(wx.RED) 
    2146                                 item[4].SetValue(val_err) 
    2147                                 has_error = True 
     2127                            else: 
     2128                                val_err = 'NaN' 
     2129                            if not self.is_mac: 
     2130                                item[3].Show(True) 
     2131                                item[4].Show(True) 
     2132                                item[4].SetForegroundColour(wx.RED) 
     2133                            item[4].SetValue(val_err) 
     2134                            has_error = True 
    21482135                i += 1 
    21492136            else: 
     
    21962183 
    21972184        """ 
    2198         if self.model == None: 
    2199             self.disable_smearer.SetValue(True) 
    2200             if event == None: 
    2201                 return 
    2202             msg = "Please select a Model first..." 
    2203             wx.MessageBox(msg, 'Info') 
    2204             wx.PostEvent(self._manager.parent, 
    2205                          StatusEvent(status="Smear: %s" % msg)) 
    2206             return 
    2207  
    22082185        # Need update param values 
    22092186        self._update_paramv_on_fit() 
     
    23452322        ## set smearing value whether or not the data contain the smearing info 
    23462323 
     2324        enable_smearer = not self.disable_smearer.GetValue() 
    23472325        self._manager.set_smearer(smearer=self.current_smearer, 
    2348                             fid=self.data.id, 
    2349                             qmin=float(self.qmin_x), 
    2350                             qmax=float(self.qmax_x), 
    2351                             enable_smearer=not self.disable_smearer.GetValue(), 
    2352                             uid=self.uid) 
     2326                                  fid=self.data.id, 
     2327                                  qmin=float(self.qmin_x), 
     2328                                  qmax=float(self.qmax_x), 
     2329                                  enable_smearer=enable_smearer, 
     2330                                  uid=self.uid) 
    23532331        return msg 
    23542332 
     
    23782356        are compute when fitting 
    23792357        """ 
    2380         if self.model == None: 
    2381             self.disable_smearer.SetValue(True) 
    2382             if event == None: 
    2383                 return 
    2384             msg = "Please select a Model first..." 
    2385             wx.MessageBox(msg, 'Info') 
    2386             wx.PostEvent(self._manager.parent, 
    2387                          StatusEvent(status="Smear: %s" % msg)) 
    2388             return 
    2389  
    23902358        # Need update param values 
    23912359        self._update_paramv_on_fit() 
     
    24752443            of the values entered for slit smear 
    24762444        """ 
    2477         if self.data.__class__.__name__ == "Data2D" or \ 
    2478                         self.enable2D: 
     2445        if self.data.__class__.__name__ == "Data2D" or self.enable2D: 
    24792446            return 
    24802447        # make sure once more if it is smearer 
     
    25132480        self.current_smearer = smear_selection(data, self.model) 
    25142481        ## set smearing value whether or not the data contain the smearing info 
     2482        enable_smearer = not self.disable_smearer.GetValue() 
    25152483        self._manager.set_smearer(smearer=self.current_smearer, 
    2516                                  fid=self.data.id, 
    2517                                  qmin=float(self.qmin_x), 
    2518                                  qmax=float(self.qmax_x), 
    2519                         enable_smearer=not self.disable_smearer.GetValue(), 
    2520                                  uid=self.uid) 
     2484                                  fid=self.data.id, 
     2485                                  qmin=float(self.qmin_x), 
     2486                                  qmax=float(self.qmax_x), 
     2487                                  enable_smearer=enable_smearer, 
     2488                                  uid=self.uid) 
    25212489        return msg 
    25222490 
     
    25522520            return 
    25532521 
    2554         if self.model == None: 
    2555             self.disable_smearer.SetValue(True) 
    2556             if event == None: 
    2557                 return 
    2558             msg = "Please select a Model first..." 
    2559             wx.MessageBox(msg, 'Info') 
    2560             wx.PostEvent(self._manager.parent, 
    2561                          StatusEvent(status="Smear: %s" % msg)) 
    2562             return 
    25632522        # Need update param values 
    25642523        self._update_paramv_on_fit() 
    2565         if self.model != None: 
     2524        if self.model is not None: 
    25662525            if self.data.is_data: 
    25672526                self._manager.page_finder[self.uid].add_data(data=self.data) 
     
    25732532 
    25742533        ## set smearing value whether or not the data contain the smearing info 
     2534        enable_smearer = not self.disable_smearer.GetValue() 
    25752535        wx.CallAfter(self._manager.set_smearer, uid=self.uid, 
    25762536                     smearer=temp_smearer, 
     
    25782538                     qmin=float(self.qmin_x), 
    25792539                     qmax=float(self.qmax_x), 
    2580                      enable_smearer=not self.disable_smearer.GetValue(), 
     2540                     enable_smearer=enable_smearer, 
    25812541                     draw=True) 
    25822542 
     
    25942554        self._get_smear_info() 
    25952555        #renew smear sizer 
    2596         if self.smear_type != None: 
     2556        if self.smear_type is not None: 
    25972557            self.smear_description_smear_type.SetValue(str(self.smear_type)) 
    25982558            self.smear_data_left.SetValue(str(self.dq_l)) 
     
    26072567            self.current_smearer = temp_smearer 
    26082568        if self.enable_smearer.GetValue(): 
    2609             if self.current_smearer == None: 
     2569            if self.current_smearer is None: 
    26102570                wx.PostEvent(self._manager.parent, 
    26112571                    StatusEvent(status="Data contains no smearing information")) 
     
    29532913                        wx.EVT_COMBOBOX(fun_box, -1, self._on_fun_box) 
    29542914                    else: 
    2955                         fun_box = self.ModelTextCtrl(self, -1, 
    2956                                                      size=(_BOX_WIDTH, 20), 
     2915                        fun_box = ModelTextCtrl(self, -1, 
     2916                                                size=(_BOX_WIDTH, 20), 
    29572917                                style=wx.TE_PROCESS_ENTER, name='%s' % item) 
    29582918                        fun_box.SetToolTipString(\ 
     
    29772937                    ix += 1 
    29782938                    value = self.model.getParam(item) 
    2979                     ctl1 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20), 
    2980                                         style=wx.TE_PROCESS_ENTER) 
     2939                    ctl1 = ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20), 
     2940                                         style=wx.TE_PROCESS_ENTER) 
    29812941                    ctl1.SetToolTipString(\ 
    29822942                                "Hit 'Enter' after typing to update the plot.") 
     
    29992959 
    30002960                    ix += 1 
    3001                     ctl3 = self.ModelTextCtrl(self, -1, 
    3002                                               size=(_BOX_WIDTH / 1.9, 20), 
    3003                                               style=wx.TE_PROCESS_ENTER, 
     2961                    ctl3 = ModelTextCtrl(self, -1, 
     2962                                         size=(_BOX_WIDTH / 1.9, 20), 
     2963                                         style=wx.TE_PROCESS_ENTER, 
    30042964                                text_enter_callback=self._onparamRangeEnter) 
    30052965                    min_bound = self.model.details[item][1] 
     
    30112971 
    30122972                    ix += 1 
    3013                     ctl4 = self.ModelTextCtrl(self, -1, 
    3014                                               size=(_BOX_WIDTH / 1.9, 20), 
    3015                                               style=wx.TE_PROCESS_ENTER, 
     2973                    ctl4 = ModelTextCtrl(self, -1, 
     2974                                         size=(_BOX_WIDTH / 1.9, 20), 
     2975                                         style=wx.TE_PROCESS_ENTER, 
    30162976                                text_enter_callback=self._onparamRangeEnter) 
    30172977                    max_bound = self.model.details[item][2] 
     
    31153075                    ix += 1 
    31163076                    value = self.model.getParam(item) 
    3117                     ctl1 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20), 
    3118                                         style=wx.TE_PROCESS_ENTER) 
     3077                    ctl1 = ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20), 
     3078                                         style=wx.TE_PROCESS_ENTER) 
    31193079                    ctl1.SetToolTipString(\ 
    31203080                                "Hit 'Enter' after typing to update the plot.") 
     
    31423102 
    31433103                    ix += 1 
    3144                     ctl3 = self.ModelTextCtrl(self, -1, 
    3145                                               size=(_BOX_WIDTH / 1.8, 20), 
    3146                                               style=wx.TE_PROCESS_ENTER, 
     3104                    ctl3 = ModelTextCtrl(self, -1, 
     3105                                         size=(_BOX_WIDTH / 1.8, 20), 
     3106                                         style=wx.TE_PROCESS_ENTER, 
    31473107                                text_enter_callback=self._onparamRangeEnter) 
    31483108 
     
    31523112 
    31533113                    ix += 1 
    3154                     ctl4 = self.ModelTextCtrl(self, -1, 
    3155                                               size=(_BOX_WIDTH / 1.8, 20), 
    3156                                               style=wx.TE_PROCESS_ENTER, 
     3114                    ctl4 = ModelTextCtrl(self, -1, 
     3115                                         size=(_BOX_WIDTH / 1.8, 20), 
     3116                                         style=wx.TE_PROCESS_ENTER, 
    31573117                            text_enter_callback=self._onparamRangeEnter) 
    31583118                    sizer.Add(ctl4, (iy, ix), (1, 1), 
  • src/sas/perspectives/fitting/fitting.py

    racf8e4a5 r373d4ee  
    12111211            del self.fit_thread_list[uid] 
    12121212 
    1213         self._update_fit_button(page_id) 
     1213        wx.CallAfter(self._update_fit_button, page_id) 
    12141214        t1 = time.time() 
    12151215        str_time = time.strftime("%a, %d %b %Y %H:%M:%S ", time.localtime(t1)) 
     
    14501450                                                      type="stop")) 
    14511451        wx.PostEvent(self.result_panel, PlotResultEvent(result=result)) 
    1452         self._update_fit_button(page_id) 
     1452        wx.CallAfter(self._update_fit_button, page_id) 
    14531453        result = result[0] 
    14541454        self.fit_thread_list = {} 
     
    14701470                                         info="warning", 
    14711471                                         type="stop")) 
    1472                     self._update_fit_button(page_id) 
     1472                    wx.CallAfter(self._update_fit_button, page_id) 
    14731473                else: 
    14741474                    #set the panel when fit result are float not list 
  • src/sas/guiframe/media/data_explorer_help.rst

    r2bf5e3b raa352c8  
    1717Remove_Data_ 
    1818 
     19Create_New_Plot_ 
     20 
    1921Append_Plot_to_Graph_ 
    20  
    21 Create_New_Plot_ 
    2222 
    2323Freeze_Theory_ 
     
    4040 
    4141*NOTE! When* Data Explorer *is hidden, all data loaded will be sent directly  
    42 to the current active application, if possible. When* Data Explorer *is  
     42to the current active analysis perspective, if possible. When* Data Explorer *is 
    4343shown, data go first to the* Data Explorer. 
    4444 
     
    5050--------- 
    5151 
    52 To load data, click the button *Load Data*, then select one or more (by holding  
    53 the Ctrl key) files to load into the application. The name of each selected  
    54 file will be listed. 
     52To load data, do one of the following: 
    5553 
    56 Clicking the *+*  symbol will display any available metadata. 
     54Select File -> Load Data File(s), and navigate to your data; 
     55 
     56Select File -> Load Data Folder, which will attempt to load all the data in the 
     57specified folder; 
     58 
     59Or, in the *Data Explorer* click the button *Load Data*, then select one or more 
     60(by holding down the Ctrl key) files to load into SasView. 
     61 
     62The name of each loaded file will be listed in the *Data Explorer*. Clicking the 
     63*+*  symbol alongside will display any available metadata read from the file. 
    5764 
    5865.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     
    6471 
    6572Right-clicking on a loaded dataset (or model calculation, what SasView calls a  
    66 theory) brings up a *Handy Menu* from which it is possible to access Datainfo,  
    67 Save the data/theory, or Plot the data/theory. 
     73'theory') brings up a *Handy Menu* from which it is possible to access *Data Info*, 
     74*Save* the data/theory, or *Plot* the data/theory. 
    6875 
    6976.. image:: hand_menu.png 
     
    7784 
    7885To interact with data it must be activated. This is accomplished by checking  
    79 the box next to the data label. A green tick will appear. 
     86the box next to the file name in the *Data Explorer*. A green tick will appear. 
    8087 
    81 Unchecking/unticking the box deactivates a data set. 
     88Unchecking/unticking a box deactivates that data set. 
    8289 
    8390There is also a combo box labeled *Selection Options* from which you can  
    84 activate or deactivate multiple data sets. 
     91activate or deactivate multiple data sets in one go. 
    8592 
    8693.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     
    94101selected data sets.* 
    95102 
    96 *Remove Data* removes all reference to selected data from the application. 
     103*Remove Data* removes all references to selected data from SasView. 
     104 
     105.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     106 
     107.. _Create_New_Plot: 
     108 
     109Create New Plot 
     110--------------- 
     111 
     112Click on the *New Plot* button to create a new plot panel where the currently 
     113selected data will be plotted. 
    97114 
    98115.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     
    103120-------------------- 
    104121 
    105 This operation can only be performed on 1D data and plot panels currently  
     122This operation can currently only be performed on 1D data and plot panels 
    106123containing 1D data. 
    107124 
    108 Click on the button *Append To* to add selected data to a plot panel. Next to  
    109 the button is a combo box containing the names of available plot panels.  
     125Click on the button *Append Plot To* to add selected data to a plot panel. Next 
     126to the button is a combo box containing the names of available plot panels. 
    110127Selecting a name from this combo box will move that plot into focus. 
    111128  
     
    114131 
    1151322D Data cannot be appended to any plot panels. 
    116  
    117 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    118  
    119 .. _Create_New_Plot: 
    120  
    121 Create New Plot 
    122 --------------- 
    123  
    124 Click on the *New Plot* button to create a new plot panel where the currently  
    125 selected data will be plotted. 
    126133 
    127134.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     
    134141The *Freeze Theory* button generates data from the selected theory. 
    135142 
    136 *NOTE! This operation can only be performed when theory labels are selected.* 
     143*NOTE! This operation can only be performed when theory labels are selected in* 
     144*the Data panel.* 
    137145 
    138146.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     
    143151------------------- 
    144152 
    145 Click on the button *Send To* button to send the currently selected data to  
    146 a perspective (for *Fitting*, *P(r) Inversion*, or *Invariant* calculation). 
     153Click on the *Send To* button to send the currently selected data to one of the 
     154perspectives (for *Fitting*, *P(r) Inversion*, or *Invariant* calculation). 
    147155  
    148156The *Single*/*Batch* mode radio buttons only apply to the *Fitting* perspective. 
     
    155163.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    156164 
    157 .. note::  This help document was last changed by Steve King, 18Feb2015 
     165.. note::  This help document was last changed by Steve King, 26Apr2015 
Note: See TracChangeset for help on using the changeset viewer.