Flutterby™! : Image Manager progress!

Next unread comment / Catchup all unread comments User Account Info | Logout | XML/Pilot/etc versions | Long version (with comments) | Weblog archives | Site Map | | Browse Topics

Image Manager progress!

2004-09-22 22:47:53.815854+00 by Dan Lyke 6 comments

I've switched to Python[Wiki] and GTK[Wiki], and I'm finally feeling like I've found my preferred development environment for GUI apps. I also feel like, after a stretch of some serious doldrums, I've got my software development mojo back. As much as I hate some of Python[Wiki]'s quirks (you want to know why significant whitespace sucks? reindenting blocks), the GTK[Wiki] bindings do a lot of things right.

Anyway, I currently have all of the images on my laptop indexed, with descriptions imported from various sources, and I'm going through and marking up the descriptions with "people", "place", "event" and "thing" attributes, where "event" might be "Alec's graduation" and "thing" is something like "turkey vulture" or "Airsoft". Now I can open up a list of all people, double-click on Charlene[Wiki], and see all images in which Charlene[Wiki] appears. And if I mark a "place" attribute and location information hasn't yet been filled in for the image, it goes and looks up lattitude and longitude.

I need to do a little more interface work here to manage things like cleaning up different names for people, and then I can post some screen shots. And maybe by tomorrow I'll have the map editing functionality ported back over from wxWindows and enough data in the system that I can show you a topo of the area with thumbnails in the locations in which they were taken...

In other news, I owe several of you mail on the job search front. Stay tuned.

[ related topics: Dan's Life Software Engineering Work, productivity and environment Maps and Mapping Python ]

comments in ascending chronological order (reverse):

#Comment Re: made: 2004-09-23 07:37:49.168122+00 by: Brian

> (you want to know why significant whitespace sucks? reindenting blocks)

You know about C-c < , right? You can't just mark the whole file and run indent-region like you can in C, but I've yet to find editing blocks to be a problem. (mind you, I don't know if there's similar functionality under vi).

The only trouble I have has been retraining my fingers to not just bounce on the TAB key like I used to, because now it matters. Every once in a while I forget and move the current line into the "child of the previous line" spot, and when the code is hairy it isn't immediately obvious where I ought to move it back to.

I usually treat this as a signal that my code is too hairy and it's time to make it cleaner. This is a general pattern I've discovered with Python, and I've come to really like it. "Don't Be Clever".

-Brian

#Comment Re: made: 2004-09-23 14:13:29.744673+00 by: Dan Lyke [edit history]

I've become really used to C-x ( [tab] C-n C-x ) C-u 500 C-x e. Needless to say this doesn't have the desired effect.

Oh, and while I'm a asking stupid Python[Wiki] questions:

  1. What's the mechanism for referencing an object reference?
  2. How do I dereference an array onto a call? I have a call that takes a variable number of arguments, I want to use an array to call it.

I think I need to go find a good language reference. Dive Into Python is a great starter, but falls down once I start looking for more esoteric features.

#Comment Re: made: 2004-09-23 19:31:07.838146+00 by: dexev [edit history]

For #1, you can say:

>>> class MyClass:
...   def _init_[Wiki]():
...      self.foo = 'bar'
...    def _str_[Wiki]()
...      return self.foo
>>> class = MyClass
>>> inst = class()
>>> print inst
'bar'

is that what you're looking for?

If I'm understanding #2 properly, you can:

>>> def myfunc(kwarg1='foo', kwarg2='bar'):
...  return kwarg1 + kwarg2
>>> args = ['do', 're']
>>> kwargs = {kwarg1:'mi', kwarg2:'fa'}
>>>myfunc()
'foobar'
>>> myfunc(*args)
'dore'
>>>myfunc(**kwargs)
'mifa'

Hope that helps

(you have been to docs.python.org, right?)

((editted for formatting))

#Comment Re: made: 2004-09-23 20:51:16.766436+00 by: Dan Lyke

Hmmm... #1 isn't exactly what I was looking for, but I'm thinking that I should really be changing my idiom for such things anyway, so that's a good help. Thanks.

On #2, thanks, that's exactly what I wanted.I've got a gtk.TextBuffer on which I'm calling buffer.insert_with_tags(buffer.get_end_iter(), "a string", *tags), and initially I'd unrolled that for the cases 1 through 10... Which I knew was wrong, but it got me past the stumbling block without breaking my flow.

I have been to docs.python.org, but mainly I use Google for my searching, I've started the official tutorial, but found it too slow, and haven't wanted to hit the language reference yet, although I can see that soon I'll have to.

Which has been my main problem with Python, there isn't the cache of lore and the huge supporting culture of Perl, and library support and development seems totally up-to-date at times, and at other times woefully behind the times (currently working around the lack of gtk.gdk.Pixbuf.subpixbuf(...) right now...). Yes, it's got a slightly cleaner and nicer syntax, and there are modules to do almost everything, but your average module on CPAN is documented better than any module I've installed so far for Python, and generally the Perl coders have caught the edge cases more correctly than the Python guys.

#Comment Re: made: 2004-09-23 22:22:53.736881+00 by: Mars Saxman

you have gotten modules off CPAN that actually work, at all?

#Comment Re: made: 2004-09-23 22:46:40.830457+00 by: Dan Lyke

Actually, I think the only module I've ever gotten off of CPAN that wasn't a help was one for reading TIGER[Wiki] data files, and the docs said it was a work in progress and not to expect anything.