mirror of
https://github.com/iperov/DeepFaceLab.git
synced 2025-07-06 13:02:15 -07:00
1
This commit is contained in:
parent
869c5e8dd0
commit
f1a3150ce9
6 changed files with 75 additions and 50 deletions
|
@ -367,6 +367,7 @@ class InteractBase(object):
|
|||
def input_in_time (self, str, max_time_sec):
|
||||
sq = multiprocessing.Queue()
|
||||
p = multiprocessing.Process(target=self.input_process, args=( sys.stdin.fileno(), sq, str))
|
||||
p.daemon = True
|
||||
p.start()
|
||||
t = time.time()
|
||||
inp = False
|
||||
|
@ -380,6 +381,25 @@ class InteractBase(object):
|
|||
sys.stdin = os.fdopen( sys.stdin.fileno() )
|
||||
return inp
|
||||
|
||||
def input_process_skip_pending(self, stdin_fd):
|
||||
sys.stdin = os.fdopen(stdin_fd)
|
||||
while True:
|
||||
try:
|
||||
if sys.stdin.isatty():
|
||||
sys.stdin.read()
|
||||
except:
|
||||
pass
|
||||
|
||||
def input_skip_pending(self):
|
||||
"""
|
||||
skips unnecessary inputs between the dialogs
|
||||
"""
|
||||
p = multiprocessing.Process(target=self.input_process_skip_pending, args=( sys.stdin.fileno(), ))
|
||||
p.daemon = True
|
||||
p.start()
|
||||
time.sleep(0.5)
|
||||
p.terminate()
|
||||
sys.stdin = os.fdopen( sys.stdin.fileno() )
|
||||
|
||||
|
||||
class InteractDesktop(InteractBase):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue