From 588bf134a73f3f78c72697b4404e18c565eb3c76 Mon Sep 17 00:00:00 2001 From: Jiri Moskovcak Date: Wed, 9 Dec 2009 11:21:35 +0100 Subject: GUI: added log window --- src/Gui/CCMainWindow.py | 11 +++++++- src/Gui/CCReporterDialog.py | 9 ++++++- src/Gui/CC_gui_functions.py | 20 +++++++++++++++ src/Gui/ccgui.glade | 36 +++++++++++++++++++++++++- src/Gui/dialogs.glade | 62 +++++++++++++++++++++++++++++++++++++++++++++ src/Gui/report.glade | 20 ++++++++++++--- 6 files changed, 152 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/Gui/CCMainWindow.py b/src/Gui/CCMainWindow.py index ee63a40..d82ec09 100644 --- a/src/Gui/CCMainWindow.py +++ b/src/Gui/CCMainWindow.py @@ -28,6 +28,7 @@ class MainWindow(): ccdaemon = None def __init__(self): self.theme = gtk.icon_theme_get_default() + self.updates = "" try: self.ccdaemon = CCDBusBackend.DBusManager() except ABRTExceptions.IsRunning, e: @@ -170,8 +171,14 @@ class MainWindow(): gui_error_message(_("Unable to finish current task!\n%s" % message), parent_dialog=self.window) def update_cb(self, daemon, message): + self.updates += message + if self.updates[-1] != '\n': + self.updates += '\n' message = message.replace('\n',' ') self.wTree.get_widget("lStatus").set_text(message) + buff = gtk.TextBuffer() + buff.set_text(self.updates) + self.wTree.get_widget("tvUpdates").set_buffer(buff) # call to update the progressbar def progress_update_cb(self, *args): @@ -281,7 +288,7 @@ class MainWindow(): if not report: gui_error_message(_("Unable to get report!\nDebuginfo is missing?")) return - report_dialog = ReporterDialog(report, self.ccdaemon, parent=self.window) + report_dialog = ReporterDialog(report, self.ccdaemon, log=self.updates, parent=self.window) # (response, report) response, result = report_dialog.run() @@ -304,6 +311,7 @@ class MainWindow(): self.refresh_report(report) def refresh_report(self, report): + self.updates = "" self.pBarWindow.show_all() self.timer = gobject.timeout_add(100, self.progress_update_cb) @@ -324,6 +332,7 @@ class MainWindow(): self.on_dumpRowActivated(self.dlist, None, path, None) def on_dumpRowActivated(self, treeview, iter, path, user_data=None): + self.updates = "" # FIXME don't duplicate the code, move to function dumpsListStore, path = treeview.get_selection().get_selected_rows() if not path: diff --git a/src/Gui/CCReporterDialog.py b/src/Gui/CCReporterDialog.py index 8c904bb..746c45c 100644 --- a/src/Gui/CCReporterDialog.py +++ b/src/Gui/CCReporterDialog.py @@ -26,10 +26,11 @@ CD_ATT = "a" # response REFRESH = -50 +SHOW_LOG = -60 class ReporterDialog(): """Reporter window""" - def __init__(self, report, daemon, parent=None): + def __init__(self, report, daemon, log=None, parent=None): self.editable = [] self.row_dict = {} self.report = report @@ -87,8 +88,11 @@ class ReporterDialog(): self.tvReport.connect_after("size-allocate", self.on_window_resize) # start with the warning hidden, so it's not visible when there is no rating self.wTree.get_widget("ebErrors").hide() + self.wTree.get_widget("bLog").connect("clicked", self.show_log_cb, log) self.hydrate() + def show_log_cb(self, widget, log): + show_log(log, parent=self.window) # this callback is called when user press Cancel or Report button in Report dialog def on_response(self, dialog, response_id, daemon): # the button has been pressed (probably) @@ -97,6 +101,9 @@ class ReporterDialog(): if not (self.check_settings(daemon) and self.check_report()): dialog.stop_emission("response") self.wTree.get_widget("bSend").stop_emission("clicked") + if response_id == SHOW_LOG: + # prevent dialog from quitting the run() + dialog.stop_emission("response") def on_send_toggled(self, cell, path, model): model[path][3] = not model[path][3] diff --git a/src/Gui/CC_gui_functions.py b/src/Gui/CC_gui_functions.py index 511e4bc..ba895c6 100644 --- a/src/Gui/CC_gui_functions.py +++ b/src/Gui/CC_gui_functions.py @@ -206,6 +206,26 @@ def get_icon_for_package(theme,package): return gtk.gdk.pixbuf_new_from_file_at_size(icon_filename,22,22) else: return None + +def show_log(log, parent=None): + builder = gtk.Builder() + builderfile = "%s%sdialogs.glade" % (sys.path[0],"/") + builder.add_from_file(builderfile) + dialog = builder.get_object("LogViewer") + tevLog = builder.get_object("tevLog") + + if parent: + dialog.set_position (gtk.WIN_POS_CENTER_ON_PARENT) + dialog.set_transient_for(parent) + else: + dialog.set_position (gtk.WIN_POS_CENTER) + + buff = gtk.TextBuffer() + buff.set_text(log) + tevLog.set_buffer(buff) + + dialog.run() + dialog.destroy() if __name__ == "__main__": window = gtk.Window() diff --git a/src/Gui/ccgui.glade b/src/Gui/ccgui.glade index 022f4ab..0db3b26 100644 --- a/src/Gui/ccgui.glade +++ b/src/Gui/ccgui.glade @@ -9,11 +9,12 @@ False True center-on-parent - 270 + 470 main_window3 True + vertical 12 @@ -35,6 +36,39 @@ 1 + + + True + True + + + True + True + automatic + automatic + etched-in + + + True + True + + + + + + + True + Details + + + label_item + + + + + 2 + + diff --git a/src/Gui/dialogs.glade b/src/Gui/dialogs.glade index b5e5273..77e78dd 100644 --- a/src/Gui/dialogs.glade +++ b/src/Gui/dialogs.glade @@ -74,4 +74,66 @@ button1 + + 5 + Log + True + 450 + 260 + normal + False + + + True + vertical + 2 + + + True + True + automatic + automatic + + + True + True + False + + + + + 1 + + + + + True + end + + + gtk-close + True + True + True + True + + + False + False + 0 + + + + + False + end + 0 + + + + + + bClose + + diff --git a/src/Gui/report.glade b/src/Gui/report.glade index 08777fb..fc8bcc8 100644 --- a/src/Gui/report.glade +++ b/src/Gui/report.glade @@ -212,6 +212,20 @@ True end + + + Log + -60 + True + True + True + + + False + False + 0 + + gtk-cancel @@ -224,7 +238,7 @@ False False - 0 + 1 @@ -239,7 +253,7 @@ False False - 1 + 2 @@ -253,7 +267,7 @@ False False - 2 + 3 -- cgit