source: sasview/theoryview/perspectives/theory/help_panel.py @ fc292d3

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since fc292d3 was 2f60121, checked in by Gervaise Alina <gervyh@…>, 14 years ago

make panel inheriting from PanelBase?

  • Property mode set to 100644
File size: 3.5 KB
RevLine 
[0277d084]1#!/usr/bin/python
2import wx
3import wx.html as html
4from wx.lib.splitter import MultiSplitterWindow
5import os
6
7
8class HelpWindow(wx.Frame):
[2f60121]9    def __init__(self, parent, id, title='HelpWindow', pageToOpen=None):
[a9a6896]10        wx.Frame.__init__(self, parent, id, title, size=(850, 500))
[0277d084]11        """
[74755ff]12        Windows containing html documentation for theory application
13       
[0277d084]14        """
15     
16        splitter = MultiSplitterWindow(self, style=wx.SP_LIVE_UPDATE)
17        rpanel = wx.Panel(splitter, -1)
[2f60121]18        lpanel = wx.Panel(splitter, -1, style=wx.BORDER_SUNKEN)
[0277d084]19       
20        vbox = wx.BoxSizer(wx.VERTICAL)
21        header = wx.Panel(rpanel, -1)
22        header.SetBackgroundColour('#6666FF')
23        header.SetForegroundColour('WHITE')
24        hbox = wx.BoxSizer(wx.HORIZONTAL)
25        st = wx.StaticText(header, -1, 'Contents', (5, 5))
26        font = st.GetFont()
27        font.SetPointSize(10)
28        st.SetFont(font)
[2f60121]29        hbox.Add(st, 1, wx.TOP|wx.BOTTOM|wx.LEFT, 5)
[0277d084]30        header.SetSizer(hbox)
31        vbox.Add(header, 0, wx.EXPAND)
32       
33        vboxl= wx.BoxSizer(wx.VERTICAL)
34        headerl = wx.Panel(lpanel, -1, size=(-1, 20))
35       
36        headerl.SetBackgroundColour('#6666FF')
37        headerl.SetForegroundColour('WHITE')
38        hboxl = wx.BoxSizer(wx.HORIZONTAL)
39        lst = wx.StaticText(headerl, -1, 'Menu', (5, 5))
40        fontl = lst.GetFont()
41        fontl.SetPointSize(10)
42        lst.SetFont(fontl)
[2f60121]43        hboxl.Add(lst, 1, wx.TOP|wx.BOTTOM|wx.LEFT, 5)
[0277d084]44        headerl.SetSizer(hboxl)
45        vboxl.Add(headerl, 0, wx.EXPAND)
46        self.lhelp = html.HtmlWindow(lpanel, -1, style=wx.NO_BORDER)
[2f60121]47        self.rhelp = html.HtmlWindow(rpanel, -1, 
48                                     style=wx.NO_BORDER, size=(500, -1))
49        page1 = """<html>
[0277d084]50            <body>
51             <p>Select topic on Menu</p>
52            </body>
53            </html>"""
[2f60121]54        page = """<html>
[0277d084]55            <body>
56            <ul>
[e071b1c]57            <li><a href ="media/model_functions.html" target ="showframe">Model Functions</a><br></li>
[0277d084]58            </ul>
59            </body>
60            </html>"""
61        self.rhelp.SetPage(page1)
62        self.lhelp.SetPage(page)
[2f60121]63        self.lhelp.Bind(wx.html.EVT_HTML_LINK_CLICKED, self.OnLinkClicked)
[0277d084]64        #open the help frame a the current page
[2f60121]65        if  pageToOpen != None:
66            self.rhelp.LoadPage(str(pageToOpen))
67        vbox.Add(self.rhelp, 1, wx.EXPAND)
[0277d084]68        vboxl.Add(self.lhelp, 1, wx.EXPAND)
69        rpanel.SetSizer(vbox)
70        lpanel.SetSizer(vboxl)
71        lpanel.SetFocus()
72        vbox1 = wx.BoxSizer(wx.HORIZONTAL)
[2f60121]73        vbox1.Add(splitter, 1, wx.EXPAND)
[0277d084]74        splitter.AppendWindow(lpanel, 200)
75        splitter.AppendWindow(rpanel)
76        self.SetSizer(vbox1)
77        self.Centre()
78        self.Show(True)
79       
80    def OnButtonClicked(self, event):
81        """
[74755ff]82        Function to diplay html page related to the hyperlinktext selected
83       
[0277d084]84        """
[e071b1c]85        self.rhelp.LoadPage("media/modelfunction.html")
[0277d084]86       
87    def OnLinkClicked(self, event):
88        """
[74755ff]89        Function to diplay html page related to the hyperlinktext selected
90       
[0277d084]91        """
92        link= event.GetLinkInfo().GetHref()
93        self.rhelp.LoadPage(link)
94
[74755ff]95
[0277d084]96class ViewApp(wx.App):
97    def OnInit(self):
98        frame = HelpWindow(None, -1, 'HelpWindow')   
99        frame.Show(True)
100        self.SetTopWindow(frame)
101       
102        return True
103       
104
105if __name__ == "__main__": 
106    app = ViewApp(0)
107    app.MainLoop()     
Note: See TracBrowser for help on using the repository browser.