diff --git a/package/README.md b/package/README.md index e69de29..14b0660 100644 --- a/package/README.md +++ b/package/README.md @@ -0,0 +1,5 @@ +# fkeycapture +This is a simple and easy to use package that allows you to capture individual keystrokes from the user. +#### Forms: +1. (Default) Recive key as a string +2. Recive key as bytes \ No newline at end of file diff --git a/package/dist/fkeycapture-Firepup650-0.0.1.tar.gz b/package/dist/fkeycapture-Firepup650-0.0.1.tar.gz new file mode 100644 index 0000000..28034e6 Binary files /dev/null and b/package/dist/fkeycapture-Firepup650-0.0.1.tar.gz differ diff --git a/package/dist/fkeycapture_Firepup650-0.0.1-py3-none-any.whl b/package/dist/fkeycapture_Firepup650-0.0.1-py3-none-any.whl new file mode 100644 index 0000000..f686c1b Binary files /dev/null and b/package/dist/fkeycapture_Firepup650-0.0.1-py3-none-any.whl differ diff --git a/package/setup.cfg b/package/setup.cfg index 4402857..ceb8f7d 100644 --- a/package/setup.cfg +++ b/package/setup.cfg @@ -1,19 +1,23 @@ [metadata] -name = fkeycapture-ALEXANDERMAPLES +name = fkeycapture-Firepup650 version = 0.0.1 -author = ALEXANDERMAPLES +author = Firepup650 author_email = firepyp650@gmail.com description = A way to capture keystrokes long_description = file: README.md long_description_content_type = text/markdown -url = https://github.com/pypa/sampleproject +url = https://github.com/Alexander-Maples/fkeycapture project_urls = - Bug Tracker = https://github.com/pypa/sampleproject/issues - Main = https://replit.com/@ALEXANDERMAPLES/fkeycapture + Bug Tracker = https://github.com/Alexander-Maples/fkeycapture/issues + replit = https://replit.com/@ALEXANDERMAPLES/fkeycapture classifiers = Programming Language :: Python :: 3 License :: OSI Approved :: MIT License Operating System :: OS Independent + Development Status :: 4 - Beta + Environment :: Console + Intended Audience :: Developers + Natural Language :: English [options] package_dir = diff --git a/package/src/fkeycapture/__init__.py b/package/src/fkeycapture/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/package/src/fkeycapture/fkeycapture.py b/package/src/fkeycapture/fkeycapture.py new file mode 100644 index 0000000..876f27c --- /dev/null +++ b/package/src/fkeycapture/fkeycapture.py @@ -0,0 +1,37 @@ +import termios, fcntl, sys +fd = sys.stdin.fileno() +flags_save = fcntl.fcntl(fd, fcntl.F_GETFL) +attrs_save = termios.tcgetattr(fd) +def getp1(): + import termios, fcntl, sys, os + fd = sys.stdin.fileno() + # save old state + flags_save = fcntl.fcntl(fd, fcntl.F_GETFL) + attrs_save = termios.tcgetattr(fd) + # make raw - the way to do this comes from the termios(3) man page. + attrs = list(attrs_save) # copy the stored version to update + # iflag + attrs[0] &= ~(termios.IGNBRK | termios.BRKINT | termios.PARMRK + | termios.ISTRIP | termios.INLCR | termios. IGNCR + | termios.ICRNL | termios.IXON ) + # oflag + attrs[1] &= ~termios.OPOST + # cflag + attrs[2] &= ~(termios.CSIZE | termios. PARENB) + attrs[2] |= termios.CS8 + # lflag + attrs[3] &= ~(termios.ECHONL | termios.ECHO | termios.ICANON + | termios.ISIG | termios.IEXTEN) + termios.tcsetattr(fd, termios.TCSANOW, attrs) + # turn off non-blocking + fcntl.fcntl(fd, fcntl.F_SETFL, flags_save & ~os.O_NONBLOCK) +def getp2(): + termios.tcsetattr(fd, termios.TCSAFLUSH, attrs_save) + fcntl.fcntl(fd, fcntl.F_SETFL, flags_save) +def get(keycount=1,bytes=False): + getp1() + key = sys.stdin.read(keycount) + getp2() + if bytes == True: + key = key.encode() + return key \ No newline at end of file diff --git a/package/src/fkeycapture_Firepup650.egg-info/PKG-INFO b/package/src/fkeycapture_Firepup650.egg-info/PKG-INFO new file mode 100644 index 0000000..1f1644a --- /dev/null +++ b/package/src/fkeycapture_Firepup650.egg-info/PKG-INFO @@ -0,0 +1,28 @@ +Metadata-Version: 2.1 +Name: fkeycapture-Firepup650 +Version: 0.0.1 +Summary: A way to capture keystrokes +Home-page: https://github.com/Alexander-Maples/fkeycapture +Author: Firepup650 +Author-email: firepyp650@gmail.com +License: UNKNOWN +Project-URL: Bug Tracker, https://github.com/Alexander-Maples/fkeycapture/issues +Project-URL: replit, https://replit.com/@ALEXANDERMAPLES/fkeycapture +Platform: UNKNOWN +Classifier: Programming Language :: Python :: 3 +Classifier: License :: OSI Approved :: MIT License +Classifier: Operating System :: OS Independent +Classifier: Development Status :: 4 - Beta +Classifier: Environment :: Console +Classifier: Intended Audience :: Developers +Classifier: Natural Language :: English +Requires-Python: >=3.6 +Description-Content-Type: text/markdown +License-File: LICENSE + +# fkeycapture +This is a simple and easy to use package that allows you to capture individual keystrokes from the user. +#### Forms: +1. (Default) Recive key as a string +2. Recive key as bytes + diff --git a/package/src/fkeycapture_Firepup650.egg-info/SOURCES.txt b/package/src/fkeycapture_Firepup650.egg-info/SOURCES.txt new file mode 100644 index 0000000..08bb027 --- /dev/null +++ b/package/src/fkeycapture_Firepup650.egg-info/SOURCES.txt @@ -0,0 +1,10 @@ +LICENSE +README.md +pyproject.toml +setup.cfg +src/fkeycapture/__init__.py +src/fkeycapture/fkeycapture.py +src/fkeycapture_Firepup650.egg-info/PKG-INFO +src/fkeycapture_Firepup650.egg-info/SOURCES.txt +src/fkeycapture_Firepup650.egg-info/dependency_links.txt +src/fkeycapture_Firepup650.egg-info/top_level.txt \ No newline at end of file diff --git a/package/src/fkeycapture_Firepup650.egg-info/dependency_links.txt b/package/src/fkeycapture_Firepup650.egg-info/dependency_links.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/package/src/fkeycapture_Firepup650.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/package/src/fkeycapture_Firepup650.egg-info/top_level.txt b/package/src/fkeycapture_Firepup650.egg-info/top_level.txt new file mode 100644 index 0000000..a083384 --- /dev/null +++ b/package/src/fkeycapture_Firepup650.egg-info/top_level.txt @@ -0,0 +1 @@ +fkeycapture