1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
From: Boyuan Yang <byang@debian.org>
Date: Tue, 24 Feb 2026 23:13:47 -0500
Subject: Fix urwid 3.x compatibility
---
urwid_utils/colors.py | 8 ++++----
urwid_utils/keys.py | 4 ++--
urwid_utils/palette.py | 4 ++--
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/urwid_utils/colors.py b/urwid_utils/colors.py
index 5fc3689..ea222ff 100644
--- a/urwid_utils/colors.py
+++ b/urwid_utils/colors.py
@@ -3,9 +3,9 @@
import re
import urwid
import math
-from urwid.display_common import _BASIC_COLORS as BASIC_COLORS
-from urwid.display_common import _BASIC_COLOR_VALUES as BASIC_COLOR_VALUES
-from urwid.display_common import _ATTRIBUTES as STYLES
+from urwid.display.common import _BASIC_COLORS as BASIC_COLORS
+from urwid.display.common import _BASIC_COLOR_VALUES as BASIC_COLOR_VALUES
+from urwid.display.common import _ATTRIBUTES as STYLES
from urwid_utils.util import get_const_identifiers
STYLES = list(zip([n.upper() for n in STYLES], STYLES))
@@ -26,7 +26,7 @@ def nearest_basic_color(high_color):
return BASIC_COLOR_MAP[closest_colors[0]]
-color_const = get_const_identifiers(urwid.display_common, STYLES)
+color_const = get_const_identifiers(urwid.display.common, STYLES)
color_const['STYLES'] = STYLES
globals().update(color_const)
__all__ = list(color_const.keys())
diff --git a/urwid_utils/keys.py b/urwid_utils/keys.py
index 76f3ae7..332a116 100644
--- a/urwid_utils/keys.py
+++ b/urwid_utils/keys.py
@@ -2,7 +2,7 @@
import urwid
from urwid_utils.util import is_valid_identifier, get_const_identifiers
-from urwid.escape import input_sequences, _keyconv
+from urwid.display.escape import input_sequences, _keyconv
class KeySequence(str):
@@ -19,7 +19,7 @@ for key in keys:
if is_valid_identifier(attr_name):
key_const[attr_name] = KeySequence(key)
-key_const.update(get_const_identifiers(urwid.escape))
+key_const.update(get_const_identifiers(urwid.display.escape))
key_const.pop('ESC') # FIXME: is this necessary?
key_const['ESCAPE'] = 'esc' # FIXME: is this necessary?
globals().update(key_const)
diff --git a/urwid_utils/palette.py b/urwid_utils/palette.py
index 2175691..2a75548 100644
--- a/urwid_utils/palette.py
+++ b/urwid_utils/palette.py
@@ -3,9 +3,9 @@
import urwid
from urwid_utils.colors import BASIC_COLORS, STYLES, nearest_basic_color
from urwid_utils.util import is_valid_identifier
-from urwid.display_common import _parse_color_256, AttrSpec
+from urwid.display.common import _parse_color_256, AttrSpec
try:
- from urwid.display_common import _parse_color_true
+ from urwid.display.common import _parse_color_true
URWID_HAS_TRUE_COLOR=True
except ImportError:
URWID_HAS_TRUE_COLOR=False
|