From fb618b39a7de74b9cc58db322599603fc880ac36 Mon Sep 17 00:00:00 2001 From: Jiri Moskovcak Date: Wed, 4 Mar 2009 17:37:26 +0100 Subject: Added a progress bar, new Comment entry for user comments.. --- src/Gui/CCDBusBackend.py | 1 - src/Gui/CCMainWindow.py | 27 +++++++++------------------ src/Gui/CCReporterDialog.py | 44 +++++++++++++++++++++++++++++++------------- src/Gui/ccgui.glade | 41 ++++++++++++++++++++++++++++++++++++++++- src/Gui/report.glade | 45 ++++++++++++++++++++++++++++++++++++++++++++- 5 files changed, 124 insertions(+), 34 deletions(-) (limited to 'src/Gui') diff --git a/src/Gui/CCDBusBackend.py b/src/Gui/CCDBusBackend.py index 0cc26d59..c5fc498b 100644 --- a/src/Gui/CCDBusBackend.py +++ b/src/Gui/CCDBusBackend.py @@ -50,7 +50,6 @@ class DBusManager(gobject.GObject): #for arg in args: # print "Analyze complete for: %s" % arg # emit signal to let clients know that analyze has been completed - # maybe rewrite this with async method call? self.emit("analyze-complete", dump) def connect_to_daemon(self): diff --git a/src/Gui/CCMainWindow.py b/src/Gui/CCMainWindow.py index ea79b8eb..35e9b1a3 100644 --- a/src/Gui/CCMainWindow.py +++ b/src/Gui/CCMainWindow.py @@ -32,7 +32,7 @@ class MainWindow(): # FIXME add to PATH # FIXME remove! - self.gladefile = "%s/ccgui.glade" % sys.path[0] + self.gladefile = "%s%sccgui.glade" % (sys.path[0],"/") self.wTree = gtk.glade.XML(self.gladefile) #Get the Main Window, and connect the "destroy" event @@ -45,7 +45,7 @@ class MainWindow(): self.appBar = self.wTree.get_widget("appBar") # pregress bar window to show while bt is being extracted self.pBarWindow = self.wTree.get_widget("pBarWindow") - print self.pBarWindow + self.pBarWindow.set_transient_for(self.window) self.pBar = self.wTree.get_widget("pBar") # set colours for descritpion heading @@ -87,6 +87,8 @@ class MainWindow(): # load data #self.load() + + # call to update the progressbar def progress_update_cb(self, *args): self.pBar.pulse() return True @@ -149,18 +151,14 @@ class MainWindow(): #print "got another crash, refresh gui?" def on_analyze_complete_cb(self, daemon, report, pBarWindow): + gobject.source_remove(self.timer) + self.pBarWindow.hide() try: dumplist = getDumpList(self.ccdaemon) except Exception, e: print e - #pBarWindow.destroy() - #entry = dumplist.ddict[UUID] - # tady asi nedostanem UUID, ale vysledek nasi volane metody - #print report - #print "GUI: Analyze for package %s crash with UUID %s is complete" % (entry.Package, UUID) - #print "We should refresh the UI ..." if not report: - gui_error_message("Unable to get report! Debuginfo missing?") + gui_error_message("Unable to get report!\nDebuginfo is missing?") return report_dialog = ReporterDialog(report) result = report_dialog.run() @@ -179,6 +177,8 @@ class MainWindow(): dumpsListStore, path = self.dlist.get_selection().get_selected_rows() if not path: return + self.update_pBar = False + self.pBar.show() self.pBarWindow.show() self.timer = gobject.timeout_add (100,self.progress_update_cb) @@ -190,16 +190,7 @@ class MainWindow(): # FIXME #3 dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoReply: Did not receive a reply # do this async and wait for yum to end with debuginfoinstal gui_error_message("Error getting the report: %s" % e.message) - return return - if not report: - gui_error_message("Unable to get report! Debuginfo missing?") - return - report_dialog = ReporterDialog(report) - result = report_dialog.run() - if result: - self.ccdaemon.Report(result) - def delete_event_cb(self, widget, event, data=None): # Change FALSE to TRUE and the main window will not be destroyed diff --git a/src/Gui/CCReporterDialog.py b/src/Gui/CCReporterDialog.py index cfe11c1f..2dc35783 100644 --- a/src/Gui/CCReporterDialog.py +++ b/src/Gui/CCReporterDialog.py @@ -13,12 +13,19 @@ class ReporterDialog(): self.report = report #Set the Glade file # FIXME add to path - self.gladefile = "/usr/share/abrt/report.glade" + self.gladefile = "%s%sreport.glade" % (sys.path[0],"/") self.wTree = gtk.glade.XML(self.gladefile) #Get the Main Window, and connect the "destroy" event self.window = self.wTree.get_widget("reporter_dialog") self.window.set_default_size(640, 480) + # comment textview + self.tvComment = self.wTree.get_widget("tvComment") + self.tvComment.connect("focus-in-event", self.on_comment_focus_cb) + self.comment_changed = False + + #user editable info in report + self.editable = ["Comment", "TextData1", "TextData2"] #init the reports treeview self.tvReport = self.wTree.get_widget("tvReport") columns = [None]*2 @@ -42,12 +49,17 @@ class ReporterDialog(): renderer.connect('edited',self.column_edited,self.reportListStore) # connect the signals - #self.wTree.get_widget("bApply").connect("clicked", self.on_apply_clicked, self.tvReport) + self.wTree.get_widget("bApply").connect("clicked", self.on_apply_clicked, self.tvReport) #self.wTree.get_widget("bCancel").connect("clicked", self.on_cancel_clicked, self.tvReport) self.tvReport.connect_after("size-allocate", self.on_window_resize) self.hydrate() + + def on_comment_focus_cb(self, widget, event): + if not self.comment_changed: + widget.set_buffer(None) + self.comment_changed = True def on_window_resize(self, treeview, allocation): # multine support @@ -60,23 +72,29 @@ class ReporterDialog(): return def on_apply_clicked(self, button, treeview): - pass + #fill the report with user changed values and return it.. + #user changed the comment, so we want to save it + for item in self.editable: + if item == "Comment" and self.comment_changed: + buff = self.tvComment.get_buffer() + self.report[item] = buff.get_text(buff.get_start_iter(),buff.get_end_iter()) def on_cancel_clicked(self, button, treeview): pass def hydrate(self): - editable = ["Comment", "TextData1", "TextData2"] for item in self.report: - self.reportListStore.append([item, self.report[item], item in editable]) - #self.reportListStore.append(["Comment","", True]) + if item == "Comment": + buff = gtk.TextBuffer() + buff.set_text("Brief description how to reproduce this or what you did...") + self.tvComment.set_buffer(buff) + continue + self.reportListStore.append([item, self.report[item], item in self.editable]) def run(self): result = self.window.run() - if result == gtk.RESPONSE_CANCEL: - self.window.destroy() - return None - else: - self.window.destroy() - return self.report - + if result != gtk.RESPONSE_APPLY: + self.report = None + self.window.destroy() + return self.report + diff --git a/src/Gui/ccgui.glade b/src/Gui/ccgui.glade index dbac11da..ee579cb4 100644 --- a/src/Gui/ccgui.glade +++ b/src/Gui/ccgui.glade @@ -1,6 +1,6 @@ - + Crash-catcher @@ -299,4 +299,43 @@ + + Please wait.. + True + GTK_WIN_POS_CENTER_ON_PARENT + 270 + + + True + + + True + Working... + + + False + + + + + True + + + False + 1 + + + + + True + 2 + + + False + 2 + + + + + diff --git a/src/Gui/report.glade b/src/Gui/report.glade index d8bc9bbb..2c68f74f 100644 --- a/src/Gui/report.glade +++ b/src/Gui/report.glade @@ -1,6 +1,6 @@ - + 5 @@ -47,6 +47,49 @@ 1 + + + True + + + True + + + True + 0 + 2 + Comment + + + + + False + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + + + True + True + + + + + False + 1 + + + + + False + 2 + + True -- cgit