GTerm: A dumb Telnet terminal with colour graphics and APL support




GTerm text plane with APL virtual keyboard ...


GTerm is a simple terminal emulator written in Python. It communicates with some operating system or application using good old Telnet. As far as text goes, it is a dumb, "glass teletype" style terminal. It doesn't understand "VT-100" cursor addressing or anything similar, so full screen editors cannot be used with it, for example. It does, however, understand a set of graphics commands (currently for colour vector line drawing). It is also rather flexible where the characters to be displayed are concerned. Anything that can be drawn and put in an image file can be displayed, because characters are drawn with texture mapping.

As of V0.4 (June 2019), it also implements local line recall and editing using arrow keys and a couple of Emacs-like control characters. This can make using some remote applications much less painful. This also works with APL characters.

It was actually written to serve as an "application terminal" for an emulated CDC Cyber mainframe computer. I wanted to be able to do two specific things:
  • Run an interactive graph drawing program (along the lines of GNUPlot) and have the graphics displayed on the terminal.
  • Run APL2 on the Cyber machine with the right APL characters displayed and with some way to enter these APL characters.
Terminals on the emulated mainframe are implemented using Telnet, so the terminal emulator needed to use the Telnet protocol. It looked as if the "batteries included" philosophy of Python went far enough to include all the bits and pieces needed to make writing a terminal emulator feasible with an acceptable amount of work. So, I thought I'd have a go at it ...

It was a valuable learning experience involving quite a lot of Python modules, seeing threading in action in Python, using PyQt, as well as making use of Cairo (for anti-aliased graphics), getting to grips (to a minimal extent) with Unicode, and many other things. As a "spare time" project, this would have been simply impossible to do with C++, IMHO. I think it would have been an order of magnitude harder (or, at least, larger), which would have made it out of the question as a "hobby project".

As it stands, it is unlikely to be of direct use to anyone but myself and a handful of others who run an emulated CDC mainframe. However, some of the code may be useful to others. For example, I could find very little practical documentation on option negotiation for the Telnet module -- the minimum interactions required to have a terminal and an operating system work well together. GTerm has code that seems to work with Linux and Windows as well as VMS and NOS.

GTerm defines its own graphics control codes, so applications have to be written to generate these to have graphics displayed. To partner GTerm, there is an interactive graph plotting program for NOS called GPLOT. There is a 'library' (of sorts) of Python code included which shows how to generate the graphics control codes. This should work on just about any modern computer and is a concrete example that might be useful if generating these codes from another language.

GTerm works on Linux (Ubuntu 12.04 and 14.0 have been tested --- there are some files for integrating GTerm with Unity) and Mac OS X V10.12+. There is a "binary" build of GTerm, made with PyInstaller, and a graphical installer for Mac OS X. If no changes are to be made to GTerm, that is the easiest way to run it (if you have a Mac). Because of the way GTerm uses select(), it would not be entirely straightforward to port it to Windows. (I won't be trying to do that myself --- I no longer have any machines running Windows).

Here are a couple more screenshots:



GTerm graphics plane showing random, anti-aliased, wide lines.






GTerm graphics plane showing a graph plotted by GPLOT from APL generated data.


The PDF manual for GTerm can be downloaded here. The software itself is available in source form here. The "binary" version for Mac OS X is available here. This is a 29 MByte disk image, so it may take some time to fetch over my ADSL link! The manual is hopefully fairly complete and includes some information on the overall structure of the program which might be useful if modifying it.

One "off-the-wall" application might be to produce computer displays with "weird" characters for use in-shot in videos. Might come in useful if you are making your own sci-fi epic! Well -- probably not ...

I hope this software might be of some use to people other than myself. Feel free to do anything you like with it, although I'd be grateful if you acknowledged where it came from if you do use it.


Go home ...