summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2008-06-25 11:39:47 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2008-06-25 11:39:47 +0200
commit01f01abb51af0639bd0e1fccd4ad5fccd5ca074c (patch)
treeaa7eb521a83be88e696bc19c79fa26eff4a3d2d3
parent235a2b16ef2b6e562ce31a81f9c69451d6da6a39 (diff)
downloadportato-01f01abb51af0639bd0e1fccd4ad5fccd5ca074c.tar.gz
portato-01f01abb51af0639bd0e1fccd4ad5fccd5ca074c.tar.bz2
portato-01f01abb51af0639bd0e1fccd4ad5fccd5ca074c.zip
Added mail error message dialog
-rw-r--r--portato/gui/dialogs.py7
-rw-r--r--portato/gui/windows/mailinfo.py30
2 files changed, 24 insertions, 13 deletions
diff --git a/portato/gui/dialogs.py b/portato/gui/dialogs.py
index 8f0c78c..7f8a736 100644
--- a/portato/gui/dialogs.py
+++ b/portato/gui/dialogs.py
@@ -13,6 +13,13 @@
import gtk
from ..helper import error
+def mail_failure_dialog(e):
+ dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, _("Mail could not be sent"))
+ dialog.format_secondary_text(_("The error was: %s") % e)
+ ret = dialog.run()
+ dialog.destroy()
+ return ret
+
def queue_not_empty_dialog():
dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_QUESTION, gtk.BUTTONS_NONE, _("There are some packages in the emerge queue and/or an emerge process is running.\nDo you really want to quit?"))
#dialog.add_buttons(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_SAVE, gtk.RESPONSE_YES, gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)
diff --git a/portato/gui/windows/mailinfo.py b/portato/gui/windows/mailinfo.py
index 8e476c6..1b5735a 100644
--- a/portato/gui/windows/mailinfo.py
+++ b/portato/gui/windows/mailinfo.py
@@ -12,11 +12,12 @@
from __future__ import absolute_import
-import smtplib
+import smtplib, socket
import time
from .basic import AbstractDialog
from ..utils import GtkThread
+from ..dialogs import mail_failure_dialog
from ...helper import debug, info
from ...constants import VERSION
@@ -59,20 +60,23 @@ Subject: %s
self.message = message
def send (self):
- debug("Connecting to server")
- server = smtplib.SMTP("mail.necoro.eu")
- debug("Sending mail")
try:
+ debug("Connecting to server")
+ server = smtplib.SMTP("mail.necoro.eu")
+ debug("Sending mail")
try:
- server.sendmail(self.addr, self.TO, self.message)
- except smtplib.SMTPRecipientsRefused, e:
- info(_("An error occurred while sending. I think we where greylisted. The error: %s") % e)
- info(_("Wait 60 seconds and try again."))
- time.sleep(60)
- server.sendmail(self.addr, self.TO, self.message)
- debug("Sent")
- finally:
- server.quit()
+ try:
+ server.sendmail(self.addr, self.TO, self.message)
+ except smtplib.SMTPRecipientsRefused, e:
+ info(_("An error occurred while sending. I think we where greylisted. The error: %s") % e)
+ info(_("Wait 60 seconds and try again."))
+ time.sleep(60)
+ server.sendmail(self.addr, self.TO, self.message)
+ debug("Sent")
+ finally:
+ server.quit()
+ except socket.error, e:
+ mail_failure_dialog("%s (Code: %s)" % (e.args[1], e.args[0]))
def cb_cancel_clicked (self, *args):
>1-1/+1 2020-02-17Revert "Local Changes"René 'Necoro' Neumann2-5/+3 2020-02-17Update vundleRené 'Necoro' Neumann1-0/+0 2020-02-17Enable secondary screen in urxvtRené 'Necoro' Neumann1-0/+1 2020-02-17Local ChangesRené 'Necoro' Neumann2-3/+5 2018-06-10[i3] Replace icons by font awesomeRené 'Necoro' Neumann24-149/+13 2018-06-10[i3] Remove obsolete pidgin stuffRené 'Necoro' Neumann2-36/+0 2018-06-10[zsh] Remove obsolete isabelle functionsRené 'Necoro' Neumann2-112/+0 2018-06-10Misc changesRené 'Necoro' Neumann3-0/+7 2018-06-10[git] Update email addressRené 'Necoro' Neumann1-1/+1 2018-06-10Enhance cci scriptRené 'Necoro' Neumann1-15/+12 2017-11-18Some windows setupRené 'Necoro' Neumann2-1/+6 2017-10-08[zsh] Use zcalc instead of bcRené 'Necoro' Neumann1-5/+4 2017-10-08[zsh] CalculatorRené 'Necoro' Neumann1-0/+8 2017-10-08Some vim changes.René 'Necoro' Neumann4-28/+17 2017-10-08Delete old stuff.René 'Necoro' Neumann5-71/+1