source: sasview/sansview/perspectives/fitting/help_panel.py @ eb9d94a

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 eb9d94a was 000b025, checked in by Jae Cho <jhjcho@…>, 14 years ago

minor change for help

  • Property mode set to 100644
File size: 4.7 KB
RevLine 
[d7d143b0]1#!/usr/bin/python
[5062bbf]2
[d7d143b0]3import wx
4import wx.html as html
[f8b79d6]5from wx.lib.splitter import MultiSplitterWindow
[d292959]6import os
[925a30e]7
[08e1912]8
[2268d10]9class HelpWindow(wx.Frame):
[5062bbf]10    """
11    """
[4faf4ba]12    def __init__(self, parent, id, title= 'HelpWindow', pageToOpen=None):
[389c991]13        wx.Frame.__init__(self, parent, id, title, size=(850, 530))
[925a30e]14        """
[5062bbf]15        contains help info
[925a30e]16        """
[08e1912]17     
[f8b79d6]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))
[18cdddb]50
51        import sans.models as models 
52        # get the media path
53        path = models.get_data_path(media='media')
54        self.path = os.path.join(path,"model_functions.html")
[389c991]55        self.path_pd = os.path.join(path,"pd_help.html")
[384647dc]56        self.path_sm = os.path.join(path,"smear_computation.html")
[18cdddb]57                   
[2268d10]58        page1="""<html>
59            <body>
60             <p>Select topic on Menu</p>
61            </body>
62            </html>"""
[08e1912]63        page="""<html>
[b92884a]64            <body>
65            <ul>
[08e1912]66            <li><a href ="media/status_bar_help.html" target ="showframe">Status Bar Help</a><br></li>
67            <li><a href ="media/load_data_help.html" target ="showframe">Load a File</a><br></li>
68            <li><a href ="media/simultaneous_fit_help.html" target ="showframe">Simultaneous Fit</a><br></li>
69            <li><a href ="media/single_fit_help.html" target ="showframe">Single Fit</a><br></li>
[000b025]70            <li><a href ="media/model_use_help.html" target ="showframe">Model Selection</a><br></li>
[18cdddb]71            <li><a href ="%s" target ="showframe">Model Functions</a><br></li>
[08e1912]72            <li><a href ="%s" target ="showframe">Polydispersion Distributions</a><br></li>
[384647dc]73            <li><a href ="%s" target ="showframe">Smear Computation</a><br></li>
[08e1912]74            <li><a href ="media/key_help.html" target ="showframe">Key Combination</a><br></li>
[b92884a]75            </ul>
76            </body>
[08e1912]77            </html>""" % (self.path, self.path_pd, self.path_sm)
[18cdddb]78       
[2268d10]79        self.rhelp.SetPage(page1)
[b92884a]80        self.lhelp.SetPage(page)
81        self.lhelp.Bind(wx.html.EVT_HTML_LINK_CLICKED,self.OnLinkClicked )
[9181512]82       
[4faf4ba]83        #open the help frame a the current page
84        if  pageToOpen!= None:
85            self.rhelp.LoadPage(str( pageToOpen))
[9181512]86           
[dcd330b]87        vbox.Add(self.rhelp,1, wx.EXPAND)
[b92884a]88        vboxl.Add(self.lhelp, 1, wx.EXPAND)
[d7d143b0]89        rpanel.SetSizer(vbox)
[b92884a]90        lpanel.SetSizer(vboxl)
91        lpanel.SetFocus()
[d7d143b0]92       
[f8b79d6]93        vbox1 = wx.BoxSizer(wx.HORIZONTAL)
94        vbox1.Add(splitter,1,wx.EXPAND)
95        splitter.AppendWindow(lpanel, 200)
96        splitter.AppendWindow(rpanel)
[d7d143b0]97        self.SetSizer(vbox1)
[6fb01b6]98       
[d7d143b0]99        self.Centre()
100        self.Show(True)
[925a30e]101       
[9181512]102    def OnButtonClicked(self, event):
103        """
[389c991]104        Function to diplay Model html page related to the hyperlinktext selected
[9181512]105        """
[18cdddb]106       
107        self.rhelp.LoadPage(self.path)
[925a30e]108       
[b92884a]109    def OnLinkClicked(self, event):
110        """
[5062bbf]111        Function to diplay html page related to the hyperlinktext selected
[b92884a]112        """
113        link= event.GetLinkInfo().GetHref()
[389c991]114       
[b92884a]115        self.rhelp.LoadPage(link)
[389c991]116       
[5062bbf]117"""
118Example: ::
[b92884a]119
[5062bbf]120    class ViewApp(wx.App):
121        def OnInit(self):
122            frame = HelpWindow(None, -1, 'HelpWindow')   
123            frame.Show(True)
124            self.SetTopWindow(frame)
125           
126            return True
127           
128   
129    if __name__ == "__main__":
[2268d10]130    app = ViewApp(0)
[5062bbf]131    app.MainLoop() 
132
133"""   
Note: See TracBrowser for help on using the repository browser.