summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNecoro <>2007-10-15 18:19:31 +0000
committerNecoro <>2007-10-15 18:19:31 +0000
commitfe2547bc8e7698846aa1894760f499a49b36adc9 (patch)
treef3c5a2cc9112e568109cb846d1b4b71d71bf828a
parent2acc7113972491b83a15ce8829a442d712794803 (diff)
downloadportato-fe2547bc8e7698846aa1894760f499a49b36adc9.tar.gz
portato-fe2547bc8e7698846aa1894760f499a49b36adc9.tar.bz2
portato-fe2547bc8e7698846aa1894760f499a49b36adc9.zip
added "Save As..." functionality for exception dialog
-rw-r--r--i18n/de.po36
-rw-r--r--i18n/messages.pot36
-rw-r--r--portato/gui/gtk/dialogs.py13
-rw-r--r--portato/gui/gtk/exception_handling.py26
4 files changed, 74 insertions, 37 deletions
diff --git a/i18n/de.po b/i18n/de.po
index 8966d4b..4e4621b 100644
--- a/i18n/de.po
+++ b/i18n/de.po
@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Portato\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2007-10-15 11:11+0100\n"
+"PO-Revision-Date: 2007-10-15 20:18+0100\n"
"Last-Translator: René 'Necoro' Neumann <necoro@necoro.net>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@@ -162,12 +162,12 @@ msgid "_Remove"
msgstr "_Löschen"
#: portato/gui/templates/portato.glade:779
-#: portato/gui/gtk/windows.py:1023
+#: portato/gui/gtk/windows.py:1025
msgid "Queue"
msgstr "Queue"
#: portato/gui/templates/portato.glade:807
-#: portato/gui/gtk/windows.py:1120
+#: portato/gui/gtk/windows.py:1122
msgid "Console"
msgstr "Konsole"
@@ -430,24 +430,24 @@ msgstr "Kann etc-proposals nicht starten. Kein grafisches Frontend installiert."
msgid "Cannot start etc-proposals. Not root!"
msgstr "Kann etc-proposals nicht starten. Nur root kann das!"
-#: portato/gui/gtk/exception_handling.py:45
+#: portato/gui/gtk/exception_handling.py:46
msgid "A programming error has been detected during the execution of this program."
msgstr "Ein Fehler ist aufgetreten."
-#: portato/gui/gtk/exception_handling.py:46
+#: portato/gui/gtk/exception_handling.py:47
msgid "Bug Detected"
msgstr "Fehler aufgetreten"
-#: portato/gui/gtk/exception_handling.py:47
+#: portato/gui/gtk/exception_handling.py:48
msgid "It probably isn't fatal, but should be reported to the developers nonetheless."
msgstr "Dies ist möglicherweise nicht kritisch, sollte aber trotzdem an die Entwickler weitergeleitet werden."
-#: portato/gui/gtk/exception_handling.py:49
+#: portato/gui/gtk/exception_handling.py:50
msgid "Show Details"
msgstr "Details"
-#: portato/gui/gtk/exception_handling.py:71
-#: portato/gui/gtk/exception_handling.py:103
+#: portato/gui/gtk/exception_handling.py:73
+#: portato/gui/gtk/exception_handling.py:119
#, python-format
msgid ""
"Exception in thread \"%(thread)s\":\n"
@@ -456,7 +456,11 @@ msgstr ""
"Exception im Thread \"%(thread)s\":\n"
"%(trace)s"
-#: portato/gui/gtk/exception_handling.py:105
+#: portato/gui/gtk/exception_handling.py:89
+msgid "Save traceback..."
+msgstr "Speichere Traceback..."
+
+#: portato/gui/gtk/exception_handling.py:121
#, python-format
msgid ""
"Exception:\n"
@@ -533,28 +537,28 @@ msgstr "Lade Plugins"
msgid "Finishing startup"
msgstr "Erledige letzte Handgriffe :)"
-#: portato/gui/gtk/windows.py:1026
+#: portato/gui/gtk/windows.py:1028
msgid "Options"
msgstr "Optionen"
-#: portato/gui/gtk/windows.py:1044
+#: portato/gui/gtk/windows.py:1046
msgid "Categories"
msgstr "Kategorien"
-#: portato/gui/gtk/windows.py:1059
+#: portato/gui/gtk/windows.py:1061
msgid "Packages"
msgstr "Pakete"
-#: portato/gui/gtk/windows.py:1122
+#: portato/gui/gtk/windows.py:1124
#, python-format
msgid "Console (%(title)s)"
msgstr "Konsole (%(title)s)"
-#: portato/gui/gtk/windows.py:1174
+#: portato/gui/gtk/windows.py:1176
msgid "use flags"
msgstr "Use Flags"
-#: portato/gui/gtk/windows.py:1181
+#: portato/gui/gtk/windows.py:1183
msgid "masking keywords"
msgstr "Masking Keywords"
diff --git a/i18n/messages.pot b/i18n/messages.pot
index ca7ee60..a0256a2 100644
--- a/i18n/messages.pot
+++ b/i18n/messages.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-10-15 11:08+0200\n"
+"POT-Creation-Date: 2007-10-15 20:17+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"
@@ -156,11 +156,11 @@ msgstr ""
msgid "_Remove"
msgstr ""
-#: portato/gui/templates/portato.glade:779 portato/gui/gtk/windows.py:1023
+#: portato/gui/templates/portato.glade:779 portato/gui/gtk/windows.py:1025
msgid "Queue"
msgstr ""
-#: portato/gui/templates/portato.glade:807 portato/gui/gtk/windows.py:1120
+#: portato/gui/templates/portato.glade:807 portato/gui/gtk/windows.py:1122
msgid "Console"
msgstr ""
@@ -418,34 +418,38 @@ msgstr ""
msgid "Cannot start etc-proposals. Not root!"
msgstr ""
-#: portato/gui/gtk/exception_handling.py:45
+#: portato/gui/gtk/exception_handling.py:46
msgid ""
"A programming error has been detected during the execution of this program."
msgstr ""
-#: portato/gui/gtk/exception_handling.py:46
+#: portato/gui/gtk/exception_handling.py:47
msgid "Bug Detected"
msgstr ""
-#: portato/gui/gtk/exception_handling.py:47
+#: portato/gui/gtk/exception_handling.py:48
msgid ""
"It probably isn't fatal, but should be reported to the developers "
"nonetheless."
msgstr ""
-#: portato/gui/gtk/exception_handling.py:49
+#: portato/gui/gtk/exception_handling.py:50
msgid "Show Details"
msgstr ""
-#: portato/gui/gtk/exception_handling.py:71
-#: portato/gui/gtk/exception_handling.py:103
+#: portato/gui/gtk/exception_handling.py:73
+#: portato/gui/gtk/exception_handling.py:119
#, python-format
msgid ""
"Exception in thread \"%(thread)s\":\n"
"%(trace)s"
msgstr ""
-#: portato/gui/gtk/exception_handling.py:105
+#: portato/gui/gtk/exception_handling.py:89
+msgid "Save traceback..."
+msgstr ""
+
+#: portato/gui/gtk/exception_handling.py:121
#, python-format
msgid ""
"Exception:\n"
@@ -519,28 +523,28 @@ msgstr ""
msgid "Finishing startup"
msgstr ""
-#: portato/gui/gtk/windows.py:1026
+#: portato/gui/gtk/windows.py:1028
msgid "Options"
msgstr ""
-#: portato/gui/gtk/windows.py:1044
+#: portato/gui/gtk/windows.py:1046
msgid "Categories"
msgstr ""
-#: portato/gui/gtk/windows.py:1059
+#: portato/gui/gtk/windows.py:1061
msgid "Packages"
msgstr ""
-#: portato/gui/gtk/windows.py:1122
+#: portato/gui/gtk/windows.py:1124
#, python-format
msgid "Console (%(title)s)"
msgstr ""
-#: portato/gui/gtk/windows.py:1174
+#: portato/gui/gtk/windows.py:1176
msgid "use flags"
msgstr ""
-#: portato/gui/gtk/windows.py:1181
+#: portato/gui/gtk/windows.py:1183
msgid "masking keywords"
msgstr ""
diff --git a/portato/gui/gtk/dialogs.py b/portato/gui/gtk/dialogs.py
index 2520add..9da8cbd 100644
--- a/portato/gui/gtk/dialogs.py
+++ b/portato/gui/gtk/dialogs.py
@@ -71,3 +71,16 @@ def remove_queue_dialog ():
ret = askMB.run()
askMB.destroy()
return ret
+
+def file_chooser_dialog (title, parent):
+ fc = gtk.FileChooserDialog(title = title, parent = parent, action = gtk.FILE_CHOOSER_ACTION_SAVE, buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
+ fc.set_do_overwrite_confirmation(True)
+ ret = fc.run()
+
+ if ret == gtk.RESPONSE_ACCEPT:
+ ret = fc.get_filename()
+ else:
+ ret = None
+
+ fc.destroy()
+ return ret
diff --git a/portato/gui/gtk/exception_handling.py b/portato/gui/gtk/exception_handling.py
index 3d89560..673dd7e 100644
--- a/portato/gui/gtk/exception_handling.py
+++ b/portato/gui/gtk/exception_handling.py
@@ -11,7 +11,7 @@
#
# Written by René 'Necoro' Neumann
-from __future__ import absolute_import
+from __future__ import absolute_import, with_statement
import gtk, pango, gobject
import sys, traceback
@@ -20,7 +20,8 @@ from threading import Thread
from gettext import lgettext as _
from StringIO import StringIO
-from ...helper import error
+from ...helper import debug, error
+from .dialogs import file_chooser_dialog, io_ex_dialog
class GtkThread (Thread):
def run(self):
@@ -47,6 +48,7 @@ class UncaughtExceptionDialog(gtk.MessageDialog):
self.format_secondary_text(_("It probably isn't fatal, but should be reported to the developers nonetheless."))
self.add_button(_("Show Details"), 1)
+ self.add_button(gtk.STOCK_SAVE_AS, 2)
self.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)
# Details
@@ -66,10 +68,10 @@ class UncaughtExceptionDialog(gtk.MessageDialog):
self.vbox.add(self.tbFrame)
textbuffer = self.textview.get_buffer()
- text = get_trace(type, value, tb)
+ self.text = get_trace(type, value, tb)
if thread:
- text = _("Exception in thread \"%(thread)s\":\n%(trace)s") % {"thread": thread, "trace": text}
- textbuffer.set_text(text)
+ self.text = _("Exception in thread \"%(thread)s\":\n%(trace)s") % {"thread": thread, "trace": text}
+ textbuffer.set_text(self.text)
self.textview.set_size_request(gtk.gdk.screen_width()/2, gtk.gdk.screen_height()/3)
self.details = self.tbFrame
@@ -82,6 +84,20 @@ class UncaughtExceptionDialog(gtk.MessageDialog):
if resp == 1:
self.details.show_all()
self.set_response_sensitive(1, False)
+ elif resp == 2:
+ debug("Want to save")
+ file = file_chooser_dialog(_("Save traceback..."), self)
+ if file:
+ debug("Save to %s", file)
+
+ try:
+ with open(file, "w") as f:
+ f.writelines(self.text)
+ except IOError, e:
+ io_ex_dialog(e)
+
+ else:
+ debug("Nothing to save")
else:
break
self.destroy()