mailr12983 - in /1.3/gui: ./ analyses/


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

Header


Content

Posted by edward on June 14, 2011 - 14:17:
Author: bugman
Date: Tue Jun 14 14:17:01 2011
New Revision: 12983

URL: http://svn.gna.org/viewcvs/relax?rev=12983&view=rev
Log:
Created the function gui.misc.add_border() for adding borders to generic GUI 
elements.

The analysis tabs now use this method for their borders.


Modified:
    1.3/gui/analyses/auto_model_free.py
    1.3/gui/analyses/auto_noe.py
    1.3/gui/analyses/auto_rx_base.py
    1.3/gui/analyses/base.py
    1.3/gui/analyses/results.py
    1.3/gui/misc.py

Modified: 1.3/gui/analyses/auto_model_free.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/gui/analyses/auto_model_free.py?rev=12983&r1=12982&r2=12983&view=diff
==============================================================================
--- 1.3/gui/analyses/auto_model_free.py (original)
+++ 1.3/gui/analyses/auto_model_free.py Tue Jun 14 14:17:01 2011
@@ -39,7 +39,6 @@
 from relax_io import DummyFileObject
 from status import Status; status = Status()
 
-
 # relax GUI module imports.
 from gui.about import About_base
 from gui.analyses.base import Base_frame
@@ -51,6 +50,7 @@
 from gui.derived_wx_classes import StructureTextCtrl
 from gui.filedialog import opendir, openfile
 from gui.message import error_message, missing_data
+from gui.misc import add_border
 from gui import paths
 
 
@@ -189,7 +189,7 @@
         self.parent = wx.Panel(notebook, -1)
 
         # Build the central sizer, with borders.
-        box = self.setup_analysis_element(self.parent)
+        box = add_border(self.parent, border=self.border, 
packing=wx.HORIZONTAL)
 
         # Build and pack the main sizer box, then add it to the automatic 
model-free analysis frame.
         self.build_main_box(box)

Modified: 1.3/gui/analyses/auto_noe.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/gui/analyses/auto_noe.py?rev=12983&r1=12982&r2=12983&view=diff
==============================================================================
--- 1.3/gui/analyses/auto_noe.py (original)
+++ 1.3/gui/analyses/auto_noe.py Tue Jun 14 14:17:01 2011
@@ -46,6 +46,7 @@
 from gui.derived_wx_classes import StructureTextCtrl
 from gui.filedialog import opendir, openfile
 from gui.message import error_message, missing_data
+from gui.misc import add_border
 from gui.paths import IMAGE_PATH
 from gui.settings import load_sequence
 
@@ -83,7 +84,7 @@
         self.parent = wx.Panel(notebook, -1)
 
         # Build the central sizer, with borders.
-        box = self.setup_analysis_element(self.parent)
+        box = add_border(self.parent, border=self.border, 
packing=wx.HORIZONTAL)
 
         # Build and pack the main sizer box, then add it to the automatic 
model-free analysis frame.
         self.build_main_box(box)

Modified: 1.3/gui/analyses/auto_rx_base.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/gui/analyses/auto_rx_base.py?rev=12983&r1=12982&r2=12983&view=diff
==============================================================================
--- 1.3/gui/analyses/auto_rx_base.py (original)
+++ 1.3/gui/analyses/auto_rx_base.py Tue Jun 14 14:17:01 2011
@@ -47,6 +47,7 @@
 from gui.derived_wx_classes import StructureTextCtrl
 from gui.filedialog import opendir
 from gui.message import error_message, missing_data
+from gui.misc import add_border
 from gui import paths
 from gui.settings import load_sequence
 
@@ -81,7 +82,7 @@
         self.parent = wx.Panel(notebook, -1)
 
         # Build the central sizer, with borders.
-        box = self.setup_analysis_element(self.parent)
+        box = add_border(self.parent, border=self.border, 
packing=wx.HORIZONTAL)
 
         # Build and pack the main sizer box, then add it to the automatic 
model-free analysis frame.
         self.build_main_box(box)

Modified: 1.3/gui/analyses/base.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/gui/analyses/base.py?rev=12983&r1=12982&r2=12983&view=diff
==============================================================================
--- 1.3/gui/analyses/base.py (original)
+++ 1.3/gui/analyses/base.py Tue Jun 14 14:17:01 2011
@@ -307,34 +307,3 @@
         # Build the right hand box and pack it next to the bitmap.
         right_box = self.build_right_box()
         box.Add(right_box, 1, wx.ALL|wx.EXPAND, 0)
-
-
-    def setup_analysis_element(self, parent):
-        """Set up the specific analysis GUI element.
-
-        @param parent:  The parent GUI element.
-        @type parent:   wx object
-        @return:        The sizer object.
-        @rtype:         wx.Sizer instance
-        """
-
-        # Some sizers.
-        sizer_hori = wx.BoxSizer(wx.HORIZONTAL)
-        sizer_vert = wx.BoxSizer(wx.VERTICAL)
-        sizer_cent = wx.BoxSizer(wx.HORIZONTAL)
-
-        # Pack the sizer into the frame.
-        parent.SetSizer(sizer_hori)
-
-        # Left and right borders.
-        sizer_hori.AddSpacer(self.border)
-        sizer_hori.Add(sizer_vert, 1, wx.EXPAND|wx.ALL)
-        sizer_hori.AddSpacer(self.border)
-
-        # Top and bottom borders.
-        sizer_vert.AddSpacer(self.border)
-        sizer_vert.Add(sizer_cent, 1, wx.EXPAND|wx.ALL)
-        sizer_vert.AddSpacer(self.border)
-
-        # Return the central sizer.
-        return sizer_cent

Modified: 1.3/gui/analyses/results.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/gui/analyses/results.py?rev=12983&r1=12982&r2=12983&view=diff
==============================================================================
--- 1.3/gui/analyses/results.py (original)
+++ 1.3/gui/analyses/results.py Tue Jun 14 14:17:01 2011
@@ -34,6 +34,7 @@
 
 # relaxGUI module imports.
 from gui.analyses.base import Base_frame
+from gui.misc import add_border
 from gui.paths import IMAGE_PATH
 
 
@@ -60,7 +61,7 @@
         self.parent = notebook
 
         # Build the central sizer, with borders.
-        box = self.setup_analysis_element(self.parent)
+        box = add_border(self.parent, border=self.border, 
packing=wx.HORIZONTAL)
 
         # Build and pack the main sizer box.
         self.build_results_box(box)

Modified: 1.3/gui/misc.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/gui/misc.py?rev=12983&r1=12982&r2=12983&view=diff
==============================================================================
--- 1.3/gui/misc.py (original)
+++ 1.3/gui/misc.py Tue Jun 14 14:17:01 2011
@@ -27,6 +27,42 @@
 # Python module imports.
 from math import pow
 from string import split
+import wx
+
+
+def add_border(parent, border=0, packing=wx.VERTICAL):
+    """Create the main part of the frame, returning the central sizer.
+
+    @param parent:      The parent GUI element to pack the box into.
+    @type parent:       wx object
+    @keyword border:    The size of the border in pixels.
+    @type border:       int
+    @keyword packing:   Specify if the central sizer should be vertically or 
horizontally packed.
+    @type packing:      wx.VERTICAL or wx.HORIZONTAL
+    @return:            The central sizer.
+    @rtype:             wx.BoxSizer instance
+    """
+
+    # Some sizers.
+    sizer_hori = wx.BoxSizer(wx.HORIZONTAL)
+    sizer_vert = wx.BoxSizer(wx.VERTICAL)
+    sizer_cent = wx.BoxSizer(packing)
+
+    # Pack the sizer into the frame.
+    parent.SetSizer(sizer_hori)
+
+    # Left and right borders.
+    sizer_hori.AddSpacer(border)
+    sizer_hori.Add(sizer_vert, 1, wx.EXPAND|wx.ALL)
+    sizer_hori.AddSpacer(border)
+
+    # Top and bottom borders.
+    sizer_vert.AddSpacer(border)
+    sizer_vert.Add(sizer_cent, 1, wx.EXPAND|wx.ALL)
+    sizer_vert.AddSpacer(border)
+
+    # Return the central sizer.
+    return sizer_cent
 
 
 def convert_to_float(string):




Related Messages


Powered by MHonArc, Updated Tue Jun 14 15:00:02 2011