Changeset c1694f8 in sasview for src/sas/perspectives/fitting


Ignore:
Timestamp:
Feb 18, 2015 3:45:37 PM (10 years ago)
Author:
butler
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:
7d32aaf
Parents:
ac85c4b
Message:

Moved the rest of basepage help to the new method. Basically
MODELS
1) Added a button to separate description help from function details
help
2) Make function details help go to new documentation
3) Converted polydispersity help (hitting question mark) and mag angle
description help (question mark again) to use new documentation.

File:
1 edited

Legend:

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

    r4380c03 rc1694f8  
    2626from sas.perspectives.fitting.pagestate import PageState 
    2727from sas.guiframe.CategoryInstaller import CategoryInstaller 
     28from sas.guiframe.documentation_window import DocumentationWindow 
     29 
    2830 
    2931(PageInfoEvent, EVT_PAGE_INFO) = wx.lib.newevent.NewEvent() 
     
    29162918        return graphs, canvases 
    29172919 
    2918     def on_model_help_clicked(self, event): 
    2919         """ 
    2920         Function called when 'Details' button is pressed next to model 
    2921         of interest.  As of Feb 2015 this function follows two paths: 
    2922         For regular models that ship with the release, it calls the Sphinx 
    2923         generated html documentation.  For plugin models it still uses the 
    2924         old pop up window reading the description provided in the model. 
    2925          
    2926         This will presumably be deprecated when the sas mdels team decides 
    2927         on how to discover new models and grab their documentation from the 
    2928         file. 
    2929          
    2930         PDB 18 Feb 2015 
    2931          
    2932         :param evt: on Details Button pressed event 
    2933         """ 
    2934         from sas.perspectives.fitting.help_panel import  HelpWindow 
    2935         from sas.models import get_data_path 
    2936          
    2937         # Get models help model_function path 
    2938         path = get_data_path(media='media') 
    2939         model_path = os.path.join(path, "model_functions.html") 
     2920    def on_function_help_clicked(self, event): 
     2921        """ 
     2922        Function called when 'Help' button is pressed next to model 
     2923        of interest.  This calls DocumentationWindow from  
     2924        documentation_window.py. It will load the top level of the model 
     2925        help documenation sphinx generated html if no model is presented. 
     2926        If a model IS present then if documention for that model exists 
     2927        it will load to that  point otherwise again it will go to the top. 
     2928        For Wx2.8 and below is used (i.e. non-released through installer) 
     2929        a browser is loaded and the top of the model documentation only is 
     2930        accessible because webbrowser module does not pass anything after 
     2931        the # to the browser. 
     2932         
     2933        :param evt: on Help Button pressed event 
     2934        """ 
     2935 
    29402936        if self.model == None: 
    29412937            name = 'index.html' 
    29422938        else: 
    29432939            name = self.formfactorbox.GetValue() 
    2944         frame = HelpWindow(None, -1, pageToOpen=model_path) 
    2945         #If model name exists and model is not a custom model 
    2946         #mod_cat = self.categorybox.GetStringSelection() 
    2947         if frame.rhelp.HasAnchor(name): 
    2948             frame.Show(True) 
    2949             frame.rhelp.ScrollToAnchor(name) 
     2940 
     2941        if self.model != None:   
     2942            _docspath='user/models/model_functions.html#' + name 
     2943            _doc_viewer = DocumentationWindow(self, -1, _docspath, name + "Help") 
    29502944        else: 
    2951             if self.model != None: 
    2952                 frame.Destroy() 
    2953                 msg = 'Model description:\n' 
    2954                 if str(self.model.description).rstrip().lstrip() == '': 
    2955                     msg += "Sorry, no information is available for this model." 
    2956                 else: 
    2957                     msg += self.model.description + '\n' 
    2958                 info = "Info" 
    2959                 wx.MessageBox(msg, info) 
     2945            _doc_viewer = DocumentationWindow(self, -1, "index.html", \ 
     2946                                                "General Help") 
     2947 
     2948 
     2949    def on_model_help_clicked(self, event): 
     2950        """ 
     2951        Function called when 'Description' button is pressed next to model 
     2952        of interest.  This calls the Description embedded in the model. This 
     2953        should work with either Wx2.8 and lower or higher. If no model is 
     2954        selected it will give the message that a model must be chosen first 
     2955        in the box that would normally contain the description.  If a badly 
     2956        behaved model is encountered which has no description then it will 
     2957        give the message that none is available. 
     2958         
     2959        :param evt: on Description Button pressed event 
     2960        """ 
     2961 
     2962        if self.model == None: 
     2963            name = 'index.html' 
     2964        else: 
     2965            name = self.formfactorbox.GetValue() 
     2966 
     2967        msg = 'Model description:\n' 
     2968        info = "Info" 
     2969        if self.model != None: 
     2970#                frame.Destroy() 
     2971            if str(self.model.description).rstrip().lstrip() == '': 
     2972                msg += "Sorry, no information is available for this model." 
    29602973            else: 
    2961                 frame.Show(True) 
     2974                msg += self.model.description + '\n' 
     2975            wx.MessageBox(msg, info) 
     2976        else: 
     2977            msg += "You must select a model to get information on this" 
     2978            wx.MessageBox(msg, info) 
    29622979 
    29632980    def _on_mag_help(self, event):     
     
    29662983        is clicked. Calls DocumentationWindow with the path of the location  
    29672984        within the documentation tree (after /doc/ ....". When using old  
    2968         versions of Wx When (i.e. before 2.9 and therefore not part of release 
     2985        versions of Wx (i.e. before 2.9 and therefore not part of release 
    29692986        versions distributed via installer) it brings up an image viewer 
    29702987        box which allows the user to click through the rest of the images in  
     
    29762993        :param evt: Triggers on clicking ? in Magnetic Angles? box 
    29772994        """ 
    2978          
    2979         from sas.guiframe.documentation_window import DocumentationWindow 
    29802995         
    29812996        _TreeLocation = "_images/M_angles_pic.bmp" 
     
    30243039        :param evt: Triggers on clicking ? in polydispersity box 
    30253040        """ 
    3026          
    3027         from sas.guiframe.documentation_window import DocumentationWindow 
    3028          
     3041                 
    30293042        _TreeLocation = "user/perspectives/fitting/fitting_help.html" 
    30303043        _TreeLocation += "#polydispersity-distributions" 
     
    35923605        self.mbox_description.SetForegroundColour(wx.RED) 
    35933606        id = wx.NewId() 
    3594         self.model_help = wx.Button(self, id, 'Details', size=(80, 23)) 
     3607        self.model_func = wx.Button(self, id, 'Help', size=(80, 23)) 
     3608        self.model_func.Bind(wx.EVT_BUTTON, self.on_function_help_clicked, id=id) 
     3609        self.model_func.SetToolTipString("Full Model Function Help") 
     3610        id = wx.NewId() 
     3611        self.model_help = wx.Button(self, id, 'Description', size=(80, 23)) 
    35953612        self.model_help.Bind(wx.EVT_BUTTON, self.on_model_help_clicked, id=id) 
    3596         self.model_help.SetToolTipString("Model Function Help") 
     3613        self.model_help.SetToolTipString("Short Model Function Description") 
    35973614        id = wx.NewId() 
    35983615        self.model_view = wx.Button(self, id, "Show 2D", size=(80, 23)) 
     
    36363653       
    36373654        sizer_radiobutton = wx.GridSizer(2, 2, 5, 5) 
     3655         
    36383656 
    36393657        #sizer_radiobutton.Add(self.shape_rbutton) 
    36403658        #sizer_radiobutton.Add(self.shape_indep_rbutton) 
    36413659        sizer_radiobutton.Add((5,5)) 
    3642         sizer_radiobutton.Add(self.model_view, 1, wx.RIGHT, 15) 
     3660        sizer_radiobutton.Add(self.model_view, 1, wx.RIGHT, 5) 
    36433661        #sizer_radiobutton.Add(self.plugin_rbutton) 
    36443662        #sizer_radiobutton.Add(self.struct_rbutton) 
    3645         sizer_radiobutton.Add((5,5)) 
    3646         sizer_radiobutton.Add(self.model_help, 1, wx.RIGHT, 15) 
     3663#        sizer_radiobutton.Add((5,5)) 
     3664        sizer_radiobutton.Add(self.model_help, 1, wx.RIGHT|wx.LEFT, 5) 
     3665#        sizer_radiobutton.Add((5,5)) 
     3666        sizer_radiobutton.Add(self.model_func, 1, wx.RIGHT, 5) 
    36473667        sizer_cat.Add(sizer_cat_box, 1, wx.LEFT, 2.5) 
    36483668        sizer_cat.Add(sizer_radiobutton) 
Note: See TracChangeset for help on using the changeset viewer.