diff options
author | Bruce Smith <bruce@nanorex.com> | 2008-12-28 01:44:54 +0000 |
---|---|---|
committer | Bruce Smith <bruce@nanorex.com> | 2008-12-28 01:44:54 +0000 |
commit | fb13b631b49ef0bf09bd3e19bf514e20e6384e51 (patch) | |
tree | 99c39dd84794a8c6f5cd31f57f11d9486471182b | |
parent | bf84f2d52ec94d08481831ac2352aedbc977eb79 (diff) | |
download | nanoengineer-fb13b631b49ef0bf09bd3e19bf514e20e6384e51.tar.gz nanoengineer-fb13b631b49ef0bf09bd3e19bf514e20e6384e51.zip |
when running under Wing IDE debugger, timer for IDE responsiveness
-rwxr-xr-x | cad/src/ne1_startup/main_startup.py | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/cad/src/ne1_startup/main_startup.py b/cad/src/ne1_startup/main_startup.py index 1ba63ba4d..5776d8255 100755 --- a/cad/src/ne1_startup/main_startup.py +++ b/cad/src/ne1_startup/main_startup.py @@ -16,7 +16,11 @@ and split out of main.py into this file (main_startup.py) by bruce 070704. """ -import sys, time, os, NE1_Build_Constants +import sys +import time +import os + +import NE1_Build_Constants # Note -- Logic in startup_before_most_imports depends on its load location. # If you move it, fix the endUser code in before_most_imports(). @@ -119,10 +123,10 @@ def startup_script( main_globals): # "Do things that should be done before most imports occur." startup_before_most_imports.before_most_imports( main_globals ) - - + + from PyQt4.Qt import QApplication, QSplashScreen - + # "Do things that should be done before creating the application object." @@ -400,6 +404,20 @@ def startup_script( main_globals): # Do other post-startup, pre-event-loop, non-profiled things, if any # (such as run optional startup commands for debugging). startup_misc.just_before_event_loop() + + if os.environ.has_key('WINGDB_ACTIVE'): + # Hack to burn some Python bytecode periodically so Wing's + # debugger can remain responsive while free-running + # [from http://wingware.com/doc/howtos/pyqt; added by bruce 081227] + print "running under Wing IDE debugger; setting up timer" + from PyQt4 import QtCore + timer = QtCore.QTimer() + def donothing(*args): + x = 0 + for i in range(0, 100): + x += i + timer.connect(timer, QtCore.SIGNAL("timeout()"), donothing) + timer.start(200) # Finally, run the main Qt event loop -- # perhaps with profiling, depending on local variables set above. |