Older blog entries for robla (starting at number 28)

26 Feb 2010 (updated 10 Mar 2010 at 05:12 UTC) »

Easy form building for terminal windows: jsonwidget-python

I’ve been working on a project to make building forms really simple. My latest work is “jsonwidget-python” for terminal-based applications (like you would use via SSH or local terminal on Linux and Mac). It’s all very retro, but terminal windows are still very much in use for buzzword-compliant activities like configuring virtual machines for cloud computing, in addition to being the preferred user interface for a lot of people out there (*cough* nerds *cough*).

This new project builds on some earlier work that I’ve retroactively renamed “jsonwidget-javascript“. jsonwidget-javascript is AJAX-y generation of forms inside a browser based on a JSON schema. jsonwidget-python is intended for terminal users at first, but will extend to other contexts as well.

Here’s a simple screenshot to show what’s going on:

Simple Address Entry in jsonwidget-python

Simple Address Entry in jsonwidget-python



There’s nothing too fancy in this screenshot, but this is probably the most typical case. What you see there is deceptively simple, but there’s a lot of complicated stuff going on under the hood. Most of the complicated parts (drawing the fields, handling focus, handling keyboard shortcuts) is being provided by urwid, an excellent Python-based library for building terminal-based user interfaces. jsonwidget is providing a further abstraction that hopefully makes it even simpler to provide this type of interface, though sacrificing much of the flexibility of programming directly against urwid. Here is the complete configuration file (the schema) describing that address entry form, as well as the documentation for the schema format. jsonwidget-python is compatible with jsonwidget-javascript, so the same schema also works in jsonwidget-javascript.
jsonwidget-javascript screenshot with simple address entry form

jsonwidget-javascript screenshot with the same simple address entry form

One nice feature on display even in the simple demo is the ability to have arrays as fields. You’ll notice that the phone number field has two phone numbers, and offers to let you add a third. There’s no artificial limit on the number of phone numbers that one can enter using this tool, beyond the usual limits of computer memory, patience, etc.

It also handles more complicated schemas if your application calls for it. For example, let’s say that one wanted to build a real address book application. Clearly a lot more flexibility would be needed than merely allowing multiple phone numbers. Here’s a screenshot showing a much more sophisticated schema that’s more like what real address book applications allow:

More complicated data entry with jsonwidget-python

More complicated data entry with jsonwidget-python

So, what is this good for? Well, I think it’ll be good for a lot of stuff. I suspect it might be a very good user interface to stick in front of a augeas-based user interface. I think it might also be a good tool for building a terminal-based frontend for editing CouchDB and similar databases. In particular, I’m thinking about making a desktop-couch interface for contact editing. Another idea I’ve dabbled with is automatically building a UI based on parameters to Python’s optparse. Yet another thought is an editor for Python’s ConfigParser or alternatively ConfigObj. Lots of different possibilities here.

I’m particularly interested in suggestions for applications that people would use. So, if you have an application for this type of thing that you’re reasonably sure you’d use if I did a good enough job implementing, let me know.

Of course, that’s probably getting a little ahead of myself. There’s a number of things on the roadmap to do, such as more kosher packaging for easy_install and for Linux distros, as well as the ability to edit arbitrary JSON. I also need to investigate SitePen’s JSON schema work, which they appear to be well along toward some sort of RFC (probably informational, but that can be enough for something like this).

Anyway, if this sort of thing is up your alley, please give it a whirl and let me know what you think. You can download jsonwidget-python and give it a spin. I’ve set up a jsonwidget mailing list which you’re more than welcome to use, but you can also just post a comment here or contact me via email.

Update: March 9 – there’s now several ways of getting jsonwidget:

Syndicated 2010-02-26 05:51:28 (Updated 2010-03-10 04:20:26) from Roblag » Tech

Sorry about the NASCAR-looking comment area

As you may have noticed if you visited blog.robla.net directly, the comment area is handled via Intense Debate. I did that to get myself out of the account management business while still maintaining a modicum of control over my site. Other than then weird blue flaming logo and the name “intense debate” on [...]

Syndicated 2010-02-26 01:01:54 from Roblag » Tech

Python’s simpleparse module

I’m working on a project that required a bit more from the JSON parser than the stock JSON parser with Python allowed for. After doing some hunting around, I came to the unfortunate conclusion that I’d probably need to write my own. Thankfully, Python’s simpleparse module lived up to its billing (thanks in large part [...]

Syndicated 2010-02-18 01:09:11 from Roblag » Tech

Moving on

I’ve decided to leave my current job at Linden Lab. Those of you interested in the ins-and-outs of Second Life may want to look at my post to “sldev” (our open source development mailing list). It was a tough decision to leave, and even tougher to make without having my next move totally [...]

Syndicated 2009-11-09 06:07:11 from Roblag » Tech

Brutal honesty in open source development

There’s a bit of a flamewar going on right now between the main PulseAudio developer, and another Linux desktop developer who grew frustrated by some very real problems caused directly and indirectly by it. PulseAudio is the latest of many savior technologies that promise to make audio on Linux not suck. I’m actually [...]

Syndicated 2008-07-19 09:10:09 from Roblag » Tech

Software as hiring decision

This article in CIO Magazine touches on things that you should look for in choosing open source software: Project stability: Can you trust the project to be there when you need it? Project support: Can you get support when you need it? Internal software management: Does your company know what open-source programs it’s using? How it’s developing and [...]

Syndicated 2008-07-17 07:08:29 from Roblag » Tech

A hard problem worth solving

Here’s a description of the organic open source panel at OSCON (which I’m participating in): “The OSI’s Open Source Definition attempts to set the minimum bar for a software license to be considered “open source”. However, there’s much more to a software project than just the license. Are software projects dominated by a [...]

Syndicated 2008-07-14 07:50:16 from Roblag » Tech

Open source and a free tote bag

Matt Asay wrote a blog post “Cash, code, or free-riding in open source communities?“, which was a good post on a topic I’ve been thinking a lot about myself. He used the term “free-rider” which caused a well documented uproar. I’m saddened by the sense of entitlement inherent in the uproar. What’s wrong with [...]

Syndicated 2008-05-16 06:02:41 from Roblag » Tech

Is OpenSolaris an elitist?

Dave Neary has a great blog post about Sun trying to do the right thing. It was refreshing to read this, and quite insightful. I’ve been watching the naming debate with some interest, if for no other reason than this is a conversation I’m quite interested in pushing my view in, and it [...]

Syndicated 2008-04-29 06:37:30 from Roblag » Tech

Speaking at the Seattle Social Media Club

A little bit of work talk. I’m going to be speaking tonight (January 31) at the Seattle Social Media Club about Second Life, along with my co-worker Greg Tomko-Pavia (aka Periapse Linden) Jeff Barr at Amazon, who has been doing really innovative work promoting Amazon Web Services using Second Life, and Brian White, the author [...]

Syndicated 2008-01-31 18:07:16 (Updated 2008-01-31 18:13:32) from Roblag » Tech

19 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!