Changeset c1694f8 in sasview for src/sas/perspectives/fitting
- Timestamp:
- Feb 18, 2015 3:45:37 PM (10 years ago)
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/perspectives/fitting/basepage.py
r4380c03 rc1694f8 26 26 from sas.perspectives.fitting.pagestate import PageState 27 27 from sas.guiframe.CategoryInstaller import CategoryInstaller 28 from sas.guiframe.documentation_window import DocumentationWindow 29 28 30 29 31 (PageInfoEvent, EVT_PAGE_INFO) = wx.lib.newevent.NewEvent() … … 2916 2918 return graphs, canvases 2917 2919 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 2940 2936 if self.model == None: 2941 2937 name = 'index.html' 2942 2938 else: 2943 2939 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") 2950 2944 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." 2960 2973 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) 2962 2979 2963 2980 def _on_mag_help(self, event): … … 2966 2983 is clicked. Calls DocumentationWindow with the path of the location 2967 2984 within the documentation tree (after /doc/ ....". When using old 2968 versions of Wx When(i.e. before 2.9 and therefore not part of release2985 versions of Wx (i.e. before 2.9 and therefore not part of release 2969 2986 versions distributed via installer) it brings up an image viewer 2970 2987 box which allows the user to click through the rest of the images in … … 2976 2993 :param evt: Triggers on clicking ? in Magnetic Angles? box 2977 2994 """ 2978 2979 from sas.guiframe.documentation_window import DocumentationWindow2980 2995 2981 2996 _TreeLocation = "_images/M_angles_pic.bmp" … … 3024 3039 :param evt: Triggers on clicking ? in polydispersity box 3025 3040 """ 3026 3027 from sas.guiframe.documentation_window import DocumentationWindow 3028 3041 3029 3042 _TreeLocation = "user/perspectives/fitting/fitting_help.html" 3030 3043 _TreeLocation += "#polydispersity-distributions" … … 3592 3605 self.mbox_description.SetForegroundColour(wx.RED) 3593 3606 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)) 3595 3612 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") 3597 3614 id = wx.NewId() 3598 3615 self.model_view = wx.Button(self, id, "Show 2D", size=(80, 23)) … … 3636 3653 3637 3654 sizer_radiobutton = wx.GridSizer(2, 2, 5, 5) 3655 3638 3656 3639 3657 #sizer_radiobutton.Add(self.shape_rbutton) 3640 3658 #sizer_radiobutton.Add(self.shape_indep_rbutton) 3641 3659 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) 3643 3661 #sizer_radiobutton.Add(self.plugin_rbutton) 3644 3662 #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) 3647 3667 sizer_cat.Add(sizer_cat_box, 1, wx.LEFT, 2.5) 3648 3668 sizer_cat.Add(sizer_radiobutton)
Note: See TracChangeset
for help on using the changeset viewer.