Tuesday, September 27, 2011

A fishy, a fishy, a fishy, a fish...

My newest adventure in programming has been learning Python and Python's GTK+ bindings through PyGTK. Having barely skimmed the surface of Python before, I'm starting to enjoy programming with it. It not only comes with nearly every library needed "baked in", it has a great set of tools to help you produce valid, well structured (PyLint), and well documented code (docstrings and PyDoc). This adventure has lead to my first GUI app for the *NIX based OSes: Rockfish
I had been using the program Catfish for a GUI based local filesystem search program. The biggest problem I have with it was the way it sorted files by date in the results view. The dates are in the format of MM/dd/yyyy, and when sorting on this column, it sorts them as strings instead of dates
So if you have 3 files sorted by name:
  • bar.txt Last Modified: "01/25/2010"
  • file.txt Last Modified: "03/29/2009"
  • foo.txt  Last Modified: "01/22/2009"
When sorting by date you get:
  • foo.txt  Last Modified: "01/22/2009"
  • bar.txt Last Modified: "01/25/2010"
  • file.txt Last Modified: 03/29/2009"
Instead of the expected:
  • foo.txt  Last Modified: 01/22/2009
  • file.txt Last Modified: 03/29/2009
  • bar.txt Last Modified: 01/25/2010
I often sort files I'm looking for by last modified date, and this was driving me crazy—especially at first when I didn't realize what was happening.

At first I planned on looking at the Catfish code, fixing it to work for me, and then submitting a patch to the developer. However a couple things hit me when I started: not knowing Python, and not understanding GTK and PyGTK bindings. It made my brain hurt to look at the code (even though it is reasonably straight forward and well commented), and as noted on the Catfish page, development has stalled for the project. Given the relatively modest scope of a program like this, I felt it would make a good first app to create (or recreate as the case may be) while learning Python and GTK.