Changeset b0ab6cb in sasview for calculatorview/perspectives/calculator/help_panel.py
- Timestamp:
- Oct 27, 2010 4:41:30 PM (14 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:
- 6cda91f
- Parents:
- c4d6900
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
calculatorview/perspectives/calculator/help_panel.py
r74b1770 rb0ab6cb 1 1 #!/usr/bin/python 2 """ 3 Help panel for calculator 4 """ 5 import os 2 6 import wx 3 7 import wx.html as html 4 8 from wx.lib.splitter import MultiSplitterWindow 5 9 import sans.perspectives.calculator as calculator 6 import os7 def help():8 """9 Provide general online help text10 Future work: extend this function to allow topic selection11 """12 info_txt = "The inversion approach is based on Moore, J. Appl. Cryst. (1980) 13, 168-175.\n\n"13 info_txt += "P(r) is set to be equal to an expansion of base functions of the type "14 info_txt += "phi_n(r) = 2*r*sin(pi*n*r/D_max). The coefficient of each base functions "15 info_txt += "in the expansion is found by performing a least square fit with the "16 info_txt += "following fit function:\n\n"17 info_txt += "chi**2 = sum_i[ I_meas(q_i) - I_th(q_i) ]**2/error**2 + Reg_term\n\n"18 info_txt += "where I_meas(q) is the measured scattering intensity and I_th(q) is "19 info_txt += "the prediction from the Fourier transform of the P(r) expansion. "20 info_txt += "The Reg_term term is a regularization term set to the second derivative "21 info_txt += "d**2P(r)/dr**2 integrated over r. It is used to produce a smooth P(r) output.\n\n"22 info_txt += "The following are user inputs:\n\n"23 info_txt += " - Number of terms: the number of base functions in the P(r) expansion.\n\n"24 info_txt += " - Regularization constant: a multiplicative constant to set the size of "25 info_txt += "the regularization term.\n\n"26 info_txt += " - Maximum distance: the maximum distance between any two points in the system.\n"27 28 return info_txt29 30 class HelpDialog(wx.Dialog):31 def __init__(self, parent, id):32 33 wx.Dialog.__init__(self, parent, id, size=(400, 420))34 self.SetTitle("Calculator help")35 36 37 vbox = wx.BoxSizer(wx.VERTICAL)38 39 explanation = help()40 41 label_explain = wx.StaticText(self, -1, explanation, size=(350,320))42 43 vbox.Add(label_explain, 0, wx.ALL|wx.EXPAND, 15)44 10 45 11 46 static_line = wx.StaticLine(self, -1)47 vbox.Add(static_line, 0, wx.EXPAND, 0)48 49 button_OK = wx.Button(self, wx.ID_OK, "OK")50 51 sizer_button = wx.BoxSizer(wx.HORIZONTAL)52 sizer_button.Add((20, 20), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)53 sizer_button.Add(button_OK, 0, wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10)54 vbox.Add(sizer_button, 0, wx.EXPAND|wx.BOTTOM|wx.TOP, 10)55 56 self.SetSizer(vbox)57 self.SetAutoLayout(True)58 59 self.Layout()60 self.Centre()61 62 12 class HelpWindow(wx.Frame): 63 def __init__(self, parent, id, title= 'HelpWindow', pageToOpen=None): 64 wx.Frame.__init__(self, parent, id, title, size=(700, 450)) 13 """ 14 """ 15 def __init__(self, parent, title='HelpWindow', pageToOpen=None): 16 wx.Frame.__init__(self, parent, title, size=(700, 450)) 65 17 """ 66 18 contains help info 67 19 """ 68 69 20 splitter = MultiSplitterWindow(self, style=wx.SP_LIVE_UPDATE) 70 21 rpanel = wx.Panel(splitter, -1) 71 lpanel = wx.Panel(splitter, -1, style=wx.BORDER_SUNKEN)22 lpanel = wx.Panel(splitter, -1, style=wx.BORDER_SUNKEN) 72 23 73 24 vbox = wx.BoxSizer(wx.VERTICAL) … … 84 35 vbox.Add(header, 0, wx.EXPAND) 85 36 86 vboxl = wx.BoxSizer(wx.VERTICAL)37 vboxl = wx.BoxSizer(wx.VERTICAL) 87 38 headerl = wx.Panel(lpanel, -1, size=(-1, 20)) 88 39 … … 103 54 self.path = calculator.get_data_path(media='media') 104 55 105 106 page1="""<html> 56 page1 = """<html> 107 57 <body> 108 58 <p>Select topic on Menu</p> … … 110 60 </html>""" 111 61 self.rhelp.SetPage(page1) 112 page ="""<html>62 page = """<html> 113 63 <body> 114 64 <ul> 115 <li><a href ="sld_calculator_help.html" target ="showframe">SLD Calculator</a><br></li> 116 <li><a href ="slit_calculator_help.html" target ="showframe">Slit Size Calculator</a><br></li> 117 <li><a href ="kiessig_calculator_help.html" target ="showframe">Kiessig Thickness Calculator</a><br></li> 65 <li><a href ="sld_calculator_help.html" 66 target ="showframe">SLD Calculator</a><br></li> 67 <li><a href ="slit_calculator_help.html" 68 target ="showframe">Slit Size Calculator</a><br></li> 69 <li><a href ="kiessig_calculator_help.html" 70 target ="showframe">Kiessig Thickness Calculator</a><br></li> 118 71 </ul> 119 72 </body> … … 121 74 122 75 self.lhelp.SetPage(page) 123 self.lhelp.Bind(wx.html.EVT_HTML_LINK_CLICKED, self.OnLinkClicked)76 self.lhelp.Bind(wx.html.EVT_HTML_LINK_CLICKED, self.OnLinkClicked) 124 77 125 vbox.Add(self.rhelp, 1, wx.EXPAND)78 vbox.Add(self.rhelp, 1, wx.EXPAND) 126 79 vboxl.Add(self.lhelp, 1, wx.EXPAND) 127 80 rpanel.SetSizer(vbox) … … 130 83 131 84 vbox1 = wx.BoxSizer(wx.HORIZONTAL) 132 vbox1.Add(splitter, 1,wx.EXPAND)85 vbox1.Add(splitter, 1, wx.EXPAND) 133 86 splitter.AppendWindow(lpanel, 200) 134 87 splitter.AppendWindow(rpanel) … … 138 91 self.Show(True) 139 92 140 141 93 def OnLinkClicked(self, event): 142 94 """ 143 95 Function to diplay html page related to the hyperlinktext selected 144 96 """ 145 146 link= event.GetLinkInfo().GetHref() 147 link = os.path.join(self.path,link) 97 link = event.GetLinkInfo().GetHref() 98 link = os.path.join(self.path, link) 148 99 self.rhelp.LoadPage(link) 100 149 101 150 102 class ViewApp(wx.App): … … 153 105 frame.Show(True) 154 106 self.SetTopWindow(frame) 155 156 107 return True 157 108 158 159 109 if __name__ == "__main__": 160 110 app = ViewApp(0)
Note: See TracChangeset
for help on using the changeset viewer.