• Home
  • About
  • Blog Archives
  • Contact Me
  • FAQ
  • The Big 101
Subscribe: Posts | Comments | E-mail

jonobacon@home

Archive for the ‘Acire’ Category


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. :-)


Posted on February 26, 2010 - by jono

Acire 0.3 Released

Everyone’s favorite tool to browse Python snippets, run them, learn from them and incorporate them into your programs has been released! This new release has the following new features:

  • Translated – Acire has now got support for multiple languages, but this is very new so it needs your translations! Want to help make Acire rocking in your language? Easy. Go and contribute here!
  • Edit Snippets – Acire now allows you to edit the code inside a snippet and execute it within Acire itself.
  • Save Snippets – You can now save the snippets, even if they have been edited, into a specific file on your system.
  • Look and Feel Polish – a little bit of spit and shine has been applied to respect your chosen monospace font, use a scalable icon for docky and a few other little changes.

As I have mentioned before, I the snippets that Acire shows and the Acire itself are in two separate packages (this means that others can write viewers to view the snippets on other environments).

Installing Acire and it’s snippets is simple. First install the daily snippets PPA (this will deliver new snippets to your system on a daily bases):

sudo add-apt-repository ppa:python-snippets-drivers/python-snippets-daily
sudo apt-get update
sudo apt-get install python-snippets

Now install the Acire PPA:

sudo add-apt-repository ppa:acire-team/acire-releases
sudo apt-get update
sudo apt-get install acire

Right now packages are available for Ubuntu 10.04 Lucid Lynx and Ubuntu 9.10 Karmic Koala packages should be available soon.

We need your snippets!

The fuel that makes Acire rock is the library of snippets. To really get the most out of Acire and it’s library of snippets, we need you to contribute snippets that demonstrate something in Python. These snippets are really helpful in showing us all how a given Python modules works, and really helpful in lowering the bar to development. Here is how you can contribute a snippet!

Step 1: Grab the library

Just run:

bzr branch lp:python-snippets

Step 2: Create your snippet

A snippet should demonstrate a specific feature in a given module or in the Python language. This could include showing how to use a specific widget, a feature of that widget, or another function.

python-snippets is divided into sub-directories which outlines the theme of the snippets. You should pick the most appropriate directory to put your snippet it, and add it there. If a suitable directory does not exist already, create it and add it there.

Step 3: Add metadata

The way Acire pulls out the snippets is by detecting some specific metadata additions to comments at the top of the file You should now add the following meta data as comments to the top of the file:

# [SNIPPET_NAME: A Short Name For The Snippet]
# [SNIPPET_CATEGORIES: Category]  <-- see CATEGORIES file for existing categories
# [SNIPPET_DESCRIPTION: A single line description of the snippet]
# [SNIPPET_AUTHOR: Your Name <your@emailaddress.com>]
# [SNIPPET_LICENSE: An Open Source license (from the LICENSES file)]

Here is an example:

# [SNIPPET_NAME: Playing a Pipeline]
# [SNIPPET_CATEGORIES: GStreamer]
# [SNIPPET_DESCRIPTION: Construct and play a pipeline]
# [SNIPPET_AUTHOR: Jono Bacon <jono@ubuntu.com>]
# [SNIPPET_LICENSE: GPL]

You now need to add your file to your branch with:

bzr add your-snippet.py

Step 4: Propose it for merging

With your new snippet ready, it is time to propose it for inclusion in the main python-snippets library.

First, commit your changes to your local branch with:

bzr commit

Now push it to your own branch on Launchpad:

bzr push lp:~<your launchpad username>/python-snippets/<name of your branch>

As an example:

bzr push lp:~jonobacon/python-snippets/gstreamer-snippets

Now go to https://code.launchpad.net/python-snippets and you should see your branch listed there. Click on it and when the branch page information page loads click on the Propose for merging link. Add a short description of what you examples do in the Initial Comment box and then click the Propose Merge button.

We will then review the merge and if it looks good, add it to python-snippets and it will be delivered to Acire users in the next daily package upload. :-)


Posted on January 12, 2010 - by jono

Call For Help: Convert Quickly Snippets To Python Snippets

As I have blogged about recently, I have been really getting into the idea of enabling opportunistic developers to get to grips with writing applications for the Open Source desktop as easily as possible. This has including raving about the awesome Quickly and I recently wrote Acire, a simple program for viewing a library of Python Snippets that can be used to read, learn from, run and help lower the barrier for making your own programs rock and roll.

Back at UDS there was an awesome snippets party which resulted in many examples on this wiki page, but it is just a webpage and of course you can’t see them in Acire, you can’t run them and you can’t play with them right away. I started moving some of them over to the Python Snippets library but I need your help! This is as simple as putting together some example programs, adding some information at the top in the comments and submitting them for review.

If we can get these (and other!) snippets included, it will be another awesome resource to enable our awesome developer community to make fantastic apps that make our desktop rock that little bit more.

Interested? Intrigued? Want to help make the goodness happen? Well, read on…

Creating Snippets

Before you create your snippets, I recommend you install the nice and fresh Acire 0.2.

Here is how you go about creating the snippets.

Step 1: Grab the library

Just run:

bzr branch lp:python-snippets

Step 2: Create your snippet

A snippet should demonstrate a specific feature in a given module or in the Python language. This could include showing how to use a specific widget, a feature of that widget, or another function. The list of snippets in the Quickly Snippets page is ideal for porting over to snippets!

python-snippets is divided into sub-directories which outlines the theme of the snippets. You should pick the most appropriate directory to put your snippet it, and add it there. If a suitable directory does not exist already, create it and add it there.

Step 3: Add metadata

The way Acire pulls out the snippets is by detecting some specific metadata additions to comments at the top of the file You should now add the following meta data as comments to the top of the file:

# [SNIPPET_NAME: A Short Name For The Snippet]
# [SNIPPET_CATEGORIES: Category]  <-- see CATEGORIES file for existing categories
# [SNIPPET_DESCRIPTION: A single line description of the snippet]
# [SNIPPET_AUTHOR: Your Name <your@emailaddress.com>]
# [SNIPPET_LICENSE: An Open Source license (from the LICENSES file)]

Here is an example:

# [SNIPPET_NAME: Playing a Pipeline]
# [SNIPPET_CATEGORIES: GStreamer]
# [SNIPPET_DESCRIPTION: Construct and play a pipeline]
# [SNIPPET_AUTHOR: Jono Bacon <jono@ubuntu.com>]
# [SNIPPET_LICENSE: GPL]

You now need to add your file to your branch with:

bzr add your-snippet.py

Step 4: Propose it for merging

With your new snippet ready, it is time to propose it for inclusion in the main python-snippets library.

First, commit your changes to your local branch with:

bzr commit

Now push it to your own branch on Launchpad:

bzr push lp:~<your launchpad username>/python-snippets/<name of your branch>

As an example:

bzr push lp:~jonobacon/python-snippets/gstreamer-snippets

Now go to https://code.launchpad.net/python-snippets and you should see your branch listed there. Click on it and when the branch page information page loads click on the Propose for merging link. Add a short description of what you examples do in the Initial Comment box and then click the Propose Merge button.

We will then review the merge and if it looks good, add it to python-snippets and it will be delivered to Acire users in the next daily package upload. :-)

I really appreciate any time you can spend in contributing snippets!


Posted on January 12, 2010 - by jono

Acire 0.2 Released

I am pleased to announce the second release of my little project to browse, read, run and learn from a library of Python examples. This release brings us:

  • Examples now have syntax highlighting and use a better font for reading code.
  • An awesome new icon designed by the ever-affable Martin Owens.
  • Various bug fixes.

You can grab it from the Acire PPA by running these simple commands:

sudo add-apt-repository ppa:acire-team/acire-releases
sudo apt-get update
sudo apt-get install acire

For Acire to be in any way useful you will need to grab the Python Snippets library. Subscribe to the PPA and get a fresh batch of Python Snippets daily! Subscribe by just running these commands:

sudo add-apt-repository ppa:python-snippets-drivers/python-snippets-daily
sudo apt-get update
sudo apt-get install python-snippets

Rock and roll!

UPDATE: It turns out we had a few dependencies missing. You can fix this with:

sudo apt-get install python-gtksourceview python-gnomeprint

We will get the packaged fixed soon, but this will get you up and running. Thanks for the feedback, folks!


Posted on January 8, 2010 - by jono

Acire: Delivering A World Of Python Snippets

A few weeks back I blogged about my new program Acire: a simple little tool that provides a library of Python examples called snippets that outline how to do specific taks. With each snippet you can browse the code, run it and otherwise learn how it works in order to help you get to grips with writing your own programs as quickly and easily as possible.

I wrote Acire to augment Quickly in lowering the bar for Opportunistic Programmers to get involved in writing applications. For more on opportunistic programmers see my article Unchaining the Opportunistic Programmer.

So core ethos in my mind behind Acire is:

Provide a regularly, automatically updating diverse range of Python examples, all available within Acire, which allows you to browse, view, run and learn from them.

Meeting this goal is broken into two parts: providing the viewer (Acire) and providing the library of examples (Python Snippets).

The Acire code is now available at http://www.launchpad.net/acire. If you want to give it a shot, make sure you have python-vte installed from your distribution and also install the python-snippets PPA (see below) and then run:

bzr branch lp:acire

Then run:

cd acire
quickly run

UPDATE: A PPA of the first Acire 0.1 release is now available. Just run these commands to install it:

sudo add-apt-repository ppa:acire-team/acire-releases
sudo apt-get update
sudo apt-get install acire

Thanks to Nathan Handler for setting this up!

Acire will show you your library of snippets and you can click on each one and click the Execute button to run it:

Let’s now discuss the snippets. I created a new Launchpad project at http://www.launchpad.net/python-snippets which is intended to provide a library of snippets. I will be encouraging the community to provide snippets for this library (see below), and I have deliberately kept the library as a seperate project from Acire which is useful for getting the library without getting Acire and also if someone wants to write an alternative to Acire (such as a KDE port).

My friend and yours Nathan Handler has created a daily PPA of the library for Karmic and you can install it by just adding these commands:

sudo add-apt-repository ppa:python-snippets-drivers/python-snippets-daily
sudo apt-get update
sudo apt-get install python-snippets

Once you have done this, the latest Python Snippets library will be delivered right to your computer and ready for browsing, learning, and playing with right from within Acire!

We Need Your Snippets!

So right now we have an awesome app for viewing with and playing with snippets, and a means of delivering them to hungry hackers, but what we now need is more snippets. Adding a snippet is as simple as following these steps.

Step 1: Grab the library

Just run:

bzr branch lp:python-snippets

Step 2: Create your snippet

A snippet should demonstrate a specific feature in a given module or in the Python language. This could include showing how to use a specific widget, a feature of that widget, or another function.

python-snippets is divided into sub-directories which outlines the theme of the snippets. You should pick the most appropriate directory to put your snippet it, and add it there. If a suitable directory does not exist already, create it and add it there.

Step 3: Add metadata

The way Acire pulls out the snippets is by detecting some specific metadata additions to comments at the top of the file You should now add the following meta data as comments to the top of the file:

# [SNIPPET_NAME: A Short Name For The Snippet]
# [SNIPPET_CATEGORIES: Category]  <-- see CATEGORIES file for existing categories
# [SNIPPET_DESCRIPTION: A single line description of the snippet]
# [SNIPPET_AUTHOR: Your Name <your@emailaddress.com>]
# [SNIPPET_LICENSE: An Open Source license (from the LICENSES file)]

Here is an example:

# [SNIPPET_NAME: Playing a Pipeline]
# [SNIPPET_CATEGORIES: GStreamer]
# [SNIPPET_DESCRIPTION: Construct and play a pipeline]
# [SNIPPET_AUTHOR: Jono Bacon <jono@ubuntu.com>]
# [SNIPPET_LICENSE: GPL]

You now need to add your file to your branch with:

bzr add your-snippet.py

Step 4: Propose it for merging

With your new snippet ready, it is time to propose it for inclusion in the main python-snippets library.

First, commit your changes to your local branch with:

bzr commit

Now push it to your own branch on Launchpad:

bzr push lp:~<your launchpad username>/python-snippets/<name of your branch>

As an example:

bzr push lp:~jonobacon/python-snippets/gstreamer-snippets

Now go to https://code.launchpad.net/python-snippets and you should see your branch listed there. Click on it and when the branch page information page loads click on the Propose for merging link. Add a short description of what you examples do in the Initial Comment box and then click the Propose Merge button.

We will then review the merge and if it looks good, add it to python-snippets and it will be delivered to Acire users in the next daily package upload. :-)

I am really keen to see snippets on pretty much everything and if you want to help, a great place to start is converting the Quickly snippets page over to real, runnable snippets for python-snippets. Let’s roll!


Posted on December 30, 2009 - by jono

Announcing Acire

After a wonderful week in England with family celebrating Christmas, Erica and I flew home to the East Bay. We were sat at Heathrow having a cup of coffee and I was thinking of what I occupy myself with on the plane ride over. Unfortunately, Lernid hacking was out of the question as I had no net connection on the plane, so I got to thinking of something else. After some busy hacking time at 35,000 feet I am proud to show of the results of my labor: a little program called Acire.

Let me provide a bit of an introduction.

I love Python and I love PyGTK and as I have waxed lyrical about recently, I am passionate about how tools such as Quickly are lowering the bar for opportunistic programmers to scratch their itch. The problem is, much as Python and PyGTK are incredible for writing apps, like any other tool they still need to be learned, and the best way to learn is by downloading, running and playing with code snippets. Traditionally this has involved finding scattered bits of sample code online and stuffing it into a directory. Not only do we download other people’s sample code but we often write our own little code snippets as we learn new parts of these tools, and these would be perfect to share with others. Unfortunately, many of us never end up putting them anywhere online. Acire is a first step in making this whole process easier.

Right now, Acire is a tool that allows you to browse snippets easily. It looks like this:

The combo box in the top left provides different categories of snippets. In the screenshot above you can see the general category PyGTK, but there is no reason why we can’t have sub-categories such as PyGTK -> TreeViews. When you select a category, the list underneath it shows all the current snippets. Clicking on a snippet not only loads the code in the view to the right, but also provides a simple description and location of the snippet underneath the code. You can then run the snippet by clicking the Execute button or copy the full code to the clipboard by clicking the Copy button.

To make snippets work in Acire, I have created some simple metadata tags that snippet authors should put at the top of the snippet in the code. Here is an example:

# [SNIPPET_NAME: Actions]
# [SNIPPET_CATEGORIES: PyGTK]
# [SNIPPET_DESCRIPTION: Demonstrates using Actions with a gtk.Action and gtk.AccelGroup]

To test this out I have already added this meta data content to all the examples from the PyGTK Manual. This functionality already makes browsing available snippets, running them and looking at the code an absolute doddle.

I have just got in from a day of traveling, I am exhausted, and headed to bed. I will get the code online tomorrow and talk more about plans for Acire. :-)



  • Ad Ad Ad Ad
  • Prepare For Awesome

  • Recent Articles

    • Unwrapping The Community Manager at OSBC in San Francisco
    • System 76 Lemur Review
    • I Never Realized…
    • International Women’s Day
    • Live Announcement Of Ubuntu International Women’s Day Competition Winners!
    • The Grand App Writing Challenge Submissions!
    • This Is Exactly What We Want
    • Ubuntu Opportunistic Developer Week and Python Snippets Day
    • Refreshing The Ubuntu Brand
    • Ubuntu Opportunistic Developer Week Day 3 Kicks Off In An hour
  • Recent Comments

    • Jon on Fun Little Acire Story
    • Oscar on Refreshing The Ubuntu Brand
    • Adam Hayward on Refreshing The Ubuntu Brand
    • Mike Sheldon on Unwrapping The Community Manager at OSBC in San Francisco
    • ? Why I’m Not Switching Back To Linux Any Time Soon on Refreshing The Ubuntu Brand
    • Diego Castro on Acire 0.3 Released
    • Ras on Refreshing The Ubuntu Brand
    • YokoZar’s Writings » Blog Archive » It’s time to fix the window controls on Refreshing The Ubuntu Brand
    • Ilya Skorik on I Never Realized…
    • Alex (Handy Backup team) on International Women’s Day
  • Flickr Photos

  •  

    March 2010
    M T W T F S S
    « Feb    
    1234567
    891011121314
    15161718192021
    22232425262728
    293031  
  • jb@h Rockstars This Year

    • ethana2 (23)
    • Digitivity (9)
    • James Duncan (9)
    • Zac (9)
    • w1ngnutz (8)
    • Aaron Toponce (7)
    • Benji (7)
    • Bruno Girin (7)
    • Gerv (7)
    • Brett (6)
© 2008 jonobacon@home - At home with Jono Bacon, Community Manager and Author