Code by Kevin

About
Code by Kevin, Programming, code, business, and other pursuits

Your Host
Kevin Walzer, software developer.



Home

Subscribe to RSS Feed
Get a syndicated feed of my weblog.


Archives
2014
2013
2012
2011
2010
2009
2008
2007
2006

Categories
Business
Software
General

September 2014
Sun Mon Tue Wed Thu Fri Sat
 
       

Privacy Policy

Site design: Skeleton

 

Tue, 24 Jul 2007

Updating PortAuthority

Things have been pretty quiet here for the past month, but that's mainly because I have been hard at work on updating my applications.

My current focus is a new update to PortAuthority, my GUI for MacPorts. This update started out as a minor refreshing of the UI, but has turned into a pretty significant overhaul.

The current interface of PortAuthority, shown below, works well enough, but it's a bit cluttered. The port categories, placed in the side tree view, are obscured by the table view of installed ports below them. The interface also makes use of two separate "split" views (placing data side by side); these data displays are very asymmetrical in their appearance, which makes getting information "at a glance" harder than it should be. The colors don't look quite right for a modern Mac application (the tree view's background is white, instead of the gentle light blue that you see in apps such as Mail). Finally, the UI makes use of several odd-looking controls (the buttons don't look like Mac toolbar buttons, the search field isn't rounded, and there is a thin black line around the table views).

These are the unavoidable limitations when you use a cross-plaform GUI toolkit, Tk. Out of the box, it may not look quite right on a given platform. This is especially true on the Mac, where interface conventions are more rigidly defined, and interface fashions tend to change more quickly; it's hard for a cross-platform toolkit to keep up.

All is not lost, however. The beauty of Tk--one of the main reasons I use it instead of a Mac-only toolkit--is that it is almost infinitely configurable. Tk itself provides just the bare bones of a graphical interface, but those basic elements can be configured in a vast number of ways--both visually, and in terms of their behavior. Furthermore, Tk's vast array of extension packages allow a developer to quickly snap together different components and assemble a sophisticated interface that very closely matches platform-specific conventions.

With that idea in mind, I have done a fair amount of work customizing some Tk components to be more Mac-like, and incorporating those into the new version of PortAuthority. A sneak peek is below:

This new version incorporates a number of changes, some subtle and some obvious. You'll probably notice the implementation of the standard Mac search field from Schelte Bron; the blue background in the tree view, with improved spacing between the items for better readability; a toolbar that blends in far better with Mac conventions than the old version; and a table view without the distracting black line. More generally, you should also see a simpler, cleaner layout--the separate list of installed packages is gone, integrated into the main table view.

Far more work has gone into this than it might seem. It's easy enough to change some basic properties of the layout; changing a background color from white to a specific shade of blue is a line of code. However, researching the standard colors is time-consuming. I've spent a fair amount of time at Apple's Human Interface Guidelines site, the Indie HIG wiki (for specific interface items not covered by Apple's guidelines), and the CocoaDev site, where a lot of Mac developers post code snippets and discuss interface strategies. Coming up with specific UI properties, testing them, soliciting feedback, and so on, is time-consuming.

And that's just time spent on the basics--finding colors, measuring pixel widths between tree items, and the like. Implementing Mac behavior when it is not provided out of the box by Tk is more complicated. The current standard Tk approach to creating toolbars is to arrange a row of buttons in a frame at the top of the window; that's what I did in the older screenshot above. The problem is, most Mac programs haven't used toolbars in this fashion since 2003. Now Apple provides specific code libraries to generate toolbars, which are not supported by Tk; modern Mac toolbars behave differently than buttons arranged in a frame, in that only the image and text of the toolbar element gets dark when pressed--not the entire button. So I had to create a Tk widget that emulates modern Mac toolbar behavior, using labels rather than buttons, changing images (from a light version to a dark one) when the mouse button is pressed, and using Tk's binding mechanism to execute commands when the button is pressed. This is what I love about Tk: its flexibility and configurability make many things possible, even easy.

Much of this work has gone into generic code libraries that I will be able to re-use in my other applications, as well; over the next few months, I anticipate releasing new versions of all of my programs, with a vastly-improved Mac-look-and-feel. I also plan to wrap some of my Mac-specific libraries into general open-source packages that other developers can use. However, a lot of PortAuthority-specific changes were required by this new interface, as well. I had to completely rewrite the mechanism that retrieves, arranges, and displays the list of installed and available MacPorts packages. MacPorts itself does not provide an integrated view of installed vs. available packages; in the past I was content to simply display the output of each MacPorts command ("port installed" and "port list") in a separate table. However, part of the value of a graphical program such as PortAuthority is that it makes using the "under-the-hood" command-line tools simpler, easier, and more intuitive. PortAuthority provides a more high-level, comprehensive view of your MacPorts installation than the command line "port" tool (which runs MacPorts by default) can do.

I still have to do a bit more work with the new version of PortAuthority--some final testing, and updating the documentation singificantly. The new version should be ready to go in the next couple of weeks.

A final note: the work I'm doing represents an unqualified endorsement of Tk's future on OS X. There's still a bit of uncertainty here, because Tk's core developers on the Mac haven't yet publicly announced how they will address the impact of Apple's recent announcements about its programming frameworks on Tk. However, apparently a lot of issues are still covered by NDA (non-disclosure agreements) with Apple and I'm confident a roadmap will emerge after the release of Mac OS X Leopard is released this fall and NDA no longer applies. Barring some unforeseen disaster, I plan to stick with Tk, in both my Tcl and Python applications.

[/business] permanent link

0 Comments

Comments are closed for this story.