From b686174b07bd56af4e5ffaa23c24f27f417fc305 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 19 Feb 2023 16:05:52 +0100 Subject: Merging upstream version 2.1.1 (Closes: #1026291). Signed-off-by: Daniel Baumann --- deluge/ui/console/modes/basemode.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'deluge/ui/console/modes/basemode.py') diff --git a/deluge/ui/console/modes/basemode.py b/deluge/ui/console/modes/basemode.py index dd3681f..5ebaf86 100644 --- a/deluge/ui/console/modes/basemode.py +++ b/deluge/ui/console/modes/basemode.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2011 Nick Lanham # Copyright (C) 2009 Andrew Resch @@ -8,8 +7,6 @@ # See LICENSE for more details. # -from __future__ import unicode_literals - import logging import sys @@ -26,9 +23,9 @@ except ImportError: try: import signal - from fcntl import ioctl - import termios import struct + import termios + from fcntl import ioctl except ImportError: pass @@ -36,7 +33,7 @@ except ImportError: log = logging.getLogger(__name__) -class InputKeyHandler(object): +class InputKeyHandler: def __init__(self): self._input_result = None @@ -62,12 +59,14 @@ class InputKeyHandler(object): return util.ReadState.IGNORED -class TermResizeHandler(object): +class TermResizeHandler: def __init__(self): try: signal.signal(signal.SIGWINCH, self.on_terminal_size) except ValueError as ex: - log.debug('Unable to catch SIGWINCH signal: %s', ex) + log.debug('TermResize unavailable, unable to catch SIGWINCH signal: %s', ex) + except AttributeError as ex: + log.debug('TermResize unavailable, no SIGWINCH signal on Windows: %s', ex) def on_terminal_size(self, *args): # Get the new rows and cols value @@ -78,14 +77,14 @@ class TermResizeHandler(object): return rows, cols -class CursesStdIO(object): +class CursesStdIO: """ fake fd to be registered as a reader with the twisted reactor. Curses classes needing input should extend this """ def fileno(self): - """ We want to select on FD 0 """ + """We want to select on FD 0""" return 0 def doRead(self): # NOQA: N802 -- cgit v1.2.3