diff options
author | necoro <> | 2007-07-21 22:13:06 +0000 |
---|---|---|
committer | necoro <> | 2007-07-21 22:13:06 +0000 |
commit | 44a726cd69e3e0d5c50890946b366c441a575a37 (patch) | |
tree | 26580405641d1f4f0e66acc859fad44ed3a54bef /portato/gui/qt | |
parent | 6d3b88dbe7a72377db9c853781593287f9cbcfa5 (diff) | |
download | portato-44a726cd69e3e0d5c50890946b366c441a575a37.tar.gz portato-44a726cd69e3e0d5c50890946b366c441a575a37.tar.bz2 portato-44a726cd69e3e0d5c50890946b366c441a575a37.zip |
added logviewers
Diffstat (limited to '')
-rw-r--r-- | portato/gui/qt/windows.py | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/portato/gui/qt/windows.py b/portato/gui/qt/windows.py index 5aa0e24..ba4dcc5 100644 --- a/portato/gui/qt/windows.py +++ b/portato/gui/qt/windows.py @@ -32,7 +32,7 @@ from highlighter import EbuildHighlighter from dialogs import * from helper import qCheck, qIsChecked -import types +import types, logging UI_DIR = DATA_DIR+"ui/" @@ -252,6 +252,27 @@ class EbuildDialog (Window): self.doc.setPlainText("".join(lines)) self.ebuildEdit.setDocument(self.doc) +class LogDialog (Window, logging.Handler): + + __metaclass__ = WindowMeta + + def __init__ (self, parent): + Window.__init__(self, parent) + + self.setAttribute(Qt.Qt.WA_DeleteOnClose, False) + logging.Handler.__init__(self, logging.INFO) + logging.getLogger("portatoLogger").addHandler(self) + + def format (self, record): + + if (record.levelno > logging.INFO): + return "%s: %s" % (record.levelname, record.getMessage()) + else: + return record.getMessage() + + def emit (self, record): + self.logView.insertPlainText(self.format(record)+"\n") + class PreferenceWindow (Window): """Window displaying some preferences.""" @@ -707,6 +728,9 @@ class MainWindow (Window): self.doUpdate = False self.pkgDetails = PackageDetails(self) + # set the logger as early as possible + self.logDialog = LogDialog(self) + # package db self.db = Database() self.db.populate() @@ -843,6 +867,10 @@ class MainWindow (Window): self.systray = None @Qt.pyqtSignature("") + def on_logAction_triggered (self): + self.logDialog.show() + + @Qt.pyqtSignature("") def on_aboutAction_triggered (self): AboutDialog(self).exec_() |