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_CATEGORIES: Python VTE]
# [SNIPPET_DESCRIPTION: Embed a VTE terminal in your application]

try:
    import gtk
except:
    print >> sys.stderr, "You need to install the python gtk bindings"
    sys.exit(1)

# import vte
try:
    import vte
except:
    error = gtk.MessageDialog (None, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK,
        'You need to install python bindings for libvte')
    error.run()
    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
    v.fork_command()

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

    # you need to show the VTE
    window.show_all()

    # Finally, run the application
    gtk.main()

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

Updates, Direct To Your Inbox

Updates, Direct To Your Inbox

Get the freshest posts with insights, approaches, tips, tricks, and recommendations delivered to you via email. Simple.

You have Successfully Subscribed!

Pin It on Pinterest

Shares
Share This