Posted on February 27, 2010 - by jono
Fun Little Acire Story
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.
7 Comments
We'd love to hear yours!
Leave a Reply
Here's your chance to speak.








Visit My Website
February 27, 2010
Permalink
Is there any way to submit snippet requests through acire?
Like, how do I request administrative authentication in a Java app?
Visit My Website
February 27, 2010
Permalink
Acire is targeted at the Python+GTK+GNOME stack that is popular for Ubuntu development – see Jono’s post, http://www.jonobacon.org/2010/01/30/connecting-the-opportunistic-dots/ It has features (including ongoing work) that work for Python, and will not work for Java (at least, not without major modifications to the code – though who knows what people might add in the future). Second, there isn’t currently any way to request snippets through Acire. That would need a communication mechanism like a mailing list/forum/etc – a link to which could be put on Acire’s Help menu, once the forum is set up
In fact, Jono wants more programmers to join in and submit Python snippets to the python-snippets project on Launchpad.net… if you write Python, consider contributing!
Visit My Website
February 27, 2010
Permalink
Thanks again Jono for the tips
Visit My Website
February 27, 2010
Permalink
Brilliant idea, I plan on using this myself – but I must say, the logo is crap! How about something a bit more scalable and colorful, eh Jono?
Visit My Website
February 28, 2010
Permalink
Don’t forget to import sys before the attempt to import vte.
Visit My Website
March 12, 2010
Permalink
I’ve install acire and python-snippets, is it right that the only categories I see are pygtksourceview, cairo, apport and pygtk?