From: Neal H. Walfield Date: Sun, 27 Nov 2011 17:00:06 +0000 (+0100) Subject: Ask the user whether they'd like to install Woodchuck. X-Git-Url: http://vcs.maemo.org/git/?p=feedingit;a=commitdiff_plain;h=95b2b55820745606cc7dae2df4fbbb214eeb161c Ask the user whether they'd like to install Woodchuck. - Save the fact that we've asked in the config file. - Only ask once. --- diff --git a/src/FeedingIt.py b/src/FeedingIt.py index 6672c46..29dc7fa 100644 --- a/src/FeedingIt.py +++ b/src/FeedingIt.py @@ -1262,12 +1262,47 @@ class FeedingIt: self.checkAutoUpdate() gobject.idle_add(self.build_feed_display) + gobject.idle_add(self.check_for_woodchuck) def build_feed_display(self): if not hasattr(self, 'disp'): self.disp = DisplayFeed(self.listing, self.config) self.disp.connect("feed-closed", self.onFeedClosed) + def check_for_woodchuck(self): + if self.config.getAskedAboutWoodchuck(): + return + + try: + import woodchuck + # It is already installed successfully. + self.config.setAskedAboutWoodchuck(True) + return + except ImportError: + pass + + note = hildon.hildon_note_new_confirmation( + self.window, + "\nFeedingIt can use Woodchuck, a network transfer " + + "daemon, to schedule transfers more intelligently.\n\n" + + "Install Woodchuck? (This is recommended.)\n") + note.set_button_texts("Install", "Cancel") + note.add_button("Learn More", 42) + + while True: + response = gtk.Dialog.run(note) + if response == 42: + open_in_browser("http://hssl.cs.jhu.edu/~neal/woodchuck") + continue + + break + + note.destroy() + + if response == gtk.RESPONSE_OK: + open_in_browser("http://maemo.org/downloads/product/raw/Maemo5/murmeltier?get_installfile") + self.config.setAskedAboutWoodchuck(True) + def button_markAll(self, button): for key in self.listing.getListOfFeeds(): feed = self.listing.getFeed(key) diff --git a/src/config.py b/src/config.py index 5b28e2d..3abb490 100644 --- a/src/config.py +++ b/src/config.py @@ -237,6 +237,7 @@ class Config(): (configParser.getint, "expiry", 24), (configParser.getboolean, "autoupdate", False), (configParser.getboolean, "woodchuck", True), + (configParser.getboolean, "askedAboutWoodchuck", False), (configParser.getint, "updateInterval", 4), (configParser.get, "orientation", "Automatic"), (configParser.getboolean, "imageCache", False), @@ -263,6 +264,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"])) @@ -303,6 +305,11 @@ class Config(): return self.config["autoupdate"] 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):