From c0b751facc2dd5ca6dc6bf15a855e4d22dd24356 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Mon, 23 Jun 2008 23:42:57 +0200 Subject: allowed to dismiss the warning dialogs for keywords/useflags --- doc/Changelog | 1 + portato/gui/dialogs.py | 8 ++++++-- portato/gui/windows/main.py | 6 ++++-- portato/session.py | 13 +++++++++++-- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index c477bd0..818fecf 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -5,6 +5,7 @@ next: - increased the maximum scrollback lines - now only use external "shm" package - allow to send bug report directly per mail +- allowed to dismiss the warning dialogs for keywords/useflags - bug fixes 0.10: diff --git a/portato/gui/dialogs.py b/portato/gui/dialogs.py index 0313cae..8f0c78c 100644 --- a/portato/gui/dialogs.py +++ b/portato/gui/dialogs.py @@ -57,11 +57,15 @@ def nothing_found_dialog (): return ret def changed_flags_dialog (what = "flags"): + check = gtk.CheckButton(_("Do not show this dialog again.")) hintMB = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, - _("You have changed %s. Portato will write these changes into the appropriate files. Please backup them if you think it is necessairy.") % what) + _("You have changed %s.\nPortato will write these changes into the appropriate files.\nPlease backup them if you think it is necessairy.") % what) + hintMB.vbox.add(check) + hintMB.vbox.show_all() ret = hintMB.run() hintMB.destroy() - return ret + + 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. :)")) diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py index 8e5eafb..364810d 100644 --- a/portato/gui/windows/main.py +++ b/portato/gui/windows/main.py @@ -1357,7 +1357,8 @@ class MainWindow (Window): """Execute the current queue.""" if len(flags.newUseFlags) > 0: - changed_flags_dialog(_("use flags")) + if not self.session.get_boolean("useflags", "dialogs"): + self.session.set("useflags", changed_flags_dialog(_("use flags"))[1], "dialogs") try: flags.write_use_flags() except IOError, e: @@ -1368,7 +1369,8 @@ class MainWindow (Window): debug("new masked: %s",flags.new_masked) debug("new unmasked: %s", flags.new_unmasked) debug("new testing: %s", flags.newTesting) - changed_flags_dialog(_("masking keywords")) + if not self.session.get_boolean("keywords", "dialogs"): + self.session.set("keywords", changed_flags_dialog(_("masking keywords"))[1], "dialogs") try: flags.write_masked() flags.write_testing() diff --git a/portato/session.py b/portato/session.py index da15171..5d1a640 100644 --- a/portato/session.py +++ b/portato/session.py @@ -105,9 +105,18 @@ class Session (object): except SectionNotFoundException: self._cfg.add_section(section) self._cfg.add(key, value, section, with_blankline = False) - + def get (self, key, section): - return self._cfg.get(key, section) + try: + return self._cfg.get(key, section) + except KeyError: + return None + + def get_boolean (self, key, section): + try: + return self._cfg.get_boolean(key, section) + except KeyError: + return None def check_version (self, vers): pass # do nothing atm -- cgit v1.2.3