Paver, textual GUI builder

Paver is a sort of GUI builder incorporated into alited editor.

It allows viewing a GUI layout and modifying it in a textual mode on fly. They say, the textual mode is preferred by Unix. Probably, by Tcl too :)

The use of paver is rather simple: the cursor is set on a currently edited layout (widget list in terms of apave package) and Paver tool is called.

First, paver strips the layout of variables / commands used (as it knows nothing about them). Then the stripped layout is displayed as a toplevel window. The edited script isn't touched by paver.

So, paver displays only a pure layout without any functionality that depends naturally on a real employment of the layout.

There is also auto update mode which means that paver updates a currently edited layout each time it is saved to the disk. At need, a user can view / modify the stripped code of the layout, to play with it separately.

Demo

To see how this works, the demos are available:

Other implementations

The idea can be implemented in any Tcl/Tk editor with an appropriate plugin, even in several ways:

  • GUI layouts might be separated into procedures or methods so that a user sets the cursor on a proc / method body and calls the plugin
  • GUI layouts might be separated into sourced files to be handled by the plugin
  • GUI layouts might be edged with special comments so that a user sets the cursor somewhere between them and calls the plugin (e.g. alited's Paver tool allows using optional #paver comments to do this)

For such plugins, the layouts need not use apave package: the standard Tk commands would be enough.

Just in the case of alited, these three are integrated: paver, apave and alited.

Restrictions

Of course, there may be layouts that can't be displayed even in the stripped mode, due to variables / commands containing options vital for the GUI.

But such cases are rather rare, e.g. alited's code contains only 2 (or 3?) of the non-pavered layouts with their number over 30, at that most of them are pavered after little commenting out, as the demo shows.