--- /var/tmp/portage/desklet-rssgrab-0.4/image/usr/share/gdesklets/Sensors/rssgrab/__init__.py 2004-01-12 12:50:40.000000000 +0000 +++ __init__.py 2004-01-23 11:35:42.553292396 +0000 @@ -33,6 +33,7 @@ # initial default values self.__maintitle = "Connecting\n(updated @ 00:00)" + self.__mainlink = "" self.__lutime = "00:00" # create vars @@ -45,15 +46,16 @@ self.__wrapper.initial_indent = "[$] " # Default values for config - self._set_config_type("url", TYPE_STRING, "http://www.slashdot.org/index.rss") - self._set_config_type("browser", TYPE_STRING, "mozilla") - self._set_config_type("update", TYPE_INT, 30) + self._set_config_type("url", TYPE_STRING, "http://packages.gentoo.org/gentoo_simple.rss") + self._set_config_type("image", TYPE_STRING, "http://www.gentoo.org/images/powered-by-gentoo2.jpg") + self._set_config_type("browser", TYPE_STRING, "epiphany") + self._set_config_type("update", TYPE_INT, 60) self._set_config_type("wrapwidth", TYPE_INT, 34) - self._set_config_type("font", TYPE_STRING, "Arial 12") - self._set_config_type("fontcolor", TYPE_STRING, "#00FF00") - self._set_config_type("titlefont", TYPE_STRING, "Arial 14") - self._set_config_type("titlefontcolor", TYPE_STRING, "#FFFF00") - self._set_config_type("highlightfont", TYPE_STRING, "Arial 14") + self._set_config_type("font", TYPE_STRING, "Sans 8") + self._set_config_type("fontcolor", TYPE_STRING, "#3D2D6D") + self._set_config_type("titlefont", TYPE_STRING, "Sans Bold 10") + self._set_config_type("titlefontcolor", TYPE_STRING, "#F0EDFF") + self._set_config_type("highlightfont", TYPE_STRING, "Sans 8") self._set_config_type("highlightfontcolor", TYPE_STRING, "#FFFFFF") # go grab the feed @@ -76,9 +78,13 @@ # Get the channel name if rssdata['channel'].has_key('title'): - self.__maintitle="%s\n(updated @ %s)" % (rssdata['channel']['title'], time.strftime("%H:%M")) + self.__maintitle="%s @ %s" % (rssdata['channel']['title'], time.strftime("%H:%M")) else: self.__maintitle="Title not found\n(updated @ %s)" % time.strftime("%H:%M") + if rssdata['channel'].has_key('link'): + self.__mainlink=rssdata['channel']['link'] + else: + self.__mainlink="" # Clear the arrays self.__titles [0:] = [] @@ -116,6 +122,7 @@ output = self._new_output() output.set("name", self.__maintitle) + output.set("image", self._get_config("image")) output.set("namefont", self._get_config("titlefont")) output.set("namecolor", self._get_config("titlefontcolor")) @@ -135,8 +142,20 @@ # override this ethod to enable user interaction def call_action(self, action, path, args = []): - index = int(path[-1]) - if (action == "launch"): + if (action == "mainlaunch"): + try: + # open the link in specified browser + browser = self._get_config("browser"); + url = self.__mainlink + + if (url != ""): + os.system("%s %s" % (browser,url)) + + except: + print "could not open", url + + elif (action == "launch"): + index = int(path[-1]) try: # open the link in specified browser browser = self._get_config("browser"); @@ -148,9 +167,10 @@ threading.Thread(target=os.system, args=("%s %s" % (browser,nurl),)).start() except: - print "could not open", uri + print "could not open", url elif (action == "leave"): + index = int(path[-1]) output = self._new_output() output.set("item_value[%(index)d]" % vars(), self.__titles[index]) output.set("font[%(index)d]" % vars(), self._get_config("font")) @@ -158,6 +178,7 @@ self._send_output(output) elif (action == "enter"): + index = int(path[-1]) output = self._new_output() output.set("item_value[%(index)d]" % vars(), self.__titles[index]) output.set("font[%(index)d]" % vars(), self._get_config("highlightfont")) @@ -171,10 +192,11 @@ conf1.set_name(_("Rss Settings")) conf1.add_title(_("Rss Source URL")) conf1.add_entry(_("URL",), "url", _("The url of the rss feed")) + conf1.add_entry(_("Image",), "image", _("The logo for the rss feed")) conf1.add_title(_("Interval between Rss updates (minutes)")) - conf1.add_spin(_("Interval",), "update", _("The interval between updates (minutes)"),1,60) + conf1.add_spin(_("Interval",), "update", _("The interval between updates (minutes)"),20,120) conf1.add_title(_("Max Headline Width (Python 2.3+ only)")) - conf1.add_spin(_("Width",), "wrapwidth", _("The max number of columns before wrapping"),1,500) + conf1.add_spin(_("Width",), "wrapwidth", _("The max number of columns before wrapping"),1,200) conf1.add_title(_("Preferred Browser")) conf1.add_entry(_("Browser",), "browser", _("The browser to use to view headlines clicked on")) conf1.add_title(_("Fonts"))