voidynullness

(mis)adventures in software development...

25 July 2013    Python

Extract emails from Gmail with Python via IMAP

Using Python to get email from a Gmail account via IMAP: The Least You Need To Know.

I have a filter setup in a Gmail account to automatically collect what are essentially automatically generated emails from a particular source, and file them neatly away into a label, leaving the inbox relatively uncluttered with their consistently formatted regularness. Thing is, those particular emails are not achieving their potential for maximum usefulness to me by just sitting there in my Gmail account. And with their predictable content, they are ripe candidates for parsing and extracting the useful data, and …

Read more...


21 June 2013    Python

Subclassing QTableWidget into submission

Python example of subclassing a Qt QTableWidget control and overriding copy behavior so that the entire selected row is copied to the clipboard, and stored in a Excel-friendly format for proper pasting.

Hello there QTableWidget, you look like just the sort of Qt control I’m looking for. I want to stick some data into you. But once the data is inside you, I might want to do other things. Like perhaps copy and paste rows of data into Excel …

Read more...



12 April 2013    Python

I’ll write a script instead…

A Python script to convert date fields in a CSV file from MM/DD/YYYY to DD/MM/YYYY format — because Excel wouldn’t do it properly!

I imagine there must be many jobs, especially in and around the finance industry, where using Excel is part of daily life. I feel sorry for those people.

I find myself using spreadsheets quite a bit lately, and it’s often a frustrating experience. There’s a lot of annoyingly repetitive pointing and …

Read more...


05 February 2013    Python

Populate a Qt combo box from a database table in PyQt

Python example of using QSqlTableModel to link a database table to a QComboBox control.

Qt provides some useful mappers for easily linking relational database tables with table/grid widgets. This works well for quickly producing simple CRUD applications. But sometimes we might want to escape the limitations of table and grid controls, and do something fancier — something to provide users with a more customised, fine-grained interface, which usually ends up being something based on forms/dialogs. So we design a form, populate it with controls, and we are then faced with having to populate …

Read more...


24 January 2013    Python

PyQt database driver loading issues on Windows after installing PySide

Had a Windows machine with a perfectly fine and functioning development setup of ActiveState Python 2.7, QT SDK, and PyQt bindings. Then decided to install PySide. What could possibly go wrong?

There’s always something…

After installing PySide, none of my PyQt SQLite database applications would work anymore (while still using the PyQt bindings). Not even the example programs. I would get a “Driver not loaded” error when trying to initialise the database. However, the PySide database examples ran …

Read more...


Home   Top