dabo Commit
Revision 6689
Date: 2011-07-09 12:02:40 -0700 (Sat, 09 Jul 2011)
Author: Jacekk
Trac: http://trac.dabodev.com/changeset/6689

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

Log:
Added exceptions handling for non dPage class inherited pages.

Diff:
Modified: trunk/dabo/ui/uiwx/dPageFrameMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dPageFrameMixin.py       2011-07-09 10:41:02 UTC (rev 
6688)
+++ trunk/dabo/ui/uiwx/dPageFrameMixin.py       2011-07-09 19:02:40 UTC (rev 
6689)
@@ -13,6 +13,9 @@
 from dabo.ui import makeDynamicProperty
 
 
+MSG_SMART_FOCUS_ABUSE = _("The '%s' control must inherit from dPage to use the 
UseSmartFocus feature.")
+
+
 class dPageFrameMixin(cm.dControlMixin):
        """Creates a container for an unlimited number of pages."""
 
@@ -44,7 +47,10 @@
                else:
                        evt.Skip()
                if oldPageNum >= 0 and self.PageCount > oldPageNum:
-                       self.Pages[oldPageNum]._saveLastActiveControl()
+                       try:
+                               self.Pages[oldPageNum]._saveLastActiveControl()
+                       except AttributeError:
+                               dabo.log.error(MSG_SMART_FOCUS_ABUSE % 
self.Name)
                self.raiseEvent(dEvents.PageChanging, oldPageNum=oldPageNum,
                                newPageNum=newPageNum)
 
@@ -100,7 +106,10 @@
                        dabo.ui.callAfter(self.raiseEvent, dEvents.PageChanged,
                                        oldPageNum=oldPageNum, 
newPageNum=newPageNum)
                        if self.UseSmartFocus:
-                               newPage._restoreLastActiveControl()
+                               try:
+                                       newPage._restoreLastActiveControl()
+                               except AttributeError:
+                                       dabo.log.error(MSG_SMART_FOCUS_ABUSE % 
self.Name)
 
 
        # Image-handling function



_______________________________________________
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