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

Source Code for Module gui.references

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