From 8a0c7c4d2d97c5b9f17cc69768d76e6afe734915 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 12 Apr 2014 20:08:00 +0200 Subject: m MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/interface.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/interface.py b/src/interface.py index 96c48b4..e657e0b 100644 --- a/src/interface.py +++ b/src/interface.py @@ -30,18 +30,18 @@ def user_interface(): ''' Start user interface ''' + (height, width) = struct.unpack('hh', fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, '1234')) + sock.sendall('status\n'.encode('utf-8')) + def winch(signal, frame): + nonlocal height, width + (height, width) = struct.unpack('hh', fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, '1234')) + signal.signal(signal.SIGWINCH, winch) print('\033[?1049h\033[?25l') saved_stty = termios.tcgetattr(sys.stdout.fileno()) stty = termios.tcgetattr(sys.stdout.fileno()) stty[3] &= ~(termios.ICANON | termios.ECHO | termios.ISIG) try: termios.tcsetattr(sys.stdout.fileno(), termios.TCSAFLUSH, stty) - (height, width) = struct.unpack('hh', fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, '1234')) - sock.sendall('status\n'.encode('utf-8')) - def winch(signal, frame): - nonlocal height, width - (height, width) = struct.unpack('hh', fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, '1234')) - signal.signal(signal.SIGWINCH, winch) def callback(status): if status is None: return -- cgit v1.2.3-70-g09d2