mailr14727 - in /1.3/gui: menu.py user_functions/__init__.py user_functions/sys_info.py


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

Header


Content

Posted by edward on September 21, 2011 - 14:19:
Author: bugman
Date: Wed Sep 21 14:19:07 2011
New Revision: 14727

URL: http://svn.gna.org/viewcvs/relax?rev=14727&view=rev
Log:
Implemented the sys_info user function GUI page and menu entry.


Added:
    1.3/gui/user_functions/sys_info.py
      - copied, changed from r14719, 1.3/gui/user_functions/structure.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=14727&r1=14726&r2=14727&view=diff
==============================================================================
--- 1.3/gui/menu.py (original)
+++ 1.3/gui/menu.py Wed Sep 21 14:19:07 2011
@@ -384,6 +384,8 @@
         self.add_uf(parent_id=id, name="structure.vectors", text="&vectors", 
icon=None, fn=user_functions.structure.vectors)
         self.add_uf(parent_id=id, name="structure.write_pdb", 
text="&write_pdb", icon=paths.icon_16x16.save, 
fn=user_functions.structure.write_pdb)
 
+        self.add_uf(parent_id=None, name="sys_info", text="sys_&info", 
icon=paths.icon_16x16.help_about, fn=user_functions.sys_info.sys_info)
+
         id = self.add_class(name="value", text="&value", 
icon=paths.icon_16x16.value)
         self.add_uf(parent_id=id, name="value.set", text="&set", 
icon=paths.icon_16x16.add, fn=user_functions.value.set)
 

Modified: 1.3/gui/user_functions/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/gui/user_functions/__init__.py?rev=14727&r1=14726&r2=14727&view=diff
==============================================================================
--- 1.3/gui/user_functions/__init__.py (original)
+++ 1.3/gui/user_functions/__init__.py Wed Sep 21 14:19:07 2011
@@ -45,6 +45,7 @@
 from spectrum import Spectrum
 from spin import Spin
 from structure import Structure
+from sys_info import Sys_info
 from value import Value
 
 
@@ -68,6 +69,7 @@
            'spectrum',
            'spin',
            'structure',
+           'sys_info',
            'value']
 
 
@@ -103,4 +105,5 @@
         self.spectrum = Spectrum(parent)
         self.spin = Spin(parent)
         self.structure = Structure(parent)
+        self.sys_info = Sys_info(parent)
         self.value = Value(parent)

Copied: 1.3/gui/user_functions/sys_info.py (from r14719, 
1.3/gui/user_functions/structure.py)
URL: 
http://svn.gna.org/viewcvs/relax/1.3/gui/user_functions/sys_info.py?p2=1.3/gui/user_functions/sys_info.py&p1=1.3/gui/user_functions/structure.py&r1=14719&r2=14727&rev=14727&view=diff
==============================================================================
--- 1.3/gui/user_functions/structure.py (original)
+++ 1.3/gui/user_functions/sys_info.py Wed Sep 21 14:19:07 2011
@@ -26,6 +26,7 @@
 # Python module imports.
 from os import sep
 from string import split
+from time import sleep
 import wx
 
 # relax module imports.
@@ -38,171 +39,36 @@
 
 
 # The container class.
-class Structure(UF_base):
+class Sys_info(UF_base):
     """The container class for holding all GUI elements."""
 
-    def create_diff_tensor_pdb(self):
-        """The structure.create_diff_tensor_pdb user function."""
+    def sys_info(self):
+        """The sys_info user function."""
 
         # Create and execute the wizard.
-        wizard = self.create_wizard(size_x=900, size_y=800, 
name='structure.create_diff_tensor_pdb', uf_page=Create_diff_tensor_pdb_page)
-        wizard.run()
-
-
-    def create_vector_dist(self):
-        """The structure.create_vector_dist user function."""
-
-        # Create and execute the wizard.
-        wizard = self.create_wizard(size_x=800, size_y=700, 
name='structure.create_vector_dist', uf_page=Create_vector_dist_page)
-        wizard.run()
-
-
-    def delete(self):
-        """The structure.delete user function."""
-
-        # Create and execute the wizard.
-        wizard = self.create_wizard(size_x=600, size_y=400, 
name='structure.delete', uf_page=Delete_page)
-        wizard.run()
-
-
-    def get_pos(self):
-        """The structure.get_pos user function."""
-
-        # Create and execute the wizard.
-        wizard = self.create_wizard(size_x=800, size_y=600, 
name='structure.get_pos', uf_page=Get_pos_page)
-        wizard.run()
-
-
-    def load_spins(self):
-        """The structure.load_spins user function."""
-
-        # Create and execute the wizard.
-        wizard = self.create_wizard(size_x=800, size_y=600, 
name='structure.load_spins', uf_page=Load_spins_page)
-        wizard.run()
-
-
-    def read_pdb(self):
-        """The structure.read_pdb user function."""
-
-        # Create and execute the wizard.
-        wizard = self.create_wizard(size_x=800, size_y=600, 
name='structure.read_pdb', uf_page=Read_pdb_page)
-        wizard.run()
-
-
-    def write_pdb(self):
-        """The structure.write_pdb user function."""
-
-        # Create and execute the wizard.
-        wizard = self.create_wizard(size_x=800, size_y=600, 
name='structure.write_pdb', uf_page=Write_pdb_page)
-        wizard.run()
-
-
-    def vectors(self):
-        """The structure.vectors user function."""
-
-        # Create the wizard.
-        wizard = self.create_wizard(size_x=800, size_y=600, 
name='structure.vectors', uf_page=Vectors_page)
+        wizard = self.create_wizard(size_x=600, size_y=400, name='sys_info', 
uf_page=Sys_info_page, apply_button=False)
         wizard.run()
 
 
 
-class Create_diff_tensor_pdb_page(UF_page):
-    """The structure.create_diff_tensor_pdb() user function page."""
+class Sys_info_page(UF_page):
+    """The sys_info() user function page."""
 
     # Some class variables.
-    image_path = WIZARD_IMAGE_PATH + sep + 'structure' + sep + 
'create_diff_tensor_pdb.png'
-    uf_path = ['structure', 'create_diff_tensor_pdb']
-    height_desc = 400
+    uf_path = ['sys_info']
 
-    def add_contents(self, sizer):
-        """Add the structure specific GUI elements.
+    def __init__(self, parent, sync=False):
+        """Set up the window.
 
-        @param sizer:   A sizer object.
-        @type sizer:    wx.Sizer instance
+        @param parent:      The parent class containing the GUI.
+        @type parent:       class instance
+        @keyword sync:      A flag which is ignored.
+        @type sync:         bool
         """
 
-        # The scale arg.
-        self.scale = self.input_field(sizer, "Scaling factor:", 
tooltip=self.uf._doc_args_dict['scale'])
-        self.scale.SetValue(float_to_gui(1.8e-6))
+        # Execute the base class method.
+        super(Sys_info_page, self).__init__(parent, sync=True)
 
-        # Add a file selection.
-        self.file = self.file_selection(sizer, "The PDB file:", message="PDB 
file selection", wildcard="PDB files (*.pdb)|*.pdb;*.PDB", style=wx.FD_SAVE, 
tooltip=self.uf._doc_args_dict['file'])
-
-        # The force flag.
-        self.force = self.boolean_selector(sizer, "Force flag:", 
tooltip=self.uf._doc_args_dict['force'], default=False)
-
-
-    def on_execute(self):
-        """Execute the user function."""
-
-        # The file name.
-        file = gui_to_str(self.file.GetValue())
-        if not file:
-            return
-
-        # Force flag.
-        force = gui_to_bool(self.force.GetValue())
-
-        # The scaling.
-        scale = gui_to_float(self.scale.GetValue())
-
-        # Delete all structures.
-        self.execute('structure.create_diff_tensor_pdb', scale=scale, 
file=file, force=force)
-
-
-
-class Create_vector_dist_page(UF_page):
-    """The structure.create_vector_dist() user function page."""
-
-    # Some class variables.
-    image_path = WIZARD_IMAGE_PATH + sep + 'structure' + sep + 
'create_vector_dist.png'
-    uf_path = ['structure', 'create_vector_dist']
-
-    def add_contents(self, sizer):
-        """Add the structure specific GUI elements.
-
-        @param sizer:   A sizer object.
-        @type sizer:    wx.Sizer instance
-        """
-
-        # The length arg.
-        self.length = self.input_field(sizer, "Vector length:", 
tooltip=self.uf._doc_args_dict['length'])
-        self.length.SetValue(float_to_gui(2e-9))
-
-        # Add a file selection.
-        self.file = self.file_selection(sizer, "The PDB file:", message="PDB 
file selection", wildcard="PDB files (*.pdb)|*.pdb;*.PDB", style=wx.FD_SAVE, 
tooltip=self.uf._doc_args_dict['file'])
-
-        # The symmetry flag.
-        self.symmetry = self.boolean_selector(sizer, "Symmetry flag:", 
tooltip=self.uf._doc_args_dict['symmetry'], default=True)
-
-        # The force flag.
-        self.force = self.boolean_selector(sizer, "Force flag:", 
tooltip=self.uf._doc_args_dict['force'], default=False)
-
-
-    def on_execute(self):
-        """Execute the user function."""
-
-        # The file name.
-        file = gui_to_str(self.file.GetValue())
-        if not file:
-            return
-
-        # Force flag.
-        force = gui_to_bool(self.force.GetValue())
-
-        # The scaling.
-        length = gui_to_float(self.length.GetValue())
-
-        # Delete all structures.
-        self.execute('structure.create_vector_dist', length=length, 
file=file, symmetry=symmetry, force=force)
-
-
-
-class Delete_page(UF_page):
-    """The structure.delete() user function page."""
-
-    # Some class variables.
-    uf_path = ['structure', 'delete']
 
     def add_contents(self, sizer):
         """Add the structure specific GUI elements.
@@ -215,203 +81,20 @@
     def on_execute(self):
         """Execute the user function."""
 
-        # Delete all structures.
-        self.execute('structure.delete')
+        # Get the App.
+        app = wx.GetApp()
 
+        # First show the controller.
+        app.gui.show_controller(None)
 
+        # Go to the last line.
+        app.gui.controller.log_panel.on_goto_end(None)
 
-class Get_pos_page(UF_page):
-    """The structure.get_pos() user function page."""
+        # Wait a little while.
+        sleep(0.5)
 
-    # Some class variables.
-    uf_path = ['structure', 'get_pos']
-    height_desc = 300
+        # Finally, execute the user function.
+        self.execute('sys_info')
 
-    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_element(sizer, default='@N')
-
-        # The ave_pos arg.
-        self.ave_pos = self.boolean_selector(sizer, "Average the atom 
position across models:", tooltip=self.uf._doc_args_dict['ave_pos'], 
default=True)
-
-
-    def on_execute(self):
-        """Execute the user function."""
-
-        # The args.
-        spin_id = gui_to_str(self.spin_id.GetValue())
-        ave_pos = gui_to_bool(self.ave_pos.GetValue())
-
-        # Delete all structures.
-        self.execute('structure.get_pos', spin_id=spin_id, ave_pos=ave_pos)
-
-
-
-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']
-
-    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_element(sizer, default='@N')
-
-        # The ave_pos arg.
-        self.ave_pos = self.boolean_selector(sizer, "Average the atom 
position across models:", tooltip=self.uf._doc_args_dict['ave_pos'], 
default=True)
-
-
-    def on_execute(self):
-        """Execute the user function."""
-
-        # The args.
-        spin_id = gui_to_str(self.spin_id.GetValue())
-        ave_pos = gui_to_bool(self.ave_pos.GetValue())
-
-        # Execute the user function.
-        self.execute('structure.load_spins', spin_id=spin_id, 
ave_pos=ave_pos)
-
-
-
-class Read_pdb_page(UF_page):
-    """The structure.read_pdb() user function page."""
-
-    # Some class variables.
-    image_path = WIZARD_IMAGE_PATH + sep + 'structure' + sep + 'read_pdb.png'
-    uf_path = ['structure', 'read_pdb']
-
-    def add_contents(self, sizer):
-        """Add the structure specific GUI elements.
-
-        @param sizer:   A sizer object.
-        @type sizer:    wx.Sizer instance
-        """
-
-        # Add a file selection.
-        self.file = self.file_selection(sizer, "The PDB file:", message="PDB 
file selection", wildcard="PDB files (*.pdb)|*.pdb;*.PDB", style=wx.FD_OPEN, 
tooltip=self.uf._doc_args_dict['file'])
-
-        # The read_mol arg.
-        self.read_mol = self.input_field(sizer, "Read molecule number:", 
tooltip=self.uf._doc_args_dict['read_mol'])
-
-        # The set_mol_name arg.
-        self.set_mol_name = self.input_field(sizer, "Set the molecule 
name:", tooltip=self.uf._doc_args_dict['set_mol_name'])
-
-        # The read_model arg.
-        self.read_model = self.input_field(sizer, "Read model number:", 
tooltip=self.uf._doc_args_dict['read_model'])
-
-        # The set_model_num arg.
-        self.set_model_num = self.input_field(sizer, "Set the model 
number:", tooltip=self.uf._doc_args_dict['set_model_num'])
-
-        # The PDB reader (default to internal).
-        self.parser = self.combo_box(sizer, "The PDB parser:", 
choices=['internal', 'scientific'], tooltip=self.uf._doc_args_dict['parser'])
-        self.parser.SetValue(str_to_gui('internal'))
-
-
-    def on_execute(self):
-        """Execute the user function."""
-
-        # The args.
-        file = gui_to_str(self.file.GetValue())
-        read_mol = gui_to_int_or_list(self.read_mol.GetValue())
-        set_mol_name = gui_to_str_or_list(self.set_mol_name.GetValue())
-        read_model = gui_to_int_or_list(self.read_model.GetValue())
-        set_model_num = gui_to_int_or_list(self.set_model_num.GetValue())
-        parser = gui_to_str(self.parser.GetValue())
-
-        # Execute the user function.
-        self.execute('structure.read_pdb', file=file, read_mol=read_mol, 
set_mol_name=set_mol_name, read_model=read_model, 
set_model_num=set_model_num, parser=parser)
-
-
-
-class Write_pdb_page(UF_page):
-    """The structure.write_pdb() user function page."""
-
-    # Some class variables.
-    image_path = WIZARD_IMAGE_PATH + sep + 'structure' + sep + 
'write_pdb.png'
-    uf_path = ['structure', 'write_pdb']
-
-    def add_contents(self, sizer):
-        """Add the structure specific GUI elements.
-
-        @param sizer:   A sizer object.
-        @type sizer:    wx.Sizer instance
-        """
-
-        # Add a file selection.
-        self.file = self.file_selection(sizer, "The PDB file:", message="PDB 
file selection", wildcard="PDB files (*.pdb)|*.pdb;*.PDB", style=wx.FD_SAVE, 
tooltip=self.uf._doc_args_dict['file'])
-
-        # The model_num arg.
-        self.model_num = self.input_field(sizer, "Only write model number:", 
tooltip=self.uf._doc_args_dict['model_num'])
-
-
-    def on_execute(self):
-        """Execute the user function."""
-
-        # The args.
-        file = gui_to_str(self.file.GetValue())
-        model_num = gui_to_str(self.model_num.GetValue())
-
-        # Execute the user function.
-        self.execute('structure.write_pdb', file=file, model_num=model_num)
-
-
-
-class Vectors_page(UF_page):
-    """The structure.vectors() user function page."""
-
-    # Some class variables.
-    uf_path = ['structure', 'vectors']
-
-    def add_contents(self, sizer):
-        """Add the structure specific GUI elements.
-
-        @param sizer:   A sizer object.
-        @type sizer:    wx.Sizer instance
-        """
-
-        # The attached atom.
-        self.attached = self.input_field(sizer, "The attached atom:", 
tooltip=self.uf._doc_args_dict['attached'])
-        self.attached.SetValue(str_to_gui("H"))
-
-        # The spin_id arg.
-        self.spin_id = self.spin_id_element(sizer, desc='Restrict vector 
loading to the spins:')
-
-        # The model.
-        self.model = self.input_field(sizer, "The model:", 
tooltip=self.uf._doc_args_dict['model'])
-
-        # The verbosity level.
-        self.verbosity = self.spin_control(sizer, "The verbosity level:", 
default=1, min=0, tooltip=self.uf._doc_args_dict['verbosity'])
-
-        # The average.
-        self.ave = self.boolean_selector(sizer, "Average the vector across 
models:", tooltip=self.uf._doc_args_dict['ave'], default=True)
-
-        # The unit flag.
-        self.unit = self.boolean_selector(sizer, "Calculate unit vectors:", 
tooltip=self.uf._doc_args_dict['unit'], default=True)
-
-
-    def on_execute(self):
-        """Execute the user function."""
-
-        # The args.
-        attached =  gui_to_str(self.attached.GetValue())
-        spin_id =   gui_to_str(self.spin_id.GetValue())
-        model =     gui_to_int(self.model.GetValue())
-        verbosity = gui_to_int(self.verbosity.GetValue())
-        ave =       gui_to_bool(self.ave.GetValue())
-        unit =      gui_to_bool(self.unit.GetValue())
-
-        # Execute the user function.
-        self.execute('structure.vectors', attached=attached, 
spin_id=spin_id, model=model, verbosity=verbosity, ave=ave, unit=unit)
+        # Bring the controller to the front.
+        wx.CallAfter(app.gui.controller.Raise)




Related Messages


Powered by MHonArc, Updated Wed Sep 21 14:40:02 2011