Python

Jan 06 19:30

Database-configured Theming in Pylons

Yesterday I looked at very simple theming in Pylons, and mentioned that I'd prefer loading the current theme from the database rather than the configuration file. So this evening I decided to see if I could achieve that.

Jan 05 13:52

Very Simple Theming in Pylons

For a while I've been thinking about how to achieve themes in some of my Pylons applications, and just today I was looking around in my environment.py file, and saw the configuration of the templates and public directories. That gave me an idea, can I load a theme directory from the configuration file and use it in there?

I had a bit of a false start initially, I thought that I could just use the config object as I do elsewhere in my application, but that didn't want to work. Eventually I found the solution: the app_conf object.

This is how my code now looks:

Jun 11 06:02

Profiling A PyQt4 Application

From time to time, I've talked about my open source lyrics projection application, openlp.org, which is written in Python and Qt4 using the PyQt4 bridge. One of the core features of openlp.org is to display lyrics on a second monitor using the current "theme," which is a collection of settings for displaying the lyrics (background, font, etc).

Mar 12 09:56

Search Utility for Quassel 0.4

Yesterday I was thinking about looking for something in my Quassel logs, and I didn't really feel like trying to scroll through the last 2 weeks' worth of backlog to find it. Also, at this stage Quassel unfortunately doesn't have a search feature either (Quassel devs, count that as a feature request Wink).

So I hauled out my latest trusty tool: Python.

Mar 11 20:57

PyQt4 code completion in Eric4

Like a lot of other folks, I use Eric4 for my PyQt4 development. It's a nice IDE that makes programming your PyQt4 application a little easier, mostly thanks to it's quick links to Qt4 tools.

One of the potentially cool features of Eric4 is it's ability to add extra API's to the code completion. However, as nice as Eric4 is, it doesn't come with an API for PyQt4.

Mar 07 10:40

Deleting items from a QListWidget in PyQt4

This morning I was working on my open source lyrics projection program, openlp.org, and I was struggling to work out how to remove an item from a QListWidget in PyQt4.

It's fairly simple in Qt4 and C++, you simply fetch the item, and then delete it using the C++ delete keyword:

QListWidgetItem item = ui->listWidget->currentItem();
delete item;

However, I couldn't figure out how to do it in Python. Initially I tried the del keyword, but that didn't work.

Mar 02 11:23

Python Eggs and Ubuntu

After seeing my last post, Michael Gorven pointed me to a couple of articles discussing RubyGem and Debian's policy. I did a bit of googling after reading those articles and some others around Ruby and package management systems, and found an article on using easy_install with Debian.

Feb 09 10:08

Wrapping my head around an egg...

Perl has CPAN, Ubuntu and Debian have apt/debs, Gentoo has portage. These are all various distribution or packaging systems, which allow you to download and install packages from the various systems fairly easily. Of course Python also has it's own system.

Dec 02 07:54

Python, Qt4 and a Mac OS X 10.4 .app

So after my last attempt to compile Qt4 on my Mac, and getting the same error repeatedly, I decided to submit a bug report. One of the guys at Trolltech replied to my bug report, and asked me a number of questions, including "Have you completely removed your previous installation of Qt4?"

Of course I have, I thought, but I decided to go and double check everywhere. Lo and behold I found some files I'd forgotten about. So then I decided to recompile Qt4 again, and was very glad to see that it worked! A make and sudo make install later, I had Qt4 installed.

Aug 19 17:39

Project HQ is plodding on nicely

Yup, Project HQ is making some nice progress, thanks to Python and the SQLAlchemy database library. SQLAlchemy really makes dealing with the database very easy.

Most recently I've been implementing an access control system that makes use of permissions and roles. SQLAlchemy makes dealing with this a breeze, and Pylons makes implementing it in the application very simple and easy. I think the most complicated part will be the roles and permissions management interface!