psa: remove old event feed items
[feedingit] / src / config.py
index 33b8957..7911299 100644 (file)
@@ -37,7 +37,7 @@ from mainthread import mainthread
 import logging
 logger = logging.getLogger(__name__)
 
-VERSION = "52"
+VERSION = "120"
 
 section = "FeedingIt"
 ranges = { "updateInterval":[0.5, 1, 2, 4, 8, 12, 24], "expiry":[24, 48, 72, 144, 288], "fontSize":range(12,24), "orientation":["Automatic", "Landscape", "Portrait"], "artFontSize":[10, 12, 14, 16, 18, 20], "feedsort":["Manual", "Most unread", "Least unread", "Most recent", "Least recent"] }
@@ -116,17 +116,10 @@ class Config():
 
 
         heading('Updating')
-        button = hildon.CheckButton(gtk.HILDON_SIZE_FINGER_HEIGHT)
-        button.set_label("Widget Based Automatic Update\n"
-                         + "(See FeedingIt widget for options)")
-        #button.set_active(self.config["autoupdate"])
-        #button.connect("toggled", self.button_toggled, "autoupdate")
-        vbox.pack_start(button, expand=False)
-        button = hildon.CheckButton(gtk.HILDON_SIZE_FINGER_HEIGHT)
-        button.set_label("Woodchuck-Based Automatic Update")
-        button.set_active(self.config["woodchuck"])
-        button.connect("toggled", self.button_toggled, "woodchuck")
-        vbox.pack_start(button, expand=False)
+        label = gtk.Label(gtk.HILDON_SIZE_FINGER_HEIGHT)
+        label.set_label("Use Woodchuck network daemon, or the home-screen widget for automatic updates.")
+        label.set_line_wrap(True)
+        vbox.pack_start(label, expand=False)
 
         try:
             import woodchuck
@@ -145,6 +138,11 @@ class Config():
             button.set_alignment(0,0,1,1)
             vbox.pack_start(button, expand=False)
         else:
+            button = hildon.CheckButton(gtk.HILDON_SIZE_FINGER_HEIGHT)
+            button.set_label("Woodchuck-Based Automatic Update")
+            button.set_active(self.config["woodchuck"])
+            button.connect("toggled", self.button_toggled, "woodchuck")
+            vbox.pack_start(button, expand=False)
             add_setting('updateInterval')
             add_setting('expiry')
 
@@ -238,13 +236,14 @@ class Config():
                   (configParser.getboolean, "autoupdate", False),
                   (configParser.getboolean, "woodchuck", True),
                   (configParser.getboolean, "askedAboutWoodchuck", False),
-                  (configParser.getint, "updateInterval", 4),
+                  (configParser.getfloat, "updateInterval", 4),
                   (configParser.get, "orientation", "Automatic"),
                   (configParser.getboolean, "imageCache", False),
                   (configParser.getboolean, "proxy", True),
                   (configParser.getboolean, "hidereadfeeds", False),
                   (configParser.getboolean, "hidereadarticles", False),
                   (configParser.getboolean, "extBrowser", False),
+                  (configParser.getboolean, "theme", True),
                   (configParser.get, "feedsort", "Manual"))
 
         for fetcher, name, default in values:
@@ -272,6 +271,7 @@ class Config():
         configParser.set(section, 'hidereadarticles', str(self.config["hidereadarticles"]))
         configParser.set(section, 'extBrowser', str(self.config["extBrowser"]))
         configParser.set(section, 'feedsort', str(self.config["feedsort"]))
+        configParser.set(section, 'theme', str(self.config["theme"]))
 
         # Writing our configuration file
         file = open(self.configFilename, 'wb')
@@ -301,8 +301,12 @@ class Config():
         return self.config["artFontSize"]
     def getExpiry(self):
         return self.config["expiry"]
+    def setExpiry(self, expiry):
+        self.config["expiry"] = expiry
     def isAutoUpdateEnabled(self):
         return self.config["autoupdate"]
+    def setAutoUpdateEnabled(self, value):
+        self.config["autoupdate"] = value
     def getWoodchuckEnabled(self):
         return self.config["woodchuck"]
     def getAskedAboutWoodchuck(self):
@@ -318,8 +322,14 @@ class Config():
         return "sans %s" % self.config["fontSize"]
     def getOrientation(self):
         return ranges["orientation"].index(self.config["orientation"])
+    def getOrientationChoices(self):
+        return ranges["orientation"]
+    def setOrientation(self, choice):
+        self.config["orientation"] = index 
     def getImageCache(self):
         return self.config["imageCache"]
+    def setImageCache(self, cache):
+        self.config["imageCache"] = bool(cache) 
     @mainthread
     def getProxy(self):
         if self.config["proxy"] == False:
@@ -332,9 +342,21 @@ class Config():
         return (False, None)
     def getHideReadFeeds(self):
         return self.config["hidereadfeeds"]
+    def setHideReadFeeds(self, setting):
+        self.config["hidereadfeeds"] = bool(setting)
     def getHideReadArticles(self):
         return self.config["hidereadarticles"]
+    def setHideReadArticles(self, setting):
+        self.config["hidereadarticles"] = bool(setting)
     def getOpenInExternalBrowser(self):
         return self.config["extBrowser"]
     def getFeedSortOrder(self):
         return self.config["feedsort"]
+    def getFeedSortOrderChoices(self):
+        return ranges["feedsort"]
+    def setFeedSortOrder(self, setting):
+        self.config["feedsort"] = setting
+    def getTheme(self):
+        return self.config["theme"]
+    def setTheme(self, theme):
+        self.config["theme"] = bool(theme)