Mercurial > hg > Feedworm
changeset 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 | 0604e374c1d6 |
children | a8442c3487b5 |
files | Preferences.py PreferencesDialog.py util.py |
diffstat | 3 files changed, 12 insertions(+), 7 deletions(-) [+] |
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)
--- a/PreferencesDialog.py Fri May 14 15:24:51 2010 +0200 +++ b/PreferencesDialog.py Sun May 16 07:54:24 2010 +0200 @@ -17,7 +17,10 @@ self.ui.startMaximized.setChecked(maximized) def startMaximizedChanged(self, change): - self.preferences.setStartMaximized(change) + if change: + self.preferences.setStartMaximized(True) + else: + self.preferences.setStartMaximized(False) def accept(self): self.session.commit()