Skip to content

Commit

Permalink
app: Ensure sure that the debugging message is delivered
Browse files Browse the repository at this point in the history
Use a QTimer to force the notification about GIT_COLA_TRACE to
the main GUI thread.

Signed-off-by: David Aguilar <davvid@gmail.com>
  • Loading branch information
davvid committed Oct 27, 2011
1 parent 3dff17e commit 9cfce67
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions cola/app.py
Expand Up @@ -182,6 +182,8 @@ def main(context):
print >> sys.stderr, 'e.g.: sudo apt-get install python-qt4'
sys.exit(-1)

from PyQt4.QtCore import SIGNAL

# Import cola modules
import cola
from cola import qtcompat
Expand Down Expand Up @@ -235,13 +237,10 @@ def main(context):
# Start the inotify thread
inotify.start()

git.GIT_COLA_TRACE = os.getenv('GIT_COLA_TRACE', False)
if git.GIT_COLA_TRACE:
msg = ('info: Trace enabled. '
'Many of commands reported with "trace" use git\'s stable '
'"plumbing" API and are not intended for typical '
'day-to-day use. Here be dragons')
cola.notifier().broadcast(signals.log_cmd, 0, msg)
msg_timer = QtCore.QTimer()
msg_timer.setSingleShot(True)
msg_timer.connect(msg_timer, SIGNAL('timeout()'), _send_msg)
msg_timer.start(0)

# Start the event loop
result = app.exec_()
Expand Down Expand Up @@ -276,6 +275,17 @@ def run(self):
return task



def _send_msg():
import cola
git.GIT_COLA_TRACE = os.getenv('GIT_COLA_TRACE', False)
if git.GIT_COLA_TRACE:
msg = ('info: Trace enabled. '
'Many of commands reported with "trace" use git\'s stable '
'"plumbing" API and are not intended for typical '
'day-to-day use. Here be dragons')
cola.notifier().broadcast(signals.log_cmd, 0, msg)

def _setup_resource_dir(dirname):
"""Adds resource directories to Qt's search path"""
from cola import qtcompat
Expand Down

0 comments on commit 9cfce67

Please sign in to comment.