[2c63857b] | 1 | #!/usr/bin/python |
---|
| 2 | """ |
---|
| 3 | Help panel for plotting |
---|
| 4 | """ |
---|
| 5 | import os |
---|
| 6 | import wx |
---|
| 7 | import wx.html as html |
---|
| 8 | from wx.lib.splitter import MultiSplitterWindow |
---|
[79492222] | 9 | from sas.guiframe import get_media_path |
---|
[2c63857b] | 10 | |
---|
| 11 | |
---|
| 12 | class HelpWindow(wx.Frame): |
---|
| 13 | """ |
---|
| 14 | """ |
---|
| 15 | def __init__(self, parent, title='Plotting Help', pageToOpen=None): |
---|
| 16 | wx.Frame.__init__(self, parent, title, size=(700, 450)) |
---|
| 17 | """ |
---|
| 18 | contains help info |
---|
| 19 | """ |
---|
[fdc3cb0] | 20 | self.SetTitle('Plotting Help') |
---|
[2c63857b] | 21 | splitter = MultiSplitterWindow(self, style=wx.SP_LIVE_UPDATE) |
---|
| 22 | rpanel = wx.Panel(splitter, -1) |
---|
| 23 | lpanel = wx.Panel(splitter, -1, style=wx.BORDER_SUNKEN) |
---|
| 24 | |
---|
| 25 | vbox = wx.BoxSizer(wx.VERTICAL) |
---|
| 26 | header = wx.Panel(rpanel, -1) |
---|
| 27 | header.SetBackgroundColour('#6666FF') |
---|
| 28 | header.SetForegroundColour('WHITE') |
---|
| 29 | hbox = wx.BoxSizer(wx.HORIZONTAL) |
---|
| 30 | st = wx.StaticText(header, -1, 'Contents', (5, 5)) |
---|
| 31 | font = st.GetFont() |
---|
| 32 | font.SetPointSize(10) |
---|
| 33 | st.SetFont(font) |
---|
| 34 | hbox.Add(st, 1, wx.TOP | wx.BOTTOM | wx.LEFT, 5) |
---|
| 35 | header.SetSizer(hbox) |
---|
| 36 | vbox.Add(header, 0, wx.EXPAND) |
---|
| 37 | |
---|
| 38 | vboxl = wx.BoxSizer(wx.VERTICAL) |
---|
| 39 | headerl = wx.Panel(lpanel, -1, size=(-1, 20)) |
---|
| 40 | |
---|
| 41 | headerl.SetBackgroundColour('#6666FF') |
---|
| 42 | headerl.SetForegroundColour('WHITE') |
---|
| 43 | hboxl = wx.BoxSizer(wx.HORIZONTAL) |
---|
| 44 | lst = wx.StaticText(headerl, -1, 'Menu', (5, 5)) |
---|
| 45 | fontl = lst.GetFont() |
---|
| 46 | fontl.SetPointSize(10) |
---|
| 47 | lst.SetFont(fontl) |
---|
| 48 | hboxl.Add(lst, 1, wx.TOP | wx.BOTTOM | wx.LEFT, 5) |
---|
| 49 | headerl.SetSizer(hboxl) |
---|
| 50 | vboxl.Add(headerl, 0, wx.EXPAND) |
---|
| 51 | self.lhelp = html.HtmlWindow(lpanel, -1, style=wx.NO_BORDER) |
---|
| 52 | self.rhelp = html.HtmlWindow(rpanel, -1, style=wx.NO_BORDER, |
---|
| 53 | size=(500,-1)) |
---|
| 54 | |
---|
[823859a] | 55 | self.path = get_media_path(media='media') |
---|
[2c63857b] | 56 | |
---|
| 57 | page1 = """<html> |
---|
| 58 | <body> |
---|
| 59 | <p>Select topic on Menu</p> |
---|
| 60 | </body> |
---|
| 61 | </html>""" |
---|
| 62 | self.rhelp.SetPage(page1) |
---|
| 63 | page = """<html> |
---|
| 64 | <body> |
---|
| 65 | <ul> |
---|
| 66 | <li><a href ="Graph_help.html" |
---|
[d874092] | 67 | target ="showframe">Graph Menu</a><br></li> |
---|
[2c63857b] | 68 | <li><a href ="averaging_help.html" |
---|
| 69 | target ="showframe">2D Data Averaging</a><br></li> |
---|
| 70 | <li><a href ="key_help.html" |
---|
| 71 | target ="showframe">Key Combination</a><br></li> |
---|
| 72 | </ul> |
---|
| 73 | </body> |
---|
| 74 | </html>""" |
---|
| 75 | |
---|
| 76 | self.lhelp.SetPage(page) |
---|
| 77 | self.lhelp.Bind(wx.html.EVT_HTML_LINK_CLICKED, self.OnLinkClicked) |
---|
| 78 | |
---|
| 79 | vbox.Add(self.rhelp, 1, wx.EXPAND) |
---|
| 80 | vboxl.Add(self.lhelp, 1, wx.EXPAND) |
---|
| 81 | rpanel.SetSizer(vbox) |
---|
| 82 | lpanel.SetSizer(vboxl) |
---|
| 83 | lpanel.SetFocus() |
---|
| 84 | |
---|
| 85 | vbox1 = wx.BoxSizer(wx.HORIZONTAL) |
---|
| 86 | vbox1.Add(splitter, 1, wx.EXPAND) |
---|
| 87 | splitter.AppendWindow(lpanel, 200) |
---|
| 88 | splitter.AppendWindow(rpanel) |
---|
| 89 | self.SetSizer(vbox1) |
---|
| 90 | |
---|
| 91 | self.Centre() |
---|
| 92 | self.Show(True) |
---|
| 93 | |
---|
| 94 | def OnLinkClicked(self, event): |
---|
| 95 | """ |
---|
| 96 | Function to diplay html page related to the hyperlinktext selected |
---|
| 97 | """ |
---|
| 98 | link = event.GetLinkInfo().GetHref() |
---|
| 99 | link = os.path.join(self.path, link) |
---|
| 100 | self.rhelp.LoadPage(link) |
---|
| 101 | |
---|
| 102 | |
---|
| 103 | class ViewApp(wx.App): |
---|
| 104 | def OnInit(self): |
---|
| 105 | frame = HelpWindow(None, -1, 'HelpWindow') |
---|
| 106 | frame.Show(True) |
---|
| 107 | self.SetTopWindow(frame) |
---|
| 108 | return True |
---|
| 109 | |
---|
| 110 | if __name__ == "__main__": |
---|
| 111 | app = ViewApp(0) |
---|
| 112 | app.MainLoop() |
---|