From c0ef9b8f98eaf9fe46b87759d8083a8bd24620fa Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Sat, 6 Mar 2010 16:26:29 +0100 Subject: Rewrote Session as to use the normal ConfigParser and not our own one (cherry picked from commit 397a31e6deb851de102bca3d7c8d754f40b0656d) --- portato/gui/windows/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'portato/gui/windows/main.py') diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py index a06756d..bc40a1f 100644 --- a/portato/gui/windows/main.py +++ b/portato/gui/windows/main.py @@ -1070,7 +1070,7 @@ class MainWindow (Window): queue = plugin.get_plugin_queue() if queue: for p in queue.get_plugins(): - self.session.add_handler(([(p.name.replace(" ","_"), "plugins")], load_plugin(p), save_plugin(p))) + self.session.add_handler(([(p.name.replace(" ","_").replace(":","_"), "plugins")], load_plugin(p), save_plugin(p))) # the other things def load_cfg ((name, cat)): -- cgit v1.2.3-54-g00ecf From c7b564ac84ad9fb7a72ee0896c2616b0383c68de Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Thu, 1 Apr 2010 15:00:12 +0200 Subject: Fixed bug from switching to ConfigParser --- portato/gui/windows/main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'portato/gui/windows/main.py') diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py index bc40a1f..3baf71c 100644 --- a/portato/gui/windows/main.py +++ b/portato/gui/windows/main.py @@ -1434,8 +1434,8 @@ class MainWindow (Window): """Execute the current queue.""" if len(flags.newUseFlags) > 0: - if not self.session.get_boolean("useflags", "dialogs"): - self.session.set("useflags", dialogs.changed_flags_dialog(_("use flags"))[1], "dialogs") + if not bool(self.session.get("useflags", "dialogs")): + self.session.set("useflags", str(dialogs.changed_flags_dialog(_("use flags"))[1]), "dialogs") try: flags.write_use_flags() except IOError, e: @@ -1446,8 +1446,8 @@ class MainWindow (Window): debug("new masked: %s",flags.new_masked) debug("new unmasked: %s", flags.new_unmasked) debug("new testing: %s", flags.newTesting) - if not self.session.get_boolean("keywords", "dialogs"): - self.session.set("keywords", dialogs.changed_flags_dialog(_("masking keywords"))[1], "dialogs") + if not bool(self.session.get("keywords", "dialogs")): + self.session.set("keywords", str(dialogs.changed_flags_dialog(_("masking keywords"))[1]), "dialogs") try: flags.write_masked() flags.write_testing() -- cgit v1.2.3-54-g00ecf From 96cc1e3964d5ab94847a5756f0494f112b3dac15 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Fri, 9 Apr 2010 23:33:52 +0200 Subject: Readded a Session.get_bool() method --- portato/gui/windows/main.py | 6 +++--- portato/session.py | 12 +++++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'portato/gui/windows/main.py') diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py index 3baf71c..665f1d6 100644 --- a/portato/gui/windows/main.py +++ b/portato/gui/windows/main.py @@ -1434,7 +1434,7 @@ class MainWindow (Window): """Execute the current queue.""" if len(flags.newUseFlags) > 0: - if not bool(self.session.get("useflags", "dialogs")): + if not self.session.get_bool("useflags", "dialogs"): self.session.set("useflags", str(dialogs.changed_flags_dialog(_("use flags"))[1]), "dialogs") try: flags.write_use_flags() @@ -1446,7 +1446,7 @@ class MainWindow (Window): debug("new masked: %s",flags.new_masked) debug("new unmasked: %s", flags.new_unmasked) debug("new testing: %s", flags.newTesting) - if not bool(self.session.get("keywords", "dialogs")): + if not self.session.get_bool("keywords", "dialogs"): self.session.set("keywords", str(dialogs.changed_flags_dialog(_("masking keywords"))[1]), "dialogs") try: flags.write_masked() @@ -1511,7 +1511,7 @@ class MainWindow (Window): gobject.idle_add(cb_idle_append, updating) finally: self.window.window.set_cursor(None) - + GtkThread(name="Update-Thread", target=__update).start() return True diff --git a/portato/session.py b/portato/session.py index be13275..ebf49af 100644 --- a/portato/session.py +++ b/portato/session.py @@ -28,9 +28,6 @@ class Session (object): A small class allowing to save certain states of a program. This class works in a quite abstract manner, as it works with handlers, which define what options to use out of the config file and how to apply them to the program. - - Note: This class currently does not work with boolean config options. If you - want to define boolean values, use 0 and 1. This is future proof. """ # the current session format version @@ -159,6 +156,15 @@ class Session (object): return self._cfg.get(section, key) except NoSuchThing: return None + + def get_bool (self, key, section = None): + if section is None: section = self._name + section = section.upper() + + try: + return self._cfg.getboolean(section, key) + except NoSuchThing, ValueError: + return None def remove (self, key, section = None): if section is None: section = self._name -- cgit v1.2.3-54-g00ecf From 359309950a1283dbbf9df6ce1085838087cfc262 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Fri, 9 Apr 2010 23:38:24 +0200 Subject: Show dialog, that update world might not work as expected --- portato/gui/dialogs.py | 11 +++++++++++ portato/gui/windows/main.py | 9 ++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'portato/gui/windows/main.py') diff --git a/portato/gui/dialogs.py b/portato/gui/dialogs.py index 7ad5c7f..2cc2d6b 100644 --- a/portato/gui/dialogs.py +++ b/portato/gui/dialogs.py @@ -83,6 +83,17 @@ def changed_flags_dialog (what = "flags"): return ret, check.get_active() +def update_world_warning_dialog (): + check = gtk.CheckButton(_("Do not show this dialog again.")) + hintMB = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_WARNING, gtk.BUTTONS_OK, _("'Update World' may be giving errors")) + hintMB.format_secondary_text(_("Due to the fast changing portage, 'update world' might not work correctly or even throw errors.\nThis will be fixed (hopefully) in the next release.")) + hintMB.vbox.add(check) + hintMB.vbox.show_all() + ret = hintMB.run() + hintMB.destroy() + + return ret, check.get_active() + def remove_deps_dialog (): infoMB = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, _("You cannot remove dependencies. :)")) ret = infoMB.run() diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py index 665f1d6..0ec35a2 100644 --- a/portato/gui/windows/main.py +++ b/portato/gui/windows/main.py @@ -1512,7 +1512,14 @@ class MainWindow (Window): finally: self.window.window.set_cursor(None) - GtkThread(name="Update-Thread", target=__update).start() + # for some reason, I have to create the thread before displaying the dialog + # else the GUI hangs + t = GtkThread(name="Update-Thread", target=__update) + + if not self.session.get_bool("update_world_warning", "dialogs"): + self.session.set("update_world_warning", str(dialogs.update_world_warning_dialog()[1]), "dialogs") + + t.start() return True -- cgit v1.2.3-54-g00ecf