Sunday, January 30, 2005

Weekend hacking summary

As I learn GNOME Python programming by way of Google, I come to realize that I need to document what I've learned so that future coders can use Google easier. My intent is to write a summary each weekend that I hack; we'll see how that really goes.

My hacking was cut short Friday night (well, 3AM Saturday) by a hard drive failure in my mail server (and Web server, and database server, et.c). I did an emergency hard drive replacement and recovered what I could from the old one (causing two kernel panics on the way), finishing up at 7AM with a working Exim. I just now got Apache going again (there was a party in between, you see) and will get PostgreSQL going in a minute. Future plans (next weekend, or maybe this week if I need it sooner) include Subversion.

Despite all that, here are some tips:

gnome.init

If you get the error message:
(guploadr.py:33062): Gnome-CRITICAL **: file gnome-program.c: line 870 (gnome_program_locate_file): assertion `program != NULL' failed

That means that you forgot to do this before calling gtk.glade.XML:
import gnome.ui

gnome.init('guploadr','0.01')


GNOME File Selector Dialog

To use the file selector dialog use this callback:
def on_open1_activate(self, widget, *args):

chooser = gtk.FileChooserDialog(
title="Select an image",
action=gtk.FILE_CHOOSER_ACTION_OPEN,
buttons=(gtk.STOCK_CANCEL,
gtk.RESPONSE_CANCEL,
gtk.STOCK_OPEN,
gtk.RESPONSE_OK))
if gtk.RESPONSE_OK == chooser.run():
print chooser.get_filename()
chooser.destroy()


About Dialog

To show a dialog window, such as the About dialog, in your constructor create an instance of it:
self.about_dialog = self.widgets.get_widget('about2')

Then in your callback just show it:
def on_about1_activate(self, widget, *args):

self.about_dialog.show()


Unsolved

I don't fully understand drag-and-drop yet. I'm reading example code at the API Web site, but I'll need to check out real code soon.

Speaking of real code, I need to use the thumbnail viewer from gthumb. It's a bonobo component, I think. How do I do this?

Other Software Ideas

  • A good-looking, working, easy-to-use Web log publishing software for GNOME.

  • A syndication aggregator for GNOME with a Planet-like view.

  • GNOME Flickr Organizr.


A lonely goldfish on the cold linoleum floor

0 Comments:

Post a Comment

<< Home