You are viewing Jason Cater's nightly CVS snapshot of NSTTI. These snapshots are from the main branch of NSTTI's CVS server. This application currently does not have an Anonymous CVS setup, so only active developers have access to CVS. The latest snapshots are always at: http://www.gnuenterprise.org/~jcater/snapshots/nstti/nstti-cvs.tar.gz and http://www.gnuenterprise.org/~jcater/snapshots/nstti/nstti-cvs.zip Typically, the last five snapshots are also located here, with a date stamp as part of their file name. If the latest CVS snapshot doesn't work for you, grab the previous night's and try it. To give you a better idea of what this application is, below is a copy of the CVS's README file: ------------------------------------------------------------------------------ nstti/README ------------------------------------------------------------------------------ -------------------------------------------- nstti.py -- the Not So Tiny Text-Interface -------------------------------------------- -------------------------------------------- based on ctinter.py Text Interface by Damond Walker Copyright (C) 1999 color-enabled by Laurent Pelecq -------------------------------------------- this version by Thomas Regner Copyright (c) 2001 Modifications to tinter: - reindentation, 4 spaces instead of 2 for a tab, I have a large monitor :-) - incompatible changes: - class Dialog and descendents expect a ScreenContainer-Instance as Parent NOT an sio-instance! - EVERY Control-Instance MUST provide the properties "Y","X","H","W" via GetProperty, this is needed for mouse-control - switch controls (focus) with arrow-keys - itīs possible to use curses-graphics in strings, they are mapped to ascii-ctrl-characters and replaced by sio.Print(...) - Mouse-Support (xterm,...) - new classes - menu-bar, menus, menu-items - scrollbar, vertical-scrollbar (therfor vertical button) - file-selector (slow but useable) - de-/activate Items (deactivated items never gain focus) - button-text is centered - semantics for color-usage TODO: - general clean-up of code (incl. code-duplication) - fix broken encapsulation of curses into class sio - make curses-pads sio-descendent - encapsulate color-usage - HotKeys - multiple-selection in file-selector - break up into smaler units!!! - ApplicationFrame-class with MenuBar, StatusBar and 'Whats this?' feature and a standard configuration for color-schemes and defaults for something Original Comment by Damond Walker: -------------------------------------------------- - This code usable under the LGPL. - - this thing has been a personal project of mine for, ohh, about a year now. I've grown to love it, - hate it, rue the day I saw Python for the first time. But it's been a learning experience. - - Oh, does it show I was learning Python the whole time? - - - Modes and Methodology of creating controls. - - All user controls are derived from the Control class. There done. Just kidding. - With that being said, what do you have to do to implement a control? Basically - you have to give it an "event loop" of sorts. Instead of having one huge - complicated event loop I decided to split the work among the controls themselves. - The primary event loop primarily concerns itself with picking the "next" control - and then calling the controls event loop. Still with me? - The simplest user control in this file is the Label control. Take the time to study - it as it is quite short. Notice that it only responds to one event, the Paint - event. Static labels are just that. - The next user control to look at is the Button. The button control has a basic - event loop which basically looks for either the enter key or a tab key. If the - user hits a tab key, the event loop exits. Otherwise the event loop calls the - user routine for the CLICK event. The button also responds to user Got/Lost focus - events. So you can create code to force the user to click the button if you so - choose. - - The standard events/properties are: - SYSPAINT: The main event loop is asking the control to paint itself on the screen. - PAINT: Allows user code. Fires after SYSPAINT. - REFRESH: Synonym for SYSPAINT, and sometimes, PAINT. - SYSLOSTFOCUS: The system is telling the control that it is about to lose focus. - LOSTFOCUS: As SYSLOSTFOCUS but this event is tied to user code and is fired after - the controls SYSLOSTFOCUS. The usercode which is fired as a result of this - event must return tiTRUE or tiFALSE. If it returns tiTRUE the focus will - move to the next control. If it returns tiFALSE, focus will remain on that - control. - SYSGOTFOCUS: The system is telling the control that it is about to gain focus. - GOTFOCUS: As SYSGOTFOCUS but this event is tied to user code and is fired after - the controls SYSGOTFOCUS event. The user code attached to this event must - return tiTRUE/tiFALSE. Operation is like LOSTFOCUS. - VERIFY: If this event is tied to usercode, it will be fired before the - SYSLOSTFOCUS/LOSTFOCUS pair. This routine must return tiTRUE/tiFALSE. - EXITFORM: If this property is set to tiTRUE and the user activates the control, - the global event loop will exit. Use this property with button controls. - X: Used to represent columns. - Y: Used to represent rows. - W: Used to represent width. - H: Used to represent height. - FOCUS: This property is used to see if a control has focus. - CANGETFOCUS: This property is set to tiTRUE if it is allowed to get focus. - Buttons are an example of something that can get focus while labels may not. --------------------------------------------------