Source: feedingit
Section: user/network
-Priority: extra
+Priority: optional
Maintainer: Yves <yves@marcoz.org>
Build-Depends: debhelper (>= 5)
Standards-Version: 3.7.2
+XB-Maemo-Display-Name: FeedingIt
+XSBC-Bugtracker: https://garage.maemo.org/tracker/?func=browse&group_id=1202&atid=4512
Package: feedingit
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, python-gtkhtml2, python, python-hildon, libgtkhtml2-0, python-dbus
Description: Simple RSS Reader
- Simple RSS Reader, with portrait mode support
+ Simple RSS Reader, with portrait mode support, and swipe gestures in articles
XB-Maemo-Icon-26:
iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAAAXNSR0IArs4c
6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0
import gobject
from portrait import FremantleRotation
import threading
+import thread
from feedingitdbus import ServerObject
from rss import *
self.urlEntry = hildon.Entry(gtk.HILDON_SIZE_AUTO)
self.urlEntry.set_placeholder("Enter a URL")
self.urlEntry.set_text(urlIn)
+ self.urlEntry.select_region(0,-1)
+
vbox = gtk.VBox(False,10)
- label = gtk.Label("Enter Feed Name:")
+ label = gtk.Label("Enter Feed URL:")
vbox.pack_start(label)
vbox.pack_start(self.urlEntry)
self.notebook.append_page(vbox, None)
return False
else:
return True
-
+
+class GetImage(threading.Thread):
+ def __init__(self, url):
+ threading.Thread.__init__(self)
+ self.url = url
+
+ def run(self):
+ f = urllib2.urlopen(self.url)
+ self.data = f.read()
+ f.close()
+
class Download(threading.Thread):
def __init__(self, listing, key):
self.listing = listing
self.key = key
- def run ( self ):
+ def run (self):
self.listing.updateFeed(self.key)
self.index = index
self.text = text
self.set_title(title)
-
+ self.images = []
+
# Init the article display
self.view = gtkhtml2.View()
self.pannable_article = hildon.PannableArea()
self.pannable_article.connect('horizontal-movement', self.gesture)
self.document = gtkhtml2.Document()
self.view.set_document(self.document)
-
+ self.document.connect("link_clicked", self._signal_link_clicked)
+ self.document.connect("request-url", self._signal_request_url)
self.document.clear()
self.document.open_stream("text/html")
self.document.write_stream(self.text)
self.show_all()
- self.document.connect("link_clicked", self._signal_link_clicked)
- self.document.connect("request-url", self._signal_request_url)
self.destroyId = self.connect("destroy", self.destroyWindow)
self.timeout_handler_id = gobject.timeout_add(300, self.reloadArticle)
def gesture(self, widget, direction, startx, starty):
- #self.disconnect(self.destroyId)
if (direction == 3):
self.emit("article-next", self.index)
if (direction == 2):
self.emit("article-previous", self.index)
- #self.emit("article-closed", self.index)
self.timeout_handler_id = gobject.timeout_add(200, self.destroyWindow)
-
+
def destroyWindow(self, *args):
self.emit("article-closed", self.index)
self.destroy()
def reloadArticle(self, *widget):
- self.document.open_stream("text/html")
- self.document.write_stream(self.text)
- self.document.close_stream()
+ if threading.activeCount() > 1:
+ # Image thread are still running, come back in a bit
+ return True
+ else:
+ for (stream, imageThread) in self.images:
+ imageThread.join()
+ stream.write(imageThread.data)
+ stream.close()
+ return False
+ self.show_all()
def _signal_link_clicked(self, object, link):
bus = dbus.SystemBus()
proxy = bus.get_object("com.nokia.osso_browser", "/com/nokia/osso_browser/request")
iface = dbus.Interface(proxy, 'com.nokia.osso_browser')
- #webbrowser.open(link)
iface.open_new_window(link)
def _signal_request_url(self, object, url, stream):
- f = urllib2.urlopen(url)
- stream.write(f.read())
- stream.close()
+ imageThread = GetImage(url)
+ imageThread.start()
+ self.images.append((stream, imageThread))
class DisplayFeed(hildon.StackableWindow):
if self.show_confirmation_note(self.window, current_selection):
self.listing.removeFeed(self.mapping[current_selection])
self.listing.saveConfig()
-
del self.mapping
self.displayListing()
def run(self):
self.window.connect("destroy", gtk.main_quit)
gtk.main()
+ self.listing.saveConfig()
if __name__ == "__main__":
def getUniqueId(self,index):
entry = self.entries[index]
- return getId(time.strftime("%a, %d %b %Y %H:%M:%S",entry["updated_parsed"]) + entry["title"])
+ if entry.has_key("updated_parsed"):
+ return getId(time.strftime("%a, %d %b %Y %H:%M:%S",entry["updated_parsed"]) + entry["title"])
+ elif entry.has_key("link"):
+ return getId(entry["link"] + entry["title"])
+ else:
+ return getId(entry["title"])
def getUpdateTime(self):
return self.updateTime
content = self.getContent(index)
link = entry.get('link', 'NoLink')
- date = time.strftime("%a, %d %b %Y %H:%M:%S",entry["updated_parsed"])
+ if entry.has_key("updated_parsed"):
+ date = time.strftime("%a, %d %b %Y %H:%M:%S",entry["updated_parsed"])
+ elif entry.has_key("published_parsed"):
+ date = time.strftime("%a, %d %b %Y %H:%M:%S", entry["published_parsed"])
+ else:
+ date = ""
#text = '''<div style="color: black; background-color: white;">'''
text = '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>'
text = text + '<div><a href=\"' + link + '\">' + title + "</a>"
file.close()
else:
self.listOfFeeds = {getId("Slashdot"):{"title":"Slashdot", "url":"http://rss.slashdot.org/Slashdot/slashdot"}, }
- print self.listOfFeeds.has_key("feedingit-order")
if self.listOfFeeds.has_key("feedingit-order"):
self.sortedKeys = self.listOfFeeds["feedingit-order"]
else:
self.sortedKeys = self.listOfFeeds.keys()
self.sortedKeys.sort(key=lambda obj: self.getFeedTitle(obj))
for key in self.sortedKeys:
+ self.loadFeed(key)
+ #self.saveConfig()
+
+ def loadFeed(self, key):
if isfile(CONFIGDIR+key):
file = open(CONFIGDIR+key)
self.feeds[key] = pickle.load(file)
file.close()
else:
self.feeds[key] = Feed(self.listOfFeeds[key]["title"], self.listOfFeeds[key]["url"])
- self.saveConfig()
def updateFeeds(self):
- print self.sortedKeys
for key in self.getListOfFeeds():
- print key, self.sortedKeys
self.feeds[key].updateFeed()
- print self.sortedKeys
def updateFeed(self, key):
self.feeds[key].updateFeed()