From 9555ec818c28c223e1c17e012431de070ff421f4 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Wed, 9 Dec 2009 18:50:17 -0500 Subject: Begin adding a PyGTK UI (doesn't work yet; disabled by default) --- abrt-triage.py | 68 +++++++++++++++--- triage.glade | 220 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 278 insertions(+), 10 deletions(-) create mode 100644 triage.glade diff --git a/abrt-triage.py b/abrt-triage.py index d4dfff1..dd75c71 100755 --- a/abrt-triage.py +++ b/abrt-triage.py @@ -2,6 +2,9 @@ from pprint import pprint import re +import gtk +import gtk.glade + from backtrace import Backtrace class Bug(object): @@ -9,6 +12,8 @@ class Bug(object): self.bz = bz self.id = id self._bug = bz.getbug(id) + if 1: + pprint(self._bug.__dict__) def get_backtrace(self): # Get the backtrace associated with this ABRT bug, as a Backtrace instance @@ -178,12 +183,14 @@ class Change(object): review of the change, rather than automatically pushing blindly via XML-RPC ''' def __init__(self, + bug, newsummary=None, newcomponent=None, comment=None, duplicate_id=None, status=None, resolution=None): + self.bug = bug self.comment = comment self.newsummary = newsummary self.newcomponent = newcomponent @@ -220,8 +227,9 @@ class Change(object): return result class Duplicate(Change): - def __init__(self, bz, other_bug_id): + def __init__(self, bug, other_bug_id): Change.__init__(self, + bug, comment=( '''Thank you for the bug report. @@ -255,14 +263,16 @@ def get_change(bz, bug_id): (newsummary, bt_blurb) = characterize_bt(bt, thread, script) if script.endswith('ies4linux-gtk.py'): - return Change(newsummary='%s running %s' % (issue, 'ies4linux-gtk.py'), + return Change(bug, + newsummary='%s running %s' % (issue, 'ies4linux-gtk.py'), comment=('''Thank you for your report. This bug is in the ies4linux script you are using to run Internet Explorer. Fedora does not provide or support this script. We would suggest that you report the problem to the upstream project at http://www.tatanka.com.br/ies4linux/ , but it does not seem to have been updated since February 2008, so the effort may be wasted. There is unfortunately nothing the Fedora project can do to help you with this problem.'''), status='CLOSED', resolution='CANTFIX' ) except Duplicate, d: return d except NoBacktrace, e: - return Change(newsummary='%s running %s' % (issue, script), + return Change(bug, + newsummary='%s running %s' % (issue, script), newcomponent = srpmname, comment=('''Thank you for the bug report. @@ -272,7 +282,8 @@ Thank you. ''') ) except UnsupportedComponent, e: - return Change(newsummary='%s in %s' % (issue, e.path), + return Change(bug, + newsummary='%s in %s' % (issue, e.path), comment=('''Thank you for the bug report. Unfortunately the problem appears to be in %(path)s. @@ -298,20 +309,20 @@ Reassigning component from "python" to "%(subpackage)s" bt_blurb = bt_blurb) if newsummary == 'Fatal error in "_XError" in /usr/share/virt-manager/virt-manager.py': - return Duplicate(bz, 540810) + return Duplicate(bug, 540810) if newsummary == 'Fatal error in "XFreeColormap" in /usr/bin/hp-systray': - return Duplicate(bz, 543286) + return Duplicate(bug, 543286) if newsummary == 'Crash in gtk_style_realize with "ClearlooksStyle"': - return Duplicate(bz, 538799) + return Duplicate(bug, 538799) - ch = Change(newsummary = newsummary, + ch = Change(bug, + newsummary = newsummary, newcomponent = srpmname, comment = comment ) - print ch print '---- BEGIN THREAD ----' for id in sorted(thread.frames.keys()): f = thread.frames[id] @@ -322,13 +333,50 @@ Reassigning component from "python" to "%(subpackage)s" print '#%i %s %s' % (id, addr, f.function) print '---- END THREAD ----' + return ch + +class ChangeGui(object): + def __init__(self, change): + self.change = change + + self._change_wnd = gtk.glade.XML ('triage.glade', 'change_window') + self._window = self._change_wnd.get_widget('change_window') + self._old_summary = self._change_wnd.get_widget('old_summary') + self._new_summary = self._change_wnd.get_widget('new_summary') + self._old_component = self._change_wnd.get_widget('old_component') + self._new_component = self._change_wnd.get_widget('new_component') + self._new_comment = self._change_wnd.get_widget('new_comment') + + print self.__dict__ + for attr in self.__dict__: + print attr + #print getattr(self, attr).__dict__ + print self._window.__dict__ + self._window.set_title('Proposed changes for bug %i' % self.change.bug.id) + self._old_summary.set_text(change.bug._bug.summary) + if change.newsummary: + self._new_summary.set_text(change.newsummary) + self._old_component.set_text(change.bug._bug.component) + if change.newcomponent: + self._new_component.set_text(change.newcomponent) + if change.comment: + self._new_comment.get_buffer().set_text(change.comment) + + + def main(): import bugzilla bz=bugzilla.Bugzilla(url='https://bugzilla.redhat.com/xmlrpc.cgi') import sys bug_id = int(sys.argv[1]) print '---- CHANGES FOR BUG %i ----' % bug_id - print get_change(bz, bug_id) + change = get_change(bz, bug_id) + print change + if False: + g = ChangeGui(change) + gtk.main() + + main() diff --git a/triage.glade b/triage.glade new file mode 100644 index 0000000..c1db085 --- /dev/null +++ b/triage.glade @@ -0,0 +1,220 @@ + + + + + + True + + + True + vertical + + + True + 4 + 3 + + + True + Summary + + + + + True + Component + + + 1 + 2 + + + + + True + True + False + + + + 1 + 2 + + + + + True + True + False + + + + 1 + 2 + 1 + 2 + + + + + True + True + + + + 2 + 3 + + + + + True + True + + + + 2 + 3 + 1 + 2 + + + + + True + Status + True + + + 2 + 3 + + + + + True + + + 1 + 2 + 2 + 3 + + + + + True + + + 2 + 3 + 2 + 3 + + + + + True + Resolution + + + 3 + 4 + + + + + True + + + 1 + 2 + 3 + 4 + + + + + True + + + 2 + 3 + 3 + 4 + + + + + 0 + + + + + True + + + True + Comment + + + 0 + + + + + + + + 1 + + + + + True + True + word + + + 2 + + + + + True + + + + + + gtk-cancel + True + True + True + True + + + 1 + + + + + gtk-apply + True + True + True + True + + + 2 + + + + + 3 + + + + + + -- cgit