Simplui 1.0.2 released – now with themes!

The default themes provided by simplui

The default themes provided by simplui

Today brings the 1.0.2 release of simplui. This is a beta release, previewing major enhancements, and I need as much feedback as possible on the new features. As such, this release isn’t heavily optimised – that is on the wishlist for next release.

The big news for this release is themes support. The GUI is now fully skinned, using a variant on the ninepatch method code developed by Joe Wreschnig and Alex Holkner on the pyglet mailing list.

Each GUI frame can use a different theme (even in the same time!), and the theme can be changed at runtime. I have included two sample themes, one modelled on the Mac OS X ‘Aqua’ interface, and the other on the PyWidget GUI toolkit.

Also included are the usual crop of bug-fixes, including the squashing (hopefully for the last time) of the persistent event clipping bug.

As per usual, grab the tarball, or visit SVN, and let me know if you have any comments or suggestions.

Advertisements

2 comments

  1. Not bad. You could center the text on those buttons, maybe add some more widgets – you might end up needing a group of option boxes some time, although you might emulate it with your checkbox. A progress bar might be useful, too, as would being able to drag the frames around.

    I recently rewrote the theme support in my own ui, and even though I moved the theme definitions from being hard-coded into XML, in the end I still end up with a lot of special case code in the widget’s painting methods (the resizeable button paints 27 different pixmaps, nine for each state, and the scroll bar also has 20 pixmaps which are switched on state…). You seem to have come across some better solution for this, although I admit I haven’t yet completely groked how it works. This ninepatch thing doesn’t look like it would mix well with having the entire theme on one texture, would it?

    • Ja, still some padding issues with the ninepatch support, and I don’t want to add more widgets until I have figured out a more flexible layout system.

      Even though the ninepatch skinning vastly reduces the amount of drawing code, every widget seems to need special-case code to handle layout and padding (even related widgets, such as buttons and checkboxes).

      As far as all the widgets on one texture, not trivially. However, I am letting pyglet.resource pack them all into texture atlases, and I may special-case the atlas generation just for GUI themes at some point.

      I am still wrestling with how layout changes should propagate both top-down and bottom-up. In real (i.e. desktop) GUI toolkits, everything is done with pixel layouts, and changes are always top-down, but I want to achieve something much simpler without sacrificing too much flexibility.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s