Author: bugman Date: Sun May 13 16:05:07 2012 New Revision: 16280 URL: http://svn.gna.org/viewcvs/relax?rev=16280&view=rev Log: The GUI user function storage object now populated itself. This singleton object is no longer populated from the main GUI object, shifting the auto_generate() method code into the singleton instantiation. The user function __call__() method not extracts the main window GUI object for use as the parent of the wizards, if a parent is not supplied. Modified: branches/uf_redesign/gui/relax_gui.py branches/uf_redesign/gui/uf_objects.py Modified: branches/uf_redesign/gui/relax_gui.py URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/gui/relax_gui.py?rev=16280&r1=16279&r2=16280&view=diff ============================================================================== --- branches/uf_redesign/gui/relax_gui.py (original) +++ branches/uf_redesign/gui/relax_gui.py Sun May 13 16:05:07 2012 @@ -49,7 +49,6 @@ from relax_io import io_streams_restore from status import Status; status = Status() import test_suite.test_suite_runner -from user_functions.data import Uf_info; uf_info = Uf_info() from version import version # relax GUI module imports. @@ -144,9 +143,6 @@ # Initialise the GUI data. self.init_data() - # Auto-generate the user functions and classes. - self.auto_generate() - # Build the menu bar. self.menu = Menu(self) @@ -272,18 +268,6 @@ # Re-perform the layout of the GUI elements, and refresh. self.Layout() self.Refresh() - - - def auto_generate(self): - """Build the user function objects from the user function data object information.""" - - # Generate the user functions. - for name, data in uf_info.uf_loop(): - # Generate a new container. - obj = Uf_object(name, self, title=data.title, size=data.wizard_size, height_desc=data.wizard_height_desc, apply_button=data.wizard_apply_button, sync=data.gui_sync) - - # Store it. - uf_store[name] = obj def close_windows(self): Modified: branches/uf_redesign/gui/uf_objects.py URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/gui/uf_objects.py?rev=16280&r1=16279&r2=16280&view=diff ============================================================================== --- branches/uf_redesign/gui/uf_objects.py (original) +++ branches/uf_redesign/gui/uf_objects.py Sun May 13 16:05:07 2012 @@ -56,9 +56,10 @@ @type parent: wx object """ - # The parent object. + # The parent object defaults to the main relax window. if parent == None: - parent = self._parent + 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) @@ -73,13 +74,11 @@ wizard.run() - def __init__(self, name, parent, title=None, size=None, height_desc=None, apply_button=True, sync=False): + def __init__(self, name, title=None, size=None, height_desc=None, apply_button=True, sync=False): """Set up the object. @param name: The name of the user function. @type name: str - @param parent: The parent wx element. - @type parent: wx.Frame instance @keyword title: The long title of the user function to set as the window title. @type title: str @keyword size: The window size. @@ -94,7 +93,6 @@ # Store the args. self._name = name - self._parent = parent self._title = title self._size = size self._height_desc = height_desc @@ -568,5 +566,13 @@ # Instantiate. self._instance = dict.__new__(self, *args, **kargs) + # Generate the user functions. + for name, data in uf_info.uf_loop(): + # Generate a new container. + obj = Uf_object(name, title=data.title, size=data.wizard_size, height_desc=data.wizard_height_desc, apply_button=data.wizard_apply_button, sync=data.gui_sync) + + # Store it. + self._instance[name] = obj + # Already instantiated, so return the instance. return self._instance