summaryrefslogtreecommitdiff
path: root/portato/gui/gtk
diff options
context:
space:
mode:
Diffstat (limited to 'portato/gui/gtk')
-rw-r--r--portato/gui/gtk/windows.py51
1 files changed, 48 insertions, 3 deletions
diff --git a/portato/gui/gtk/windows.py b/portato/gui/gtk/windows.py
index 51179c3..33cd037 100644
--- a/portato/gui/gtk/windows.py
+++ b/portato/gui/gtk/windows.py
@@ -33,7 +33,7 @@ from wrapper import GtkTree, GtkConsole
from usetips import UseTips
# other
-import types
+import types, logging
GLADE_FILE = DATA_DIR+"portato.glade"
@@ -832,6 +832,44 @@ class PackageTable:
return True
+class LogWindow (AbstractDialog, logging.Handler):
+
+ def __init__ (self, parent):
+ AbstractDialog.__init__(self, parent)
+ logging.Handler.__init__(self, logging.INFO)
+
+ self.logView = self.tree.get_widget("logView")
+ logging.getLogger("portatoLogger").addHandler(self)
+
+ self.deleteIsOk = False
+
+ 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.get_buffer().insert_at_cursor(self.format(record)+"\n")
+
+ def show (self):
+ self.window.show()
+
+ def close (self):
+ self.window.hide()
+
+ def destroy (self):
+ self.deleteIsOk = True
+ self.window.destroy()
+
+ def cb_delete (self, *args):
+ if not self.deleteIsOk:
+ self.close()
+ return True
+ else:
+ return False
+
class MainWindow (Window):
"""Application main window."""
@@ -852,13 +890,16 @@ class MainWindow (Window):
mHeight = 800
if gtk.gdk.screen_height() <= 800: mHeight = 600
self.window.set_geometry_hints (self.window, min_width = 600, min_height = mHeight, max_height = gtk.gdk.screen_height(), max_width = gtk.gdk.screen_width())
-
+
# booleans
self.doUpdate = False
# installed pixbuf
self.instPixbuf = self.window.render_icon(gtk.STOCK_YES, gtk.ICON_SIZE_MENU)
+ # get the logging window as soon as possible
+ self.logWindow = LogWindow(self.window)
+
# package db
self.db = Database()
self.db.populate()
@@ -1232,7 +1273,10 @@ class MainWindow (Window):
PluginWindow(self.window, queue)
return True
-
+
+ def cb_show_log_clicked (self, btn):
+ self.logWindow.show()
+
@Window.watch_cursor
def cb_show_updates_clicked (self, button):
UpdateWindow(self.window, system.get_updated_packages(), self.queue, self.jump_to)
@@ -1322,6 +1366,7 @@ class MainWindow (Window):
def cb_destroy (self, widget):
"""Calls main_quit()."""
+ self.logWindow.destroy()
gtk.main_quit()
def main (self):
k/windows/update.py?h=0.14&id=045852491ba5330d8c4a63b0c6e443d6e073f2be&follow=1'>Splitted windows.pyRené 'Necoro' Neumann10-424/+549 2008-03-12Moved get_dependencies to top package classRené 'Necoro' Neumann4-50/+85 2008-03-11improved performance by caching the use_expand queriesRené 'Necoro' Neumann1-5/+14 2008-03-11use catapult varsRené 'Necoro' Neumann2-4/+6 2008-03-11Updated catapult stuffRené 'Necoro' Neumann5-56/+108 2008-03-10Generate correct KeyNotFoundExceptionRené 'Necoro' Neumann1-2/+2 2008-03-09Small changesRené 'Necoro' Neumann3-1/+4 2008-03-07Better session handlingRené 'Necoro' Neumann1-5/+54 2008-03-07Small changesRené 'Necoro' Neumann1-1/+4 2008-03-07Updated shm module to 1.2René 'Necoro' Neumann1-8/+21 2008-03-07Update TODORené 'Necoro' Neumann1-3/+1 2008-03-07hmm ... yesRené 'Necoro' Neumann1-1/+1 2008-03-06Used better exceptions for configuration parserRené 'Necoro' Neumann1-26/+114 2008-03-06Update translationRené 'Necoro' Neumann2-349/+393 2008-03-06Update createpot.shRené 'Necoro' Neumann1-3/+2 2008-03-06Use 'nofork' instead of 'nolistener'René 'Necoro' Neumann1-3/+3 2008-03-05Install glade files into template dir and not data dirRené 'Necoro' Neumann2-2/+1 2008-03-05Added dependency listRené 'Necoro' Neumann3-117/+237