urwid 2.6.0.post0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of urwid might be problematic. Click here for more details.
- urwid/__init__.py +333 -0
- urwid/canvas.py +1413 -0
- urwid/command_map.py +137 -0
- urwid/container.py +59 -0
- urwid/decoration.py +65 -0
- urwid/display/__init__.py +97 -0
- urwid/display/_posix_raw_display.py +413 -0
- urwid/display/_raw_display_base.py +914 -0
- urwid/display/_web.css +12 -0
- urwid/display/_web.js +462 -0
- urwid/display/_win32.py +171 -0
- urwid/display/_win32_raw_display.py +269 -0
- urwid/display/common.py +1219 -0
- urwid/display/curses.py +690 -0
- urwid/display/escape.py +624 -0
- urwid/display/html_fragment.py +251 -0
- urwid/display/lcd.py +518 -0
- urwid/display/raw.py +37 -0
- urwid/display/web.py +636 -0
- urwid/event_loop/__init__.py +55 -0
- urwid/event_loop/abstract_loop.py +175 -0
- urwid/event_loop/asyncio_loop.py +231 -0
- urwid/event_loop/glib_loop.py +294 -0
- urwid/event_loop/main_loop.py +721 -0
- urwid/event_loop/select_loop.py +230 -0
- urwid/event_loop/tornado_loop.py +206 -0
- urwid/event_loop/trio_loop.py +302 -0
- urwid/event_loop/twisted_loop.py +269 -0
- urwid/event_loop/zmq_loop.py +275 -0
- urwid/font.py +695 -0
- urwid/graphics.py +96 -0
- urwid/highlight.css +19 -0
- urwid/listbox.py +1899 -0
- urwid/monitored_list.py +522 -0
- urwid/numedit.py +376 -0
- urwid/signals.py +330 -0
- urwid/split_repr.py +130 -0
- urwid/str_util.py +358 -0
- urwid/text_layout.py +632 -0
- urwid/treetools.py +515 -0
- urwid/util.py +557 -0
- urwid/version.py +16 -0
- urwid/vterm.py +1806 -0
- urwid/widget/__init__.py +181 -0
- urwid/widget/attr_map.py +161 -0
- urwid/widget/attr_wrap.py +140 -0
- urwid/widget/bar_graph.py +649 -0
- urwid/widget/big_text.py +77 -0
- urwid/widget/box_adapter.py +126 -0
- urwid/widget/columns.py +1145 -0
- urwid/widget/constants.py +574 -0
- urwid/widget/container.py +227 -0
- urwid/widget/divider.py +110 -0
- urwid/widget/edit.py +718 -0
- urwid/widget/filler.py +403 -0
- urwid/widget/frame.py +539 -0
- urwid/widget/grid_flow.py +539 -0
- urwid/widget/line_box.py +194 -0
- urwid/widget/overlay.py +829 -0
- urwid/widget/padding.py +597 -0
- urwid/widget/pile.py +971 -0
- urwid/widget/popup.py +170 -0
- urwid/widget/progress_bar.py +141 -0
- urwid/widget/scrollable.py +597 -0
- urwid/widget/solid_fill.py +44 -0
- urwid/widget/text.py +354 -0
- urwid/widget/widget.py +852 -0
- urwid/widget/widget_decoration.py +166 -0
- urwid/widget/wimp.py +792 -0
- urwid/wimp.py +23 -0
- urwid-2.6.0.post0.dist-info/COPYING +504 -0
- urwid-2.6.0.post0.dist-info/METADATA +332 -0
- urwid-2.6.0.post0.dist-info/RECORD +75 -0
- urwid-2.6.0.post0.dist-info/WHEEL +5 -0
- urwid-2.6.0.post0.dist-info/top_level.txt +1 -0
urwid/__init__.py
ADDED
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
# Urwid __init__.py - all the stuff you're likely to care about
|
|
2
|
+
#
|
|
3
|
+
# Copyright (C) 2004-2012 Ian Ward
|
|
4
|
+
#
|
|
5
|
+
# This library is free software; you can redistribute it and/or
|
|
6
|
+
# modify it under the terms of the GNU Lesser General Public
|
|
7
|
+
# License as published by the Free Software Foundation; either
|
|
8
|
+
# version 2.1 of the License, or (at your option) any later version.
|
|
9
|
+
#
|
|
10
|
+
# This library is distributed in the hope that it will be useful,
|
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
13
|
+
# Lesser General Public License for more details.
|
|
14
|
+
#
|
|
15
|
+
# You should have received a copy of the GNU Lesser General Public
|
|
16
|
+
# License along with this library; if not, write to the Free Software
|
|
17
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
18
|
+
#
|
|
19
|
+
# Urwid web site: https://urwid.org/
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
from __future__ import annotations
|
|
23
|
+
|
|
24
|
+
import importlib
|
|
25
|
+
import sys
|
|
26
|
+
import types
|
|
27
|
+
import typing
|
|
28
|
+
import warnings
|
|
29
|
+
|
|
30
|
+
from urwid.canvas import (
|
|
31
|
+
BlankCanvas,
|
|
32
|
+
Canvas,
|
|
33
|
+
CanvasCache,
|
|
34
|
+
CanvasCombine,
|
|
35
|
+
CanvasError,
|
|
36
|
+
CanvasJoin,
|
|
37
|
+
CanvasOverlay,
|
|
38
|
+
CompositeCanvas,
|
|
39
|
+
SolidCanvas,
|
|
40
|
+
TextCanvas,
|
|
41
|
+
)
|
|
42
|
+
from urwid.command_map import (
|
|
43
|
+
ACTIVATE,
|
|
44
|
+
CURSOR_DOWN,
|
|
45
|
+
CURSOR_LEFT,
|
|
46
|
+
CURSOR_MAX_LEFT,
|
|
47
|
+
CURSOR_MAX_RIGHT,
|
|
48
|
+
CURSOR_PAGE_DOWN,
|
|
49
|
+
CURSOR_PAGE_UP,
|
|
50
|
+
CURSOR_RIGHT,
|
|
51
|
+
CURSOR_UP,
|
|
52
|
+
REDRAW_SCREEN,
|
|
53
|
+
CommandMap,
|
|
54
|
+
command_map,
|
|
55
|
+
)
|
|
56
|
+
from urwid.display import (
|
|
57
|
+
BLACK,
|
|
58
|
+
BROWN,
|
|
59
|
+
DARK_BLUE,
|
|
60
|
+
DARK_CYAN,
|
|
61
|
+
DARK_GRAY,
|
|
62
|
+
DARK_GREEN,
|
|
63
|
+
DARK_MAGENTA,
|
|
64
|
+
DARK_RED,
|
|
65
|
+
DEFAULT,
|
|
66
|
+
LIGHT_BLUE,
|
|
67
|
+
LIGHT_CYAN,
|
|
68
|
+
LIGHT_GRAY,
|
|
69
|
+
LIGHT_GREEN,
|
|
70
|
+
LIGHT_MAGENTA,
|
|
71
|
+
LIGHT_RED,
|
|
72
|
+
UPDATE_PALETTE_ENTRY,
|
|
73
|
+
WHITE,
|
|
74
|
+
YELLOW,
|
|
75
|
+
AttrSpec,
|
|
76
|
+
AttrSpecError,
|
|
77
|
+
BaseScreen,
|
|
78
|
+
RealTerminal,
|
|
79
|
+
ScreenError,
|
|
80
|
+
)
|
|
81
|
+
from urwid.event_loop import AsyncioEventLoop, EventLoop, ExitMainLoop, MainLoop, SelectEventLoop
|
|
82
|
+
from urwid.font import (
|
|
83
|
+
Font,
|
|
84
|
+
FontRegistry,
|
|
85
|
+
HalfBlock5x4Font,
|
|
86
|
+
HalfBlock6x5Font,
|
|
87
|
+
HalfBlock7x7Font,
|
|
88
|
+
HalfBlockHeavy6x5Font,
|
|
89
|
+
Sextant2x2Font,
|
|
90
|
+
Sextant3x3Font,
|
|
91
|
+
Thin3x3Font,
|
|
92
|
+
Thin4x3Font,
|
|
93
|
+
Thin6x6Font,
|
|
94
|
+
get_all_fonts,
|
|
95
|
+
)
|
|
96
|
+
from urwid.listbox import ListBox, ListBoxError, ListWalker, ListWalkerError, SimpleFocusListWalker, SimpleListWalker
|
|
97
|
+
from urwid.monitored_list import MonitoredFocusList, MonitoredList
|
|
98
|
+
from urwid.signals import (
|
|
99
|
+
MetaSignals,
|
|
100
|
+
Signals,
|
|
101
|
+
connect_signal,
|
|
102
|
+
disconnect_signal,
|
|
103
|
+
disconnect_signal_by_key,
|
|
104
|
+
emit_signal,
|
|
105
|
+
register_signal,
|
|
106
|
+
)
|
|
107
|
+
from urwid.str_util import calc_text_pos, calc_width, is_wide_char, move_next_char, move_prev_char, within_double_byte
|
|
108
|
+
from urwid.text_layout import LayoutSegment, StandardTextLayout, TextLayout, default_layout
|
|
109
|
+
from urwid.util import (
|
|
110
|
+
MetaSuper,
|
|
111
|
+
TagMarkupException,
|
|
112
|
+
apply_target_encoding,
|
|
113
|
+
calc_trim_text,
|
|
114
|
+
decompose_tagmarkup,
|
|
115
|
+
detected_encoding,
|
|
116
|
+
get_encoding_mode,
|
|
117
|
+
int_scale,
|
|
118
|
+
is_mouse_event,
|
|
119
|
+
set_encoding,
|
|
120
|
+
supports_unicode,
|
|
121
|
+
)
|
|
122
|
+
from urwid.version import version as __version__
|
|
123
|
+
from urwid.version import version_tuple as __version_tuple__
|
|
124
|
+
from urwid.widget import (
|
|
125
|
+
ANY,
|
|
126
|
+
BOTTOM,
|
|
127
|
+
BOX,
|
|
128
|
+
CENTER,
|
|
129
|
+
CLIP,
|
|
130
|
+
ELLIPSIS,
|
|
131
|
+
FIXED,
|
|
132
|
+
FLOW,
|
|
133
|
+
GIVEN,
|
|
134
|
+
LEFT,
|
|
135
|
+
MIDDLE,
|
|
136
|
+
PACK,
|
|
137
|
+
RELATIVE,
|
|
138
|
+
RELATIVE_100,
|
|
139
|
+
RIGHT,
|
|
140
|
+
SPACE,
|
|
141
|
+
TOP,
|
|
142
|
+
WEIGHT,
|
|
143
|
+
Align,
|
|
144
|
+
AttrMap,
|
|
145
|
+
AttrMapError,
|
|
146
|
+
AttrWrap,
|
|
147
|
+
BarGraph,
|
|
148
|
+
BarGraphError,
|
|
149
|
+
BarGraphMeta,
|
|
150
|
+
BigText,
|
|
151
|
+
BoxAdapter,
|
|
152
|
+
BoxAdapterError,
|
|
153
|
+
BoxWidget,
|
|
154
|
+
Button,
|
|
155
|
+
CheckBox,
|
|
156
|
+
CheckBoxError,
|
|
157
|
+
Columns,
|
|
158
|
+
ColumnsError,
|
|
159
|
+
Divider,
|
|
160
|
+
Edit,
|
|
161
|
+
EditError,
|
|
162
|
+
Filler,
|
|
163
|
+
FillerError,
|
|
164
|
+
FixedWidget,
|
|
165
|
+
FlowWidget,
|
|
166
|
+
Frame,
|
|
167
|
+
FrameError,
|
|
168
|
+
GraphVScale,
|
|
169
|
+
GridFlow,
|
|
170
|
+
GridFlowError,
|
|
171
|
+
IntEdit,
|
|
172
|
+
LineBox,
|
|
173
|
+
Overlay,
|
|
174
|
+
OverlayError,
|
|
175
|
+
Padding,
|
|
176
|
+
PaddingError,
|
|
177
|
+
Pile,
|
|
178
|
+
PileError,
|
|
179
|
+
PopUpLauncher,
|
|
180
|
+
PopUpTarget,
|
|
181
|
+
ProgressBar,
|
|
182
|
+
RadioButton,
|
|
183
|
+
Scrollable,
|
|
184
|
+
ScrollBar,
|
|
185
|
+
SelectableIcon,
|
|
186
|
+
Sizing,
|
|
187
|
+
SolidFill,
|
|
188
|
+
Text,
|
|
189
|
+
TextError,
|
|
190
|
+
VAlign,
|
|
191
|
+
WHSettings,
|
|
192
|
+
Widget,
|
|
193
|
+
WidgetContainerMixin,
|
|
194
|
+
WidgetDecoration,
|
|
195
|
+
WidgetDisable,
|
|
196
|
+
WidgetError,
|
|
197
|
+
WidgetMeta,
|
|
198
|
+
WidgetPlaceholder,
|
|
199
|
+
WidgetWrap,
|
|
200
|
+
WidgetWrapError,
|
|
201
|
+
WrapMode,
|
|
202
|
+
delegate_to_widget_mixin,
|
|
203
|
+
fixed_size,
|
|
204
|
+
scale_bar_values,
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
from . import display, event_loop, widget
|
|
208
|
+
|
|
209
|
+
from .treetools import ParentNode, TreeListBox, TreeNode, TreeWalker, TreeWidget, TreeWidgetError # isort: skip
|
|
210
|
+
|
|
211
|
+
# Optional event loops with external dependencies
|
|
212
|
+
|
|
213
|
+
try:
|
|
214
|
+
from .event_loop import TornadoEventLoop
|
|
215
|
+
except ImportError:
|
|
216
|
+
pass
|
|
217
|
+
|
|
218
|
+
try:
|
|
219
|
+
from .event_loop import GLibEventLoop
|
|
220
|
+
except ImportError:
|
|
221
|
+
pass
|
|
222
|
+
|
|
223
|
+
try:
|
|
224
|
+
from .event_loop import TwistedEventLoop
|
|
225
|
+
except ImportError:
|
|
226
|
+
pass
|
|
227
|
+
|
|
228
|
+
try:
|
|
229
|
+
from .event_loop import TrioEventLoop
|
|
230
|
+
except ImportError:
|
|
231
|
+
pass
|
|
232
|
+
|
|
233
|
+
# OS Specific
|
|
234
|
+
if sys.platform != "win32":
|
|
235
|
+
from .vterm import TermCanvas, TermCharset, Terminal, TermModes, TermScroller
|
|
236
|
+
|
|
237
|
+
# ZMQEventLoop cause interpreter crash on windows
|
|
238
|
+
try:
|
|
239
|
+
from .event_loop import ZMQEventLoop
|
|
240
|
+
except ImportError:
|
|
241
|
+
pass
|
|
242
|
+
|
|
243
|
+
# Backward compatibility
|
|
244
|
+
VERSION = __version_tuple__
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
# Moved modules handling
|
|
248
|
+
__locals: dict[str, typing.Any] = locals() # use mutable access for pure lazy loading
|
|
249
|
+
|
|
250
|
+
# Backward compatible lazy load with deprecation warnings
|
|
251
|
+
_moved_warn: dict[str, str] = {
|
|
252
|
+
"lcd_display": "urwid.display.lcd",
|
|
253
|
+
"html_fragment": "urwid.display.html_fragment",
|
|
254
|
+
"web_display": "urwid.display.web",
|
|
255
|
+
}
|
|
256
|
+
# Backward compatible lazy load without any warnings
|
|
257
|
+
# Before DeprecationWarning need to start PendingDeprecationWarning process.
|
|
258
|
+
_moved_no_warn: dict[str, str] = {
|
|
259
|
+
"display_common": "urwid.display.common",
|
|
260
|
+
"raw_display": "urwid.display.raw",
|
|
261
|
+
"curses_display": "urwid.display.curses",
|
|
262
|
+
"escape": "urwid.display.escape",
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
class _MovedModule(types.ModuleType):
|
|
267
|
+
"""Special class to handle moved modules.
|
|
268
|
+
|
|
269
|
+
PEP-0562 handles moved modules attributes, but unfortunately not handle nested modules access
|
|
270
|
+
like "from xxx.yyy import zzz"
|
|
271
|
+
"""
|
|
272
|
+
|
|
273
|
+
__slots__ = ("_moved_from", "_moved_to")
|
|
274
|
+
|
|
275
|
+
def __init__(self, moved_from: str, moved_to: str) -> None:
|
|
276
|
+
super().__init__(moved_from.join(".")[-1])
|
|
277
|
+
self._moved_from = moved_from
|
|
278
|
+
self._moved_to = moved_to
|
|
279
|
+
|
|
280
|
+
def __getattr__(self, name: str) -> typing.Any:
|
|
281
|
+
real_module = importlib.import_module(self._moved_to)
|
|
282
|
+
sys.modules[self._moved_from] = real_module
|
|
283
|
+
return getattr(real_module, name)
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
class _MovedModuleWarn(_MovedModule):
|
|
287
|
+
"""Special class to handle moved modules.
|
|
288
|
+
|
|
289
|
+
Produce DeprecationWarning messages for imports.
|
|
290
|
+
"""
|
|
291
|
+
|
|
292
|
+
__slots__ = ()
|
|
293
|
+
|
|
294
|
+
def __getattr__(self, name: str) -> typing.Any:
|
|
295
|
+
warnings.warn(
|
|
296
|
+
f"{self._moved_from} is moved to {self._moved_to}",
|
|
297
|
+
DeprecationWarning,
|
|
298
|
+
stacklevel=2,
|
|
299
|
+
)
|
|
300
|
+
return super().__getattr__(name)
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
for _name, _module in _moved_no_warn.items():
|
|
304
|
+
_module_path = f"{__name__}.{_name}"
|
|
305
|
+
sys.modules[_module_path] = _MovedModule(_module_path, _module)
|
|
306
|
+
|
|
307
|
+
for _name, _module in _moved_warn.items():
|
|
308
|
+
_module_path = f"{__name__}.{_name}"
|
|
309
|
+
sys.modules[_module_path] = _MovedModuleWarn(_module_path, _module)
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
def __getattr__(name: str) -> typing.Any:
|
|
313
|
+
"""Get attributes lazy.
|
|
314
|
+
|
|
315
|
+
:return: attribute by name
|
|
316
|
+
:raises AttributeError: attribute is not defined for lazy load
|
|
317
|
+
"""
|
|
318
|
+
if name in _moved_no_warn:
|
|
319
|
+
mod = importlib.import_module(_moved_no_warn[name])
|
|
320
|
+
__locals[name] = mod
|
|
321
|
+
return mod
|
|
322
|
+
|
|
323
|
+
if name in _moved_warn:
|
|
324
|
+
warnings.warn(
|
|
325
|
+
f"{name} is moved to {_moved_warn[name]}",
|
|
326
|
+
DeprecationWarning,
|
|
327
|
+
stacklevel=2,
|
|
328
|
+
)
|
|
329
|
+
|
|
330
|
+
mod = importlib.import_module(_moved_warn[name])
|
|
331
|
+
__locals[name] = mod
|
|
332
|
+
return mod
|
|
333
|
+
raise AttributeError(f"{name} not found in {__package__}")
|