From 259f88e58f10192c18cdef69266a222d3e92173a Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Fri, 23 Nov 2018 02:46:33 +0200 Subject: [PATCH] dagascii: use wait_for_input from asciimatics Fixes #1359 Signed-off-by: Ruslan Kuprieiev --- dvc/dagascii.py | 11 +++++++++-- requirements.txt | 2 +- setup.py | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/dvc/dagascii.py b/dvc/dagascii.py index 60eb27e17..8faa2c882 100644 --- a/dvc/dagascii.py +++ b/dvc/dagascii.py @@ -1,6 +1,5 @@ import sys import math -import select from grandalf.graphs import Vertex, Edge, Graph from grandalf.layouts import SugiyamaLayout @@ -8,6 +7,8 @@ from grandalf.routing import route_with_lines, EdgeViewer class AsciiCanvas(object): + TIMEOUT = 1 + def __init__(self, cols, lines): assert cols > 1 assert lines > 1 @@ -64,7 +65,13 @@ class AsciiCanvas(object): # NOTE: get_event() doesn't block by itself, # so we have to do the blocking ourselves. - select.select([sys.stdin], [], [], None) + # + # NOTE: using formally private method while waiting for PR [1] + # to get merged. After that need to adjust asciimatics version + # requirements. + # + # [1] https://github.com/peterbrittain/asciimatics/pull/188 + screen._wait_for_input(self.TIMEOUT) event = screen.get_event() if not isinstance(event, KeyboardEvent): diff --git a/requirements.txt b/requirements.txt index a0922bbe0..daae76efe 100644 --- a/requirements.txt +++ b/requirements.txt @@ -22,5 +22,5 @@ wheel>=0.31.1 futures>=3.2.0; python_version == "2.7" grandalf==0.6 pydot>=1.2.4 -asciimatics>=1.10.0 +asciimatics==1.10.0 distro>=1.3.0 diff --git a/setup.py b/setup.py index 708f83b5e..7f4a5e307 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ install_requires = [ "jsonpath-rw==1.4.0", "requests>=2.18.4", "grandalf==0.6", - "asciimatics>=1.10.0", + "asciimatics==1.10.0", "distro>=1.3.0", ]