psa: remove old event feed items
[feedingit] / src / config.py
index 5b28e2d..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("Time-Based Automatic Update\n"
-                         + "(requires use of FeedingIt widget)")
-        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
@@ -144,9 +137,14 @@ class Config():
             button.connect("clicked", install_woodchuck_clicked)
             button.set_alignment(0,0,1,1)
             vbox.pack_start(button, expand=False)
-
-        add_setting('updateInterval')
-        add_setting('expiry')
+        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')
 
         heading('Network')
         button = hildon.CheckButton(gtk.HILDON_SIZE_FINGER_HEIGHT)
@@ -237,13 +235,15 @@ class Config():
                   (configParser.getint, "expiry", 24),
                   (configParser.getboolean, "autoupdate", False),
                   (configParser.getboolean, "woodchuck", True),
-                  (configParser.getint, "updateInterval", 4),
+                  (configParser.getboolean, "askedAboutWoodchuck", False),
+                  (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:
@@ -263,6 +263,7 @@ class Config():
         configParser.set(section, 'autoupdate', str(self.config["autoupdate"]))
         configParser.set(section, 'updateInterval', str(self.config["updateInterval"]))
         configParser.set(section, 'woodchuck', str(self.config["woodchuck"]))
+        configParser.set(section, 'askedAboutWoodchuck', str(self.config["askedAboutWoodchuck"]))
         configParser.set(section, 'orientation', str(self.config["orientation"]))
         configParser.set(section, 'imageCache', str(self.config["imageCache"]))
         configParser.set(section, 'proxy', str(self.config["proxy"]))
@@ -270,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')
@@ -299,10 +301,19 @@ 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):
+        return self.config["askedAboutWoodchuck"]
+    def setAskedAboutWoodchuck(self, value):
+        self.config["askedAboutWoodchuck"] = value
+        self.saveConfig()
     def getUpdateInterval(self):
         return float(self.config["updateInterval"])
     def getReadFont(self):
@@ -311,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:
@@ -325,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)