mailr13450 - in /branches/gui_testing/gui/spin_viewer: containers.py tree.py


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

Header


Content

Posted by edward on July 06, 2011 - 14:53:
Author: bugman
Date: Wed Jul  6 14:53:05 2011
New Revision: 13450

URL: http://svn.gna.org/viewcvs/relax?rev=13450&view=rev
Log:
The info data structure is no longer passed into the container object.

The Container.display() method has been deleted, and the root, molecule, 
residue and spin container
methods are called directly from the tree.


Modified:
    branches/gui_testing/gui/spin_viewer/containers.py
    branches/gui_testing/gui/spin_viewer/tree.py

Modified: branches/gui_testing/gui/spin_viewer/containers.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/spin_viewer/containers.py?rev=13450&r1=13449&r2=13450&view=diff
==============================================================================
--- branches/gui_testing/gui/spin_viewer/containers.py (original)
+++ branches/gui_testing/gui/spin_viewer/containers.py Wed Jul  6 14:53:05 
2011
@@ -30,7 +30,7 @@
 import wx
 
 # relax module imports.
-from generic_fns.mol_res_spin import generate_spin_id, return_spin
+from generic_fns.mol_res_spin import return_spin
 
 # GUI module imports.
 from gui import paths
@@ -85,18 +85,24 @@
         self.Refresh()
 
 
-    def container_molecule(self, mol_name=None):
+    def container_molecule(self, mol_name=None, mol_id=None, select=True):
         """Build and display the molecule container
 
         @keyword mol_name:  The name of the molecule.
         @type mol_name:     str
+        @keyword mol_id:    The molecule ID string.
+        @type mol_id:       str
+        @keyword select:    The selection flag.
+        @type select:       bool
         """
 
         # Store the args.
         self.mol_name = mol_name
-
-        # The molecule ID.
-        self.mol_id = generate_spin_id(mol_name=mol_name)
+        self.mol_id = mol_id
+        self.select = select
+
+        # Destroy all the original contents.
+        self.main_sizer.Clear(deleteWindows=True)
 
         # Create the header.
         sizer = self.header_molecule()
@@ -108,8 +114,12 @@
         line = wx.StaticLine(self, -1, (25, 50))
         self.main_sizer.Add(line, 0, wx.EXPAND|wx.ALL, border=self.border)
 
-
-    def container_residue(self, mol_name=None, res_num=None, res_name=None):
+        # Re-perform the window layout.
+        self.Layout()
+        self.Refresh()
+
+
+    def container_residue(self, mol_name=None, res_num=None, res_name=None, 
res_id=None, select=True):
         """Build and display the residue container
 
         @keyword mol_name:  The molecule name.
@@ -118,15 +128,21 @@
         @type res_num:      str
         @keyword res_name:  The residue name.
         @type res_name:     str
+        @keyword res_id:    The residue ID string.
+        @type res_id:       str
+        @keyword select:    The selection flag.
+        @type select:       bool
         """
 
         # Store the args.
         self.mol_name = mol_name
         self.res_num = res_num
         self.res_name = res_name
-
-        # The residue ID.
-        self.res_id = generate_spin_id(mol_name=mol_name, res_num=res_num, 
res_name=res_name)
+        self.res_id = res_id
+        self.select = select
+
+        # Destroy all the original contents.
+        self.main_sizer.Clear(deleteWindows=True)
 
         # Create the header.
         sizer = self.header_residue()
@@ -138,8 +154,12 @@
         line = wx.StaticLine(self, -1, (25, 50))
         self.main_sizer.Add(line, 0, wx.EXPAND|wx.ALL, border=self.border)
 
-
-    def container_spin(self, mol_name=None, res_num=None, res_name=None, 
spin_num=None, spin_name=None):
+        # Re-perform the window layout.
+        self.Layout()
+        self.Refresh()
+
+
+    def container_spin(self, mol_name=None, res_num=None, res_name=None, 
spin_num=None, spin_name=None, spin_id=None, select=True):
         """Build and display the spin container
 
         @keyword mol_name:  The molecule name.
@@ -148,10 +168,14 @@
         @type res_num:      str
         @keyword res_name:  The residue name.
         @type res_name:     str
-        @keyword spin_num:   The spin number.
-        @type spin_num:      str
-        @keyword spin_name:  The spin name.
-        @type spin_name:     str
+        @keyword spin_num:  The spin number.
+        @type spin_num:     str
+        @keyword spin_name: The spin name.
+        @type spin_name:    str
+        @keyword spin_id:   The spin ID string.
+        @type spin_id:      str
+        @keyword select:    The selection flag.
+        @type select:       bool
         """
 
         # Store the args.
@@ -160,9 +184,11 @@
         self.res_name = res_name
         self.spin_num = spin_num
         self.spin_name = spin_name
-
-        # The spin ID.
-        self.spin_id = generate_spin_id(mol_name=mol_name, res_num=res_num, 
res_name=res_name, spin_num=spin_num, spin_name=spin_name)
+        self.spin_id = spin_id
+        self.select = select
+
+        # Destroy all the original contents.
+        self.main_sizer.Clear(deleteWindows=True)
 
         # Create the header.
         sizer = self.header_spin()
@@ -177,6 +203,10 @@
         # The spin container variables.
         sizer2 = self.spin_vars()
         self.main_sizer.Add(sizer2, 1, wx.ALL|wx.EXPAND, border=self.border)
+
+        # Re-perform the window layout.
+        self.Layout()
+        self.Refresh()
 
 
     def create_head_text(self, text):
@@ -248,49 +278,25 @@
         return title
 
 
-    def display(self, info):
-        """Display the info for the selected container.
-
-        @param info:    The information list consisting of the container 
type ('root', 'mol', 'res', or 'spin'), the molecule name, the residue 
number, the residue name, the spin number, and the spin name.  The name and 
number information is dropped when not needed.
-        @type info:     list of str and int
-        """
+    def display_root(self):
+        """Build and display the root window."""
 
         # Destroy all the original contents.
         self.main_sizer.Clear(deleteWindows=True)
 
-        # The root window display.
-        if info == 'root':
-            self.display_root()
-
-        # The molecule container display.
-        elif info['type'] == 'mol':
-            self.container_molecule(mol_name=info['mol_name'])
-
-        # The residue container display.
-        elif info['type'] == 'res':
-            self.container_residue(mol_name=info['mol_name'], 
res_num=info['res_num'], res_name=info['res_name'])
-
-        # The spin container display.
-        elif info['type'] == 'spin':
-            self.container_spin(mol_name=info['mol_name'], 
res_num=info['res_num'], res_name=info['res_name'], 
spin_num=info['spin_num'], spin_name=info['spin_name'])
+        # A sizer for the header.
+        sizer = wx.BoxSizer(wx.VERTICAL)
+
+        # The title
+        title = self.create_title("The spin view window")
+        sizer.Add(title, 0, wx.LEFT, 0)
+
+        # Add to the sizer.
+        self.main_sizer.Add(sizer, 0, wx.ALL|wx.EXPAND, border=self.border)
 
         # Re-perform the window layout.
         self.Layout()
         self.Refresh()
-
-
-    def display_root(self):
-        """Build and display the root window."""
-
-        # A sizer for the header.
-        sizer = wx.BoxSizer(wx.VERTICAL)
-
-        # The title
-        title = self.create_title("The spin view window")
-        sizer.Add(title, 0, wx.LEFT, 0)
-
-        # Add to the sizer.
-        self.main_sizer.Add(sizer, 0, wx.ALL|wx.EXPAND, border=self.border)
 
 
     def header_molecule(self):

Modified: branches/gui_testing/gui/spin_viewer/tree.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/spin_viewer/tree.py?rev=13450&r1=13449&r2=13450&view=diff
==============================================================================
--- branches/gui_testing/gui/spin_viewer/tree.py (original)
+++ branches/gui_testing/gui/spin_viewer/tree.py Wed Jul  6 14:53:05 2011
@@ -163,8 +163,21 @@
         # The python data.
         info = self.tree.GetItemPyData(item)
 
-        # Display the container.
-        self.gui.spin_view.container.display(info)
+        # The root window display.
+        if info == 'root':
+            self.gui.spin_viewer.container.display_root()
+
+        # The molecule container display.
+        elif info['type'] == 'mol':
+            
self.gui.spin_viewer.container.container_molecule(mol_name=info['mol_name'], 
mol_id=info['id'], select=info['select'])
+
+        # The residue container display.
+        elif info['type'] == 'res':
+            
self.gui.spin_viewer.container.container_residue(mol_name=info['mol_name'], 
res_num=info['res_num'], res_name=info['res_name'], res_id=info['id'], 
select=info['select'])
+
+        # The spin container display.
+        elif info['type'] == 'spin':
+            
self.gui.spin_viewer.container.container_spin(mol_name=info['mol_name'], 
res_num=info['res_num'], res_name=info['res_name'], 
spin_num=info['spin_num'], spin_name=info['spin_name'], spin_id=info['id'], 
select=info['select'])
 
 
     def create_residue(self, event):




Related Messages


Powered by MHonArc, Updated Wed Jul 06 15:40:02 2011