diff options
author | Jiri Moskovcak <jmoskovc@redhat.com> | 2009-12-09 11:21:35 +0100 |
---|---|---|
committer | Jiri Moskovcak <jmoskovc@redhat.com> | 2009-12-09 11:21:35 +0100 |
commit | 588bf134a73f3f78c72697b4404e18c565eb3c76 (patch) | |
tree | b75665c0a5025d68dec7fa0a660a1dfeba2dc993 /src | |
parent | e0ad11c1ed8725a92d09ec09e9cb4113b7d90bac (diff) | |
download | abrt-588bf134a73f3f78c72697b4404e18c565eb3c76.tar.gz abrt-588bf134a73f3f78c72697b4404e18c565eb3c76.tar.xz abrt-588bf134a73f3f78c72697b4404e18c565eb3c76.zip |
GUI: added log window
Diffstat (limited to 'src')
-rw-r--r-- | src/Gui/CCMainWindow.py | 11 | ||||
-rw-r--r-- | src/Gui/CCReporterDialog.py | 9 | ||||
-rw-r--r-- | src/Gui/CC_gui_functions.py | 20 | ||||
-rw-r--r-- | src/Gui/ccgui.glade | 36 | ||||
-rw-r--r-- | src/Gui/dialogs.glade | 62 | ||||
-rw-r--r-- | src/Gui/report.glade | 20 |
6 files changed, 152 insertions, 6 deletions
diff --git a/src/Gui/CCMainWindow.py b/src/Gui/CCMainWindow.py index ee63a406..d82ec092 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 8c904bb0..746c45c2 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 511e4bce..ba895c67 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 022f4ab0..0db3b261 100644 --- a/src/Gui/ccgui.glade +++ b/src/Gui/ccgui.glade @@ -9,11 +9,12 @@ <property name="resizable">False</property> <property name="modal">True</property> <property name="window_position">center-on-parent</property> - <property name="default_width">270</property> + <property name="default_width">470</property> <property name="transient_for">main_window3</property> <child> <widget class="GtkVBox" id="vbox1"> <property name="visible">True</property> + <property name="orientation">vertical</property> <property name="spacing">12</property> <child> <widget class="GtkLabel" id="lStatus"> @@ -35,6 +36,39 @@ <property name="position">1</property> </packing> </child> + <child> + <widget class="GtkExpander" id="expander1"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <child> + <widget class="GtkScrolledWindow" id="scrolledwindow1"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hscrollbar_policy">automatic</property> + <property name="vscrollbar_policy">automatic</property> + <property name="shadow_type">etched-in</property> + <child> + <widget class="GtkTextView" id="tvUpdates"> + <property name="visible">True</property> + <property name="can_focus">True</property> + </widget> + </child> + </widget> + </child> + <child> + <widget class="GtkLabel" id="lUpdates"> + <property name="visible">True</property> + <property name="label" translatable="yes">Details</property> + </widget> + <packing> + <property name="type">label_item</property> + </packing> + </child> + </widget> + <packing> + <property name="position">2</property> + </packing> + </child> </widget> </child> </widget> diff --git a/src/Gui/dialogs.glade b/src/Gui/dialogs.glade index b5e5273a..77e78ddc 100644 --- a/src/Gui/dialogs.glade +++ b/src/Gui/dialogs.glade @@ -74,4 +74,66 @@ <action-widget response="0">button1</action-widget> </action-widgets> </object> + <object class="GtkDialog" id="LogViewer"> + <property name="border_width">5</property> + <property name="title" translatable="yes">Log</property> + <property name="modal">True</property> + <property name="default_width">450</property> + <property name="default_height">260</property> + <property name="type_hint">normal</property> + <property name="has_separator">False</property> + <child internal-child="vbox"> + <object class="GtkVBox" id="dialog-vbox3"> + <property name="visible">True</property> + <property name="orientation">vertical</property> + <property name="spacing">2</property> + <child> + <object class="GtkScrolledWindow" id="scrolledwindow1"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hscrollbar_policy">automatic</property> + <property name="vscrollbar_policy">automatic</property> + <child> + <object class="GtkTextView" id="tevLog"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">False</property> + </object> + </child> + </object> + <packing> + <property name="position">1</property> + </packing> + </child> + <child internal-child="action_area"> + <object class="GtkHButtonBox" id="dialog-action_area3"> + <property name="visible">True</property> + <property name="layout_style">end</property> + <child> + <object class="GtkButton" id="bClose"> + <property name="label">gtk-close</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="pack_type">end</property> + <property name="position">0</property> + </packing> + </child> + </object> + </child> + <action-widgets> + <action-widget response="0">bClose</action-widget> + </action-widgets> + </object> </interface> diff --git a/src/Gui/report.glade b/src/Gui/report.glade index 08777fb1..fc8bcc81 100644 --- a/src/Gui/report.glade +++ b/src/Gui/report.glade @@ -213,6 +213,20 @@ <property name="visible">True</property> <property name="layout_style">end</property> <child> + <widget class="GtkButton" id="bLog"> + <property name="label" translatable="yes">Log</property> + <property name="response_id">-60</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> <widget class="GtkButton" id="bCancel"> <property name="label">gtk-cancel</property> <property name="response_id">-6</property> @@ -224,7 +238,7 @@ <packing> <property name="expand">False</property> <property name="fill">False</property> - <property name="position">0</property> + <property name="position">1</property> </packing> </child> <child> @@ -239,7 +253,7 @@ <packing> <property name="expand">False</property> <property name="fill">False</property> - <property name="position">1</property> + <property name="position">2</property> </packing> </child> <child> @@ -253,7 +267,7 @@ <packing> <property name="expand">False</property> <property name="fill">False</property> - <property name="position">2</property> + <property name="position">3</property> </packing> </child> </widget> |