source: sasview/theoryview/perspectives/theory/help_panel.py @ 76703da

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 76703da was 18cdddb, checked in by Jae Cho <jhjcho@…>, 14 years ago

moved modelfunction html files

  • Property mode set to 100644
File size: 3.7 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):
[18cdddb]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)
[18cdddb]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)
[18cdddb]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)
[18cdddb]47        self.rhelp = html.HtmlWindow(rpanel, -1, style=wx.NO_BORDER, size=(500,-1))
48       
49        import sans.models as models 
50        # get the media path
51        path = models.get_data_path(media='media')
52        self.path = os.path.join(path,"model_functions.html")
53
54        page1="""<html>
[0277d084]55            <body>
56             <p>Select topic on Menu</p>
57            </body>
58            </html>"""
[18cdddb]59        page="""<html>
[0277d084]60            <body>
61            <ul>
[18cdddb]62            <li><a href ="%s" target ="showframe">Model Functions</a><br></li>
[0277d084]63            </ul>
64            </body>
[18cdddb]65            </html>""" % self.path
66       
[0277d084]67        self.rhelp.SetPage(page1)
68        self.lhelp.SetPage(page)
[18cdddb]69        self.lhelp.Bind(wx.html.EVT_HTML_LINK_CLICKED,self.OnLinkClicked )
70       
[0277d084]71        #open the help frame a the current page
[18cdddb]72        if  pageToOpen!= None:
73            self.rhelp.LoadPage(str( pageToOpen))
74           
75        vbox.Add(self.rhelp,1, wx.EXPAND)
[0277d084]76        vboxl.Add(self.lhelp, 1, wx.EXPAND)
77        rpanel.SetSizer(vbox)
78        lpanel.SetSizer(vboxl)
79        lpanel.SetFocus()
[18cdddb]80       
[0277d084]81        vbox1 = wx.BoxSizer(wx.HORIZONTAL)
[18cdddb]82        vbox1.Add(splitter,1,wx.EXPAND)
[0277d084]83        splitter.AppendWindow(lpanel, 200)
84        splitter.AppendWindow(rpanel)
85        self.SetSizer(vbox1)
[18cdddb]86       
[0277d084]87        self.Centre()
88        self.Show(True)
89       
90    def OnButtonClicked(self, event):
91        """
[74755ff]92        Function to diplay html page related to the hyperlinktext selected
93       
[0277d084]94        """
[18cdddb]95        self.rhelp.LoadPage(self.path)#"media/modelfunction.html")
[0277d084]96       
97    def OnLinkClicked(self, event):
98        """
[74755ff]99        Function to diplay html page related to the hyperlinktext selected
100       
[0277d084]101        """
102        link= event.GetLinkInfo().GetHref()
103        self.rhelp.LoadPage(link)
104
[74755ff]105
[0277d084]106class ViewApp(wx.App):
107    def OnInit(self):
108        frame = HelpWindow(None, -1, 'HelpWindow')   
109        frame.Show(True)
110        self.SetTopWindow(frame)
111       
112        return True
113       
114
115if __name__ == "__main__": 
116    app = ViewApp(0)
117    app.MainLoop()     
Note: See TracBrowser for help on using the repository browser.