[node-devel] Thoughts and code for an updated TUI

Fabian Deutsch fabiand at redhat.com
Wed Sep 26 10:45:22 UTC 2012


Hey,

the current Node TUI (ovirt-config-setup) has a couple of limitations which can 
not be solved using newt (as it is right now), e.g. resizing.
Besides that there are implementation issues (with constraints on newt's 
functionality) e.g. recursion when drawing the TUI, which are hard or not to solve
with newt.
Further more some problems repeat itself over different parts of the TUI, e.g.
validation of the user input.
And looking from a testing perspective it's currently also hard to write unit
tests for the "pages" of the TUI.

On the other hand the TUI has to provide just enough configurations options to
the user to modify a couple of files to be manageable by some entity like
oVirt Engine.

Seeing these shortcomings and the requirements I started to think about a more
modular approach compared to what ovirt-config-setup currently is, to address the
technical problems and still provide the TUI the user needs.

The idea is to separate the model - which has to be modified (the config) - from
the user interface by pushing all the functionality into plugins.
A plugin is just exposing the model and a set of widgets (which are bound to the
model) which are used to modify the model through the TUI.
Events tell the plugin when the model has changed or shall be saved.
This separation addresses the need for testability and the general need for
plug-able TUI extensions.
When starting to write some code for this ideas and trying newt for the TUI, it
quickly became clear that the technical limitation can not be solved quickly.
Therefor I used python-urwid [1] as the toolkit for the UI.
urwid is event based, supports mouse input, utf8 and resizable consoles, features
which newt currently doesn't support. urwid is also actively maintained, used
in a couple of projects (also in the debian world afaik) and packaged for Fedora.


This is not (yet) a proposal for new TUI for Node, but at least I wanted to share my
thoughts and point you to my current playground [2]. The intention at last is however 
to come up with a solution solving our TUI problems.

Check out the code and have a look at the example.py plugin (uses most of the
functionality). plugins/__init__.py has also lot's of documentation for the interface
between plugins and tui.

Greetings
fabian

--
[1] http://excess.org/urwid/
[2] http://fedorapeople.org/cgit/fabiand/public_git/molch.git/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ovirt.org/pipermail/node-devel/attachments/20120926/1894e0cb/attachment.sig>


More information about the node-devel mailing list