Text UI

Mirko Zeibig mirko at picard.inka.de
Tue Sep 21 11:47:27 EDT 1999


On 21 Sep 1999 13:56:58 +0100, 
a.d.stribblehill at dur.ac.uk <a.d.stribblehill at dur.ac.uk> wrote:
> 
> I'm trying to do something similar myself -- I found RedHat have used
> an interface to slang to do something quite pretty. IIRC, the
> 'sysconfig' command is a Python-slang-ncurses menu thing.
> 
> I didn't find it particularly nice though, but this was a year or so
> back.
Hello Andrew,
I guess you think of newt, which will install a module called snack.py and
dynamic library to access some slang-features. If you take a look into
lorax, the current beta of RH6.1 you will see, that RH will take newt as
standard-text-interface for their new installer ``anaconda''.

I wrote a script to configure ISDN under Redhat using newt and python and
found the library rather useful. Though you have to guess most of the
syntax. If you download the text.py from the anaconda-installer, you may be
able to figure out some things. Otherwise it's very poorly documented. I
even had to check out the C-source-code to find a bug (see below) and as I
am no C-expert and the code is rather ``randomly'' documented this was a
hard one.

When trying to improve my script I found that snack.py seems to have an
error in the Widget-Class for the setCallback-Function (sort of 
event-trigger, though the HTML-Doku states that newt does not know about
events, but then in the C-code there are some message-queue like structures):
Original it runs:

class Widget:
  def setCallback(self, obj, data = None):
	  if data:
		  self.w.setCallback(obj, data)
		self.w.setCallback(obj)

When trying to use this, _snackmodule is complaining about not having enough
arguments, so:
class Widget:
  def setCallback(self, obj, data = None):
	  if data:
		  self.w.setCallback(obj, data)
		else:
		  self.w.setCallback(obj)

was, what did it for me (did report this to developer.redhat.com)

Regards
Mirko

-- 
mailto:   mirko.zeibig at gmx.de
privat:   http://sites.inka.de/picard
commerce: http://www.webideal.de
qmail, ldap, serialfax, rh-isdn: http://www.webideal.de/#downloads




More information about the Python-list mailing list