diff Preferences.py @ 46:03358c113170

Better preferences handling: the GUI's responsibility is to convert the input from the event into a boolean value
author Dirk Olmes <dirk@xanthippe.ping.de>
date Sun, 16 May 2010 07:54:24 +0200
parents be990ac6e478
children db35ab7753f0
line wrap: on
line diff
--- a/Preferences.py	Fri May 14 15:24:51 2010 +0200
+++ b/Preferences.py	Sun May 16 07:54:24 2010 +0200
@@ -15,7 +15,7 @@
         else:
             pref = Preference.forKey(key, self.session)
             if pref is None:
-                pref = Preference(key, defaultValue)
+                pref = Preference(key, str(defaultValue))
                 self.session.add(pref)
             self.cache[key] = pref
             return pref
@@ -25,9 +25,5 @@
         return util.str2bool(pref.value)
 
     def setStartMaximized(self, flag):
-        """ Convert flag to boolean so that a defined value is stored in the DB """
-        boolValue = False
-        if flag:
-            boolValue = True
         pref = self._cachedPreference(START_MAXIMIZED)
-        pref.value = boolValue
+        pref.value = util.bool2str(flag)