summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2008-03-19 16:56:36 +0100
committerRené 'Necoro' Neumann <necoro@necoro.net>2008-03-19 16:56:36 +0100
commit0e97cc678cb9ec813460ca2e60a23595e753c2f8 (patch)
tree52a064ba973dd42f856a50ce858c2b012b2135cc
parente942cac568e392b29064b01166eec20441650f99 (diff)
downloadportato-0e97cc678cb9ec813460ca2e60a23595e753c2f8.tar.gz
portato-0e97cc678cb9ec813460ca2e60a23595e753c2f8.tar.bz2
portato-0e97cc678cb9ec813460ca2e60a23595e753c2f8.zip
Make logger thread-safe
-rw-r--r--portato/gui/views.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/portato/gui/views.py b/portato/gui/views.py
index b069aae..41e6ae5 100644
--- a/portato/gui/views.py
+++ b/portato/gui/views.py
@@ -12,7 +12,7 @@
from __future__ import absolute_import, with_statement
-import gtk
+import gtk, gobject
import pango
import gtksourceview2
import logging
@@ -142,5 +142,8 @@ class LogView (logging.Handler):
tag = "log_%s" % name
break
- self.buf.insert_with_tags_by_name(self.buf.get_end_iter(), "* ", tag)
- self.buf.insert(self.buf.get_end_iter(), record.getMessage()+"\n")
+ def _add():
+ self.buf.insert_with_tags_by_name(self.buf.get_end_iter(), "* ", tag)
+ self.buf.insert(self.buf.get_end_iter(), record.getMessage()+"\n")
+
+ gobject.idle_add(_add) # logger might be called from another thread