dabo Commit
Revision 1531
Date: 2005-11-09 14:09:50 -0800 (Wed, 09 Nov 2005)
Author: ed

Changed:
U   trunk/dabo/ui/dialogs/Wizard.py

Log:
Changed the wizard to be based upon dDialog instead of dForm.

Oh, forgot to mention in my last commit in daboide: I've updated the AppWizard 
to work correctly with this change.


Diff:
Modified: trunk/dabo/ui/dialogs/Wizard.py
===================================================================
--- trunk/dabo/ui/dialogs/Wizard.py     2005-11-09 19:21:29 UTC (rev 1530)
+++ trunk/dabo/ui/dialogs/Wizard.py     2005-11-09 22:09:50 UTC (rev 1531)
@@ -6,7 +6,7 @@
 from WizardPage import WizardPage
 
 
-class Wizard(dabo.ui.dForm):
+class Wizard(dabo.ui.dDialog):
        """ This is the main form for creating wizards. To use it, define
        a series of wizard pages, based on WizardPage. Then add these
        classes to your subclass of Wizard. The order that you add them 
@@ -16,16 +16,20 @@
        def __init__(self, parent=None, properties=None, *args, **kwargs):
                pgs = self._extractKey(kwargs, "Pages")
                self.iconName = self._extractKey(kwargs, "image")
-               # Add the main panel
-               kwargs["panel"] = True
                kwargs["BorderResizable"] = False
                kwargs["ShowMaxButton"] = False
                kwargs["ShowMinButton"] = False
                kwargs["ShowCloseButton"] = False
-               kwargs["ShowStatusBar"] = False
+#              kwargs["ShowStatusBar"] = False
                                
-               super(Wizard, self).__init__(parent=parent, 
properties=properties, *args, **kwargs)
+               super(Wizard, self).__init__(parent=parent, 
+                               properties=properties, *args, **kwargs)
                
+               # Add the main panel
+               mp = self.mainPanel = dabo.ui.dPanel(self)
+               self.Sizer.append(mp, 1, "x")
+               mp.Sizer = dabo.ui.dSizer(self.Sizer.Orientation)
+
                self._pages = []
                self._currentPage = -1
                self._blankPage = None
@@ -124,7 +128,7 @@
                        if not dabo.ui.areYouSure(self.confirmCancelMsg, 
                                        "Cancel Received", cancelButton=False):
                                return
-               dabo.ui.callAfter(self.Close)
+               dabo.ui.callAfter(self.closeWizard)
                                
        
        def _finish(self):
@@ -133,7 +137,7 @@
                if ok is not False:
                        finOK = self.finish()
                        if finOK is not False:
-                               dabo.ui.callAfter(self.close, True)
+                               dabo.ui.callAfter(self.closeWizard)
 
 
        def finish(self):
@@ -144,16 +148,25 @@
                
        
        def start(self):
+               self.CurrentPage = 0
                self.show()     
-               self.CurrentPage = 0
-               
        
+       
+       def closeWizard(self):
+               self.close(True)
+               if self.Parent is None:
+                       # Since this is a dialog, we need to explicitly remove
+                       # it or the app will hang.
+                       self.Destroy()
+                       
+       
        def append(self, pg):
                if isinstance(pg, (list, tuple)):
                        for p in pg:
                                self.append(p)
                else:
                        page = pg(self.pagePanel)
+                       page.wizard = self
                        page.Size = self.pagePanel.Size
                        self._pages.append(page)
                        page.Visible = False




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev

Reply via email to