dabo Commit
Revision 4366
Date: 2008-08-06 13:06:00 -0700 (Wed, 06 Aug 2008)
Author: Nate
Trac: http://svn.dabodev.com/trac/dabo/changeset/4366

Changed:
U   trunk/dabo/ui/uiwx/dDialog.py

Log:
I added two user level hooks to dDialog called beforeAddControls and 
afterAddControls.  If you design a dialog in the ClassDesigner, addControls is 
already used internally by the framework to add the controls.  So, both these 
hooks make it possible to add controls afterward and set the dialog's sizer 
properties before.

Diff:
Modified: trunk/dabo/ui/uiwx/dDialog.py
===================================================================
--- trunk/dabo/ui/uiwx/dDialog.py       2008-08-06 17:53:01 UTC (rev 4365)
+++ trunk/dabo/ui/uiwx/dDialog.py       2008-08-06 20:06:00 UTC (rev 4366)
@@ -104,9 +104,21 @@
                can be added in this method in framework classes, or
                in addControls() in instances.
                """
+               self.beforeAddControls()
                self.addControls()
-       
+               self.afterAddControls()
 
+
+       def beforeAddControls(self):
+               """This is a hook, called at the appropriate time by the 
framework."""
+               pass
+
+
+       def afterAddControls(self):
+               """This is a hook, called at the appropriate time by the 
framework."""
+               pass
+
+
        def addControls(self):
                """Add your custom controls to the dialog.
 
@@ -324,10 +336,14 @@
                sz = self.Sizer
                if self.ButtonSizerPosition is None:
                        # User code didn't add it, so we must.
+                       if sz.DefaultBorder:
+                               spacer = sz.DefaultBorder
+                       else:
+                               spacer = 10
                        bs = dabo.ui.dSizer("v")
-                       bs.append((0, sz.DefaultBorder/2))
+                       bs.append((0, spacer/2))
                        bs.append(self.ButtonSizer, "x")
-                       bs.append((0, sz.DefaultBorder))
+                       bs.append((0, spacer))
                        sz.append(bs, "x")
                self.layout()
 




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]

Reply via email to