Slashdot is powered by your submissions, so send in your scoop

 



Forgot your password?
typodupeerror
×
News

Text Mode Interface Toolkits 9

afreeman asks: "We're currently transmogrifying some 100+ odd Python scripts into a workable sysadmin toolkit (we're also hiring another 30 or so entry-level Admins RSN), and are looking for a way to wrap everything together with a simple front end. For a variety of reasons, most of our hardware doesn't run X or a web server, which leaves text-mode interfaces. Besides curses, the most promising kits look to be UMenu, or TUI (for Perl). Any suggestions on approaches to quickly building Text Mode UIs, particularly with Python?"
This discussion has been archived. No new comments can be posted.

Text Mode Interface Toolkits

Comments Filter:
  • You probably want Newt. Redhat uses it to make CLI front ends. I don't have a link for it but it's packaged in Redhat and Debian, just search around on the net if you're using something else.

    I've worked with it a little. It doesn't do a whole lot, but what it does do, it does pretty well, and it is quite easy to use. I haven't tried to extend it so I don't know how hard it is to add new features (should that be neccesary for you.)

    It can be used from Python, C, and Perl.

  • I designed and built a popular Internet access device a few years back. I had the same issues you have. My conclusion was to separate the content & control from the presentation, and do it in HTML and HTTP.

    This allows you to do forms, menus, etc, in an easy language. You can change it very quickly. There are lots of libraries around for building HTML, handling CGI forms, etc. I actually built my own, in ksh.

    If you want pure-text presentation, you can use text web browsers like lynx as the UI. if you want a richer UI, you can use something like netscape navigator.

    There are many other advantages. Using a web server allows you to build in secure, remote access if you want it, for free. You also get auditability .. you can look at the web server access logs to see who performed what actions.

    If you use a layered user model like:
    Web browser
    HTML form
    CGI wrapper (for suid security)
    command-line interface
    then you can also allow command-line access to all administrative functions. This is not strictly necessary, since you can 'fake' command-line access by using something like lynx or wget, but it might be desired if you want to run admin scripts without a web server available.
  • Sorry, I wasn't obvious in my above response that since not all devices can run a web server, the CGIs would sometimes have to 'log in' to the device to perform operations. Using something like 'expect' (I know of tcl and perl versions, but I'll bet there's something like it for python) works great for these.
  • But what about /bin/bash?

  • NEWT (RH and others use it) - has bindings for C at least, maybe other languages

    CDK (Curses Development Kit) - has bindings for Perl and C if I remember correctly, requires ncurses I believe

    (N)Curses - which you already mentioned

    dialog/whiptail/etc. - allow you to pop up interactive windows from a command line, returns results to stdout I think. IIRC, NEWT comes with whiptail?

    SLang - has some embedded screen control stuff, not sure about bindings or anything else

    I'm also interested in doing text-mode UI stuff with Python, so if you find a good windowing/menuing/text-displaying/etc. solution to use with Python, I'd be happy to know about it (post here I guess).
  • RH writes their installers in Python, and their text-based installer seems decent enough to me. Find out what they use and see if it will work for you.
  • Only alphas of 1.6 have been released; things aren't at a beta stage yet.

    True, but... (from the webpage) "I'm now planning to release Python 1.6 (final) around June 1st". So either the schedule slipped a bit, or it's a late beta disguised as an alpha. :)

  • I don't know very much about Python (still making my way through Learning Python), but I remember they talk a bit about the cmd module, which is basically a menu-driven interface framework. You supply callbacks, and then run a main loop. (This probably isn't exactly right, see the online Python docs [python.org] for details).

    Hmmm.. Python 1.6 betas are out now, I see. Yummy. :)
  • Only alphas of 1.6 have been released; things aren't at a beta stage yet.

    This week I checked in a relevant change; the old curses module has been replaced with a greatly expanded version that provides many ncurses features, such as colour. This means that you can no longer use the module with BSD curses implementations, but everyone has switched to SYSV curses (which is what ncurses implements), so there's no great loss except for people on really ancient platforms. The Curses HOWTO [python.org] might help, though it needs extensive updating for the new module.

He has not acquired a fortune; the fortune has acquired him. -- Bion

Working...