March 6, 2015 at 11:30 PM by Dr. Drang
Pashua is Carsten Blüm’s gift to scripters. It’s a free Mac application that helps you put GUI front ends on scripts written in Perl, Python, Ruby, PHP, Bash, AppleScript, and even Tcl and Rexx. With it, you can define a window that includes
- Regular buttons
- Radio buttons
- Text entry fields
- Popup menus
- File selector sheets for saving or opening
- Text labels
While Pashua creates a nice GUI, it is itself configured entirely through text, with each element’s position and/or size defined numerically rather than by drawing as it’s done in Xcode. Here’s how the window above is defined in Python:
python: conf = ''' # Window properties *.title = Snapshot # File name text field properties fn.type = textfield fn.default = Snapshot fn.width = 264 fn.x = 54 fn.y = 40 fnl.type = text fnl.default = Name: fnl.x = 0 fnl.y = 42 # Border checkbox properties bd.type = checkbox bd.label = Background border bd.x = 10 bd.y = 5 # Default button db.type = defaultbutton db.label = Save # Cancel button cb.type = cancelbutton ''' dialog = Pashua.run(conf)
The results of your interaction with the window are then accessible as items in the
dialog['bd'], and so on. Because Pashua has nice defaults, you don’t always have to define every geometric property of every graphical element, but there’s still some trial and error involved in getting the parts exactly where you want them.
I was reminded of Pashua when I read this post from Jason Snell, in which he wraps Marco Arment’s audio file encoder script in AppleScript and uses AppleScript’s
display dialog command to generate a series of windows for collecting input from the user. Pashua, which Jason didn’t know about, could have condensed his four input windows into one.
Later in the afternoon James Muspratt reminded me of Xee:
@drdrang Do you still use Finder to browse/preview photos? Anything better than Xee? I’m leaving Aperture for files and folders. Thanks!
— James Muspratt (@jmuspratt) Mar 6 2015 4:27 PM
Xee is a lightweight app for browsing image files. When I returned to the Mac in 2005, I used Xee all the time because it was faster and more flexible than Preview and its display of images was larger than you could get in the Finder’s icon view. With Preview getting faster, the Finder’s maximum icon size getting larger, and the introduction of QuickLook, Xee fell by the wayside. It shouldn’t have. Xee has lots of nice shortcuts for flipping quickly through folders of images and it uses Phil Harvey’s great ExifTool library for displaying metadata in a sidebar.
I should never have stopped using it.
Unlike Pashua, Xee isn’t free, but it’s only $4, and you can get it either directly from its developer, Dag Ågren, or from the Mac App Store. Be aware that there are some differences between the versions.
Note that the App Store version is sandboxed, while the non-App Store trial and full versions are not sandboxed. If you prefer the safety of the OS X sandbox, you should get the App Store version. However, the sandboxed version needs to ask you for permission for certain operations, and if you find this annoying, you should get the non-App Store version.
Having linked to posts from 2006 and 2008, I think it’s time to stop with the trip down memory lane. Next thing you know, I’ll be writing about Fred Allen.