# ============================================================================
# Name : FeedingIt.py
# Author : Yves Marcoz
-# Version : 0.5.2
+# Version : 0.5.4
# Description : Simple RSS Reader
# ============================================================================
socket.setdefaulttimeout(timeout)
color_style = gtk.rc_get_style_by_paths(gtk.settings_get_default() , 'GtkButton', 'osso-logical-colors', gtk.Button)
-fg_color = color_style.lookup_color('ActiveTextColor')
+unread_color = color_style.lookup_color('ActiveTextColor')
+read_color = color_style.lookup_color('DefaultTextColor')
del color_style
CONFIGDIR="/home/user/.feedingit/"
self.vbox2 = gtk.VBox(False, 10)
- button = hildon.GtkButton(gtk.HILDON_SIZE_AUTO)
+ button = hildon.GtkButton(gtk.HILDON_SIZE_FINGER_HEIGHT)
button.set_label("Move Up")
button.connect("clicked", self.buttonUp)
self.vbox2.pack_start(button, expand=False, fill=False)
- button = hildon.GtkButton(gtk.HILDON_SIZE_AUTO)
+ button = hildon.GtkButton(gtk.HILDON_SIZE_FINGER_HEIGHT)
button.set_label("Move Down")
button.connect("clicked", self.buttonDown)
self.vbox2.pack_start(button, expand=False, fill=False)
- button = hildon.GtkButton(gtk.HILDON_SIZE_AUTO)
+ button = hildon.GtkButton(gtk.HILDON_SIZE_FINGER_HEIGHT)
button.set_label("Add Feed")
button.connect("clicked", self.buttonAdd)
self.vbox2.pack_start(button, expand=False, fill=False)
- button = hildon.GtkButton(gtk.HILDON_SIZE_AUTO)
+ button = hildon.GtkButton(gtk.HILDON_SIZE_FINGER_HEIGHT)
button.set_label("Edit Feed")
button.connect("clicked", self.buttonEdit)
self.vbox2.pack_start(button, expand=False, fill=False)
- button = hildon.GtkButton(gtk.HILDON_SIZE_AUTO)
+ button = hildon.GtkButton(gtk.HILDON_SIZE_FINGER_HEIGHT)
button.set_label("Delete")
button.connect("clicked", self.buttonDelete)
self.vbox2.pack_start(button, expand=False, fill=False)
if self.feed.isEntryRead(id):
#label.modify_font(pango.FontDescription("sans 16"))
label.modify_font(pango.FontDescription(self.config.getReadFont()))
- label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse("white"))
+ label.modify_fg(gtk.STATE_NORMAL, read_color) # gtk.gdk.color_parse("white"))
else:
#print self.listing.getFont() + " bold"
label.modify_font(pango.FontDescription(self.config.getUnreadFont()))
- #label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse("SkyBlue"))
- #fg_color = fg_button.child.get_children()[0].get_children()[0].get_children()[1].get_style().fg[gtk.STATE_NORMAL]
- label.modify_fg(gtk.STATE_NORMAL, fg_color)
- #label.modify_font(pango.FontDescription("sans bold 23"))
- #"sans bold 16"
+ label.modify_fg(gtk.STATE_NORMAL, unread_color)
label.set_line_wrap(True)
label.set_size_request(self.get_size()[0]-50, -1)
gobject.timeout_add(200, self.destroyArticle, tmp)
#print "previous"
self.disp = newDisp
-
- #stack.push(tmp)
- #if not self.disp == False:
- # self.disp.destroyWindow()
elif next:
- #print type(self.disp).__name__
-
- #self.disp.destroyWindow()
- #stack.pop_and_push(1,newDisp)
- #else:
- # stack.push(newDisp)
- #self.disp = newDisp
newDisp.show_all()
if type(self.disp).__name__ == "DisplayArticle":
gobject.timeout_add(200, self.destroyArticle, self.disp)
self.disp = newDisp
- #self.disp.show_all()
- #if not self.disp == False:
- # self.disp.destroyWindow()
else:
self.disp = newDisp
self.disp.show_all()
def nextArticle(self, object, index):
label = self.buttons[index].child
label.modify_font(pango.FontDescription(self.config.getReadFont()))
- label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse("white"))
+ label.modify_fg(gtk.STATE_NORMAL, read_color) # gtk.gdk.color_parse("white"))
id = self.feed.getNextId(index)
self.button_clicked(object, id, next=True)
def previousArticle(self, object, index):
label = self.buttons[index].child
label.modify_font(pango.FontDescription(self.config.getReadFont()))
- label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse("white"))
+ label.modify_fg(gtk.STATE_NORMAL, read_color) # gtk.gdk.color_parse("white"))
id = self.feed.getPreviousId(index)
self.button_clicked(object, id, previous=True)
def onArticleClosed(self, object, index):
label = self.buttons[index].child
label.modify_font(pango.FontDescription(self.config.getReadFont()))
- label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse("white"))
+ label.modify_fg(gtk.STATE_NORMAL, read_color) # gtk.gdk.color_parse("white"))
self.buttons[index].show()
def button_update_clicked(self, button):
self.vbox.destroy()
self.feed = self.listing.getFeed(self.key)
self.displayFeed()
- #self.feed.updateFeed()
- # self.clear()
- # self.displayFeed()
def buttonReadAllClicked(self, button):
for index in self.feed.getIds():
self.feed.setEntryRead(index)
label = self.buttons[index].child
label.modify_font(pango.FontDescription(self.config.getReadFont()))
- label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse("white"))
+ label.modify_fg(gtk.STATE_NORMAL, read_color) # gtk.gdk.color_parse("white"))
self.buttons[index].show()
self.autoupdate = False
self.checkAutoUpdate()
hildon.hildon_gtk_window_set_progress_indicator(self.window, 0)
- gobject.idle_add(self.enabelDbus)
+ gobject.idle_add(self.enableDbus)
def enableDbus(self):
dbusHandler = ServerObject(self)
self.disp.connect("feed-closed", self.onFeedClosed)
def onFeedClosed(self, object, key):
- #self.displayListing()
self.listing.saveConfig()
self.refreshList()
- #self.buttons[key].set_text(self.listing.getFeedTitle(key), self.listing.getFeedUpdateTime(key) + " / "
- # + str(self.listing.getFeedNumberOfUnreadItems(key)) + " Unread Items")
- #self.buttons[key].show()
def run(self):
self.window.connect("destroy", gtk.main_quit)
gtk.main()
- #for key in self.listing.getListOfFeeds():
- # self.listing.getFeed(key).saveFeed(CONFIGDIR)
self.listing.saveConfig()
def prefsClosed(self, *widget):
# ============================================================================
# Name : FeedingIt.py
# Author : Yves Marcoz
-# Version : 0.4.3
+# Version : 0.5.4
# Description : Simple RSS Reader
# ============================================================================
import gconf
import urllib2
+VERSION = "0.5.4"
+
section = "FeedingIt"
ranges = { "updateInterval":[0.5, 1, 2, 4, 12, 24], "expiry":[24, 48, 72], "fontSize":range(12,24), "orientation":["Automatic", "Landscape", "Portrait"], "artFontSize":[10, 12, 14, 16, 18, 20]}
titles = {"updateInterval":"Auto-update Interval", "expiry":"Expiry For Articles", "fontSize":"Font Size For Article Listing", "orientation":"Display Orientation", "artFontSize":"Font Size For Articles"}
button.connect("toggled", self.button_toggled, "imageCache")
vbox.pack_start(button, expand=False)
+ button = hildon.Button(gtk.HILDON_SIZE_FINGER_HEIGHT, hildon.BUTTON_ARRANGEMENT_VERTICAL)
+ button.set_label("View Known Issues and Tips")
+ button.connect("clicked", self.button_tips_clicked)
+ button.set_alignment(0,0,1,1)
+ vbox.pack_start(button, expand=False)
+
+
panArea.add_with_viewport(vbox)
self.window.vbox.add(panArea)
self.window.show_all()
return self.window
+ def button_tips_clicked(self, *widget):
+ import dbus
+ bus = dbus.SessionBus()
+ proxy = bus.get_object("com.nokia.osso_browser", "/com/nokia/osso_browser/request")
+ iface = dbus.Interface(proxy, 'com.nokia.osso_browser')
+ iface.open_new_window("http://feedingit.marcoz.org/%s.html" % VERSION)
+
def onExit(self, *widget):
self.saveConfig()
self.window.destroy()
# ============================================================================
# Name : FeedingIt.py
# Author : Yves Marcoz
-# Version : 0.5.2
+# Version : 0.5.4
# Description : Simple RSS Reader
# ============================================================================
def getId(string):
return md5.new(string).hexdigest()
+def getProxy():
+ import gconf
+ if gconf.client_get_default().get_bool('/system/http_proxy/use_http_proxy'):
+ port = gconf.client_get_default().get_int('/system/http_proxy/port')
+ http = gconf.client_get_default().get_string('/system/http_proxy/host')
+ proxy = proxy = urllib2.ProxyHandler( {"http":"http://%s:%s/"% (http,port)} )
+ return (True, proxy)
+ return (False, None)
+
+# Enable proxy support for images and ArchivedArticles
+(proxy_support, proxy) = getProxy()
+if proxy_support:
+ opener = urllib2.build_opener(proxy)
+ urllib2.install_opener(opener)
+
# Entry = {"title":XXX, "content":XXX, "date":XXX, "link":XXX, images = [] }
class ImageHandler:
self.sortedKeys.remove("font")
self.sortedKeys.sort(key=lambda obj: self.getFeedTitle(obj))
list = self.sortedKeys[:]
- #for key in list:
- # try:
- # self.loadFeed(key)
- # except:
- #import traceback
- #if key.startswith('d8'):
- #traceback.print_exc()
- # self.sortedKeys.remove(key)
- #print key
- #print key in self.sortedKeys
- #print "d8eb3f07572892a7b5ed9c81c5bb21a2" in self.sortedKeys
- #print self.listOfFeeds["d8eb3f07572892a7b5ed9c81c5bb21a2"]
self.closeCurrentlyDisplayedFeed()
- #self.saveConfig()
def addArchivedArticle(self, key, index):
feed = self.getFeed(key)
def getListOfFeeds(self):
return self.sortedKeys
- #def getNumberOfUnreadItems(self, key):
- # if self.listOfFeeds.has_key("unread"):
- # return self.listOfFeeds[key]["unread"]
- # else:
- # return 0
-
def addFeed(self, title, url):
if not self.listOfFeeds.has_key(getId(title)):
self.listOfFeeds[getId(title)] = {"title":title, "url":url, "unread":0, "updateTime":"Never"}