Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/perspectives/fitting/fitpage.py

    r5265420 rf3dc56c  
    1616from sas.guiframe.utils import format_number 
    1717from sas.guiframe.utils import check_float 
     18from sas.guiframe.documentation_window import DocumentationWindow 
    1819 
    1920(Chi2UpdateEvent, EVT_CHI2_UPDATE) = wx.lib.newevent.NewEvent() 
     
    188189    def _fill_range_sizer(self): 
    189190        """ 
    190         Fill the sizer containing the plotting range 
    191         add  access to npts 
     191        Fill the Fitting sizer on the fit panel which contains: the smearing 
     192        information (dq), the weighting information (dI or other), the plotting 
     193        range, access to the 2D mask editor, the compute, fit, and help 
     194        buttons, xi^2, number of points etc. 
    192195        """ 
    193196        is_2Ddata = False 
     
    265268        weighting_box.Add(sizer_weighting) 
    266269 
    267         sizer_fit = wx.GridSizer(2, 4, 2, 6) 
     270        sizer_fit = wx.GridSizer(2, 5, 2, 6) 
    268271 
    269272        # combobox for smear2d accuracy selection 
     
    284287        self.btFit.SetToolTipString("Start fitting.") 
    285288 
     289        #General Help button 
     290        self.btFitHelp = wx.Button(self, -1, 'HELP') 
     291        self.btFitHelp.SetToolTipString("General Fitting Help.") 
     292        self.btFitHelp.Bind(wx.EVT_BUTTON, self._onFitHelp) 
     293         
     294        #Resolution Smearing Help button (for now use same technique as 
     295        #used for dI help to get tiniest possible button that works 
     296        #both on MAC and PC.  Should completely rewrite the fitting sizer  
     297        #in future.  This is minimum to get out release 3.1 
     298        #        comment June 14, 2015     --- PDB 
     299        if sys.platform.count("win32") > 0: 
     300            size_q = (20, 15)  #on PC 
     301        else: 
     302            size_q = (30, 20)  #on MAC 
     303        self.btSmearHelp = wx.Button(self, -1, '?', style=wx.BU_EXACTFIT,\ 
     304                                     size=size_q) 
     305        self.btSmearHelp.SetToolTipString("Resolution Smearing Help.") 
     306        self.btSmearHelp.Bind(wx.EVT_BUTTON, self._onSmearHelp) 
     307         
    286308        #textcntrl for custom resolution 
    287309        self.smear_pinhole_max = ModelTextCtrl(self, -1, 
     
    341363 
    342364        # add 4 types of smearing to the sizer 
     365        # Note from June 14, 2015 
     366        # removed the extra (10,10) spaces to make room for help.  Actually 
     367        # don't see the need for those anyway as the wx.LEFT, xx should take 
     368        # care of spacing anyway though it does not seem to work for some 
     369        # reason.  Currently leaving as we are in "code freeze" only making 
     370        # minimal changes necessary for release 3.1.  We probably want to clean 
     371        # up the whole fitpage (and basepage and fitpanel etc) eventually. 
     372        #                          ---- PDB 
    343373        sizer_smearer.Add(self.disable_smearer, 0, wx.LEFT, 10) 
    344         sizer_smearer.Add((10, 10)) 
     374#        sizer_smearer.Add((10, 10)) 
    345375        sizer_smearer.Add(self.enable_smearer) 
    346         sizer_smearer.Add((10, 10)) 
     376#        sizer_smearer.Add((10, 10)) 
    347377        sizer_smearer.Add(self.pinhole_smearer) 
    348         sizer_smearer.Add((10, 10)) 
     378#        sizer_smearer.Add((10, 10)) 
    349379        sizer_smearer.Add(self.slit_smearer) 
     380#        sizer_smearer.Add((10, 10)) 
     381        sizer_smearer.Add(self.btSmearHelp) 
    350382        sizer_smearer.Add((10, 10)) 
    351383 
     
    391423        #sizer_fit.Add(box_description_3, 0, 0) 
    392424        sizer_fit.Add(self.draw_button, 0, 0) 
     425        sizer_fit.Add((-1,5)) 
    393426        sizer_fit.Add(self.tcChi, 0, 0) 
    394427        sizer_fit.Add(self.Npts_fit, 0, 0) 
    395428        sizer_fit.Add(self.Npts_total, 0, 0) 
    396429        sizer_fit.Add(self.btFit, 0, 0) 
     430        sizer_fit.Add(self.btFitHelp, 0, 0) 
    397431 
    398432        # StaticText for smear 
     
    10461080        self.fit_started = self._manager.onFit(uid=self.uid) 
    10471081        wx.CallAfter(self.set_fitbutton) 
     1082 
     1083    def _onFitHelp(self, event): 
     1084        """ 
     1085        Bring up the Full Fitting Documentation whenever the HELP button is 
     1086        clicked. 
     1087 
     1088        Calls DocumentationWindow with the path of the location within the 
     1089        documentation tree (after /doc/ ....".  Note that when using old 
     1090        versions of Wx (before 2.9) and thus not the release version of 
     1091        installers, the help comes up at the top level of the file as 
     1092        webbrowser does not pass anything past the # to the browser when it is 
     1093        running "file:///...." 
     1094 
     1095    :param evt: Triggers on clicking the help button 
     1096    """ 
     1097 
     1098        _TreeLocation = "user/perspectives/fitting/fitting_help.html" 
     1099        _doc_viewer = DocumentationWindow(self, -1, _TreeLocation, "", 
     1100                                          "General Fitting Help") 
     1101 
     1102    def _onSmearHelp(self, event): 
     1103        """ 
     1104        Bring up the instrumental resolution smearing Documentation whenever 
     1105        the ? button in the smearing box is clicked. 
     1106 
     1107        Calls DocumentationWindow with the path of the location within the 
     1108        documentation tree (after /doc/ ....".  Note that when using old 
     1109        versions of Wx (before 2.9) and thus not the release version of 
     1110        installers, the help comes up at the top level of the file as 
     1111        webbrowser does not pass anything past the # to the browser when it is 
     1112        running "file:///...." 
     1113 
     1114    :param evt: Triggers on clicking the help button 
     1115    """ 
     1116 
     1117        _TreeLocation = "user/perspectives/fitting/sm_help.html" 
     1118        _doc_viewer = DocumentationWindow(self, -1, _TreeLocation, "", 
     1119                                          "Instrumental Resolution Smearing \ 
     1120                                          Help") 
    10481121 
    10491122    def set_fitbutton(self): 
     
    30123085                orient_angle = wx.StaticText(self, -1, '[For 2D only]:') 
    30133086                mag_on_button = wx.Button(self, -1, "Magnetic ON") 
     3087                mag_on_button.SetToolTipString("Turn Pol Beam/Mag scatt on/off") 
    30143088                mag_on_button.Bind(wx.EVT_BUTTON, self._on_mag_on) 
    3015                 mag_help_button = wx.Button(self, -1, "Magnetic angles?") 
     3089                mag_angle_help_button = wx.Button(self, -1, "Magnetic angles?") 
     3090                mag_angle_help_button.SetToolTipString("see angle definitions") 
     3091                mag_help_button = wx.Button(self, -1, "Mag HELP") 
     3092                mag_help_button.SetToolTipString("Help on pol beam/mag fitting") 
    30163093                mag_help_button.Bind(wx.EVT_BUTTON, self._on_mag_help) 
     3094                mag_angle_help_button.Bind(wx.EVT_BUTTON, \ 
     3095                                            self._on_mag_angle_help) 
    30173096                sizer.Add(orient_angle, (iy, ix), (1, 1), 
    30183097                          wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 
     
    30203099                sizer.Add(mag_on_button, (iy, ix), (1, 1), 
    30213100                          wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 
     3101                ix += 1 
     3102                sizer.Add(mag_angle_help_button, (iy, ix), (1, 1), 
     3103                          wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 
    30223104                sizer.Add(mag_help_button, (iy, ix + 1), (1, 1), 
    30233105                          wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 
    30243106 
    30253107                #handle the magnetic buttons 
     3108                #clean this up so that assume mag is off then turn  
     3109                #all buttons on IF mag has mag and has 2D 
    30263110                if not self._has_magnetic: 
    30273111                    mag_on_button.Show(False) 
     
    30353119                        mag_on_button.SetLabel("Magnetic OFF") 
    30363120                        mag_help_button.Show(True) 
     3121                        mag_angle_help_button.Show(True) 
    30373122                    else: 
    30383123                        mag_on_button.SetLabel("Magnetic ON") 
    30393124                        mag_help_button.Show(False) 
     3125                        mag_angle_help_button.Show(False) 
    30403126 
    30413127                if not self.data.__class__.__name__ == "Data2D" and \ 
Note: See TracChangeset for help on using the changeset viewer.