Package gui :: Module references
[hide private]
[frames] | no frames]

Source Code for Module gui.references

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2010-2013 Edward d'Auvergne                                   # 
  4  #                                                                             # 
  5  # This file is part of the program relax (http://www.nmr-relax.com).          # 
  6  #                                                                             # 
  7  # This program is free software: you can redistribute it and/or modify        # 
  8  # it under the terms of the GNU General Public License as published by        # 
  9  # the Free Software Foundation, either version 3 of the License, or           # 
 10  # (at your option) any later version.                                         # 
 11  #                                                                             # 
 12  # This program is distributed in the hope that it will be useful,             # 
 13  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
 14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
 15  # GNU General Public License for more details.                                # 
 16  #                                                                             # 
 17  # You should have received a copy of the GNU General Public License           # 
 18  # along with this program.  If not, see <http://www.gnu.org/licenses/>.       # 
 19  #                                                                             # 
 20  ############################################################################### 
 21   
 22  # Module docstring. 
 23  """The relax related references window.""" 
 24   
 25  # Python module imports. 
 26  import webbrowser 
 27  import wx 
 28  import wx.html 
 29   
 30  # relax module imports. 
 31  from info import Info_box 
 32  from graphics import IMAGE_PATH 
 33  from gui.icons import relax_icons 
 34   
 35   
 36  # HTML header. 
 37  HTML_HEADER = """\ 
 38  <?xml version="1.0" encoding="utf-8"?> 
 39  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
 40  <html xmlns="http://www.w3.org/1999/xhtml"> 
 41   
 42  <head> 
 43    <title>relax</title> 
 44    <meta name="AUTHOR" content="Edward d'Auvergne"/> 
 45    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 
 46  </head> 
 47   
 48  <body bgcolor="#e5feff"> 
 49  """ 
 50   
 51  # HTML footer. 
 52  HTML_FOOTER = """\ 
 53  </body> 
 54  </html> 
 55  """ 
 56   
 57   
58 -class References(wx.Frame):
59 """The references window.""" 60
61 - def __init__(self, parent):
62 """Build the window. 63 64 @param parent: The parent wx object. 65 @type parent: wx object 66 """ 67 68 # Init the base class. 69 super(References, self).__init__(parent, -1, "relax references", style=wx.DEFAULT_FRAME_STYLE) 70 71 # Set up the window icon. 72 self.SetIcons(relax_icons) 73 74 # Set an initial window size. 75 self.SetSize((800, 800)) 76 77 # Add a sizer box. 78 box = wx.BoxSizer(wx.VERTICAL) 79 self.SetSizer(box) 80 81 # The HTML window. 82 self.html = RefWindow(self, -1, size=(500, -1)) 83 box.Add(self.html, 1, wx.GROW) 84 85 # Centre the window. 86 self.Centre() 87 88 # Show the front page. 89 self.front_page()
90 91
92 - def front_page(self):
93 """The main reference page.""" 94 95 # Initialise the program information container. 96 info = Info_box() 97 98 # The HTML header. 99 text = HTML_HEADER 100 101 # The reference header. 102 text = text + "<center>" 103 text = text + "<img src=%s%s></img>" % (IMAGE_PATH, 'ulysses_shadowless_400x168.png') 104 text = text + "<h1>relax references</h1>" 105 text = text + "</center>" 106 107 # Main refs. 108 text = text + "<h2>The program relax</h2>" 109 text = text + "<p>%s</p>" % info.bib['dAuvergneGooley08a'].cite_html() 110 text = text + "<p>%s</p>" % info.bib['dAuvergneGooley08b'].cite_html() 111 112 # GUI refs. 113 text = text + "<h3><i>The relax GUI</i></h3>" 114 text = text + "<p>%s</p>" % info.bib['Bieri11'].cite_html() 115 116 # Model-free refs. 117 text = text + "<h2>Model-free analysis</h2>" 118 text = text + "<p>For a model-free analysis, all of the following should be cited!</p>" 119 text = text + "<h3><i>Original Lipari-Szabo theory</i></h3>" 120 text = text + "<p>%s</p>" % info.bib['LipariSzabo82a'].cite_html() 121 text = text + "<p>%s</p>" % info.bib['LipariSzabo82b'].cite_html() 122 text = text + "<h3><i>Extended model-free theory</i></h3>" 123 text = text + "<p>%s</p>" % info.bib['Clore90'].cite_html() 124 text = text + "<h3><i>Model-free model selection</i></h3>" 125 text = text + "<p>%s</p>" % info.bib['dAuvergneGooley03'].cite_html() 126 text = text + "<h3><i>Model-free model elimination</i></h3>" 127 text = text + "<p>%s</p>" % info.bib['dAuvergneGooley06'].cite_html() 128 text = text + "<h3><i>Model-free minimisation</i></h3>" 129 text = text + "<p>%s</p>" % info.bib['dAuvergneGooley08a'].cite_html() 130 text = text + "<h3><i>The new model-free analysis protocol</i></h3>" 131 text = text + "<p>%s</p>" % info.bib['dAuvergneGooley07'].cite_html() 132 text = text + "<p>%s</p>" % info.bib['dAuvergneGooley08b'].cite_html() 133 text = text + "<h3><i>Comprehensive reference</i></h3>" 134 text = text + "<p>This PhD thesis expands on all of the d'Auvergne and Gooley references and describes model-free analysis and the program relax in more detail:</p>" 135 text = text + "<p>%s</p>" % info.bib['dAuvergne06'].cite_html() 136 137 # The footer. 138 text = text + HTML_FOOTER 139 self.html.SetPage(text)
140 141 142
143 -class RefWindow(wx.html.HtmlWindow):
144 """New HTML window class to catch clicks on links and open in a browser.""" 145
146 - def OnLinkClicked(self, url):
147 """Redefine the link clicking behaviour.""" 148 149 # Open a new browser window instead. 150 webbrowser.open(url.GetHref())
151