commit 4ea211ffc54b4c32b9d7cc90e4b395523145484b Author: Kamran Riaz Khan krkhan@inspirated.com Date: Wed Jun 22 01:15:50 2011 +0500
Connect a TorEventObserver instance with LogPanel. --- src/gui/controller.py | 7 +------ src/gui/logPanel.py | 13 ++++++------- 2 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/src/gui/controller.py b/src/gui/controller.py index c5c8767..090cc31 100644 --- a/src/gui/controller.py +++ b/src/gui/controller.py @@ -24,12 +24,7 @@ class GuiController: self.logPanel = logPanel.LogPanel(self.builder) self.logPanel.pack_widgets()
- def random_entries(): - while True: - log.log(log.DEBUG, "Hello World at %s" % time.asctime(time.localtime())) - time.sleep(5) - - thread.start_new_thread(random_entries, ()) + log.log(log.DEBUG, "Hello world!")
def run(self): window = self.builder.get_object('window_main') diff --git a/src/gui/logPanel.py b/src/gui/logPanel.py index 7197178..78b218a 100644 --- a/src/gui/logPanel.py +++ b/src/gui/logPanel.py @@ -14,7 +14,7 @@ import gtk from TorCtl import TorCtl from util import log, uiTools, torTools
-from cli.logPanel import RUNLEVEL_EVENT_COLOR, LogEntry +from cli.logPanel import RUNLEVEL_EVENT_COLOR, LogEntry, TorEventObserver
class LogPanel: def __init__(self, builder): @@ -22,12 +22,11 @@ class LogPanel:
self.msgLog = deque()
- log.LOG_LOCK.acquire() - try: - armRunlevels = [log.DEBUG, log.INFO, log.NOTICE, log.WARN, log.ERR] - log.addListeners(armRunlevels, self._register_arm_event) - finally: - log.LOG_LOCK.release() + armRunlevels = [log.DEBUG, log.INFO, log.NOTICE, log.WARN, log.ERR] + log.addListeners(armRunlevels, self._register_arm_event) + + conn = torTools.getConn() + conn.addEventListener(TorEventObserver(self.register_event))
def fill_log(self): liststore = self.builder.get_object('liststore_log')