You are not logged in.
Pages: 1
Started working on a little project. An rss reader that sits in the systray. Its pretty bare right now, but its downloading feeds and opens them in the browser when i click on them.
-- mod edit: read the Forum Etiquette and only post thumbnails http://wiki.archlinux.org/index.php/For … s_and_Code [jwr] --
Offline
Is your code hosted somewhere? i.e github, bitbucket, etc.
Offline
i uploaded it to github just now, https://github.com/syamajala/rsstray the code is very rough. i don't know gtk at all, so i've just been taking code from random examples i find online. i used to use this app on os x and couldn't find anything like it on linux, http://www.macupdate.com/app/mac/17216/rss-menu
Offline
Offline
im working on having it update feeds every however many minutes and hopefully show a little pop up using libnotify. it should be able to handle multiple feeds then. also i didn't notice this before but there seems to be a bug, when you click on a specific article it opens the page for the last article it added to the submenu. guess i don't completely understand how connect works.
Offline
Keep digging! I love the idea of having a systray RSS reader like this. Sorry I can't help in any way, as I'm absolutely code blind...
Offline
Fixed that bug, kind of, i'm not sure if it's the proper solution, but it seems to work. Relevant code:
def build_submenu(self, feed):
menu = Gtk.Menu()
for i in feed.entries:
menuitem = Gtk.MenuItem()
menuitem.set_label(i.title)
menuitem.connect("activate", self.construct_command(i.link))
menu.append(menuitem)
return menu
def construct_command(self, link):
def open_link(self):
webbrowser.open(link)
return open_link
Lambda expression inside a loop seems to overwrite itself during every iteration, like here:
l = []
for i in range(10):
l.append(id(lambda x: x*i))
print(l)
# OUT: [139721358186400, 139721358186400, 139721358186400, 139721358186400, 139721358186400, 139721358186400, 139721358186400, 139721358186400, 139721358186400, 139721358186400]
print(l.count(l[0]))
# OUT: 10
As you can see, id of the lambda expression is the same in every iteration, despite being a different function (i is different in each lambda), so when the for loop finishes, you'll end up with only one callable object, that every menu item executes on activation.
EDIT:
After a bit of screwing around, i found that this also works:
menuitem.link = i.link
menuitem.connect("activate", lambda x: webbrowser.open(x.link))
Instead of passing the arbitrary address to the lambda it just extracts link from the menu entry itself.
Last edited by kaszak696 (2013-01-18 16:02:15)
'What can be asserted without evidence can also be dismissed without evidence.' - Christopher Hitchens
'There's no such thing as addiction, there's only things that you enjoy doing more than life.' - Doug Stanhope
GitHub Junkyard
Offline
thanks for that!
i made a bit of progress. its updating feeds every x seconds and printing notifications using libnotify when it does the updates. still need to fix a few things though. right now it makes a whole new submenu for each feed when it does the update so feeds appear multiple times. the quit button also isn't working because of the threading stuff i needed to have it do the updates. also, its doing multiple feeds now.
Offline
If the threads don't have to exit cleanly, you can make them daemons. This way, when the main event loop exits, daemon threads are killed automatically.
'What can be asserted without evidence can also be dismissed without evidence.' - Christopher Hitchens
'There's no such thing as addiction, there's only things that you enjoy doing more than life.' - Doug Stanhope
GitHub Junkyard
Offline
got all that stuff working and did a push. it would be nice if when it did updates, it kept track of which articles in a feed are new. also, which articles have already been read and which haven't.
Offline
Aaah, I knew I had tried something similar to this some time ago...
AvalonRSSNotify - you can grab some ideas from here and expand a little on it: keep it simple, keep it classy
In my view, notifications should be optional. Some people, like myself, don't run a notification daemon and would rather just have it sit on the systray. A change in colour whenever there are new items to read would be more than enough for me. And for those who want fancy notifications... just enable them. Also, being able to choose the browser is also a good one.
Offline
Also, being able to choose the browser is also a good one.
Technically, you can. Webbrowser module uses xdg-open on Linux to detect default browser, so you just have to change xdg-open settings to pick a different one.
'What can be asserted without evidence can also be dismissed without evidence.' - Christopher Hitchens
'There's no such thing as addiction, there's only things that you enjoy doing more than life.' - Doug Stanhope
GitHub Junkyard
Offline
Yup, I know. I meant within the application itself. I may not want to open links for the rss reader on my default browser (I actually don't, really). You can also register browsers which are not by default registered on the module. Python2 still didn't have Chromium/Chrome but it's pretty simple to register.
Offline
Pages: 1