mailr15862 - in /1.3/gui: menu.py user_functions/__init__.py user_functions/bmrb.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on April 30, 2012 - 20:52:
Author: bugman
Date: Mon Apr 30 20:52:39 2012
New Revision: 15862

URL: http://svn.gna.org/viewcvs/relax?rev=15862&view=rev
Log:
Added an initial but far from complete bmrb.citation user function page and 
menu element.

This user function will require a new type of wizard element to handle the 
list of authors!


Added:
    1.3/gui/user_functions/bmrb.py
Modified:
    1.3/gui/menu.py
    1.3/gui/user_functions/__init__.py

Modified: 1.3/gui/menu.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/gui/menu.py?rev=15862&r1=15861&r2=15862&view=diff
==============================================================================
--- 1.3/gui/menu.py (original)
+++ 1.3/gui/menu.py Mon Apr 30 20:52:39 2012
@@ -314,6 +314,9 @@
         self.uf = {}
 
         # Build the user function menus.
+        id = self.add_class(name="bmrb", text="&bmrb", 
icon=paths.icon_16x16.bmrb)
+        self.add_uf(parent_id=id, name="bmrb.citation", text="&citation", 
fn=user_functions.bmrb.citation)
+
         id = self.add_class(name="bruker", text="&bruker", 
icon=paths.icon_16x16.bruker)
         self.add_uf(parent_id=id, name="bruker.read", text="&read", 
icon=paths.icon_16x16.open, fn=user_functions.bruker.read)
 

Modified: 1.3/gui/user_functions/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/gui/user_functions/__init__.py?rev=15862&r1=15861&r2=15862&view=diff
==============================================================================
--- 1.3/gui/user_functions/__init__.py (original)
+++ 1.3/gui/user_functions/__init__.py Mon Apr 30 20:52:39 2012
@@ -27,6 +27,7 @@
 from relax_errors import RelaxError
 
 # GUI module imports.
+from bmrb import Bmrb
 from bruker import Bruker
 from deselect import Deselect
 from gpl import Gpl
@@ -52,6 +53,7 @@
 
 # The package __all__ list.
 __all__ = ['base',
+           'bmrb',
            'bruker',
            'deselect',
            'gpl',
@@ -89,6 +91,7 @@
         """
 
         # The user functions.
+        self.bmrb = Bmrb(parent)
         self.bruker = Bruker(parent)
         self.deselect = Deselect(parent)
         self.gpl = Gpl(parent)

Added: 1.3/gui/user_functions/bmrb.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/gui/user_functions/bmrb.py?rev=15862&view=auto
==============================================================================
--- 1.3/gui/user_functions/bmrb.py (added)
+++ 1.3/gui/user_functions/bmrb.py Mon Apr 30 20:52:39 2012
@@ -1,0 +1,76 @@
+###############################################################################
+#                                                                            
 #
+# Copyright (C) 2012 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 BMRB user function GUI elements."""
+
+# Python module imports.
+import wx
+
+# GUI module imports.
+from base import UF_base, UF_page
+from gui.paths import WIZARD_IMAGE_PATH
+from gui.misc import gui_to_float, gui_to_int, gui_to_str, str_to_gui
+
+
+# The container class.
+class Bmrb(UF_base):
+    """The container class for holding all GUI elements."""
+
+    def citation(self):
+        """The bmrb.citation user function."""
+
+        # Execute the wizard.
+        wizard = self.create_wizard(size_x=1000, size_y=700, 
name='bmrb.citation', uf_page=Citation_page)
+        wizard.run()
+
+
+
+class Citation_page(UF_page):
+    """The bmrb.citation() user function page."""
+
+    # Some class variables.
+    height_desc = 140
+    image_path = WIZARD_IMAGE_PATH + 'bmrb.png'
+    uf_path = ['bmrb', 'citation']
+
+    def add_contents(self, sizer):
+        """Add the specific GUI elements.
+
+        @param sizer:   A sizer object.
+        @type sizer:    wx.Sizer instance
+        """
+
+        # The fields.
+        self.cite_id = self.input_field(sizer, "The citation ID:", 
tooltip=self.uf._doc_args_dict['cite_id'])
+        self.authors = self.input_field(sizer, "The citation ID:", 
tooltip=self.uf._doc_args_dict['cite_id'])
+
+
+    def on_execute(self):
+        """Execute the user function."""
+
+        # The data.
+        cite_id = gui_to_str(self.cite_id.GetValue())
+        authors = gui_to_str(self.authors.GetValue())
+
+        # Read the relaxation data.
+        self.execute('bmrb.citation', cite_id=cite_id, authors=authors)




Related Messages


Powered by MHonArc, Updated Mon Apr 30 21:00:02 2012