
Jean-Paul Calderone ha scritto:
On Sat, 30 Sep 2006 13:06:03 +0200, Manlio Perillo <manlio_perillo@libero.it> wrote:
[snip]
Here is the main code. I suspect such a thing will never be accepted into Twisted ;-):
[snip]
This looks like it could be an interesting beginning for better terminal support on Windows. It would be better if you included it in unified diff format in the issue tracker, though, along with the unit tests you developed with it. I don't know if anyone out there is interested enough to finish it, but if it correctly provides even a basic level of functionality, it might prove a useful starting place for some other developer.
I just remembered that IPython came with a readline implementation in Python + ctypes. There is a complete console module with ansi terminal emulation. The idea is to write a conio module with an implementation for both Windows and POSIX (like serialport).
Comprehensive test coverage and developer-oriented documentation improve the chances of someone else picking up where you've left off.
I'll try to reuse the console module from IPython. Is it a problem the use of ctype? This is not really necessary with pywin32.
The ConsoleWriter does not need to support asyncronous I/O, so it is a simple wrapper for ConsoleWrite.
Why? Can't writing block? What if you write a huge amount of data? What if the user clicks and holds on the terminal, or selects a menu or resizes the window? Won't those lead to a write blocking for an arbitrary amount of time?
Ok. I'll just copy the code from _PollableWritePipe. If I'm not wrong it simply write a chunk of data at every tick of the timer.
This code still have some problems[1]... For now I have added this to _pollingfile module.
[snip]
[1] How can be tested such a thing?
Presumably by launching a process in a terminal and then communicating with it in order to assert things about its behavior.
I'll try to do something. Regards Manlio Perillo