diff options
Diffstat (limited to 'pydora/utils.py')
-rw-r--r-- | pydora/utils.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/pydora/utils.py b/pydora/utils.py index 6675773..5a96ff1 100644 --- a/pydora/utils.py +++ b/pydora/utils.py | |||
@@ -10,11 +10,11 @@ class TerminalPlatformUnsupported(Exception): | |||
10 | Raised by code that can not be used to interact with the terminal on this | 10 | Raised by code that can not be used to interact with the terminal on this |
11 | platform. | 11 | platform. |
12 | """ | 12 | """ |
13 | |||
13 | pass | 14 | pass |
14 | 15 | ||
15 | 16 | ||
16 | class Colors: | 17 | class Colors: |
17 | |||
18 | def __wrap_with(raw_code): | 18 | def __wrap_with(raw_code): |
19 | @staticmethod | 19 | @staticmethod |
20 | def inner(text, bold=False): | 20 | def inner(text, bold=False): |
@@ -22,6 +22,7 @@ class Colors: | |||
22 | if bold: | 22 | if bold: |
23 | code = "1;{}".format(code) | 23 | code = "1;{}".format(code) |
24 | return "\033[{}m{}\033[0m".format(code, text) | 24 | return "\033[{}m{}\033[0m".format(code, text) |
25 | |||
25 | return inner | 26 | return inner |
26 | 27 | ||
27 | red = __wrap_with("31") | 28 | red = __wrap_with("31") |
@@ -44,6 +45,7 @@ class PosixEchoControl: | |||
44 | def __init__(self): | 45 | def __init__(self): |
45 | try: | 46 | try: |
46 | import termios | 47 | import termios |
48 | |||
47 | self.termios = termios | 49 | self.termios = termios |
48 | except ImportError: | 50 | except ImportError: |
49 | raise TerminalPlatformUnsupported("POSIX not supported") | 51 | raise TerminalPlatformUnsupported("POSIX not supported") |
@@ -110,7 +112,6 @@ class Win32EchoControl: | |||
110 | 112 | ||
111 | 113 | ||
112 | class Screen: | 114 | class Screen: |
113 | |||
114 | def __init__(self): | 115 | def __init__(self): |
115 | try: | 116 | try: |
116 | self._echo_driver = PosixEchoControl() | 117 | self._echo_driver = PosixEchoControl() |