With the new release of Acire just out I wanted to tell you folks a fun little story of an added benefit to Acire that I never envisaged when I came up with the idea for the app.

Yesterday I got an email from someone (I will keep the identify private) saying:

I’m trying to create an application but I can’t seem to find any way to embed a gnome-terminal into my app. I know you’re not offering support :) but if you have some spare time is there any chance you can point me to the documentation for that?

This happens a lot: someone wants to do something, so they ask for help over email or on another medium such as IRC. Unfortunately, I am usually pretty busy and typically don’t have the time to answer support questions. Before Acire existed I would have at most hunted out some links or possibly just the person to to go and ask on a particular forum or mailing list.

Now Acire exists, I just fired it up, selected Python VTE from the cateogries combo box, clicked on the snippet, and then cut and pasted the code into the email:

#!/usr/bin/env python

# [SNIPPET_NAME: Embed a VTE terminal]
# [SNIPPET_DESCRIPTION: Embed a VTE terminal in your application]

    import gtk
    print >> sys.stderr, "You need to install the python gtk bindings"

# import vte
    import vte
    error = gtk.MessageDialog (None, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK,
        'You need to install python bindings for libvte')
    sys.exit (1)

if __name__ == '__main__':
    # create the terminal
    v = vte.Terminal()
    v.connect ("child-exited", lambda term: gtk.main_quit())

    # fork_command() will run a command, in this case it shows a prompt

    # create a window and add the VTE
    window = gtk.Window()
    window.connect('delete-event', lambda window, event: gtk.main_quit())

    # you need to show the VTE

    # Finally, run the application

Job done. What made me smile about this was that Acire not only helps me, but it helped me help someone else too. Rocking. :-)

Share This
%d bloggers like this: