Author: bugman Date: Tue Feb 16 11:23:34 2010 New Revision: 10701 URL: http://svn.gna.org/viewcvs/relax?rev=10701&view=rev Log: Modified how the relax references are handled. Instead of opening http://www.nmr-relax.com/refs.html in a browser, a HTML window is now being used to display all relevant references. The refs are coming from the info container. This is far from complete. To be added are: - Links "(more)" added to the end of each reference. This will open a new HTML page with the full information, DOI link, abstract, etc. for each reference separately. - Make the DOI link open in a brower. - Make the forward and reverse buttons functional. The HTML also needs to be prettified. Added: branches/bieri_gui/gui_bieri/oxygen_icons/48x48/actions/go-next-view.png (with props) branches/bieri_gui/gui_bieri/oxygen_icons/48x48/actions/go-previous-view.png (with props) branches/bieri_gui/gui_bieri/references.py Modified: branches/bieri_gui/gui_bieri/paths.py branches/bieri_gui/gui_bieri/relax_gui.py Added: branches/bieri_gui/gui_bieri/oxygen_icons/48x48/actions/go-next-view.png URL: http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/oxygen_icons/48x48/actions/go-next-view.png?rev=10701&view=auto ============================================================================== Binary file - no diff available. Propchange: branches/bieri_gui/gui_bieri/oxygen_icons/48x48/actions/go-next-view.png ------------------------------------------------------------------------------ svn:mime-type = image/png Added: branches/bieri_gui/gui_bieri/oxygen_icons/48x48/actions/go-previous-view.png URL: http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/oxygen_icons/48x48/actions/go-previous-view.png?rev=10701&view=auto ============================================================================== Binary file - no diff available. Propchange: branches/bieri_gui/gui_bieri/oxygen_icons/48x48/actions/go-previous-view.png ------------------------------------------------------------------------------ svn:mime-type = image/png Modified: branches/bieri_gui/gui_bieri/paths.py URL: http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/paths.py?rev=10701&r1=10700&r2=10701&view=diff ============================================================================== --- branches/bieri_gui/gui_bieri/paths.py (original) +++ branches/bieri_gui/gui_bieri/paths.py Tue Feb 16 11:23:34 2010 @@ -58,5 +58,7 @@ # 48x48 icons. #ADD_ICON = ICON_PATH + '48x48'+sep+'actions'+sep+'list-add-relax-blue.png' +BACKWARDS_ICON = ICON_PATH + '48x48'+sep+'actions'+sep+'go-previous-view.png' #CANCEL_ICON = ICON_PATH + '48x48'+sep+'actions'+sep+'dialog-cancel.png' +FORWARDS_ICON = ICON_PATH + '48x48'+sep+'actions'+sep+'go-next-view.png' #REMOVE_ICON = ICON_PATH + '48x48'+sep+'actions'+sep+'list-remove.png' Added: branches/bieri_gui/gui_bieri/references.py URL: http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/references.py?rev=10701&view=auto ============================================================================== --- branches/bieri_gui/gui_bieri/references.py (added) +++ branches/bieri_gui/gui_bieri/references.py Tue Feb 16 11:23:34 2010 @@ -1,0 +1,181 @@ +############################################################################### +# # +# Copyright (C) 2010 Edward d'Auvergne # +# # +# This file is part of the program relax. # +# # +# relax is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either version 2 of the License, or # +# (at your option) any later version. # +# # +# relax is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with relax; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# # +############################################################################### + +# Module docstring. +"""The relax related references window.""" + +# Python module imports. +import wx +import wx.html + +# relax module imports. +from info import Info_box + +# relax GUI module imports. +from gui_bieri.paths import IMAGE_PATH, BACKWARDS_ICON, FORWARDS_ICON + +# HTML header. +HTML_HEADER = """\ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> + +<head> + <title>relax</title> + <meta name="AUTHOR" content="Edward d'Auvergne"/> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> +</head> + +<body bgcolor="#e5feff"> +""" + +# HTML footer. +HTML_FOOTER = """\ +</body> +</html> +""" + + +class References(wx.Dialog): + """The references dialog.""" + + def __init__(self, parent): + """Build the dialog. + + @param parent: The parent wx object. + @type parent: wx object + """ + + # Init the base class wx.Dialog. + super(References, self).__init__(parent, -1, "relax references", style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) + + # Set an initial window size. + self.SetSize((800, 800)) + + # Add a sizer box. + box = wx.BoxSizer(wx.VERTICAL) + self.SetSizer(box) + + # Add some buttons. + self.add_buttons(box) + + # The HTML window. + self.html = wx.html.HtmlWindow(self, -1, size=(500, -1)) + box.Add(self.html, 1, wx.GROW) + + # Show the front page. + self.front_page() + + + def add_buttons(self, box): + """Add forwards, backwards, and close buttons. + + @param box: The box sizer element to pack the relax execution GUI element into. + @type box: wx.BoxSizer instance + """ + + # Create a horizontal box sizer to pack the buttons into. + button_box = wx.BoxSizer(wx.HORIZONTAL) + + # Backwards button. + button = wx.BitmapButton(self, -1, wx.Bitmap(BACKWARDS_ICON, wx.BITMAP_TYPE_ANY), style=wx.NO_BORDER) + button.SetSize(button.GetBestSize()) + self.Bind(wx.EVT_BUTTON, self.backwards, button) + button_box.Add(button) + + # Forwards button. + button = wx.BitmapButton(self, -1, wx.Bitmap(FORWARDS_ICON, wx.BITMAP_TYPE_ANY), style=wx.NO_BORDER) + button.SetSize(button.GetBestSize()) + self.Bind(wx.EVT_BUTTON, self.forwards, button) + button_box.Add(button) + + # Add the buttons. + box.Add(button_box) + + + def backwards(self, event): + """Go backwards. + + @param event: The wx event. + @type event: wx event + """ + + # Go backwards. + self.html.HistoryBack() + + + def forwards(self, event): + """Go forwards. + + @param event: The wx event. + @type event: wx event + """ + + # Go backwards. + self.html.HistoryForward() + + + def front_page(self): + """The main reference page.""" + + # Initialise the program information container. + info = Info_box() + + # The HTML header. + text = HTML_HEADER + + # The reference header. + text = text + "<center>" + text = text + "<img src=%s%s></img>" % (IMAGE_PATH, 'ulysses_shadowless_400x168.png') + text = text + "<h1>relax references</h1>" + text = text + "</center>" + + # Main refs. + text = text + "<h2>The program relax</h2>" + text = text + "<p>%s</p>" % info.bib['dAuvergneGooley08a'].cite_html() + text = text + "<p>%s</p>" % info.bib['dAuvergneGooley08b'].cite_html() + + # GUI refs. + text = text + "<h3><i>The relax GUI</i></h3>" + text = text + "<p>Bieri et al., in progress.</p>" + + # Model-free refs. + text = text + "<h2>Model-free analysis</h2>" + text = text + "<p>For a model-free analysis, all of the following should be cited!</p>" + text = text + "<h3><i>Original Lipari-Szabo theory</i></h3>" + text = text + "<p>%s</p>" % info.bib['LipariSzabo82a'].cite_html() + text = text + "<p>%s</p>" % info.bib['LipariSzabo82b'].cite_html() + text = text + "<h3><i>Extended model-free theory</i></h3>" + text = text + "<p>%s</p>" % info.bib['Clore90'].cite_html() + text = text + "<h3><i>Model-free model selection</i></h3>" + text = text + "<p>%s</p>" % info.bib['dAuvergneGooley03'].cite_html() + text = text + "<h3><i>Model-free model elimination</i></h3>" + text = text + "<p>%s</p>" % info.bib['dAuvergneGooley06'].cite_html() + text = text + "<h3><i>Model-free minimisation</i></h3>" + text = text + "<p>%s</p>" % info.bib['dAuvergneGooley08a'].cite_html() + text = text + "<h3><i>The new model-free analysis protocol</i></h3>" + text = text + "<p>%s</p>" % info.bib['dAuvergneGooley07'].cite_html() + text = text + "<p>%s</p>" % info.bib['dAuvergneGooley08b'].cite_html() + + # The footer. + text = text + HTML_FOOTER + self.html.SetPage(text) Modified: branches/bieri_gui/gui_bieri/relax_gui.py URL: http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/relax_gui.py?rev=10701&r1=10700&r2=10701&view=diff ============================================================================== --- branches/bieri_gui/gui_bieri/relax_gui.py (original) +++ branches/bieri_gui/gui_bieri/relax_gui.py Tue Feb 16 11:23:34 2010 @@ -58,6 +58,7 @@ from filedialog import multi_openfile, opendir, openfile, savefile from message import dir_message, exec_relax, missing_data, question, relax_run_ok from paths import ABOUT_RELAX_ICON, ABOUT_RELAXGUI_ICON, CONTACT_ICON, CONTROLLER_ICON, EXIT_ICON, IMAGE_PATH, LOAD_ICON, MANUAL_ICON, NEW_ICON, OPEN_ICON, REF_ICON, SAVE_ICON, SAVE_AS_ICON, SETTINGS_ICON, SETTINGS_GLOBAL_ICON, SETTINGS_RESET_ICON +from references import References from settings import import_file_settings, load_sequence, relax_global_settings @@ -1097,7 +1098,17 @@ def references(self, event): - webbrowser.open_new('http://www.nmr-relax.com/refs.html') + """Display the references relevant for relax. + + @param event: The wx event. + @type event: wx event + """ + + # Build and show the references window. + self.references = References(self) + self.references.Show() + + # Terminate the event. event.Skip()