magmax / python-readchar

Python library to read characters and key strokes
MIT License
143 stars 45 forks source link

Version 0.12.0? used 12 because 11 was last used. #23

Closed suresttexas00 closed 3 years ago

suresttexas00 commented 7 years ago

Based off of 0.8.0, this version successfully implements the Linux special keys including the ESC.

For both OS types, the new readkey() now wraps a get_char method, which is separate from the readchar methods (which only return a character byte). The get_char handles the reading need to get the full keystroke codes.

for Linux:

for Windows:

suresttexas00 commented 7 years ago

@magmax .. Can we discuss?? I found the problem. The test suite is substituting its get_char function for the actual function in our code... which works when YOUR readkey was processing the keystrokes (not real keystrokes, but just a stream of values). As a result, when the test suite passes "\x1b ....", the stream returns x1b and the factory function returns that to the test code. The internal functions for get_char for linux or windows never get run.

This test suite does not properly test our code. I have just tweaked it to allow passing the factory function test stream...

suresttexas00 commented 7 years ago

If you don't like this whole thing, feel free to close it. I admit it is a bit of a mess and maybe you want to start from scratch with what you were doing. I don't like the hacks I implemented around the Travis testing, which created "passing" build, but horrible code...

However, on my own project, I did do a lot of windows testing and mapped most of the windows keys. I would suggest you take advantage of the mappings I made for windows in my other repo: https://github.com/suresttexas00/readkey

magmax commented 7 years ago

I see you already realized about the mess we have to do here. But I think it is better to do the mess here than in a lot of projects.

I started this project thinking it was much easier, but... well, now I am even more happy to have started it, despite maybe it is not the best solution in the world.

Thank you very much for your contributions. I will have a second look as soon as I can.

suresttexas00 commented 7 years ago

Not sure where we are with this now... Did you want me to make these changes first, or did you want to approve the pull request and then make the changes yourself?

magmax commented 3 years ago

I've changed the way to use versions. Do not care about them any more. This PR contains a lot of changes. Please, use smaller ones.

suresttexas00 commented 3 years ago

Wow, I had forgotten about this. I don't use it anymore and I have no idea where I left off, code-wise. I won't be issuing any more PR's at this time.