mailr13383 - in /branches/gui_testing/gui: menu.py user_functions/structure.py


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

Header


Content

Posted by edward on July 01, 2011 - 17:43:
Author: bugman
Date: Fri Jul  1 17:43:19 2011
New Revision: 13383

URL: http://svn.gna.org/viewcvs/relax?rev=13383&view=rev
Log:
Created the structure.load_spins user function window and menu entry.


Modified:
    branches/gui_testing/gui/menu.py
    branches/gui_testing/gui/user_functions/structure.py

Modified: branches/gui_testing/gui/menu.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/menu.py?rev=13383&r1=13382&r2=13383&view=diff
==============================================================================
--- branches/gui_testing/gui/menu.py (original)
+++ branches/gui_testing/gui/menu.py Fri Jul  1 17:43:19 2011
@@ -231,6 +231,7 @@
             ]],
             [wx.NewId(), "s&tructure", paths.icon_16x16.structure, None, [
                 [wx.NewId(), "&delete", paths.icon_16x16.remove, 
self.gui.user_functions.structure.delete],
+                [wx.NewId(), "&load_spins", paths.icon_16x16.spin, 
self.gui.user_functions.structure.load_spins],
                 [wx.NewId(), "&read_pdb", paths.icon_16x16.open, 
self.gui.user_functions.structure.read_pdb],
                 [wx.NewId(), "&write_pdb", paths.icon_16x16.save, 
self.gui.user_functions.structure.write_pdb]
             ]],

Modified: branches/gui_testing/gui/user_functions/structure.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/user_functions/structure.py?rev=13383&r1=13382&r2=13383&view=diff
==============================================================================
--- branches/gui_testing/gui/user_functions/structure.py (original)
+++ branches/gui_testing/gui/user_functions/structure.py Fri Jul  1 17:43:19 
2011
@@ -32,7 +32,7 @@
 
 # GUI module imports.
 from base import UF_base, UF_page
-from gui.misc import gui_to_str, str_to_gui
+from gui.misc import gui_to_bool, gui_to_str, str_to_gui
 from gui.paths import WIZARD_IMAGE_PATH
 from gui.wizard import Wiz_window
 
@@ -57,6 +57,22 @@
         wizard.run()
 
 
+    def load_spins(self, event):
+        """The structure.load_spins user function.
+
+        @param event:       The wx event.
+        @type event:        wx event
+        """
+
+        # Create the wizard.
+        wizard = Wiz_window(size_x=800, size_y=600, title='Spin loader')
+        page = Load_spins_page(wizard, self.gui, self.interpreter)
+        wizard.add_page(page)
+
+        # Execute the wizard.
+        wizard.run()
+
+
     def read_pdb(self, event):
         """The structure.read_pdb user function.
 
@@ -111,6 +127,47 @@
 
         # Delete all structures.
         self.interpreter.structure.delete()
+
+
+
+class Load_spins_page(UF_page):
+    """The structure.load_spins() user function page."""
+
+    # Some class variables.
+    #image_path = WIZARD_IMAGE_PATH + sep + 'structure' + sep + 
'load_spins.png'
+    uf_path = ['structure', 'load_spins']
+    title = 'Load spins from structure'
+
+
+    def add_contents(self, sizer):
+        """Add the structure specific GUI elements.
+
+        @param sizer:   A sizer object.
+        @type sizer:    wx.Sizer instance
+        """
+
+        # The spin_id arg.
+        self.spin_id = self.spin_id_field(sizer, "The spin identification 
string:", tooltip="The 'spin_id' user function argument.")
+
+        # The combine_model arg.
+        self.combine_model = self.combo_box(sizer, "Combine spins of all 
models:", choices=['True', 'False'], tooltip="The 'combine_models' user 
function argument:  A flag which specifies if spins from separate models 
should be combined.")
+        self.combine_model.SetValue('True')
+
+        # The ave_pos arg.
+        self.ave_pos = self.combo_box(sizer, "Average the atom position 
across models:", choices=['True', 'False'], tooltip="The 'ave_pos' user 
function argument:  A flag specifying if the position of the atom is to be 
averaged across models.")
+        self.ave_pos.SetValue('True')
+
+
+    def on_execute(self):
+        """Execute the user function."""
+
+        # The args.
+        spin_id = gui_to_str(self.spin_id.GetValue())
+        combine_model = gui_to_bool(self.combine_model.GetValue())
+        ave_pos = gui_to_bool(self.ave_pos.GetValue())
+
+        # Execute the user function.
+        self.interpreter.structure.load_spins(spin_id=spin_id, 
combine_model=combine_model, ave_pos=ave_pos)
 
 
 




Related Messages


Powered by MHonArc, Updated Fri Jul 01 18:00:02 2011