feedreader / feedreader.py

# -*- coding:utf-8 -*-
import os
from PyQt4 import QtGui, QtCore, uic, QtWebKit
import feedparser
from feeds import *

uifile = os.path.join(os.path.dirname(__file__), 'mainwindow.ui')
Form, Base = uic.loadUiType(uifile)

class MainWindow(Base, Form):
    def __init__(self):
        super(Base, self).__init__()
        Form.setupUi(self, self)
        self.filename = None
        self.webView = QtWebKit.QWebView(self.feedEntryViewContainer)
        self.webView.setHtml(u"<html><body><h1>Feed Reader</h1><p>This is contents.</p></body></html>")


    def setupEntryList(self):
        self.entryModel = EntryListModel(self)

    def setupFeedsTree(self):
        urls = [
            (u'Aodag Blog', 'http://feeds.feedburner.jp/AodagBlog'),
            (u'aodagの日記', 'http://d.hatena.ne.jp/aodag/rss'),
        blog = FeedCategory('blog', [Feed(n, u) for n, u in urls])
        urls = [
            (u'Bicking Blog', 'http://blog.ianbicking.org/feed/atom/'),
        python = FeedCategory('python', [Feed(n, u) for n, u in urls])
        self.categoryTreeModel = FeedListModel([blog, python], self.categoryTreeView)

    def on_categoryTreeView_activated(self, index):
        entries = index.internalPointer().entries

    def on_entriesView_activated(self, index):
        entry = index.internalPointer()
        self.webView.setHtml('<h1>%s</h1><div>%s</div>' % (entry.title, entry.content[0].value))

def main():
    import sys
    app = QtGui.QApplication(sys.argv)

    win = MainWindow()

if __name__ == '__main__':
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.