Author: bugman Date: Thu Jun 7 16:55:55 2012 New Revision: 16733 URL: http://svn.gna.org/viewcvs/relax?rev=16733&view=rev Log: The GUI user function objects can now be called with the wx_wizard_sync and wx_wizard_modal args. This is used to force the user function to operate synchronous or asynchronous mode, or to force the user function wizard to be modal. This will allow a number of hacks to be avoided throughout the GUI! Modified: branches/uf_redesign/gui/uf_objects.py Modified: branches/uf_redesign/gui/uf_objects.py URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/gui/uf_objects.py?rev=16733&r1=16732&r2=16733&view=diff ============================================================================== --- branches/uf_redesign/gui/uf_objects.py (original) +++ branches/uf_redesign/gui/uf_objects.py Thu Jun 7 16:55:55 2012 @@ -179,21 +179,29 @@ class Uf_object(object): """The object for auto-generating the GUI user functions.""" - def __call__(self, event=None, wx_parent=None, wx_wizard_run=True, **kwds): + def __call__(self, event=None, wx_parent=None, wx_wizard_sync=None, wx_wizard_run=True, wx_wizard_modal=False, **kwds): """Make the GUI user function executable. All keyword args, apart from 'event', 'wx_parent' and 'wx_wizard_run' will be assumed to be user function arguments and the Uf_page.SetValue() method of the page will be used to set the GUI arg elements to the values supplied. - @keyword event: The wx event. - @type event: wx event or None - @keyword wx_parent: The parent wx object to associate the user function wizard to. - @type wx_parent: wx object - @keyword wx_wizard_run: A flag which if True will call the wizard run() method. - @type wx_wizard_run: bool - @return: The status of the call. If the call failed, False will be returned. - @rtype: bool - """ + @keyword event: The wx event. + @type event: wx event or None + @keyword wx_parent: The parent wx object to associate the user function wizard to. + @type wx_parent: wx object + @keyword wx_wizard_sync: A flag which if given will switch between synchronous and asynchronous user function operation. + @type wx_wizard_sync: None or bool + @keyword wx_wizard_run: A flag which if True will call the wizard run() method. + @type wx_wizard_run: bool + @keyword wx_wizard_modal: A flag which if True will cause the wizard run() method to have the modal flag set so that the wizard is modal. + @type wx_wizard_modal: bool + @return: The status of the call. If the call failed, False will be returned. + @rtype: bool + """ + + # Store the sync flag. + if wx_wizard_sync != None: + self._sync = wx_wizard_sync # Create a new wizard if needed (checking that the parent of an old wizard is not the same). if self.wizard == None or (wx_parent != None and wx_parent != self.wizard.GetParent()) or self.wizard._pages[0] == None: @@ -215,7 +223,7 @@ # Execute the wizard when asked. if wx_wizard_run: - self.wizard.run() + self.wizard.run(modal=wx_wizard_modal) def __init__(self, name, title=None, size=None, height_desc=None, apply_button=True, sync=False):