summaryrefslogtreecommitdiff
path: root/portato/gui/windows
diff options
context:
space:
mode:
Diffstat (limited to 'portato/gui/windows')
-rw-r--r--portato/gui/windows/about.py2
-rw-r--r--portato/gui/windows/basic.py2
-rw-r--r--portato/gui/windows/mailinfo.py10
-rw-r--r--portato/gui/windows/main.py43
-rw-r--r--portato/gui/windows/pkglist.py6
-rw-r--r--portato/gui/windows/plugin.py12
-rw-r--r--portato/gui/windows/preference.py16
-rw-r--r--portato/gui/windows/search.py2
-rw-r--r--portato/gui/windows/splash.py2
9 files changed, 48 insertions, 47 deletions
diff --git a/portato/gui/windows/about.py b/portato/gui/windows/about.py
index 0d2ce1a..f59e791 100644
--- a/portato/gui/windows/about.py
+++ b/portato/gui/windows/about.py
@@ -10,7 +10,7 @@
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
-from __future__ import absolute_import, with_statement
+
import os
import gtk
diff --git a/portato/gui/windows/basic.py b/portato/gui/windows/basic.py
index 01d31e5..3f8c535 100644
--- a/portato/gui/windows/basic.py
+++ b/portato/gui/windows/basic.py
@@ -10,7 +10,7 @@
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
-from __future__ import absolute_import
+
# gtk stuff
import gtk
diff --git a/portato/gui/windows/mailinfo.py b/portato/gui/windows/mailinfo.py
index 4367482..3cdfb7d 100644
--- a/portato/gui/windows/mailinfo.py
+++ b/portato/gui/windows/mailinfo.py
@@ -10,7 +10,7 @@
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
-from __future__ import absolute_import, with_statement
+
import smtplib, socket
import time
@@ -152,7 +152,7 @@ class MailInfoWindow (AbstractDialog):
else: debug("TLS not supported in Python. Continuing without it.")
server.sendmail(self.addr, self.TO, self.message.as_string())
- except smtplib.SMTPRecipientsRefused, e:
+ except smtplib.SMTPRecipientsRefused as e:
if e.recipients[self.TO][0] < 500:
info(_("An error occurred while sending. I think we were greylisted. The error: %s") % e)
else: raise
@@ -164,11 +164,11 @@ class MailInfoWindow (AbstractDialog):
server.quit()
except smtplib.SMTPServerDisconnected:
pass # ignore this
- except socket.error, e:
+ except socket.error as e:
gobject.idle_add(mail_failure_dialog, "%s (Code: %s)" % (e.args[1], e.args[0]))
- except smtplib.SMTPResponseException, e:
+ except smtplib.SMTPResponseException as e:
gobject.idle_add(mail_failure_dialog, "%s (Code: %s)" % (e.smtp_error, e.smtp_code))
- except smtplib.SMTPException, e:
+ except smtplib.SMTPException as e:
gobject.idle_add(mail_failure_dialog, e.args)
def cb_cancel_clicked (self, *args):
diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py
index 3c868e8..ac1d376 100644
--- a/portato/gui/windows/main.py
+++ b/portato/gui/windows/main.py
@@ -10,7 +10,7 @@
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
-from __future__ import absolute_import, with_statement
+from future_builtins import map, filter, zip
# gtk stuff
import gtk
@@ -199,15 +199,15 @@ class PackageTable:
try:
try:
self.queue.append(self.pkg.get_cpv(), type = type, update = update)
- except PackageNotFoundException, e:
+ except PackageNotFoundException as e:
if dialogs.unmask_dialog(e[0]) == gtk.RESPONSE_YES:
self.queue.append(self.pkg.get_cpv(), type = type, unmask = True, update = update)
- except BlockedException, e:
+ except BlockedException as e:
dialogs.blocked_dialog(e[0], e[1])
else:
try:
self.queue.append(self.pkg.get_cpv(), type = "uninstall")
- except PackageNotFoundException, e:
+ except PackageNotFoundException as e:
error(_("Package could not be found: %s"), e[0])
#masked_dialog(e[0])
@@ -464,7 +464,7 @@ class MainWindow (Window):
splash(_("Loading Config"))
try:
self.cfg = Config(CONFIG_LOCATION)
- except IOError, e:
+ except IOError as e:
dialogs.io_ex_dialog(e)
raise
@@ -521,7 +521,7 @@ class MainWindow (Window):
# notebooks
self.sysNotebook = self.tree.get_widget("systemNotebook")
self.pkgNotebook = self.tree.get_widget("packageNotebook")
- self.set_notebook_tabpos(map(PreferenceWindow.tabpos.get, map(int, (self.cfg.get("packageTabPos", "GUI"), self.cfg.get("systemTabPos", "GUI")))))
+ self.set_notebook_tabpos(list(map(PreferenceWindow.tabpos.get, list(map(int, (self.cfg.get("packageTabPos", "GUI"), self.cfg.get("systemTabPos", "GUI")))))))
slots.NotebookSlot(self.pkgNotebook, gtk.Widget, "Package Notebook")
# the useScroll
@@ -555,9 +555,9 @@ class MainWindow (Window):
try:
try:
self.load_session()
- except OldSessionException, e:
+ except OldSessionException as e:
self.load_session(e)
- except SessionException, e:
+ except SessionException as e:
warning(str(e))
self.load_session(defaults_only = True) # last ressort
@@ -891,7 +891,7 @@ class MainWindow (Window):
def build_type_combo (self):
model = gtk.ListStore(int, str)
- for k,v in self.db.TYPES.iteritems():
+ for k,v in self.db.TYPES.items():
model.append((k,v))
self.typeCombo.set_model(model)
@@ -915,7 +915,7 @@ class MainWindow (Window):
"""
try:
self.session = Session("gui.cfg", name="GUI", oldfiles=["gtk_session.cfg"])
- except (OSError, IOError), e:
+ except (OSError, IOError) as e:
dialogs.io_ex_dialog(e)
return
@@ -953,7 +953,7 @@ class MainWindow (Window):
# PANED
def load_paned (*pos):
- pos = map(int, pos)
+ pos = list(map(int, pos))
[x.set_position(p) for x,p in zip((self.vpaned, self.hpaned), pos)]
def save_paned ():
@@ -1056,7 +1056,7 @@ class MainWindow (Window):
self.session.add_handler(value)
# set the simple ones :)
- map(_add,[
+ list(map(_add,[
([("gtksessionversion", "session")], load_session_version, lambda: SESSION_VERSION),
(["width", "height"], lambda w,h: self.window.resize(int(w), int(h)), self.window.get_size),
(["vpanedpos", "hpanedpos"], load_paned, save_paned),
@@ -1064,7 +1064,7 @@ class MainWindow (Window):
(["pkgsel"], load_pkg_selection, save_pkg_selection, ["portato@0"]),
(["searchtype"], load_search_type, lambda: self.db.type)
#([("merge", "queue"), ("unmerge", "queue"), ("oneshot", "queue")], load_queue, save_queue),
- ])
+ ]))
# set the plugins
queue = plugin.get_plugin_queue()
@@ -1073,7 +1073,8 @@ class MainWindow (Window):
self.session.add_handler(([(p.name.replace(" ","_").replace(":","_"), "plugins")], load_plugin(p), save_plugin(p)))
# the other things
- def load_cfg ((name, cat)):
+ def load_cfg (pkg):
+ (name, cat) = pkg
def load (v):
self.cfg.set_session(name, cat, v)
@@ -1086,7 +1087,7 @@ class MainWindow (Window):
self.session.add_handler(([(name, cat)], load, save))
- map(load_cfg, [("prefheight", "GUI"), ("prefwidth", "GUI")])
+ list(map(load_cfg, [("prefheight", "GUI"), ("prefwidth", "GUI")]))
# now we have the handlers -> load
self.session.load(defaults_only)
@@ -1298,7 +1299,7 @@ class MainWindow (Window):
self.selCP = "%s/%s" % (store.get_value(it, 2), store.get_value(it, 1))
try:
self.fill_version_list(self.selCP)
- except VersionsNotFoundException, e:
+ except VersionsNotFoundException as e:
warning(_("No versions of package '%s' found!") % self.selCP)
dialogs.no_versions_dialog(self.selCP)
self.db.disable(self.selCP)
@@ -1438,7 +1439,7 @@ class MainWindow (Window):
self.session.set("useflags", str(dialogs.changed_flags_dialog(_("use flags"))[1]), "dialogs")
try:
flags.write_use_flags()
- except IOError, e:
+ except IOError as e:
dialogs.io_ex_dialog(e)
return True
@@ -1451,7 +1452,7 @@ class MainWindow (Window):
try:
flags.write_masked()
flags.write_testing()
- except IOError, e:
+ except IOError as e:
dialogs.io_ex_dialog(e)
return True
else:
@@ -1485,12 +1486,12 @@ class MainWindow (Window):
try:
for pkg, old_pkg in updating:
self.queue.append(pkg.get_cpv(), type = "update", unmask = False)
- except PackageNotFoundException, e:
+ except PackageNotFoundException as e:
if dialogs.unmask_dialog(e[0]) == gtk.RESPONSE_YES:
for pkg, old_pkg in updating:
self.queue.append(pkg.get_cpv(), type = "update", unmask = True)
- except BlockedException, e:
+ except BlockedException as e:
dialogs.blocked_dialog(e[0], e[1])
self.queue.remove_children(self.queueTree.get_update_it())
@@ -1567,7 +1568,7 @@ class MainWindow (Window):
flags.write_use_flags()
flags.write_testing()
flags.write_masked()
- except IOError, e:
+ except IOError as e:
dialogs.io_ex_dialog(e)
@Window.watch_cursor
diff --git a/portato/gui/windows/pkglist.py b/portato/gui/windows/pkglist.py
index df3ef46..956d929 100644
--- a/portato/gui/windows/pkglist.py
+++ b/portato/gui/windows/pkglist.py
@@ -10,7 +10,7 @@
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
-from __future__ import absolute_import
+
import gtk
from .basic import AbstractDialog
@@ -107,11 +107,11 @@ class PkgListWindow (AbstractDialog):
try:
try:
self.queue.append(item, "install", oneshot = True)
- except PackageNotFoundException, e:
+ except PackageNotFoundException as e:
if unmask_dialog(e[0]) == gtk.RESPONSE_YES :
self.queue.append(item, "install", unmask = True, oneshot = True)
- except BlockedException, e:
+ except BlockedException as e:
blocked_dialog(e[0], e[1])
else:
for item in items:
diff --git a/portato/gui/windows/plugin.py b/portato/gui/windows/plugin.py
index 89d38f5..14d38b1 100644
--- a/portato/gui/windows/plugin.py
+++ b/portato/gui/windows/plugin.py
@@ -10,7 +10,7 @@
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
-from __future__ import absolute_import
+from future_builtins import map, filter, zip
import gtk
@@ -40,8 +40,8 @@ class PluginWindow (AbstractDialog):
self.inst = []
self.ninst = []
- self.buttons = map(self.tree.get_widget, ("disabledRB", "tempEnabledRB", "enabledRB", "tempDisabledRB"))
- map(lambda b: b.set_mode(False), self.buttons)
+ self.buttons = list(map(self.tree.get_widget, ("disabledRB", "tempEnabledRB", "enabledRB", "tempDisabledRB")))
+ list(map(lambda b: b.set_mode(False), self.buttons))
self.descrLabel = self.tree.get_widget("descrLabel")
self.authorLabel = self.tree.get_widget("authorLabel")
@@ -108,7 +108,7 @@ class PluginWindow (AbstractDialog):
debug("new changed plugins: %s => %d", plugin.name, state)
def cb_ok_clicked (self, btn):
- for plugin, val in self.changedPlugins.iteritems():
+ for plugin, val in self.changedPlugins.items():
plugin.status = val
self.close()
@@ -164,10 +164,10 @@ class PluginWindow (AbstractDialog):
try:
try:
self.queue.append(pkg, type = "install")
- except PackageNotFoundException, e:
+ except PackageNotFoundException as e:
if unmask_dialog(e[0]) == gtk.RESPONSE_YES:
self.queue.append(pkg, type = "install", unmask = True)
- except BlockedException, e:
+ except BlockedException as e:
blocked_dialog(e[0], e[1])
return True
diff --git a/portato/gui/windows/preference.py b/portato/gui/windows/preference.py
index 021788c..4bf5b97 100644
--- a/portato/gui/windows/preference.py
+++ b/portato/gui/windows/preference.py
@@ -10,7 +10,7 @@
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
-from __future__ import absolute_import
+from future_builtins import map, filter, zip
import gtk
@@ -111,14 +111,14 @@ class PreferenceWindow (AbstractDialog):
hintEB.modify_bg(gtk.STATE_NORMAL, get_color(self.cfg, "prefhint"))
# the checkboxes
- for box, val in self.checkboxes.iteritems():
+ for box, val in self.checkboxes.items():
if isinstance(val, tuple):
self.tree.get_widget(box).set_active(self.cfg.get_boolean(val[0], section = val[1]))
else:
self.tree.get_widget(box).set_active(self.cfg.get_boolean(val))
# the edits
- for edit, val in self.edits.iteritems():
+ for edit, val in self.edits.items():
if isinstance(val,tuple):
self.tree.get_widget(edit).set_text(self.cfg.get(val[0], section = val[1]))
else:
@@ -170,7 +170,7 @@ class PreferenceWindow (AbstractDialog):
ctr = 0
active = 0
- for k, (name, desc) in db.types.iteritems():
+ for k, (name, desc) in db.types.items():
if k == dbtype:
active = ctr
@@ -191,13 +191,13 @@ class PreferenceWindow (AbstractDialog):
def _save(self):
"""Sets all options in the Config-instance."""
- for box, val in self.checkboxes.iteritems():
+ for box, val in self.checkboxes.items():
if isinstance(val, tuple):
self.cfg.set(val[0], self.tree.get_widget(box).get_active(), section = val[1])
else:
self.cfg.set(val, self.tree.get_widget(box).get_active())
- for edit, val in self.edits.iteritems():
+ for edit, val in self.edits.items():
if isinstance(val,tuple):
self.cfg.set(val[0], self.tree.get_widget(edit).get_text(), section = val[1])
else:
@@ -218,7 +218,7 @@ class PreferenceWindow (AbstractDialog):
self.cfg.set("packageTabPos", str(pkgPos), section = "GUI")
self.cfg.set("systemTabPos", str(sysPos), section = "GUI")
- self.tabpos_fn(map(self.tabpos.get, (pkgPos, sysPos)))
+ self.tabpos_fn(list(map(self.tabpos.get, (pkgPos, sysPos))))
self.linkbtn_fn(self.cfg.get("browserCmd", section="GUI"))
@@ -272,7 +272,7 @@ class PreferenceWindow (AbstractDialog):
self._save()
try:
self.cfg.write()
- except IOError, e:
+ except IOError as e:
io_ex_dialog(e)
self.window.destroy()
diff --git a/portato/gui/windows/search.py b/portato/gui/windows/search.py
index f9191d7..9485396 100644
--- a/portato/gui/windows/search.py
+++ b/portato/gui/windows/search.py
@@ -10,7 +10,7 @@
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
-from __future__ import absolute_import
+
import gtk
from .basic import AbstractDialog
diff --git a/portato/gui/windows/splash.py b/portato/gui/windows/splash.py
index 2e9d5a8..bd46f62 100644
--- a/portato/gui/windows/splash.py
+++ b/portato/gui/windows/splash.py
@@ -10,7 +10,7 @@
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
-from __future__ import absolute_import
+
import gtk