summaryrefslogtreecommitdiffstats
path: root/deluge/ui/console/modes/basemode.py
diff options
context:
space:
mode:
Diffstat (limited to 'deluge/ui/console/modes/basemode.py')
-rw-r--r--deluge/ui/console/modes/basemode.py19
1 files changed, 9 insertions, 10 deletions
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 <nick@afternight.org>
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
@@ -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