dabo Commit
Revision 6634
Date: 2011-06-27 09:12:25 -0700 (Mon, 27 Jun 2011)
Author: Paul
Trac: http://trac.dabodev.com/changeset/6634

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

Log:
I'm tired of receiving automated error reports with tracebacks that only
trace back to the wx.Notify() call from the dabo.ui.callAfter() and 
dabo.ui.callAfterInterval() functions. I want to also see the trace 
that lead to the callAfter*() call.

So, this commit saves the current call stack in every callAfter() or
callAfterInterval() call. 

If it becomes a performance bottleneck, we could configure whether 
to do this in dabo.settings, defaulting to False.
 


Diff:
Modified: trunk/dabo/ui/__init__.py
===================================================================
--- trunk/dabo/ui/__init__.py   2011-06-20 16:37:42 UTC (rev 6633)
+++ trunk/dabo/ui/__init__.py   2011-06-27 16:12:25 UTC (rev 6634)
@@ -19,6 +19,7 @@
 import dabo
 from dabo.dLocalize import _
 
+lastCallAfterIntervalStack = ""  ## see uiwx/__init__.py in callAfter and 
callAfterInterval
 
 def getUIType():
        """Return the identifier of the currently loaded UI, or None."""

Modified: trunk/dabo/ui/uiwx/__init__.py
===================================================================
--- trunk/dabo/ui/uiwx/__init__.py      2011-06-20 16:37:42 UTC (rev 6633)
+++ trunk/dabo/ui/uiwx/__init__.py      2011-06-27 16:12:25 UTC (rev 6634)
@@ -8,6 +8,8 @@
 import time
 import cStringIO
 import warnings
+import traceback
+import dabo
 from dabo.dLocalize import _
 from dabo.lib.utils import ustr
 from dabo.lib import utils
@@ -270,10 +272,10 @@
 
 def callAfter(fnc, *args, **kwargs):
        """
-       There are times when this functionality is needed when creating UI
-       code. This function simply wraps the wx.CallAfter function so that
-       developers do not need to use wx code in their apps.
+       Call the passed function with the passed arguments in the next
+       event loop.
        """
+       dabo.ui.lastCallAfterStack = "".join(traceback.format_stack())
        wx.CallAfter(fnc, *args, **kwargs)
 
 
@@ -288,6 +290,7 @@
        refresh something because you changed it, but the frequency of changes 
can be
        high.
        """
+       dabo.ui.lastCallAfterStack = "".join(traceback.format_stack())
        if isinstance(func, int):
                # Arguments are in the old order
                interval, func = func, interval



_______________________________________________
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