From: Yves Marcoz Date: Fri, 6 Jan 2012 06:05:52 +0000 (-0800) Subject: psa: added new get functions. X-Git-Url: http://git.maemo.org/git/?a=commitdiff_plain;h=8343d987e0e52c552c5294541e0bb2c913cc69f6;p=feedingit psa: added new get functions. config is now saved right away if new setting detected --- diff --git a/psa_harmattan/feedingit/pysrc/config.py b/psa_harmattan/feedingit/pysrc/config.py index 7911299..af41540 100644 --- a/psa_harmattan/feedingit/pysrc/config.py +++ b/psa_harmattan/feedingit/pysrc/config.py @@ -231,7 +231,7 @@ class Config(): # The function to use to fetch the parameter, the parameter's # name and the default value. values = ((configParser.getint, "fontSize", 17), - (configParser.getint, "artFontSize", 14), + (configParser.getint, "artFontSize", 24), (configParser.getint, "expiry", 24), (configParser.getboolean, "autoupdate", False), (configParser.getboolean, "woodchuck", True), @@ -246,13 +246,17 @@ class Config(): (configParser.getboolean, "theme", True), (configParser.get, "feedsort", "Manual")) + newSetting = False for fetcher, name, default in values: try: v = fetcher(section, name) except Exception: + newSetting = True logger.exception("Reading config variable %s", name) v = default self.config[name] = v + if newSetting: + self.saveConfig() def saveConfig(self): configParser = RawConfigParser() @@ -297,8 +301,12 @@ class Config(): def getFontSize(self): return self.config["fontSize"] + def setFontSize(self, value): + self.config["fontSize"] = value def getArtFontSize(self): return self.config["artFontSize"] + def setArtFontSize(self, value): + self.config["artFontSize"] = value def getExpiry(self): return self.config["expiry"] def setExpiry(self, expiry):