HINDSIGHT LABS

Creating Select form fields with currencies and countries using Babel and WTForms

Written by Christine
August 4th, 2010 in Python, WTForms, Web development Comments (1)

A quick tutorial on how to create some nifty currency and country select fields using WTForms. This was sort of a headache to figure out, which is why I’m sharing it. If you have a cleaner way to do this (particularly the country list), please comment, because I’m highly dissatisfied with hardcoding the countries and

Read more…

Sort a Python list by dictionary key

Written by Christine
May 5th, 2010 in Uncategorized Comments (4)

I probably should have known how to do this innately, it’s that simple, but I didn’t. So for the benefit of fellow feckless Pythonistas, here is how to sort a list of dictionaries based on a key in the dictionary.
Say I have a list of dictionaries where each dictionary represents data for a person who

Read more…

Displaying fieldsets with Jinja2 and Django forms, the quick way

Written by Christine
April 30th, 2010 in Django, Python Comments (1)

We had two problems to solve: we wanted to use fieldsets with Django forms, and the follow-up issue, making that custom rendering Jinja2-compatible. There are plenty of awesome libraries/snippets to display forms as fieldsets, including django-form-utils.
I wanted a quick and dirty and method of doing this.
So here it is: step 1, add a fieldsets

Read more…

Jinja2 and Django 4ever

Written by Christine
March 15th, 2010 in Django, Python Comments (3)

My goal is to stop hating Django. Our team has been bouncing back and forth between using Django and Pylons for the creation of the web front end for ChompStack, a restaurant-oriented iPhone app site with an admin panel for easy data management.
In the beginning, there was Django, and it was good. But gradually we

Read more…

Adding extra fields to a model form in Django’s admin

Written by Steven
February 11th, 2010 in Python Comments (10)

I ran into this problem recently and found that the Django documentation wasn’t exactly clear on how to solve it, so I’ve provided an example in case anyone else needs to do the same thing. My goal was to add an extra form field to one of my model objects that represented a property which

Read more…

PyClutter video tutorial

Written by Christine
February 9th, 2010 in Uncategorized Comments (3)

As usual, we’re learning together: today I decided that I would like to be able to play video in our Bazooka (PyClutter-based) framework, so I set out to write a Bazooka video class. The source code for Bazooka, including this video class, is in our git repository here.
First, make sure you have PyClutter 0.9.2 installed:

Read more…

Clutter links

Written by Christine
February 8th, 2010 in Clutter Leave a Comment

Bazooka is built on top of the Python bindings for the 0.9.2 version of the Clutter Toolkit, or whatever version the latest stable Python bindings are at. Occasionally I go trolling for additional Clutter links, and I thought I’d post a few of my finds here for easy access.

Latest stable clutter docs
Latest stable COGL docs
Programming

Read more…

Adding a persistent ad banner to a UITabBar

Written by Steven
February 8th, 2010 in iPhone Comments (3)

Here’s a little tip for anyone that wants to add a persistent ad banner above the UITabBar to their tab navigation based iPhone app. I’ve seen a few apps do this so I was fairly surprised when a quick search of Google and StackOverflow turned up absolutely nothing. After all, it seems like it would

Read more…

And on the 7th day there were PyGTK custom icons…

Written by Christine
January 18th, 2010 in PyGTK, Python, Screwdriver Leave a Comment

It’s been a few days since our first bumbling foray into custom PyGTK icons using PyCairo, and now it’s time to reap the benefits. We’re concocting a few simple classes which will make drawing and icon creation a breeze. Your final, glorious product should look like this:

Unimpressive, you say? Well maybe so, but take a

Read more…

F**** YEAH I DREW ANOTHER RECTANGLE! Icons in PyGTK continued…

Written by Christine
January 13th, 2010 in PyGTK, Python, Screwdriver Leave a Comment

Welcome to Part II of learning to draw custom icons in PyGTK with PyCairo. In the previous post we learned how to draw on a gtk.DrawingArea the hard way. Now let’s simplify things; after all, who has time to wait for “expose-event”s before drawing?? In a recession???
Another suggested method for drawing in a Cairo/Drawable context

Read more…