summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2010-04-09 23:33:52 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2010-04-09 23:33:52 +0200
commit96cc1e3964d5ab94847a5756f0494f112b3dac15 (patch)
tree306fd4621543948f0675966197f85464505cecb7
parentc7b564ac84ad9fb7a72ee0896c2616b0383c68de (diff)
downloadportato-96cc1e3964d5ab94847a5756f0494f112b3dac15.tar.gz
portato-96cc1e3964d5ab94847a5756f0494f112b3dac15.tar.bz2
portato-96cc1e3964d5ab94847a5756f0494f112b3dac15.zip
Readded a Session.get_bool() method
-rw-r--r--portato/gui/windows/main.py6
-rw-r--r--portato/session.py12
2 files changed, 12 insertions, 6 deletions
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