mailr16408 - in /branches/uf_redesign/gui: uf_objects.py wizard.py


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

Header


Content

Posted by edward on May 23, 2012 - 09:00:
Author: bugman
Date: Wed May 23 09:00:11 2012
New Revision: 16408

URL: http://svn.gna.org/viewcvs/relax?rev=16408&view=rev
Log:
The wizards for the individual user function pages are now recycled.

This should speed up the GUI (and the GUI tests massively).  Closing the 
wizard calls the Close()
rather than Destroy() method, so the wizards are still in memory.  A new call 
to an old GUI uf
object will simply call SetValue() for all keyword arg GUI elements, hence 
reset the element.

The Wizard GUI object has been modified to only add the buttons if they do 
not currently exist.
Without this, a new set of buttons is added each time the user function 
wizard appears.


Modified:
    branches/uf_redesign/gui/uf_objects.py
    branches/uf_redesign/gui/wizard.py

Modified: branches/uf_redesign/gui/uf_objects.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/gui/uf_objects.py?rev=16408&r1=16407&r2=16408&view=diff
==============================================================================
--- branches/uf_redesign/gui/uf_objects.py (original)
+++ branches/uf_redesign/gui/uf_objects.py Wed May 23 09:00:11 2012
@@ -167,24 +167,27 @@
             app = wx.GetApp()
             parent = app.gui
 
-        # Create the wizard dialog.
-        wizard = Wiz_window(parent=parent, size_x=self._size[0], 
size_y=self._size[1], title=self._title)
-
-        # Create the page.
-        page = self.create_page(wizard, sync=self._sync)
-
-        # For an update of the argument data.
-        page.update_args()
+        # Do not reuse an old wizard (checking that the parent of an old 
wizard is not the same).
+        if self.wizard != None and parent != self.wizard.GetParent():
+            prin
+            # Create the wizard dialog.
+            self.wizard = Wiz_window(parent=parent, size_x=self._size[0], 
size_y=self._size[1], title=self._title)
+
+            # Create the page.
+            self.page = self.create_page(self.wizard, sync=self._sync)
+
+            # For an update of the argument data.
+            self.page.update_args()
+
+            # Add the page to the wizard.
+            self.wizard.add_page(self.page, apply_button=self._apply_button)
 
         # Loop over the keyword args, using the Uf_page.SetValue() method to 
set the user function argument GUI element values.
         for key in kwds:
-            page.SetValue(key, kwds[key])
-
-        # Add the page to the wizard.
-        wizard.add_page(page, apply_button=self._apply_button)
+            self.page.SetValue(key, kwds[key])
 
         # Execute the wizard.
-        wizard.run()
+        self.wizard.run()
 
 
     def __init__(self, name, title=None, size=None, height_desc=None, 
apply_button=True, sync=False):
@@ -212,6 +215,9 @@
         self._apply_button = apply_button
         self._sync = sync
 
+        # Initialise the wizard storage.
+        self.wizard = None
+
 
     def create_page(self, wizard=None, sync=False):
         """Create the user function page object.

Modified: branches/uf_redesign/gui/wizard.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/gui/wizard.py?rev=16408&r1=16407&r2=16408&view=diff
==============================================================================
--- branches/uf_redesign/gui/wizard.py (original)
+++ branches/uf_redesign/gui/wizard.py Wed May 23 09:00:11 2012
@@ -1045,6 +1045,9 @@
             # Page skipping.
             self._skip_flag.append(False)
 
+        # Flag to suppress later button addition.
+        self._buttons_built = False
+
 
     def _build_buttons(self):
         """Construct the buttons for all pages of the wizard."""
@@ -1142,6 +1145,9 @@
             self._button_sizers[i].Add(button, 0, wx.ADJUST_MINSIZE, 0)
             self.Bind(wx.EVT_BUTTON, self._cancel, button)
             self._buttons[i]['cancel'] = button
+
+        # Flag to suppress later button addition.
+        self._buttons_built = True
 
 
     def _cancel(self, event):
@@ -1432,7 +1438,8 @@
                 return
 
         # Build the buttons for the entire wizard.
-        self._build_buttons()
+        if not self._buttons_built:
+            self._build_buttons()
 
         # Display the first page.
         self._display_page(0)




Related Messages


Powered by MHonArc, Updated Wed May 23 09:20:02 2012