[d7d143b0] | 1 | #!/usr/bin/python |
---|
[5062bbf] | 2 | |
---|
[d7d143b0] | 3 | import wx |
---|
| 4 | import wx.html as html |
---|
[f8b79d6] | 5 | from wx.lib.splitter import MultiSplitterWindow |
---|
[d292959] | 6 | import os |
---|
[925a30e] | 7 | |
---|
[d7d143b0] | 8 | |
---|
[2268d10] | 9 | class HelpWindow(wx.Frame): |
---|
[5062bbf] | 10 | """ |
---|
| 11 | """ |
---|
[4faf4ba] | 12 | def __init__(self, parent, id, title= 'HelpWindow', pageToOpen=None): |
---|
[1c779b6] | 13 | wx.Frame.__init__(self, parent, id, title, size=(850, 500)) |
---|
[925a30e] | 14 | """ |
---|
[5062bbf] | 15 | contains help info |
---|
[925a30e] | 16 | """ |
---|
[f8b79d6] | 17 | |
---|
| 18 | splitter = MultiSplitterWindow(self, style=wx.SP_LIVE_UPDATE) |
---|
| 19 | rpanel = wx.Panel(splitter, -1) |
---|
| 20 | lpanel = wx.Panel(splitter, -1,style=wx.BORDER_SUNKEN) |
---|
[d7d143b0] | 21 | |
---|
| 22 | vbox = wx.BoxSizer(wx.VERTICAL) |
---|
[6fb01b6] | 23 | header = wx.Panel(rpanel, -1) |
---|
[d7d143b0] | 24 | header.SetBackgroundColour('#6666FF') |
---|
| 25 | header.SetForegroundColour('WHITE') |
---|
| 26 | hbox = wx.BoxSizer(wx.HORIZONTAL) |
---|
[2268d10] | 27 | st = wx.StaticText(header, -1, 'Contents', (5, 5)) |
---|
[d7d143b0] | 28 | font = st.GetFont() |
---|
| 29 | font.SetPointSize(10) |
---|
| 30 | st.SetFont(font) |
---|
| 31 | hbox.Add(st, 1, wx.TOP | wx.BOTTOM | wx.LEFT, 5) |
---|
| 32 | header.SetSizer(hbox) |
---|
| 33 | vbox.Add(header, 0, wx.EXPAND) |
---|
| 34 | |
---|
[b92884a] | 35 | vboxl= wx.BoxSizer(wx.VERTICAL) |
---|
| 36 | headerl = wx.Panel(lpanel, -1, size=(-1, 20)) |
---|
[d292959] | 37 | |
---|
[b92884a] | 38 | headerl.SetBackgroundColour('#6666FF') |
---|
| 39 | headerl.SetForegroundColour('WHITE') |
---|
| 40 | hboxl = wx.BoxSizer(wx.HORIZONTAL) |
---|
[2268d10] | 41 | lst = wx.StaticText(headerl, -1, 'Menu', (5, 5)) |
---|
[b92884a] | 42 | fontl = lst.GetFont() |
---|
| 43 | fontl.SetPointSize(10) |
---|
| 44 | lst.SetFont(fontl) |
---|
| 45 | hboxl.Add(lst, 1, wx.TOP | wx.BOTTOM | wx.LEFT, 5) |
---|
| 46 | headerl.SetSizer(hboxl) |
---|
| 47 | vboxl.Add(headerl, 0, wx.EXPAND) |
---|
| 48 | self.lhelp = html.HtmlWindow(lpanel, -1, style=wx.NO_BORDER) |
---|
[6fb01b6] | 49 | self.rhelp = html.HtmlWindow(rpanel, -1, style=wx.NO_BORDER, size=(500,-1)) |
---|
[2268d10] | 50 | page1="""<html> |
---|
| 51 | <body> |
---|
| 52 | <p>Select topic on Menu</p> |
---|
| 53 | </body> |
---|
| 54 | </html>""" |
---|
[b92884a] | 55 | page="""<html> |
---|
| 56 | <body> |
---|
| 57 | <ul> |
---|
[0df5d68] | 58 | <li><a href ="media/change_scale_help.html" target ="showframe">Change Scale</a><br></li> |
---|
[3244cbe1] | 59 | <li><a href ="media/reset_Graph_help.html" target ="showframe">Graph Help</a><br></li> |
---|
[0df5d68] | 60 | <li><a href ="media/status_bar_help.html" target ="showframe">Status Bar Help</a><br></li> |
---|
[3244cbe1] | 61 | <li><a href ="media/load_data_help.html" target ="showframe">Load a File</a><br></li> |
---|
| 62 | <li><a href ="media/simultaneous_fit_help.html" target ="showframe">Simultaneous Fit</a><br></li> |
---|
| 63 | <li><a href ="media/single_fit_help.html" target ="showframe">Single Fit</a><br></li> |
---|
| 64 | <li><a href ="media/model_use_help.html" target ="showframe">Visualize Model</a><br></li> |
---|
| 65 | <li><a href ="media/averaging_help.html" target ="showframe">Data Averaging</a><br></li> |
---|
| 66 | <li><a href ="media/model_functions.html" target ="showframe">Model Functions</a><br></li> |
---|
[b92884a] | 67 | </ul> |
---|
| 68 | </body> |
---|
| 69 | </html>""" |
---|
[2268d10] | 70 | self.rhelp.SetPage(page1) |
---|
[b92884a] | 71 | self.lhelp.SetPage(page) |
---|
| 72 | self.lhelp.Bind(wx.html.EVT_HTML_LINK_CLICKED,self.OnLinkClicked ) |
---|
[9181512] | 73 | |
---|
[4faf4ba] | 74 | #open the help frame a the current page |
---|
| 75 | if pageToOpen!= None: |
---|
| 76 | self.rhelp.LoadPage(str( pageToOpen)) |
---|
[9181512] | 77 | |
---|
[dcd330b] | 78 | vbox.Add(self.rhelp,1, wx.EXPAND) |
---|
[b92884a] | 79 | vboxl.Add(self.lhelp, 1, wx.EXPAND) |
---|
[d7d143b0] | 80 | rpanel.SetSizer(vbox) |
---|
[b92884a] | 81 | lpanel.SetSizer(vboxl) |
---|
| 82 | lpanel.SetFocus() |
---|
[d7d143b0] | 83 | |
---|
[f8b79d6] | 84 | vbox1 = wx.BoxSizer(wx.HORIZONTAL) |
---|
| 85 | vbox1.Add(splitter,1,wx.EXPAND) |
---|
| 86 | splitter.AppendWindow(lpanel, 200) |
---|
| 87 | splitter.AppendWindow(rpanel) |
---|
[d7d143b0] | 88 | self.SetSizer(vbox1) |
---|
[6fb01b6] | 89 | |
---|
[d7d143b0] | 90 | self.Centre() |
---|
| 91 | self.Show(True) |
---|
[925a30e] | 92 | |
---|
[9181512] | 93 | def OnButtonClicked(self, event): |
---|
| 94 | """ |
---|
[5062bbf] | 95 | Function to diplay html page related to the hyperlinktext selected |
---|
[9181512] | 96 | """ |
---|
[3244cbe1] | 97 | self.rhelp.LoadPage("media/modelfunction.html") |
---|
[925a30e] | 98 | |
---|
[b92884a] | 99 | def OnLinkClicked(self, event): |
---|
| 100 | """ |
---|
[5062bbf] | 101 | Function to diplay html page related to the hyperlinktext selected |
---|
[b92884a] | 102 | """ |
---|
| 103 | link= event.GetLinkInfo().GetHref() |
---|
| 104 | self.rhelp.LoadPage(link) |
---|
[5062bbf] | 105 | """ |
---|
| 106 | Example: :: |
---|
[b92884a] | 107 | |
---|
[5062bbf] | 108 | class ViewApp(wx.App): |
---|
| 109 | def OnInit(self): |
---|
| 110 | frame = HelpWindow(None, -1, 'HelpWindow') |
---|
| 111 | frame.Show(True) |
---|
| 112 | self.SetTopWindow(frame) |
---|
| 113 | |
---|
| 114 | return True |
---|
| 115 | |
---|
| 116 | |
---|
| 117 | if __name__ == "__main__": |
---|
[2268d10] | 118 | app = ViewApp(0) |
---|
[5062bbf] | 119 | app.MainLoop() |
---|
| 120 | |
---|
| 121 | """ |
---|