From 1b1d6ac2694ed540963d41cf08e5853fb88f8d68 Mon Sep 17 00:00:00 2001 From: chrys Date: Tue, 20 Aug 2019 11:44:33 +0200 Subject: [PATCH] Update screen_utils.py --- src/fenrirscreenreader/utils/screen_utils.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/fenrirscreenreader/utils/screen_utils.py b/src/fenrirscreenreader/utils/screen_utils.py index e6810063..8c34d41c 100644 --- a/src/fenrirscreenreader/utils/screen_utils.py +++ b/src/fenrirscreenreader/utils/screen_utils.py @@ -5,7 +5,8 @@ # By Chrys, Storm Dragon, and contributers. from fenrirscreenreader.core import debug -import getpass, time, string, select, os +import getpass, time, string, os +from select import select def removeNonprintable(text): # Get the difference of all ASCII characters from the set of printable characters @@ -35,16 +36,18 @@ def createScreenEventData(content): } return eventData.copy() -def hasMore(fd, timetout=0.1): - r, _, _ = select.select([fd], [], [], timetout) - return (fd in r) -def hasMoreWhat(fdList, timetout=0.1): +def hasMore(fd, timetout=0.05): + r, _, _ = select([fd], [], [], timetout) + return (fd in r) + +def hasMoreWhat(fdList, timetout=0.05): if not isinstance(fdList, list): return [] elif fdList == []: return [] - r, _, _ = select.select(fdList, [], [], timetout) + r, _, _ = select(fdList, [], [], timetout) return r + def isValidShell(shell = ''): if not isinstance(shell, str): return False @@ -58,6 +61,7 @@ def isValidShell(shell = ''): except: return False return True + def getShell(): try: shell = os.environ["FENRIRSHELL"]