[Twisted-Python] Python Xlib + Twisted

Ed Suominen general at eepatents.com
Mon Mar 14 12:33:23 EST 2005

Below is what I sent to python-xlib-users this morning. Hopefully 
there's some interest in getting a Twisted-driven version of Python 
Xlib done. I think I've learned the innards of Twisted well enough by 
now to do it myself (writing a new protocol for X events), but help and 
advice is of course welcome.

Ed Suominen
Registered Patent Agent
Open-Source Software Author (yes, both...)
Web Site: http://www.eepatents.com

On Monday 14 March 2005 08:08 am, Peter Liljenberg wrote:
> Simon Forman, calroc99 at users.sourceforge.net, has kindly offered to
> maintain Python Xlib from now on.  Give him a big hand, folks.
> I'll resign as project admin, but will still lurk around and may even
> do the occasional CVS commit (here's hoping).
> /Peter Liljenberg

Python Xlib is a neat project, and I'm glad to see the continued 

One of the projects I've been planning for the near future is to add 
some functionality to the connection code of Python Xlib so that it can 
operate asynchronously using the Twisted networking framework rather 
than relying on blocking and threads. I'm planning to integrate the 
patched Python Xlib into WinDictator, a Windows-Linux bridge I wrote 
and use for running dictation software in VMware and having the 
keystrokes typed with X events.

Briefly, the Windows copy of WinDictator is a TCP server to a Linux 
client and presents a dictation window on the Windows machine.  Using 
the dictation software's "direct dictation" feature, the user generates 
text in the dictation window, which is sent immediately to the Linux 
client. The Linux client then generates an X "KeyPress" event (followed 
by an X "KeyRelease" event) corresponding to the character sent from 
the Windows client. It is assumed that the (virtual) Windows machine is 
insecure and will be firewalled off from the Internet anyhow, so it is 
the TCP server. Plus, multiple Linux clients can connect to and use a 
single Windows server at different times.

Advantageously, the client-server pair allows "direct dictation" from a 
text entry window running on Windows (along with the Windows-only
dictation software) to whatever word processor the user is employing
under Linux. The text entry window can be viewed on a separate screen of
a separate Windows box, or can appear somewhere on the Linux computer's
display. The latter can be accomplished by emulation with VMware or (I 
think) QEMU, or by VNC operation of the separate Windows box.

Twisted's "Perspective Broker" maintains the client-server communication 
very nicely at a high level. WinDicator works great with the xte 
program "typing" the keystrokes, and I use it every day. But I want to 
improve it and need the finer-grained control of Python Xlib to do so. 
Ideally, I would like to see Python Xlib's networking integrated 
smoothly into Twisted's asynchronous event loop for performance, 
compatibility, and because it is just plain cool.

See http://twistedmatrix.com/services/twisted-advantage for more info 
about Twisted, if you're interested. It runs my web site plus my boss's 
site (http://valuablepatents.com), among other things, off of a single 
main python thread. 

Offers of cooperation, either to add Twisted capability to Python Xlib 
or with WinDictator (GPL) itself, would of course be welcomed.

More information about the Twisted-Python mailing list