dabo Commit
Revision 3185
Date: 2007-06-19 17:27:50 -0700 (Tue, 19 Jun 2007)
Author: Ed
Trac: http://svn.dabodev.com/trac/dabo/changeset/3185

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

Log:
Fixes the problem with the app crashing on close if a dDockForm window has a 
floating child pane.


Diff:
Modified: trunk/dabo/ui/uiwx/dDockForm.py
===================================================================
--- trunk/dabo/ui/uiwx/dDockForm.py     2007-06-19 22:25:49 UTC (rev 3184)
+++ trunk/dabo/ui/uiwx/dDockForm.py     2007-06-20 00:27:50 UTC (rev 3185)
@@ -33,6 +33,13 @@
                ret = self.GetAllPanes()[-1]
                dabo.ui.callAfterInterval(100, self.Update)
                return ret
+
+
+       def runUpdate(self):
+               win = self.GetManagedWindow()
+               if not win or win._finito:
+                       return
+               self.Update()
                
 
 
@@ -709,19 +716,24 @@
 class dDockForm(dabo.ui.dForm):
        def _afterInit(self):
                self._mgr = mgr = _dDockManager(self)
-               self._centerPanel = _dDockPanel(self, BackColor="lavender", 
-                               name="CenterPanel", typ="center")
+               pc = self.getBasePanelClass()
+               self._centerPanel = pc(self, name="CenterPanel", typ="center")
                self._centerPanel.Sizer = dabo.ui.dSizer("v")
                super(dDockForm, self)._afterInit()
+               self.bindEvent(dEvents.Destroy, self.__onDestroy)
        
        
+       def __onDestroy(self, evt):
+               if self._finito:
+                       self._mgr.UnInit()
+       
        def getBasePanelClass(cls):
                return _dDockPanel
        getBasePanelClass = classmethod(getBasePanelClass)
 
 
        def onChildBorn(self, evt):
-               ok = (_dDockPanel, dabo.ui.dStatusBar, dabo.ui.dShell)
+               ok = isinstance(evt.child, (_dDockPanel, dabo.ui.dStatusBar, 
dabo.ui.dShell))
                if not ok:
                        print "BORN:", evt.child
                
@@ -737,12 +749,14 @@
        
        
        def _refreshState(self, interval=None):
+               if self._finito:
+                               return
                if interval is None:
                        interval = 100
                if interval == 0:
                        self._mgr.Update()
                else:
-                       dabo.ui.callAfterInterval(interval, self._mgr.Update)   
        
+                       dabo.ui.callAfterInterval(interval, 
self._mgr.runUpdate)                
 
 
        # Property get/set/del methods follow. Scroll to bottom to see the 
property
@@ -769,6 +783,15 @@
                self._centerPanel.Sizer.append(btn)
                btn = dabo.ui.dButton(self._centerPanel, Caption="Test Blue", 
OnHit=self.onTestDP)
                self._centerPanel.Sizer.append(btn)
+               self.fp.DynamicCaption = self.capForOrange
+
+
+       def capForOrange(self):
+               state = "Floating"
+               if self.fp.Docked:
+                       state = "Docked"
+               return "I'm %s!" % state
+               
        
        def onTestFP(self, evt):
                self.printTest(self.fp)




_______________________________________________
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/dabo-dev/[EMAIL PROTECTED]

Reply via email to