2008-07-22 16:48

Urssus: July 22nd / looking good

Today it was a bit more than two hours, but spread in 10 minute chunks, which is not exactly efficient.


  • Rewrote the whole next/next unread/article/feed spaghetti in a decent way. It's broken regarding filtered/sorted article lists, but it's trivial to fix.
  • A few UI features:
    • Show only feeds with unread articles google-reader style
    • Show in dark red the unread articles
    • Show title / date of articles in separate columns
  • Implemented "Match case" for the search
  • Implemented dumb systray icon (need to make it useful)
  • Implemented article counts in folders (but not article lists which is, of course, harder)

And of course, a screenshot:


A bad side is that the main window takes about 3 seconds to appear, but I am pretty sure that's fixable reordering the startup code.


  • Feed CRUD
  • Post mark as (read/unread/important/whatever)
  • Filter by post status
  • Search in all feeds
  • Virtual feeds
  • Persistent settings
  • More aggressive feed fetching (now it's a single queue, should be a configurable number)
  • Lots of minor fixes

And it will be pretty much in feature parity with Akregator, and ready to start the packaging work. Not bad for a week of work (BTW: if anyone has any experience packaging PyQt stuff for windows/Mac I can use the help ;-).

Still fun (although tree traversing is starting to get quite annoying)

2008-07-20 17:44

Urssus: July 20th / eating my own dogfood

Yes, I am now using uRSSus instead of Akregator.

On the programming side, I did very little work because it's sunday...

  • Implemented the Find windget backend code and it works forwad and backward (but not "Match case" which is pretty trivial).
  • Fixed a few focus issues. When you have a multi-widget main window, it can get kinda tricky, and you may end needing to move focus around manually (not in this case yet).

I have found a few bugs, mainly related to traversing the feed tree, but they are all fixable with some effort (or by doing it correctly the second time ;-)

2008-07-19 08:43

Urssus: July 19th

I confess I cheated and kept working on it yesterday after the blog post. OTOH, I will not touch it today ;-). Big functionality added, too.

  • Feed items (The things on the tree) now are updated when the background process checks them.
  • They are also updated when you read articles from a feed.
  • The filter thingie works, you type some text, and only the articles with that text are shown (see screenshot).
  • Added a widget (not dialog) for searching within the page, firefox-like (see screenshot)

The bad news is that the "next unread article" code and a few others is garbage. It's quite inefficient because I tried to be cheap and not create a coherent model for feeds.

However it works and you will never tell the difference unless you have 2000 articles between where you are and the next unread (in which case the window goes kinda nuts for a couple of seconds).

Still fun!

2008-07-18 15:43

Urssus again

Another day, another two hours of work on it.

What's new?

  • Some UI elements without code behind them (the "filter article" thingie), and a feed properties dialog.
  • A (IMVHO) better UI distribution than akregator. Consider this screenshot:

The article list and feed tree are the same size, but removing the tabs and moving the filter into a toolbar really makes the actual reading area quite larger.

  • Delegate all links from the reading area to the desktop's web browser (this is not a web browser yet ;-)
  • Progress report for web page loading (more useful once you can declare a feed as "load link directly")
  • Finished feed/article navigation (next/previous feed/article unread/any), and fixed bugs in the part that was already done.
  • Zoom in/out for the web view
  • Show/hide statusbar
  • Several bug fixes

And yes, still fun!

2008-07-17 16:21

Urssus improves

Today's 2 hours:

  • An about dialog (not wired to the UI yet)
  • Icons on the feed tree (not favicons, though)
  • Handle a few more feed quirks
  • A status message queue, so subprocesses can post their progress in the status bar.
  • UI for importOPML
  • Implemented "Next Article" and "Next Feed". This Model/View Qt thing is kinda painful (but powerful!)
  • Use of Mako templates to display the articles pretty and neat
  • Menu & Shortcuts following Akreggator
  • Added several fields to the Post and Feed models to make them more useful (which means the DB changed, but that's to be expected at this stage). These include things like "unread" and "author" and "link" ;-)

Still fun!

2008-07-16 21:44

A programming challenge for myself

I worked on uRSSus for a couple of hours again, and it's working pretty nicely.

  • Really uses the ORM
  • Multiprocessing for a non-blocking UI (python-processing is awesome)
  • Adapts to the quirks of some feeds (why on earth would someone do a feed without dates? It's AOL FanHouse!)

I intend to keep working like this for a couple of weeks, and see how far I can get in feature parity to akregator.

No, I don't expect to reach feature parity, I only want to strive for it. SInce I lack the focusand/or energy for a multi year commitment it requires to write the average free software, I want to see how far a sprint gets me.


So far, it's fun.

2008-07-16 11:49

Why no packaging software should replace your config files

When you upgrade a piece of software on Linux, there are two paths it can go when there are incompatible changes in the config files (ok, 3 paths, Debian asks you what to do):

  1. The "rpmnew" way: install the new config file as "whatever.rpmnew", which means the softwarewill break immediately, but that's ok, because you are doing upgrades, so you should be watching already.
  2. The "rpmsave" way: replace the old file and save a copy as "whatever.rpmsave".

This has two problems:

  1. The software may fail or not, or fail in a subtle way, and you will not notice right away.

  2. Maybe the old file will be lost anyway:

    lrwxrwxrwx  1 root root 32 jul 15 22:41 /etc/named.conf -> /var/named/chroot/etc/named.conf
    lrwxrwxrwx  1 root root 32 jul 15 22:36 /etc/named.conf.rpmsave -> /var/named/chroot/etc/named.conf

In this case the "file" was a symlink, so by "saving a copy" it only saved another symlink to the soon-to-be-overwritten file.

And that's why, ladies and gentlemen, the rpmnew way is the good way.

2008-07-15 23:38

The world lamest GUI newsreader... in 130 LOC

I started this as an experiment to see how hard it was to build apps using QT and Elixir. This is how it looks after two hours of coding:


And here's the code: http://urssus.googlecode.com

You will need:

  • PyQt 4.4 or later
  • Mark Pilgrim's feedparser
  • Python 2.5 (or whenever elementtree got included)
  • A OPML file
  • The Python SQLite bindings
  • Elixir (the declarative layer over SQL Alchemy)

You can find the real code at

And then you can use these 131 LOC ;-)

# -*- coding: utf-8 -*-

# Mark Pilgrim's feed parser
import feedparser as fp

# DB Classes
from elixir import *

metadata.bind = "sqlite:///urssus.sqlite"
metadata.bind.echo = True

class Feed(Entity):
  htmlUrl     = Field(Text)
  xmlUrl      = Field(Text)
  title       = Field(Text)
  text        = Field(Text)
  description = Field(Text)
  children    = OneToMany('Feed')
  parent      = ManyToOne('Feed')
  posts       = OneToMany('Post')
  def __repr__(self):
    return self.text

  def update(self):

class Post(Entity):
  feed        = ManyToOne('Feed')
  title       = Field(Text)
  post_id     = Field(Text)
  content     = Field(Text)

# This is just temporary

# UI Classes
from PyQt4 import QtGui, QtCore
from Ui_main import Ui_MainWindow

class MainWindow(QtGui.QMainWindow):
  def __init__(self):

    # Set up the UI from designer

    # Initialize the tree from the Feeds

    # Internal function
    def addSubTree(parent, node):
      if not node.children:
        for child in node.children:
          addSubTree(nn, child)

    for root in roots:
      addSubTree(iroot, root)


    QtCore.QObject.connect(self.ui.feeds, QtCore.SIGNAL("clicked(QModelIndex)"), self.openFeed)
    QtCore.QObject.connect(self.ui.posts, QtCore.SIGNAL("clicked(QModelIndex)"), self.openPost)

  def openFeed(self, index):

    if not feed.xmlUrl:

    for post in d['entries']:
      print post
      print '----------------------------------\n\n'
      if 'content' in post:
        posts.append(Post(feed=feed, title=post['title'], post_id=post['id'], content='<hr>'.join([ c.value for c in post['content']])))
      elif 'summary' in post:
        posts.append(Post(feed=feed, title=post['title'], post_id=post['id'], content=post['summary']))
      elif 'value' in post:
        posts.append(Post(feed=feed, title=post['title'], post_id=post['id'], content=post['value']))

    for post in posts:

  def openPost(self, index):

if __name__ == "__main__":
  import sys
  # For starters, lets import a OPML file into the DB so we have some data to work with
  from xml.etree import ElementTree
  tree = ElementTree.parse(sys.argv[1])
  for outline in tree.findall("//outline"):
    if xu:
      if current:

2008-07-07 09:18

Thanks Philip Pearson!

This blog was hosted for a long time in http://lateral.pycs.net ... until the site kinda died. And there are hundreds of links around, all pointing to URLs in pycs.net for the older stories. Now they all work again!

So, thanks Philip!

2008-06-26 14:56

Creating and sending nice HTML+Text mails from python

I decided I needed an automatic report of some things on my email every day, and I wanted it to look nice both in plain text and HTML. Here's what I came up with.

Let's assume you created the HTML version using whatever mechanism you wish, and have it in a variable called "report".

Here's the imports we will use:

import smtplib,email,os,tempfile
from email.MIMEText import MIMEText
from email.MIMEMultipart import MIMEMultipart
from email.Charset import Charset

And here's the code:

# Create a HTML mail part
hpart=MIMEText(reporte, _subtype='html', _charset='utf-8')

# Create a plain text mail part
# Ugly and requires links, but makes for a great-looking plain text version ;-)
tpart=MIMEText(os.popen('links -dump %s'%tf,'r').read(), _subtype='plain', _charset='utf-8')

# Create the message with both parts attached

# Standard headers (add all you need, for example, date)
msg['Subject'] = 'Report'
msg['From']    = '[email protected]'
msg['To']      = '[email protected]'

#If you need to use SMTP authentication, change accordingly
smtp.sendmail('[email protected]','[email protected]',msg.as_string())

Contents © 2000-2019 Roberto Alsina