summaryrefslogtreecommitdiff
path: root/portato/gui
diff options
context:
space:
mode:
Diffstat (limited to 'portato/gui')
-rw-r--r--portato/gui/dialogs.py7
-rw-r--r--portato/gui/windows/mailinfo.py30
-rw-r--r--portato/gui/windows/main.py19
-rw-r--r--portato/gui/windows/plugin.py5
4 files changed, 34 insertions, 27 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):
diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py
index 364810d..b4e6353 100644
--- a/portato/gui/windows/main.py
+++ b/portato/gui/windows/main.py
@@ -607,13 +607,13 @@ class MainWindow (Window):
# set plugins and plugin-menu
splash(_("Loading Plugins"))
- plugin.load_plugins("gtk")
- menus = plugin.get_plugin_queue().get_plugin_menus()
+ plugin.load_plugins()
+ menus = [p.menus for p in plugin.get_plugin_queue().get_plugins()]
if menus:
self.tree.get_widget("pluginMenuItem").set_no_show_all(False)
pluginMenu = self.tree.get_widget("pluginMenu")
- for m in menus:
+ for m in itt.chain(*menus):
item = gtk.MenuItem(m.label)
item.connect("activate", m.call)
pluginMenu.append(item)
@@ -1082,13 +1082,8 @@ class MainWindow (Window):
def save_plugin (p):
def _save ():
- stat_on = p.status >= p.STAT_ENABLED
- hard_on = not p.get_option("disabled")
-
- if stat_on != hard_on:
- return int(stat_on)
- else:
- return ""
+ return int(p.status >= p.STAT_ENABLED)
+
return _save
# SESSION VERSION
@@ -1553,8 +1548,8 @@ class MainWindow (Window):
if queue is None:
plugins = []
else:
- plugins = queue.get_plugins()
-
+ plugins = list(queue.get_plugins())
+
PluginWindow(self.window, plugins)
return True
diff --git a/portato/gui/windows/plugin.py b/portato/gui/windows/plugin.py
index 17c5326..9760658 100644
--- a/portato/gui/windows/plugin.py
+++ b/portato/gui/windows/plugin.py
@@ -15,6 +15,7 @@ from __future__ import absolute_import
import gtk
from .basic import AbstractDialog
+from ...backend import system
from ...helper import debug
class PluginWindow (AbstractDialog):
@@ -64,7 +65,7 @@ class PluginWindow (AbstractDialog):
self.window.show_all()
def build_dep_list (self):
- store = gtk.TreeStore(gtk.gdk.Pixbuf, str)
+ store = gtk.ListStore(gtk.gdk.Pixbuf, str)
self.depList.set_model(store)
@@ -113,7 +114,7 @@ class PluginWindow (AbstractDialog):
if not plugin.description:
self.descrLabel.hide()
else:
- self.descrLabel.set_label(plugin.description)
+ self.descrLabel.set_markup(plugin.description)
self.descrLabel.show()
self.authorLabel.set_label(plugin.author)