PATCH 3/6 is the key one. It ports python-meh to Gtk3 and changes its look to match the newui design (links to video preview and mockups can be found on the devel list).
The major advantage of the PATCH 6/6 is that with it there is no need for the "temporary glue" (see the libreport patch) in libreport. I believe there is no need to have the text only in the file that is read again and again at multiple places.
See commit messages for some more details.
-- Vratislav Podzimek
There is no need to run 'all' target in the 'install' target, because the common steps are 'make' followed by 'make install'. --- Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile index b38aa2f..42b6315 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ test: @echo "*** Running unittests ***" PYTHONPATH=. python $(TESTSUITE) -v
-install: all +install: python setup.py install --root=$(DESTDIR) $(MAKE) -C po install
These things are not necessary, we can return the return code directly from the run() method. --- meh/ui/__init__.py | 12 +++--------- meh/ui/text.py | 13 ++++++------- 2 files changed, 9 insertions(+), 16 deletions(-)
diff --git a/meh/ui/__init__.py b/meh/ui/__init__.py index e0bf0ed..63980aa 100644 --- a/meh/ui/__init__.py +++ b/meh/ui/__init__.py @@ -88,7 +88,7 @@ class AbstractMainExceptionWindow(object): longTracebackFile -- A file containing the output of ExceptionDump.write(). """ - self.rc = 0 + pass
def destroy(self, *args, **kwargs): """Destroy the current dialog. This method must be provided by all @@ -96,12 +96,6 @@ class AbstractMainExceptionWindow(object): """ raise NotImplementedError
- def getrc(self, *args, **kwargs): - """Return which button was clicked on the interface. This method need - not be overridden by subclasses. - """ - return self.rc - def run(self, *args, **kwargs): """Run the window and set a return value. This method does everything after the interface has been set up, but does not destroy it. This @@ -122,7 +116,7 @@ class AbstractExitWindow(object): title -- The window's title. text -- The window's text. """ - self.rc = 0 + pass
def destroy(self, *args, **kwargs): """Destroy the current dialog. This method must be provided by all @@ -149,7 +143,7 @@ class AbstractMessageWindow(object): title -- The window's title. text -- The window's text. """ - self.rc = 0 + pass
def destroy(self, *args, **kwargs): """Destroy the current dialog. This method must be provided by all diff --git a/meh/ui/text.py b/meh/ui/text.py index ef98205..5dd6fe1 100644 --- a/meh/ui/text.py +++ b/meh/ui/text.py @@ -76,18 +76,17 @@ class MainExceptionWindow(AbstractMainExceptionWindow): self.screen.popWindow() self.screen.refresh()
- def getrc(self, *args, **kwargs): - if self.rc == string.lower(_("Debug")): + def run(self, *args, **kwargs): + response = ButtonChoiceWindow(self.screen, _("Exception Occurred"), + self.text, self.buttons) + + if response == string.lower(_("Debug")): return MAIN_RESPONSE_DEBUG - elif self.rc == string.lower(_("Save")): + elif response == string.lower(_("Save")): return MAIN_RESPONSE_SAVE else: return MAIN_RESPONSE_OK
- def run(self, *args, **kwargs): - self.rc = ButtonChoiceWindow(self.screen, _("Exception Occurred"), - self.text, self.buttons) - class MessageWindow(AbstractMessageWindow): def __init__(self, title, text, *args, **kwargs): AbstractMessageWindow.__init__(self, title, text, *args, **kwargs)
--- meh/__init__.py | 3 +- meh/handler.py | 5 +- meh/ui/gui.py | 119 +++++++++------------ meh/ui/text.py | 2 +- po/python-meh.pot | 59 ++++++++---- setup.py | 2 +- ui/detailed-dialog.glade | 171 ------------------------------- ui/exception-dialog.glade | 248 +++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 346 insertions(+), 263 deletions(-) delete mode 100644 ui/detailed-dialog.glade create mode 100644 ui/exception-dialog.glade
diff --git a/meh/__init__.py b/meh/__init__.py index 2732e66..69352f8 100644 --- a/meh/__init__.py +++ b/meh/__init__.py @@ -25,7 +25,8 @@ # exception is hit. MAIN_RESPONSE_DEBUG = 0 MAIN_RESPONSE_SAVE = 1 -MAIN_RESPONSE_OK = 2 +MAIN_RESPONSE_QUIT = 2 +MAIN_RESPONSE_NONE = 3
# And these constants represent the return values of buttons on the exception # saving dialog. diff --git a/meh/handler.py b/meh/handler.py index 143c1b9..75dca12 100644 --- a/meh/handler.py +++ b/meh/handler.py @@ -80,7 +80,7 @@ class ExceptionHandler(object): a subclass. """
- responseHash = {MAIN_RESPONSE_OK: self.runQuit, + responseHash = {MAIN_RESPONSE_QUIT: self.runQuit, MAIN_RESPONSE_DEBUG: self.runDebug, MAIN_RESPONSE_SAVE: self.runSave}
@@ -107,8 +107,7 @@ class ExceptionHandler(object): if not win: self.runQuit((ty, value, tb))
- win.run() - rc = win.getrc() + rc = win.run()
try: responseHash[rc]((ty, value, tb)) diff --git a/meh/ui/gui.py b/meh/ui/gui.py index ec05739..2b6ff15 100644 --- a/meh/ui/gui.py +++ b/meh/ui/gui.py @@ -18,15 +18,14 @@ # from meh import * from meh.ui import * -import gtk -import gtk.glade import os import report +from gi.repository import Gtk
import gettext _ = lambda x: gettext.ldgettext("python-meh", x)
-def findGladeFile(file): +def find_glade_file(file): path = os.environ.get("GLADEPATH", "./:ui/:/tmp/updates/:/tmp/updates/ui/:/usr/share/python-meh/") for d in path.split(":"): fn = d + file @@ -34,14 +33,6 @@ def findGladeFile(file): return fn raise RuntimeError, "Unable to find glade file %s" % file
-def findPixmap(file): - path = os.environ.get("PIXMAPPATH", "./:pixmaps/:/tmp/updates/:/tmp/updates/pixmaps/:/usr/share/python-meh/") - for d in path.split(":"): - fn = d + file - if os.access(fn, os.R_OK): - return fn - return None - class GraphicalIntf(AbstractIntf): def __init__(self, *args, **kwargs): AbstractIntf.__init__(self, *args, **kwargs) @@ -83,74 +74,66 @@ class MainExceptionWindow(AbstractMainExceptionWindow): AbstractMainExceptionWindow.__init__(self, shortTraceback, longTracebackFile, *args, **kwargs)
- xml = gtk.glade.XML(findGladeFile("detailed-dialog.glade"), domain="python-meh") - self.dialog = xml.get_widget("detailedDialog") - self.mainVBox = xml.get_widget("mainVBox") - self.hbox = xml.get_widget("hbox1") - self.info = xml.get_widget("info") - self.detailedExpander = xml.get_widget("detailedExpander") - self.detailedView = xml.get_widget("detailedView") - - # Set the custom icon. - img = gtk.Image() - img.set_from_file(findPixmap("exception.png")) - self.hbox.pack_start(img) - self.hbox.reorder_child(img, 0) - - # Set the buttons. - for (button, response) in [(_("Debu_g"), MAIN_RESPONSE_DEBUG), - ("gtk-save", MAIN_RESPONSE_SAVE), - (_("_Exit"), MAIN_RESPONSE_OK)]: - self.dialog.add_button(button, response) - - self.dialog.set_default_response(MAIN_RESPONSE_OK) - - self.info.set_text(_("An unhandled exception has occurred. This " - "is most likely a bug. Please save a copy " - "of the detailed exception and file a bug " - "report.")) - - if longTracebackFile: - f = open(longTracebackFile) - - textbuf = gtk.TextBuffer() - i = textbuf.get_start_iter() + builder = Gtk.Builder() + glade_file = find_glade_file("exception-dialog.glade") + builder.add_from_file(glade_file) + builder.connect_signals(self)
- while True: - # Wish readline would give StopIteration at the end of a file. - line = f.readline() - if line == "": - break + self._main_window = builder.get_object("exceptionWindow")
- if __builtins__.get("type")(line) != unicode: - try: - line = unicode(line, encoding='utf-8') - except UnicodeDecodeError: - pass + self._traceback_buffer = builder.get_object("tracebackBuffer")
- textbuf.insert(i, line) + if longTracebackFile: + with open(longTracebackFile) as fobj: + long_traceback = "" + for line in fobj: + long_traceback += line
- f.close() - self.detailedView.set_buffer(textbuf) - else: - self.mainVBox.remove(self.detailedExpander) + self._traceback_buffer.set_text(long_traceback) + self._response = MAIN_RESPONSE_QUIT
def destroy(self, *args, **kwargs): - self.dialog.destroy() + self._main_window.destroy()
def run(self, *args, **kwargs): - self.dialog.show_all() - self.rc = self.dialog.run() - self.dialog.destroy() + self._main_window.show_all() + Gtk.main() + self.destroy() + return self._response + + def on_report_clicked(self, button): + self._response = MAIN_RESPONSE_SAVE + Gtk.main_quit() + + def on_quit_clicked(self, button): + self._response = MAIN_RESPONSE_QUIT + Gtk.main_quit() + + def on_debug_clicked(self, button): + self._response = MAIN_RESPONSE_DEBUG + Gtk.main_quit() + + def on_expander_activated(self, expander, *args): + if expander.get_expanded(): + self._main_window.resize(600, 400) + else: + #resize the window back to the default size when expander is + #minimized + self._main_window.resize(1, 1) + + def on_main_window_deleted(self, *args): + self._response = MAIN_RESPONSE_NONE + self.destroy() + Gtk.main_quit()
class MessageWindow(AbstractMessageWindow): def __init__(self, title, text, *args, **kwargs): AbstractMessageWindow.__init__(self, title, text, *args, **kwargs) - self.dialog = gtk.MessageDialog(buttons=gtk.BUTTONS_OK, - type=gtk.MESSAGE_INFO, + self.dialog = Gtk.MessageDialog(buttons=Gtk.ButtonsType.OK, + type=Gtk.MessageType.INFO, message_format=text) self.dialog.set_title(title) - self.dialog.set_position(gtk.WIN_POS_CENTER) + self.dialog.set_position(Gtk.WindowPosition.CENTER)
def destroy(self, *args, **kwargs): self.dialog.destroy() @@ -162,9 +145,9 @@ class MessageWindow(AbstractMessageWindow):
class ExitWindow(MessageWindow): def __init__(self, title, text, *args, **kwargs): - self.dialog = gtk.MessageDialog(buttons=gtk.BUTTONS_NONE, - type=gtk.MESSAGE_INFO, + self.dialog = Gtk.MessageDialog(buttons=Gtk.ButtonsType.NONE, + type=Gtk.MessageType.INFO, message_format=text) self.dialog.set_title(title) self.dialog.add_button(_("_Exit"), 0) - self.dialog.set_position(gtk.WIN_POS_CENTER) + self.dialog.set_position(Gtk.WindowPosition.CENTER) diff --git a/meh/ui/text.py b/meh/ui/text.py index 5dd6fe1..717212e 100644 --- a/meh/ui/text.py +++ b/meh/ui/text.py @@ -85,7 +85,7 @@ class MainExceptionWindow(AbstractMainExceptionWindow): elif response == string.lower(_("Save")): return MAIN_RESPONSE_SAVE else: - return MAIN_RESPONSE_OK + return MAIN_RESPONSE_QUIT
class MessageWindow(AbstractMessageWindow): def __init__(self, title, text, *args, **kwargs): diff --git a/po/python-meh.pot b/po/python-meh.pot index b291941..ab22b61 100644 --- a/po/python-meh.pot +++ b/po/python-meh.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-04-14 10:26+0200\n" +"POT-Creation-Date: 2012-07-09 14:33+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME EMAIL@ADDRESS\n" "Language-Team: LANGUAGE LL@li.org\n" @@ -17,45 +17,68 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n"
-#: ../meh/ui/text.py:73 ../meh/ui/text.py:100 +#: ../meh/ui/text.py:73 ../meh/ui/text.py:99 msgid "OK" msgstr ""
-#: ../meh/ui/text.py:73 ../meh/ui/text.py:82 +#: ../meh/ui/text.py:73 ../meh/ui/text.py:85 msgid "Save" msgstr ""
-#: ../meh/ui/text.py:73 ../meh/ui/text.py:80 +#: ../meh/ui/text.py:73 ../meh/ui/text.py:83 msgid "Debug" msgstr ""
-#: ../meh/ui/text.py:88 +#: ../meh/ui/text.py:80 msgid "Exception Occurred" msgstr ""
-#: ../meh/ui/text.py:114 +#: ../meh/ui/text.py:113 msgid "Exit" msgstr ""
-#. Set the buttons. -#: ../meh/ui/gui.py:101 -msgid "Debu_g" +#: ../meh/ui/gui.py:150 +msgid "_Exit" msgstr ""
-#: ../meh/ui/gui.py:103 ../meh/ui/gui.py:169 -msgid "_Exit" +#: tmp/exception-dialog.glade.h:1 tmp/exception-dialog-new.glade.h:1 +msgid "'Debug' will take you to tty1. Press Ctrl + Alt + F6 to return." +msgstr "" + +#: tmp/exception-dialog.glade.h:2 tmp/exception-dialog-new.glade.h:2 +msgid "An unknown error has occured" +msgstr "" + +#: tmp/exception-dialog.glade.h:3 +msgid "More _info..." +msgstr "" + +#: tmp/exception-dialog.glade.h:4 tmp/exception-dialog-new.glade.h:4 +msgid "No additional info available." +msgstr "" + +#: tmp/exception-dialog.glade.h:5 tmp/exception-dialog-new.glade.h:5 +msgid "The output below may help determine the cause of the error:" msgstr ""
-#: ../meh/ui/gui.py:108 +#: tmp/exception-dialog.glade.h:6 tmp/exception-dialog-new.glade.h:6 msgid "" -"An unhandled exception has occurred. This is most likely a bug. Please " -"save a copy of the detailed exception and file a bug report." +"This program has encountered an unknown error. You may\n" +"report the bug bellow or quit the program." +msgstr "" + +#: tmp/exception-dialog.glade.h:8 tmp/exception-dialog-new.glade.h:8 +msgid "_Debug" +msgstr "" + +#: tmp/exception-dialog.glade.h:9 tmp/exception-dialog-new.glade.h:9 +msgid "_Quit" msgstr ""
-#: tmp/detailed-dialog.glade.h:1 -msgid "Info" +#: tmp/exception-dialog.glade.h:10 tmp/exception-dialog-new.glade.h:10 +msgid "_Report Bug" msgstr ""
-#: tmp/detailed-dialog.glade.h:2 -msgid "_Details" +#: tmp/exception-dialog-new.glade.h:3 +msgid "More info..." msgstr "" diff --git a/setup.py b/setup.py index ab48424..5d5628f 100644 --- a/setup.py +++ b/setup.py @@ -6,5 +6,5 @@ setup(name='python-meh', version='0.13', description='Python module for handling exceptions', author='Chris Lumens', author_email='clumens@redhat.com', url='http://git.fedoraproject.org/git/?p=python-meh.git', - data_files = [('/usr/share/python-meh', ['ui/detailed-dialog.glade', 'pixmaps/exception.png'])], + data_files = [('/usr/share/python-meh', ['ui/exception-dialog.glade'])], packages=['meh', 'meh.ui']) diff --git a/ui/detailed-dialog.glade b/ui/detailed-dialog.glade deleted file mode 100644 index 61fca36..0000000 --- a/ui/detailed-dialog.glade +++ /dev/null @@ -1,171 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> - -<glade-interface> - -<widget class="GtkDialog" id="detailedDialog"> - <property name="visible">True</property> - <property name="title">Exception Occurred</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_CENTER</property> - <property name="modal">True</property> - <property name="default_width">550</property> - <property name="default_height">400</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - <property name="decorated">True</property> - <property name="skip_taskbar_hint">False</property> - <property name="skip_pager_hint">False</property> - <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - <property name="focus_on_map">True</property> - <property name="urgency_hint">False</property> - <property name="has_separator">True</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="detailedDialog-vbox"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">12</property> - - <child internal-child="action_area"> - <widget class="GtkHButtonBox" id="buttonBox"> - <property name="visible">True</property> - <property name="layout_style">GTK_BUTTONBOX_END</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="mainVBox"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">12</property> - - <child> - <widget class="GtkHBox" id="hbox1"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <placeholder/> - </child> - - <child> - <widget class="GtkLabel" id="info"> - <property name="visible">True</property> - <property name="label" translatable="yes">Info</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">True</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkExpander" id="detailedExpander"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="expanded">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkScrolledWindow" id="scrolledwindow2"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="shadow_type">GTK_SHADOW_IN</property> - <property name="window_placement">GTK_CORNER_TOP_LEFT</property> - - <child> - <widget class="GtkTextView" id="detailedView"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">False</property> - <property name="overwrite">False</property> - <property name="accepts_tab">True</property> - <property name="justification">GTK_JUSTIFY_LEFT</property> - <property name="wrap_mode">GTK_WRAP_NONE</property> - <property name="cursor_visible">False</property> - <property name="pixels_above_lines">0</property> - <property name="pixels_below_lines">0</property> - <property name="pixels_inside_wrap">0</property> - <property name="left_margin">0</property> - <property name="right_margin">0</property> - <property name="indent">0</property> - <property name="text" translatable="yes"></property> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label1"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Details</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="type">label_item</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - </child> -</widget> - -</glade-interface> diff --git a/ui/exception-dialog.glade b/ui/exception-dialog.glade new file mode 100644 index 0000000..89b62c2 --- /dev/null +++ b/ui/exception-dialog.glade @@ -0,0 +1,248 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <object class="GtkWindow" id="exceptionWindow"> + <property name="can_focus">False</property> + <property name="window_position">center</property> + <signal name="delete-event" handler="on_main_window_deleted" swapped="no"/> + <child> + <object class="GtkBox" id="mainBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <child> + <object class="GtkBox" id="box1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">start</property> + <property name="valign">center</property> + <property name="margin_left">20</property> + <property name="margin_top">30</property> + <child> + <object class="GtkImage" id="image1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="stock">gtk-dialog-warning</property> + <property name="icon-size">5</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="padding">7</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="titleLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">An unknown error has occured</property> + <attributes> + <attribute name="weight" value="bold"/> + <attribute name="scale" value="1.1000000000000001"/> + </attributes> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="explainLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">start</property> + <property name="valign">start</property> + <property name="margin_left">40</property> + <property name="margin_right">40</property> + <property name="label" translatable="yes">This program has encountered an unknown error. You may +report the bug bellow or quit the program.</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="padding">21</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButtonBox" id="buttonbox1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">start</property> + <property name="margin_right">20</property> + <property name="spacing">10</property> + <property name="layout_style">end</property> + <child> + <object class="GtkButton" id="reportButton"> + <property name="label" translatable="yes">_Report Bug</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> + <property name="use_underline">True</property> + <signal name="clicked" handler="on_report_clicked" swapped="no"/> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="quitButton"> + <property name="label" translatable="yes">_Quit</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> + <property name="use_underline">True</property> + <signal name="clicked" handler="on_quit_clicked" swapped="no"/> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkExpander" id="expander"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="margin_left">10</property> + <property name="margin_right">10</property> + <property name="margin_bottom">10</property> + <property name="use_underline">True</property> + <signal name="activate" handler="on_expander_activated" swapped="no"/> + <child> + <object class="GtkBox" id="box2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="vexpand">True</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="GtkLabel" id="commentLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">start</property> + <property name="margin_left">2</property> + <property name="xalign">0.10000000149011612</property> + <property name="label" translatable="yes">The output below may help determine the cause of the error:</property> + <attributes> + <attribute name="style" value="italic"/> + </attributes> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkScrolledWindow" id="tracebackScrolledWindow"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="vexpand">True</property> + <property name="shadow_type">in</property> + <child> + <object class="GtkTextView" id="tracebackView"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="vscroll_policy">natural</property> + <property name="editable">False</property> + <property name="cursor_visible">False</property> + <property name="buffer">tracebackBuffer</property> + </object> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkBox" id="bottomBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">4</property> + <child> + <object class="GtkLabel" id="warningLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0.89999997615814209</property> + <property name="label" translatable="yes">'Debug' will take you to tty1. Press Ctrl + Alt + F6 to return.</property> + <attributes> + <attribute name="style" value="italic"/> + <attribute name="scale" value="0.80000000000000004"/> + </attributes> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="debugButton"> + <property name="label" translatable="yes">_Debug</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> + <property name="use_underline">True</property> + <signal name="clicked" handler="on_debug_clicked" swapped="no"/> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="expanderLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">More _info...</property> + <property name="use_underline">True</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + </object> + </child> + </object> + <object class="GtkTextBuffer" id="tracebackBuffer"> + <property name="text" translatable="yes">No additional info available.</property> + </object> +</interface>
the whole set looks fine to me, I just have one comment below
----- Original Message -----
meh/__init__.py | 3 +- meh/handler.py | 5 +- meh/ui/gui.py | 119 +++++++++------------ meh/ui/text.py | 2 +- po/python-meh.pot | 59 ++++++++---- setup.py | 2 +- ui/detailed-dialog.glade | 171 ------------------------------- ui/exception-dialog.glade | 248 +++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 346 insertions(+), 263 deletions(-) delete mode 100644 ui/detailed-dialog.glade create mode 100644 ui/exception-dialog.glade
diff --git a/meh/__init__.py b/meh/__init__.py index 2732e66..69352f8 100644 --- a/meh/__init__.py +++ b/meh/__init__.py @@ -25,7 +25,8 @@ # exception is hit. MAIN_RESPONSE_DEBUG = 0 MAIN_RESPONSE_SAVE = 1 -MAIN_RESPONSE_OK = 2 +MAIN_RESPONSE_QUIT = 2 +MAIN_RESPONSE_NONE = 3
# And these constants represent the return values of buttons on the exception # saving dialog. diff --git a/meh/handler.py b/meh/handler.py index 143c1b9..75dca12 100644 --- a/meh/handler.py +++ b/meh/handler.py @@ -80,7 +80,7 @@ class ExceptionHandler(object): a subclass. """
responseHash = {MAIN_RESPONSE_OK: self.runQuit,
responseHash = {MAIN_RESPONSE_QUIT: self.runQuit, MAIN_RESPONSE_DEBUG: self.runDebug, MAIN_RESPONSE_SAVE: self.runSave}@@ -107,8 +107,7 @@ class ExceptionHandler(object): if not win: self.runQuit((ty, value, tb))
win.run()rc = win.getrc()
rc = win.run() try: responseHash[rc]((ty, value, tb))diff --git a/meh/ui/gui.py b/meh/ui/gui.py index ec05739..2b6ff15 100644 --- a/meh/ui/gui.py +++ b/meh/ui/gui.py @@ -18,15 +18,14 @@ # from meh import * from meh.ui import * -import gtk -import gtk.glade import os import report +from gi.repository import Gtk
import gettext _ = lambda x: gettext.ldgettext("python-meh", x)
-def findGladeFile(file): +def find_glade_file(file): path = os.environ.get("GLADEPATH", "./:ui/:/tmp/updates/:/tmp/updates/ui/:/usr/share/python-meh/") for d in path.split(":"): fn = d + file @@ -34,14 +33,6 @@ def findGladeFile(file): return fn raise RuntimeError, "Unable to find glade file %s" % file
-def findPixmap(file):
- path = os.environ.get("PIXMAPPATH",
"./:pixmaps/:/tmp/updates/:/tmp/updates/pixmaps/:/usr/share/python-meh/")
- for d in path.split(":"):
fn = d + fileif os.access(fn, os.R_OK):return fn- return None
class GraphicalIntf(AbstractIntf): def __init__(self, *args, **kwargs): AbstractIntf.__init__(self, *args, **kwargs) @@ -83,74 +74,66 @@ class MainExceptionWindow(AbstractMainExceptionWindow): AbstractMainExceptionWindow.__init__(self, shortTraceback, longTracebackFile, *args, **kwargs)
xml = gtk.glade.XML(findGladeFile("detailed-dialog.glade"),domain="python-meh")
self.dialog = xml.get_widget("detailedDialog")self.mainVBox = xml.get_widget("mainVBox")self.hbox = xml.get_widget("hbox1")self.info = xml.get_widget("info")self.detailedExpander = xml.get_widget("detailedExpander")self.detailedView = xml.get_widget("detailedView")# Set the custom icon.img = gtk.Image()img.set_from_file(findPixmap("exception.png"))self.hbox.pack_start(img)self.hbox.reorder_child(img, 0)# Set the buttons.for (button, response) in [(_("Debu_g"),MAIN_RESPONSE_DEBUG),
("gtk-save", MAIN_RESPONSE_SAVE),(_("_Exit"), MAIN_RESPONSE_OK)]:self.dialog.add_button(button, response)self.dialog.set_default_response(MAIN_RESPONSE_OK)self.info.set_text(_("An unhandled exception has occurred.This "
"is most likely a bug. Please save acopy "
"of the detailed exception and file abug "
"report."))if longTracebackFile:f = open(longTracebackFile)textbuf = gtk.TextBuffer()i = textbuf.get_start_iter()
builder = Gtk.Builder()glade_file = find_glade_file("exception-dialog.glade")builder.add_from_file(glade_file)builder.connect_signals(self)
while True:# Wish readline would give StopIteration at the endof a file.
line = f.readline()if line == "":break
self._main_window = builder.get_object("exceptionWindow")
if __builtins__.get("type")(line) != unicode:try:line = unicode(line, encoding='utf-8')except UnicodeDecodeError:pass
self._traceback_buffer =builder.get_object("tracebackBuffer")
textbuf.insert(i, line)
if longTracebackFile:with open(longTracebackFile) as fobj:long_traceback = ""for line in fobj:long_traceback += line
you could use
long_traceback = ''.join(fobj)
f.close()self.detailedView.set_buffer(textbuf)else:self.mainVBox.remove(self.detailedExpander)
self._traceback_buffer.set_text(long_traceback)self._response = MAIN_RESPONSE_QUITdef destroy(self, *args, **kwargs):
self.dialog.destroy()
self._main_window.destroy()def run(self, *args, **kwargs):
self.dialog.show_all()self.rc = self.dialog.run()self.dialog.destroy()
self._main_window.show_all()Gtk.main()self.destroy()return self._response- def on_report_clicked(self, button):
self._response = MAIN_RESPONSE_SAVEGtk.main_quit()- def on_quit_clicked(self, button):
self._response = MAIN_RESPONSE_QUITGtk.main_quit()- def on_debug_clicked(self, button):
self._response = MAIN_RESPONSE_DEBUGGtk.main_quit()- def on_expander_activated(self, expander, *args):
if expander.get_expanded():self._main_window.resize(600, 400)else:#resize the window back to the default size whenexpander is
#minimizedself._main_window.resize(1, 1)- def on_main_window_deleted(self, *args):
self._response = MAIN_RESPONSE_NONEself.destroy()Gtk.main_quit()class MessageWindow(AbstractMessageWindow): def __init__(self, title, text, *args, **kwargs): AbstractMessageWindow.__init__(self, title, text, *args, **kwargs)
self.dialog = gtk.MessageDialog(buttons=gtk.BUTTONS_OK,type=gtk.MESSAGE_INFO,
self.dialog = Gtk.MessageDialog(buttons=Gtk.ButtonsType.OK,type=Gtk.MessageType.INFO, message_format=text) self.dialog.set_title(title)
self.dialog.set_position(gtk.WIN_POS_CENTER)
self.dialog.set_position(Gtk.WindowPosition.CENTER)def destroy(self, *args, **kwargs): self.dialog.destroy()
@@ -162,9 +145,9 @@ class MessageWindow(AbstractMessageWindow):
class ExitWindow(MessageWindow): def __init__(self, title, text, *args, **kwargs):
self.dialog = gtk.MessageDialog(buttons=gtk.BUTTONS_NONE,type=gtk.MESSAGE_INFO,
self.dialog =Gtk.MessageDialog(buttons=Gtk.ButtonsType.NONE,
type=Gtk.MessageType.INFO, message_format=text) self.dialog.set_title(title) self.dialog.add_button(_("_Exit"), 0)
self.dialog.set_position(gtk.WIN_POS_CENTER)
self.dialog.set_position(Gtk.WindowPosition.CENTER)diff --git a/meh/ui/text.py b/meh/ui/text.py index 5dd6fe1..717212e 100644 --- a/meh/ui/text.py +++ b/meh/ui/text.py @@ -85,7 +85,7 @@ class MainExceptionWindow(AbstractMainExceptionWindow): elif response == string.lower(_("Save")): return MAIN_RESPONSE_SAVE else:
return MAIN_RESPONSE_OK
return MAIN_RESPONSE_QUITclass MessageWindow(AbstractMessageWindow): def __init__(self, title, text, *args, **kwargs): diff --git a/po/python-meh.pot b/po/python-meh.pot index b291941..ab22b61 100644 --- a/po/python-meh.pot +++ b/po/python-meh.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-04-14 10:26+0200\n" +"POT-Creation-Date: 2012-07-09 14:33+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME EMAIL@ADDRESS\n" "Language-Team: LANGUAGE LL@li.org\n" @@ -17,45 +17,68 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n"
-#: ../meh/ui/text.py:73 ../meh/ui/text.py:100 +#: ../meh/ui/text.py:73 ../meh/ui/text.py:99 msgid "OK" msgstr ""
-#: ../meh/ui/text.py:73 ../meh/ui/text.py:82 +#: ../meh/ui/text.py:73 ../meh/ui/text.py:85 msgid "Save" msgstr ""
-#: ../meh/ui/text.py:73 ../meh/ui/text.py:80 +#: ../meh/ui/text.py:73 ../meh/ui/text.py:83 msgid "Debug" msgstr ""
-#: ../meh/ui/text.py:88 +#: ../meh/ui/text.py:80 msgid "Exception Occurred" msgstr ""
-#: ../meh/ui/text.py:114 +#: ../meh/ui/text.py:113 msgid "Exit" msgstr ""
-#. Set the buttons. -#: ../meh/ui/gui.py:101 -msgid "Debu_g" +#: ../meh/ui/gui.py:150 +msgid "_Exit" msgstr ""
-#: ../meh/ui/gui.py:103 ../meh/ui/gui.py:169 -msgid "_Exit" +#: tmp/exception-dialog.glade.h:1 tmp/exception-dialog-new.glade.h:1 +msgid "'Debug' will take you to tty1. Press Ctrl + Alt + F6 to return." +msgstr ""
+#: tmp/exception-dialog.glade.h:2 tmp/exception-dialog-new.glade.h:2 +msgid "An unknown error has occured" +msgstr ""
+#: tmp/exception-dialog.glade.h:3 +msgid "More _info..." +msgstr ""
+#: tmp/exception-dialog.glade.h:4 tmp/exception-dialog-new.glade.h:4 +msgid "No additional info available." +msgstr ""
+#: tmp/exception-dialog.glade.h:5 tmp/exception-dialog-new.glade.h:5 +msgid "The output below may help determine the cause of the error:" msgstr ""
-#: ../meh/ui/gui.py:108 +#: tmp/exception-dialog.glade.h:6 tmp/exception-dialog-new.glade.h:6 msgid "" -"An unhandled exception has occurred. This is most likely a bug. Please " -"save a copy of the detailed exception and file a bug report." +"This program has encountered an unknown error. You may\n" +"report the bug bellow or quit the program." +msgstr ""
+#: tmp/exception-dialog.glade.h:8 tmp/exception-dialog-new.glade.h:8 +msgid "_Debug" +msgstr ""
+#: tmp/exception-dialog.glade.h:9 tmp/exception-dialog-new.glade.h:9 +msgid "_Quit" msgstr ""
-#: tmp/detailed-dialog.glade.h:1 -msgid "Info" +#: tmp/exception-dialog.glade.h:10 tmp/exception-dialog-new.glade.h:10 +msgid "_Report Bug" msgstr ""
-#: tmp/detailed-dialog.glade.h:2 -msgid "_Details" +#: tmp/exception-dialog-new.glade.h:3 +msgid "More info..." msgstr "" diff --git a/setup.py b/setup.py index ab48424..5d5628f 100644 --- a/setup.py +++ b/setup.py @@ -6,5 +6,5 @@ setup(name='python-meh', version='0.13', description='Python module for handling exceptions', author='Chris Lumens', author_email='clumens@redhat.com', url='http://git.fedoraproject.org/git/?p=python-meh.git',
data_files = [('/usr/share/python-meh',['ui/detailed-dialog.glade', 'pixmaps/exception.png'])],
data_files = [('/usr/share/python-meh',['ui/exception-dialog.glade'])], packages=['meh', 'meh.ui']) diff --git a/ui/detailed-dialog.glade b/ui/detailed-dialog.glade deleted file mode 100644 index 61fca36..0000000 --- a/ui/detailed-dialog.glade +++ /dev/null @@ -1,171 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
-<glade-interface>
-<widget class="GtkDialog" id="detailedDialog">
- <property name="visible">True</property>
- <property name="title">Exception Occurred</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_CENTER</property>
- <property name="modal">True</property>
- <property name="default_width">550</property>
- <property name="default_height">400</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
- <property name="decorated">True</property>
- <property name="skip_taskbar_hint">False</property>
- <property name="skip_pager_hint">False</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
- <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
- <property name="focus_on_map">True</property>
- <property name="urgency_hint">False</property>
- <property name="has_separator">True</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="detailedDialog-vbox">
<property name="visible">True</property><property name="homogeneous">False</property><property name="spacing">12</property><child internal-child="action_area"><widget class="GtkHButtonBox" id="buttonBox">
<property name="visible">True</property><property name="layout_style">GTK_BUTTONBOX_END</property></widget>
<packing>
<property name="padding">0</property><property name="expand">False</property><property name="fill">True</property><property name="pack_type">GTK_PACK_END</property></packing>
</child><child><widget class="GtkVBox" id="mainVBox">
<property name="visible">True</property><property name="homogeneous">False</property><property name="spacing">12</property><child><widget class="GtkHBox" id="hbox1"><property name="visible">True</property><property name="homogeneous">False</property><property name="spacing">6</property><child><placeholder/></child><child><widget class="GtkLabel" id="info"><property name="visible">True</property><property name="label" translatable="yes">Info</property><property name="use_underline">False</property><property name="use_markup">False</property><property name="justify">GTK_JUSTIFY_LEFT</property><property name="wrap">True</property><property name="selectable">False</property><property name="xalign">0</property><property name="yalign">0.5</property><property name="xpad">0</property><property name="ypad">0</property><property name="ellipsize">PANGO_ELLIPSIZE_NONE</property><property name="width_chars">-1</property><property name="single_line_mode">False</property><property name="angle">0</property></widget><packing><property name="padding">0</property><property name="expand">True</property><property name="fill">True</property></packing></child></widget><packing><property name="padding">0</property><property name="expand">False</property><property name="fill">False</property></packing></child><child><widget class="GtkExpander" id="detailedExpander"><property name="visible">True</property><property name="can_focus">True</property><property name="expanded">False</property><property name="spacing">0</property><child><widget class="GtkScrolledWindow" id="scrolledwindow2"><property name="visible">True</property><property name="can_focus">True</property><propertyname="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<propertyname="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property><property name="window_placement">GTK_CORNER_TOP_LEFT</property><child><widget class="GtkTextView" id="detailedView"><property name="visible">True</property><property name="can_focus">True</property><property name="editable">False</property><property name="overwrite">False</property><property name="accepts_tab">True</property><property name="justification">GTK_JUSTIFY_LEFT</property><property name="wrap_mode">GTK_WRAP_NONE</property><property name="cursor_visible">False</property><property name="pixels_above_lines">0</property><property name="pixels_below_lines">0</property><property name="pixels_inside_wrap">0</property><property name="left_margin">0</property><property name="right_margin">0</property><property name="indent">0</property><property name="text" translatable="yes"></property></widget></child></widget></child><child><widget class="GtkLabel" id="label1"><property name="visible">True</property><property name="label" translatable="yes">_Details</property><property name="use_underline">True</property><property name="use_markup">False</property><property name="justify">GTK_JUSTIFY_LEFT</property><property name="wrap">False</property><property name="selectable">False</property><property name="xalign">0.5</property><property name="yalign">0.5</property><property name="xpad">0</property><property name="ypad">0</property><property name="ellipsize">PANGO_ELLIPSIZE_NONE</property><property name="width_chars">-1</property><property name="single_line_mode">False</property><property name="angle">0</property></widget><packing><property name="type">label_item</property></packing></child></widget><packing><property name="padding">0</property><property name="expand">True</property><property name="fill">True</property><property name="pack_type">GTK_PACK_END</property></packing></child></widget>
<packing>
<property name="padding">0</property><property name="expand">True</property><property name="fill">True</property></packing>
</child></widget>
</child>
-</widget>
-</glade-interface> diff --git a/ui/exception-dialog.glade b/ui/exception-dialog.glade new file mode 100644 index 0000000..89b62c2 --- /dev/null +++ b/ui/exception-dialog.glade @@ -0,0 +1,248 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkWindow" id="exceptionWindow">
- <property name="can_focus">False</property>
- <property name="window_position">center</property>
- <signal name="delete-event" handler="on_main_window_deleted"
swapped="no"/>
<child>
<object class="GtkBox" id="mainBox"><property name="visible">True</property><property name="can_focus">False</property><property name="orientation">vertical</property><child><object class="GtkBox" id="box1"><property name="visible">True</property><property name="can_focus">False</property><property name="halign">start</property><property name="valign">center</property><property name="margin_left">20</property><property name="margin_top">30</property><child><object class="GtkImage" id="image1"><property name="visible">True</property><property name="can_focus">False</property><property name="stock">gtk-dialog-warning</property><property name="icon-size">5</property></object><packing><property name="expand">False</property><property name="fill">True</property><property name="padding">7</property><property name="position">0</property></packing></child><child><object class="GtkLabel" id="titleLabel"><property name="visible">True</property><property name="can_focus">False</property><property name="label" translatable="yes">An unknownerror has occured</property>
<attributes><attribute name="weight" value="bold"/><attribute name="scale"value="1.1000000000000001"/>
</attributes></object><packing><property name="expand">False</property><property name="fill">True</property><property name="position">1</property></packing></child></object><packing><property name="expand">False</property><property name="fill">False</property><property name="position">0</property></packing></child><child><object class="GtkLabel" id="explainLabel"><property name="visible">True</property><property name="can_focus">False</property><property name="halign">start</property><property name="valign">start</property><property name="margin_left">40</property><property name="margin_right">40</property><property name="label" translatable="yes">This programhas encountered an unknown error. You may +report the bug bellow or quit the program.</property>
</object><packing><property name="expand">False</property><property name="fill">True</property><property name="padding">21</property><property name="position">1</property></packing></child><child><object class="GtkButtonBox" id="buttonbox1"><property name="visible">True</property><property name="can_focus">False</property><property name="valign">start</property><property name="margin_right">20</property><property name="spacing">10</property><property name="layout_style">end</property><child><object class="GtkButton" id="reportButton"><property name="label" translatable="yes">_ReportBug</property>
<property name="visible">True</property><property name="can_focus">True</property><property name="receives_default">True</property><propertyname="use_action_appearance">False</property>
<property name="use_underline">True</property><signal name="clicked" handler="on_report_clicked"swapped="no"/>
</object><packing><property name="expand">False</property><property name="fill">True</property><property name="position">0</property></packing></child><child><object class="GtkButton" id="quitButton"><property name="label"translatable="yes">_Quit</property>
<property name="visible">True</property><property name="can_focus">True</property><property name="receives_default">True</property><propertyname="use_action_appearance">False</property>
<property name="use_underline">True</property><signal name="clicked" handler="on_quit_clicked"swapped="no"/>
</object><packing><property name="expand">False</property><property name="fill">True</property><property name="position">1</property></packing></child></object><packing><property name="expand">False</property><property name="fill">True</property><property name="position">2</property></packing></child><child><object class="GtkExpander" id="expander"><property name="visible">True</property><property name="can_focus">True</property><property name="margin_left">10</property><property name="margin_right">10</property><property name="margin_bottom">10</property><property name="use_underline">True</property><signal name="activate" handler="on_expander_activated"swapped="no"/>
<child><object class="GtkBox" id="box2"><property name="visible">True</property><property name="can_focus">False</property><property name="vexpand">True</property><property name="orientation">vertical</property><property name="spacing">6</property><child><object class="GtkLabel" id="commentLabel"><property name="visible">True</property><property name="can_focus">False</property><property name="halign">start</property><property name="margin_left">2</property><propertyname="xalign">0.10000000149011612</property>
<property name="label" translatable="yes">Theoutput below may help determine the cause of the error:</property>
<attributes><attribute name="style" value="italic"/></attributes></object><packing><property name="expand">False</property><property name="fill">True</property><property name="position">0</property></packing></child><child><object class="GtkScrolledWindow"id="tracebackScrolledWindow">
<property name="visible">True</property><property name="can_focus">True</property><property name="vexpand">True</property><property name="shadow_type">in</property><child><object class="GtkTextView"id="tracebackView">
<property name="visible">True</property><property name="can_focus">True</property><propertyname="vscroll_policy">natural</property>
<property name="editable">False</property><propertyname="cursor_visible">False</property>
<propertyname="buffer">tracebackBuffer</property>
</object></child></object><packing><property name="expand">True</property><property name="fill">True</property><property name="position">1</property></packing></child><child><object class="GtkBox" id="bottomBox"><property name="visible">True</property><property name="can_focus">False</property><property name="spacing">4</property><child><object class="GtkLabel" id="warningLabel"><property name="visible">True</property><property name="can_focus">False</property><propertyname="xalign">0.89999997615814209</property>
<property name="label"translatable="yes">'Debug' will take you to tty1. Press Ctrl + Alt + F6 to return.</property>
<attributes><attribute name="style" value="italic"/><attribute name="scale"value="0.80000000000000004"/>
</attributes></object><packing><property name="expand">True</property><property name="fill">True</property><property name="position">0</property></packing></child><child><object class="GtkButton" id="debugButton"><property name="label"translatable="yes">_Debug</property>
<property name="visible">True</property><property name="can_focus">True</property><propertyname="receives_default">True</property>
<propertyname="use_action_appearance">False</property>
<propertyname="use_underline">True</property>
<signal name="clicked"handler="on_debug_clicked" swapped="no"/>
</object><packing><property name="expand">False</property><property name="fill">True</property><property name="position">1</property></packing></child></object><packing><property name="expand">False</property><property name="fill">True</property><property name="position">2</property></packing></child></object></child><child type="label"><object class="GtkLabel" id="expanderLabel"><property name="visible">True</property><property name="can_focus">False</property><property name="label" translatable="yes">More_info...</property>
<property name="use_underline">True</property></object></child></object><packing><property name="expand">False</property><property name="fill">True</property><property name="position">3</property></packing></child></object></child>
</object>
<object class="GtkTextBuffer" id="tracebackBuffer">
- <property name="text" translatable="yes">No additional info
available.</property>
</object>
+</interface>
1.7.4.4
anaconda-patches mailing list anaconda-patches@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/anaconda-patches
On Wed, 2012-07-11 at 08:18 -0400, Martin Gracik wrote:
the whole set looks fine to me, I just have one comment below
----- Original Message -----
meh/__init__.py | 3 +- meh/handler.py | 5 +- meh/ui/gui.py | 119 +++++++++------------ meh/ui/text.py | 2 +- po/python-meh.pot | 59 ++++++++---- setup.py | 2 +- ui/detailed-dialog.glade | 171 ------------------------------- ui/exception-dialog.glade | 248 +++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 346 insertions(+), 263 deletions(-) delete mode 100644 ui/detailed-dialog.glade create mode 100644 ui/exception-dialog.glade
diff --git a/meh/__init__.py b/meh/__init__.py index 2732e66..69352f8 100644 --- a/meh/__init__.py +++ b/meh/__init__.py @@ -25,7 +25,8 @@ # exception is hit. MAIN_RESPONSE_DEBUG = 0 MAIN_RESPONSE_SAVE = 1 -MAIN_RESPONSE_OK = 2 +MAIN_RESPONSE_QUIT = 2 +MAIN_RESPONSE_NONE = 3
# And these constants represent the return values of buttons on the exception # saving dialog. diff --git a/meh/handler.py b/meh/handler.py index 143c1b9..75dca12 100644 --- a/meh/handler.py +++ b/meh/handler.py @@ -80,7 +80,7 @@ class ExceptionHandler(object): a subclass. """
responseHash = {MAIN_RESPONSE_OK: self.runQuit,
responseHash = {MAIN_RESPONSE_QUIT: self.runQuit, MAIN_RESPONSE_DEBUG: self.runDebug, MAIN_RESPONSE_SAVE: self.runSave}@@ -107,8 +107,7 @@ class ExceptionHandler(object): if not win: self.runQuit((ty, value, tb))
win.run()rc = win.getrc()
rc = win.run() try: responseHash[rc]((ty, value, tb))diff --git a/meh/ui/gui.py b/meh/ui/gui.py index ec05739..2b6ff15 100644 --- a/meh/ui/gui.py +++ b/meh/ui/gui.py @@ -18,15 +18,14 @@ # from meh import * from meh.ui import * -import gtk -import gtk.glade import os import report +from gi.repository import Gtk
import gettext _ = lambda x: gettext.ldgettext("python-meh", x)
-def findGladeFile(file): +def find_glade_file(file): path = os.environ.get("GLADEPATH", "./:ui/:/tmp/updates/:/tmp/updates/ui/:/usr/share/python-meh/") for d in path.split(":"): fn = d + file @@ -34,14 +33,6 @@ def findGladeFile(file): return fn raise RuntimeError, "Unable to find glade file %s" % file
-def findPixmap(file):
- path = os.environ.get("PIXMAPPATH",
"./:pixmaps/:/tmp/updates/:/tmp/updates/pixmaps/:/usr/share/python-meh/")
- for d in path.split(":"):
fn = d + fileif os.access(fn, os.R_OK):return fn- return None
class GraphicalIntf(AbstractIntf): def __init__(self, *args, **kwargs): AbstractIntf.__init__(self, *args, **kwargs) @@ -83,74 +74,66 @@ class MainExceptionWindow(AbstractMainExceptionWindow): AbstractMainExceptionWindow.__init__(self, shortTraceback, longTracebackFile, *args, **kwargs)
xml = gtk.glade.XML(findGladeFile("detailed-dialog.glade"),domain="python-meh")
self.dialog = xml.get_widget("detailedDialog")self.mainVBox = xml.get_widget("mainVBox")self.hbox = xml.get_widget("hbox1")self.info = xml.get_widget("info")self.detailedExpander = xml.get_widget("detailedExpander")self.detailedView = xml.get_widget("detailedView")# Set the custom icon.img = gtk.Image()img.set_from_file(findPixmap("exception.png"))self.hbox.pack_start(img)self.hbox.reorder_child(img, 0)# Set the buttons.for (button, response) in [(_("Debu_g"),MAIN_RESPONSE_DEBUG),
("gtk-save", MAIN_RESPONSE_SAVE),(_("_Exit"), MAIN_RESPONSE_OK)]:self.dialog.add_button(button, response)self.dialog.set_default_response(MAIN_RESPONSE_OK)self.info.set_text(_("An unhandled exception has occurred.This "
"is most likely a bug. Please save acopy "
"of the detailed exception and file abug "
"report."))if longTracebackFile:f = open(longTracebackFile)textbuf = gtk.TextBuffer()i = textbuf.get_start_iter()
builder = Gtk.Builder()glade_file = find_glade_file("exception-dialog.glade")builder.add_from_file(glade_file)builder.connect_signals(self)
while True:# Wish readline would give StopIteration at the endof a file.
line = f.readline()if line == "":break
self._main_window = builder.get_object("exceptionWindow")
if __builtins__.get("type")(line) != unicode:try:line = unicode(line, encoding='utf-8')except UnicodeDecodeError:pass
self._traceback_buffer =builder.get_object("tracebackBuffer")
textbuf.insert(i, line)
if longTracebackFile:with open(longTracebackFile) as fobj:long_traceback = ""for line in fobj:long_traceback += lineyou could use
long_traceback = ''.join(fobj)
Nice tip, thanks! However, since the PATCH 6/6 completely removes this block, I will leave it like that for this time.
--- meh/handler.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/meh/handler.py b/meh/handler.py index 75dca12..a4f6f1d 100644 --- a/meh/handler.py +++ b/meh/handler.py @@ -187,7 +187,7 @@ class ExceptionHandler(object): """ import pdb pdb.post_mortem(tb) - os.kill(os.getpid(), signal.SIGKILL) + #no need to quit here, let's just get back to the main dialog
def runSave(self, (ty, value, tb)): """This method is called when the "Save" button is clicked. It may
People don't usually know that 'continue' command quits the debugger, so let's display a little hint. --- meh/handler.py | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/meh/handler.py b/meh/handler.py index a4f6f1d..2a5bb76 100644 --- a/meh/handler.py +++ b/meh/handler.py @@ -185,6 +185,8 @@ class ExceptionHandler(object): be overridden by a subclass if specialized behavior is required to enter debug mode. """ + print "Use 'continue' command to quit the debugger and get back to "\ + "the main menu" import pdb pdb.post_mortem(tb) #no need to quit here, let's just get back to the main dialog
We passed the filename of the file containing the traceback and object dump to libreport, and MainExceptionWindow. But that meant libreport and MainExceptionWindow had to read the file and save the content to its internal structure. We need to write traceback and object dump to a file, but we can pass its contents as string directly to libreport and MainExceptionWindow.
There is a related patch for libreport removing the glue reading the file contents. --- meh/dump.py | 113 +++++++++++++++++++++++++++------------------------- meh/handler.py | 10 +++- meh/ui/__init__.py | 6 +- meh/ui/gui.py | 12 +---- meh/ui/text.py | 4 +- 5 files changed, 74 insertions(+), 71 deletions(-)
diff --git a/meh/dump.py b/meh/dump.py index 7e01d39..adfdb27 100644 --- a/meh/dump.py +++ b/meh/dump.py @@ -249,9 +249,9 @@ class ExceptionDump(object):
return traceback.format_list(frames)
- # Create a string representation of a class and write it to fd. This - # method will recursively handle all attributes of the base given class. - def _dumpClass(self, instance, fd, level=0, parentkey="", skipList=[]): + # Create a string representation of a class. This method will recursively + # handle all attributes of the base given class. + def _dumpClass(self, instance, level=0, parentkey="", skipList=[]): # This is horribly cheesy, and bound to require maintainence in the # future. The problem is that anything subclassed from object fails # the types.InstanceType test we used to have which means those @@ -266,6 +266,8 @@ class ExceptionDump(object): types.StringType, types.UnicodeType] or \ not hasattr(instance, "__class__")
+ ret = "" + # protect from loops try: # Store the id(), not the instance name to protect against @@ -273,23 +275,23 @@ class ExceptionDump(object): if not self._dumpHash.has_key(id(instance)): self._dumpHash[id(instance)] = None else: - fd.write("Already dumped (%s instance)\n" % instance.__class__.__name__) + ret += "Already dumped (%s instance)\n" % instance.__class__.__name__ return except TypeError: - fd.write("Cannot dump object\n") + ret += "Cannot dump object\n" return
if (instance.__class__.__dict__.has_key("__str__") or instance.__class__.__dict__.has_key("__repr__")): try: - fd.write("%s\n" % (instance,)) + ret += "%s\n" % (instance,) except: - fd.write("\n") + ret += "\n"
return
- fd.write("%s instance, containing members:\n" % - (instance.__class__.__name__)) + ret += "%s instance, containing members:\n" %\ + (instance.__class__.__name__) pad = ' ' * ((level) * 2)
for key, value in instance.__dict__.items(): @@ -305,58 +307,60 @@ class ExceptionDump(object): # None are probably okay. if eval("instance.%s is not None" % key) and \ eval("id(instance.%s)" % key) in skipList: - fd.write("%s%s: Skipped\n" % (pad, curkey)) + ret += "%s%s: Skipped\n" % (pad, curkey) continue
if type(value) == types.ListType: - fd.write("%s%s: [" % (pad, curkey)) + ret += "%s%s: [" % (pad, curkey) first = 1 for item in value: if not first: - fd.write(", ") + ret += ", " else: first = 0
if __isSimpleType(item): - fd.write("%s" % (item,)) + ret += "%s" % (item,) else: - self._dumpClass(item, fd, level + 1, skipList=skipList) - fd.write("]\n") + self._dumpClass(item, level + 1, skipList=skipList) + ret += "]\n" elif type(value) == types.DictType: - fd.write("%s%s: {" % (pad, curkey)) + ret += "%s%s: {" % (pad, curkey) first = 1 for k, v in value.items(): if not first: - fd.write(", ") + ret += ", " else: first = 0 if type(k) == types.StringType: - fd.write("'%s': " % (k,)) + ret += "'%s': " % (k,) else: - fd.write("%s: " % (k,)) + ret += "%s: " % (k,)
if __isSimpleType(v): - fd.write("%s" % (v,)) + ret += "%s" % (v,) else: - self._dumpClass(v, fd, level + 1, parentkey = curkey, skipList=skipList) - fd.write("}\n") + self._dumpClass(v, level + 1, parentkey = curkey, skipList=skipList) + ret += "}\n" elif __isSimpleType(value): - fd.write("%s%s: %s\n" % (pad, curkey, value)) + ret += "%s%s: %s\n" % (pad, curkey, value) else: - fd.write("%s%s: " % (pad, curkey)) - self._dumpClass(value, fd, level + 1, parentkey=curkey, skipList=skipList) + ret += "%s%s: " % (pad, curkey) + self._dumpClass(value, level + 1, parentkey=curkey, skipList=skipList) + + return ret
- def dump(self, fd, obj): - """Dump the local variables and all attributes of a given object to an - open file descriptor. The lists of files and attrs to ignore are - all taken from a Config object instance provided when the - ExceptionDump class was created. + def dump(self, obj): + """Dump the local variables and all attributes of a given object. + The lists of files and attrs to ignore are all taken from a + Config object instance provided when the ExceptionDump class was + created.
- fd -- An open file descriptor to write everything to. obj -- Any Python object. This object will have all its attributes written out, except for those mentioned in the attrSkipList. """ idSkipList = [] + ret = ""
# We need to augment the environment eval() will run in with the # bindings that were local when the traceback happened so that the @@ -376,39 +380,39 @@ class ExceptionDump(object): # Write local variables to the given file descriptor, ignoring any of # the local skips. frame = self.stack[-1][0] - fd.write ("\nLocal variables in innermost frame:\n") + ret += "\nLocal variables in innermost frame:\n" try: for (key, value) in frame.f_locals.items(): loweredKey = key.lower() if len(filter(lambda s: loweredKey.find(s) != -1, self.conf.localSkipList)) > 0: continue
- fd.write ("%s: %s\n" % (key, value)) + ret += "%s: %s\n" % (key, value) except: pass
# And now dump the object's attributes. try: - fd.write("\n\n") - self._dumpClass(obj, fd, skipList=idSkipList) + ret += "\n\n" + ret += self._dumpClass(obj, skipList=idSkipList) except: - fd.write("\nException occurred during state dump:\n") - traceback.print_exc(None, fd) + ret += "\nException occurred during state dump:\n" + ret += traceback.format_exc(None)
# And finally, write a bunch of files into the dump too. - for fn in self.conf.fileList: + for fname in self.conf.fileList: try: - f = open(fn, 'r') - line = "\n\n%s:\n" % (fn,) - while line: - fd.write(line) - line = f.readline() - f.close() + with open(fname, 'r') as fobj: + ret += "\n\n%s:\n" % (fname,) + for line in fobj: + ret += line except IOError: pass except: - fd.write("\nException occurred during %s file copy:\n" % (fn,)) - traceback.print_exc(None, fd) + ret += "\nException occurred during %s file copy:\n" % (fname,) + ret += traceback.format_exc(None) + + return ret
@property def hash(self): @@ -428,17 +432,18 @@ class ExceptionDump(object):
return hashlib.sha256(s).hexdigest()
- def write(self, obj, fd): - """Write the traceback and a text representation of an object to an - open file descriptor. + def traceback_and_object_dump(self, obj): + """ + Return the traceback and a text representation of an object. + + @param obj: Any Python object. This object will have all its attributes + written out, except for those mentioned in the attrSkipList.
- fd -- An open file descriptor to write everything to. - obj -- Any Python object. This object will have all its attributes - written out, except for those mentioned in the attrSkipList. """ + ret = str(self) - fd.write(ret) - self.dump(fd, obj) + ret += self.dump(obj) + return ret
class ReverseExceptionDump(ExceptionDump): diff --git a/meh/handler.py b/meh/handler.py index 2a5bb76..befbcf8 100644 --- a/meh/handler.py +++ b/meh/handler.py @@ -54,6 +54,7 @@ class ExceptionHandler(object):
self._exitcode = 10 self._exn = None + self.exnText = ""
def _setExitCode(self, code): self._exitcode = code @@ -96,14 +97,15 @@ class ExceptionHandler(object): # Save the exception to the filesystem first. self.exn = self.exnClass((ty, value, tb), self.conf) (fd, self.exnFile) = self.openFile() - text = self.exn.write(obj, fd) + self.exnText = self.exn.traceback_and_object_dump(obj) + fd.write(self.exnText) fd.close()
self.postWriteHook((ty, value, tb), obj)
# Run initial UI screen, asking whether to save/debug/quit. while True: - win = self.intf.mainExceptionWindow(text, self.exnFile) + win = self.intf.mainExceptionWindow(str(self.exn), self.exnText) if not win: self.runQuit((ty, value, tb))
@@ -209,7 +211,9 @@ class ExceptionHandler(object): params["reason"] = self.exn.desc params["description"] = "The following was filed automatically by %s:\n%s" \ % (self.conf.programName, str(self.exn)) - params["exnFileName"] = self.exnFile + + tb_item_name = "%s-tb" % self.conf.programName + params[tb_item_name] = self.exnText
accountManager = report.accountmanager.AccountManager()
diff --git a/meh/ui/__init__.py b/meh/ui/__init__.py index 63980aa..295c133 100644 --- a/meh/ui/__init__.py +++ b/meh/ui/__init__.py @@ -77,7 +77,7 @@ class AbstractMainExceptionWindow(object): window is the initial dialog displayed by the exception handler that provides the debug/save/quit options. """ - def __init__(self, shortTraceback=None, longTracebackFile=None, *args, **kwargs): + def __init__(self, shortTraceback=None, longTraceback=None, *args, **kwargs): """Create a new MainExceptionWindow instance. This must handle creating the dialog and populating it with widgets, but must not run the dialog. A self.dialog attribute should be created that @@ -85,8 +85,8 @@ class AbstractMainExceptionWindow(object):
shortTraceback -- The short traceback (usually, just the stack trace). - longTracebackFile -- A file containing the output of - ExceptionDump.write(). + longTraceback -- The long traceback (full traceback and the main + object dump). """ pass
diff --git a/meh/ui/gui.py b/meh/ui/gui.py index 2b6ff15..035733f 100644 --- a/meh/ui/gui.py +++ b/meh/ui/gui.py @@ -70,8 +70,8 @@ class SaveExceptionWindow(AbstractSaveExceptionWindow): report.report(self.signature, self.io)
class MainExceptionWindow(AbstractMainExceptionWindow): - def __init__(self, shortTraceback=None, longTracebackFile=None, *args, **kwargs): - AbstractMainExceptionWindow.__init__(self, shortTraceback, longTracebackFile, + def __init__(self, shortTraceback=None, longTraceback=None, *args, **kwargs): + AbstractMainExceptionWindow.__init__(self, shortTraceback, longTraceback, *args, **kwargs)
builder = Gtk.Builder() @@ -83,13 +83,7 @@ class MainExceptionWindow(AbstractMainExceptionWindow):
self._traceback_buffer = builder.get_object("tracebackBuffer")
- if longTracebackFile: - with open(longTracebackFile) as fobj: - long_traceback = "" - for line in fobj: - long_traceback += line - - self._traceback_buffer.set_text(long_traceback) + self._traceback_buffer.set_text(longTraceback) self._response = MAIN_RESPONSE_QUIT
def destroy(self, *args, **kwargs): diff --git a/meh/ui/text.py b/meh/ui/text.py index 717212e..3cdde37 100644 --- a/meh/ui/text.py +++ b/meh/ui/text.py @@ -63,8 +63,8 @@ class SaveExceptionWindow(AbstractSaveExceptionWindow): report.report(self.signature, self.io)
class MainExceptionWindow(AbstractMainExceptionWindow): - def __init__(self, shortTraceback=None, longTracebackFile=None, *args, **kwargs): - AbstractMainExceptionWindow.__init__(self, shortTraceback, longTracebackFile, + def __init__(self, shortTraceback=None, longTraceback=None, *args, **kwargs): + AbstractMainExceptionWindow.__init__(self, shortTraceback, longTraceback, *args, **kwargs)
self.text = "%s\n\n" % shortTraceback
diff --git a/meh/dump.py b/meh/dump.py index 7e01d39..adfdb27 100644 --- a/meh/dump.py +++ b/meh/dump.py @@ -249,9 +249,9 @@ class ExceptionDump(object):
return traceback.format_list(frames)
- # Create a string representation of a class and write it to fd. This
- # method will recursively handle all attributes of the base given class.
- def _dumpClass(self, instance, fd, level=0, parentkey="", skipList=[]):
- # Create a string representation of a class. This method will recursively
- # handle all attributes of the base given class.
- def _dumpClass(self, instance, level=0, parentkey="", skipList=[]):
While you're here, you might as well get rid of the bug we've been dragging around forever. Convert to skipList=None and then at the beginning of the function, add a:
if not skipList: skipList = []
The key is to just not have a list as the default argument to something.
@@ -209,7 +211,9 @@ class ExceptionHandler(object): params["reason"] = self.exn.desc params["description"] = "The following was filed automatically by %s:\n%s" \ % (self.conf.programName, str(self.exn))
params["exnFileName"] = self.exnFile
tb_item_name = "%s-tb" % self.conf.programNameparams[tb_item_name] = self.exnText accountManager = report.accountmanager.AccountManager()
I've not been following along too well with things in report land. Does the traceback still end up getting written to a file with a unique component in the filename?
- Chris
On Wed, 2012-07-11 at 10:38 -0400, Chris Lumens wrote:
diff --git a/meh/dump.py b/meh/dump.py index 7e01d39..adfdb27 100644 --- a/meh/dump.py +++ b/meh/dump.py @@ -249,9 +249,9 @@ class ExceptionDump(object):
return traceback.format_list(frames)
- # Create a string representation of a class and write it to fd. This
- # method will recursively handle all attributes of the base given class.
- def _dumpClass(self, instance, fd, level=0, parentkey="", skipList=[]):
- # Create a string representation of a class. This method will recursively
- # handle all attributes of the base given class.
- def _dumpClass(self, instance, level=0, parentkey="", skipList=[]):
While you're here, you might as well get rid of the bug we've been dragging around forever. Convert to skipList=None and then at the beginning of the function, add a:
if not skipList: skipList = []
The key is to just not have a list as the default argument to something.
Good idea, I will change this before pushing.
@@ -209,7 +211,9 @@ class ExceptionHandler(object): params["reason"] = self.exn.desc params["description"] = "The following was filed automatically by %s:\n%s" \ % (self.conf.programName, str(self.exn))
params["exnFileName"] = self.exnFile
tb_item_name = "%s-tb" % self.conf.programNameparams[tb_item_name] = self.exnText accountManager = report.accountmanager.AccountManager()I've not been following along too well with things in report land. Does the traceback still end up getting written to a file with a unique component in the filename?
This is handled few lines above (still using the openFile() method):
# Save the exception to the filesystem first. self.exn = self.exnClass((ty, value, tb), self.conf) (fd, self.exnFile) = self.openFile() - text = self.exn.write(obj, fd) + self.exnText = self.exn.traceback_and_object_dump(obj) + fd.write(self.exnText) fd.close()
As for the bugreport -- since some people use the anaconda-tb prefix to search through bugreports, I kept the name of the item (passed in the params dictionary) to match this prefix. Without this patch, report reads the file content and attaches it to bugreport under the name of the file (e.g. anaconda-tb-PfS1Hi). With this patch, report just doesn't have to read the file contents and the name of the attached file is simply 'anaconda-tb' without the random suffix.
Remove the 17 months old "temporary glue" reading the traceback generated and dumped by python-meh to a file. python-meh now passes the contents of the file, not just the filename. --- src/report-python/__init__.py | 11 +---------- 1 files changed, 1 insertions(+), 10 deletions(-)
diff --git a/src/report-python/__init__.py b/src/report-python/__init__.py index 6f4f543..34b1ed1 100644 --- a/src/report-python/__init__.py +++ b/src/report-python/__init__.py @@ -144,7 +144,7 @@ def createAlertSignature(component, hashmarkername, hashvalue, summary, alertSig # used in anaconda / python-meh def createPythonUnhandledExceptionSignature(**kwargs): mandatory_args = ["component", "hashmarkername", "duphash", "reason", - "description", "exnFileName"] + "description"]
for arg in mandatory_args: if arg not in kwargs: @@ -164,15 +164,6 @@ def createPythonUnhandledExceptionSignature(**kwargs): # need to add "release", parse_release() expects format "<product> release <version>" pd.add("os_release", product +" release "+ version) pd.add_basics() # adds product and version + some other required field - # FIXME: how to handle files out of dump dir?? - # temporary glue: 2011-02-08 (let's see how temporary..) - exnFileName = kwargs["exnFileName"] - try: - inf = open(exnFileName, "r") - pd.add(os.path.basename(exnFileName), inf.read()) - inf.close() - except Exception, ex: - print "Can't add %s to report: %s" % (exnFileName, ex)
return pd
anaconda-patches@lists.fedorahosted.org