From 489a66ee0060d61d4beee70a9d7e5d5ee57aea71 Mon Sep 17 00:00:00 2001 From: cedricbonhomme Date: Wed, 28 Jul 2010 11:06:39 +0200 Subject: Number of unread articles is now displayed in the tab of the browser. --- pyAggr3g470r.py | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py index 205ac3ec..4f9795af 100755 --- a/pyAggr3g470r.py +++ b/pyAggr3g470r.py @@ -53,12 +53,13 @@ path = {'/css/style.css': {'tools.staticfile.on': True, \ '/var/qrcode': {'tools.staticdir.on': True, 'tools.staticdir.dir': os.path.join(utils.path, './var/qrcode')}} -htmlheader = '\n' + \ - '' + \ - '\n\tpyAggr3g470r - RSS Feed Reader\n' + \ - '\t' + \ - '\n\t\n' + \ - '\n' +def htmlheader(nb_unread_articles=""): + return '\n' + \ + '' + \ + '\n\t'+ nb_unread_articles +'pyAggr3g470r - RSS Feed Reader\n' + \ + '\t' + \ + '\n\t\n' + \ + '\n' htmlfooter = '

This software is under GPLv3 license. You are welcome to copy, modify or' + \ ' redistribute the source code according to the' + \ @@ -77,7 +78,9 @@ class Root: """ Main page containing the list of feeds and articles. """ - html = htmlheader + html = htmlheader((self.nb_unread_articles and \ + ['(' + str(self.nb_unread_articles) +') '] or \ + [""])[0]) html += htmlnav html += self.create_right_menu() html += """

\n""" @@ -189,7 +192,7 @@ class Root: """ Management of articles. """ - html = htmlheader + html = htmlheader() html += htmlnav html += """
\n""" html += "

Add Feeds

\n" @@ -279,7 +282,7 @@ class Root: feed_id = None if param == "Feed": feed_id, _, querystring = value.partition(':') - html = htmlheader + html = htmlheader() html += htmlnav html += """
""" @@ -356,7 +359,7 @@ class Root: articles_list = self.articles[feed_id] except KeyError: return self.error_page("This feed do not exists.") - html = htmlheader + html = htmlheader() html += htmlnav html += """
""" for article in articles_list: @@ -459,7 +462,7 @@ class Root: articles_list = self.articles[feed_id] except KeyError: return self.error_page("This feed do not exists.") - html = htmlheader + html = htmlheader() html += htmlnav html += """
\n""" html += """Mark all articles from this feed as read""" % (feed_id,) @@ -505,7 +508,7 @@ class Root: """ Display all unread articles of a feed. """ - html = htmlheader + html = htmlheader() html += htmlnav html += """
""" if feed_id == "All": @@ -549,7 +552,7 @@ class Root: """ if lang not in ['english', 'french', 'other']: return self.error_page('This language is not supported.') - html = htmlheader + html = htmlheader() html += htmlnav html += """
""" html += """

Article(s) written in %s

\n
\n""" % (lang,) @@ -585,7 +588,7 @@ class Root: articles_list = self.articles[feed_id] except KeyError: return self.error_page("This feed do not exists.") - html = htmlheader + html = htmlheader() html += htmlnav html += """
""" feed_id, article_id = target.split(':') @@ -609,7 +612,7 @@ class Root: """ Display a message (bad feed id, bad article id, etc.) """ - html = htmlheader + html = htmlheader() html += htmlnav html += """
""" html += """%s""" % message @@ -659,7 +662,7 @@ class Root: """ List all active e-mail notifications. """ - html = htmlheader + html = htmlheader() html += htmlnav html += """
""" html += "

You are receiving e-mails for the following feeds:

\n" @@ -745,7 +748,7 @@ class Root: """ List of favorites articles """ - html = htmlheader + html = htmlheader() html += htmlnav html += """
""" html += "

Your favorites articles

" @@ -769,7 +772,7 @@ class Root: """ Add a new feed with the URL of a page. """ - html = htmlheader + html = htmlheader() html += htmlnav html += """
""" # search the feed in the HTML page with BeautifulSoup @@ -797,7 +800,7 @@ class Root: """ Remove a feed from the file feed.lst and from the SQLite base. """ - html = htmlheader + html = htmlheader() html += htmlnav html += """
""" if feed_id in self.feeds.keys(): @@ -864,7 +867,7 @@ class Root: if export_method == "export_HTML": name = folder + "/" + article[1]+ ".html" f = open(name.replace(' ', '_'), "w") - content = htmlheader + content = htmlheader() content += "

" + article[2].encode('utf-8') + "


" content += article[4].encode('utf-8') content += "
\n" -- cgit