Changes in / [7d32aaf:e8bb5b6] in sasview


Ignore:
File:
1 edited

Legend:

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

    rc1694f8 r4380c03  
    2626from sas.perspectives.fitting.pagestate import PageState 
    2727from sas.guiframe.CategoryInstaller import CategoryInstaller 
    28 from sas.guiframe.documentation_window import DocumentationWindow 
    29  
    3028 
    3129(PageInfoEvent, EVT_PAGE_INFO) = wx.lib.newevent.NewEvent() 
     
    29182916        return graphs, canvases 
    29192917 
    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  
     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") 
    29362940        if self.model == None: 
    29372941            name = 'index.html' 
    29382942        else: 
    29392943            name = self.formfactorbox.GetValue() 
    2940  
    2941         if self.model != None:   
    2942             _docspath='user/models/model_functions.html#' + name 
    2943             _doc_viewer = DocumentationWindow(self, -1, _docspath, name + "Help") 
     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) 
    29442950        else: 
    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." 
     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) 
    29732960            else: 
    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) 
     2961                frame.Show(True) 
    29792962 
    29802963    def _on_mag_help(self, event):     
     
    29832966        is clicked. Calls DocumentationWindow with the path of the location  
    29842967        within the documentation tree (after /doc/ ....". When using old  
    2985         versions of Wx (i.e. before 2.9 and therefore not part of release 
     2968        versions of Wx When (i.e. before 2.9 and therefore not part of release 
    29862969        versions distributed via installer) it brings up an image viewer 
    29872970        box which allows the user to click through the rest of the images in  
     
    29932976        :param evt: Triggers on clicking ? in Magnetic Angles? box 
    29942977        """ 
     2978         
     2979        from sas.guiframe.documentation_window import DocumentationWindow 
    29952980         
    29962981        _TreeLocation = "_images/M_angles_pic.bmp" 
     
    30393024        :param evt: Triggers on clicking ? in polydispersity box 
    30403025        """ 
    3041                  
     3026         
     3027        from sas.guiframe.documentation_window import DocumentationWindow 
     3028         
    30423029        _TreeLocation = "user/perspectives/fitting/fitting_help.html" 
    30433030        _TreeLocation += "#polydispersity-distributions" 
     
    36053592        self.mbox_description.SetForegroundColour(wx.RED) 
    36063593        id = wx.NewId() 
    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)) 
     3594        self.model_help = wx.Button(self, id, 'Details', size=(80, 23)) 
    36123595        self.model_help.Bind(wx.EVT_BUTTON, self.on_model_help_clicked, id=id) 
    3613         self.model_help.SetToolTipString("Short Model Function Description") 
     3596        self.model_help.SetToolTipString("Model Function Help") 
    36143597        id = wx.NewId() 
    36153598        self.model_view = wx.Button(self, id, "Show 2D", size=(80, 23)) 
     
    36533636       
    36543637        sizer_radiobutton = wx.GridSizer(2, 2, 5, 5) 
    3655          
    36563638 
    36573639        #sizer_radiobutton.Add(self.shape_rbutton) 
    36583640        #sizer_radiobutton.Add(self.shape_indep_rbutton) 
    36593641        sizer_radiobutton.Add((5,5)) 
    3660         sizer_radiobutton.Add(self.model_view, 1, wx.RIGHT, 5) 
     3642        sizer_radiobutton.Add(self.model_view, 1, wx.RIGHT, 15) 
    36613643        #sizer_radiobutton.Add(self.plugin_rbutton) 
    36623644        #sizer_radiobutton.Add(self.struct_rbutton) 
    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) 
     3645        sizer_radiobutton.Add((5,5)) 
     3646        sizer_radiobutton.Add(self.model_help, 1, wx.RIGHT, 15) 
    36673647        sizer_cat.Add(sizer_cat_box, 1, wx.LEFT, 2.5) 
    36683648        sizer_cat.Add(sizer_radiobutton) 
Note: See TracChangeset for help on using the changeset viewer.