urwid 2.6.15__py3-none-any.whl → 3.0.5__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.
- urwid/__init__.py +30 -20
- urwid/canvas.py +34 -53
- urwid/command_map.py +6 -4
- urwid/container.py +1 -1
- urwid/decoration.py +1 -1
- urwid/display/__init__.py +53 -48
- urwid/display/_posix_raw_display.py +20 -8
- urwid/display/_raw_display_base.py +21 -16
- urwid/display/_win32_raw_display.py +16 -17
- urwid/display/common.py +45 -74
- urwid/display/curses.py +3 -5
- urwid/display/escape.py +28 -13
- urwid/display/lcd.py +8 -10
- urwid/display/web.py +11 -16
- urwid/event_loop/asyncio_loop.py +35 -15
- urwid/event_loop/main_loop.py +18 -23
- urwid/event_loop/tornado_loop.py +4 -5
- urwid/event_loop/trio_loop.py +1 -1
- urwid/font.py +19 -22
- urwid/numedit.py +65 -65
- urwid/signals.py +19 -27
- urwid/split_repr.py +9 -3
- urwid/str_util.py +105 -60
- urwid/text_layout.py +14 -13
- urwid/util.py +8 -19
- urwid/version.py +22 -4
- urwid/vterm.py +20 -47
- urwid/widget/__init__.py +0 -6
- urwid/widget/attr_map.py +10 -10
- urwid/widget/attr_wrap.py +11 -13
- urwid/widget/bar_graph.py +3 -8
- urwid/widget/big_text.py +8 -9
- urwid/widget/box_adapter.py +6 -6
- urwid/widget/columns.py +52 -83
- urwid/widget/container.py +29 -75
- urwid/widget/divider.py +6 -6
- urwid/widget/edit.py +50 -50
- urwid/widget/filler.py +14 -14
- urwid/widget/frame.py +31 -40
- urwid/widget/grid_flow.py +25 -110
- urwid/widget/line_box.py +31 -18
- urwid/widget/listbox.py +16 -51
- urwid/widget/monitored_list.py +75 -49
- urwid/widget/overlay.py +4 -37
- urwid/widget/padding.py +31 -68
- urwid/widget/pile.py +179 -158
- urwid/widget/popup.py +2 -2
- urwid/widget/progress_bar.py +17 -18
- urwid/widget/scrollable.py +26 -34
- urwid/widget/solid_fill.py +3 -3
- urwid/widget/text.py +44 -30
- urwid/widget/treetools.py +27 -48
- urwid/widget/widget.py +13 -130
- urwid/widget/widget_decoration.py +6 -35
- urwid/widget/wimp.py +61 -61
- urwid/wimp.py +1 -1
- {urwid-2.6.15.dist-info → urwid-3.0.5.dist-info}/METADATA +24 -24
- urwid-3.0.5.dist-info/RECORD +74 -0
- {urwid-2.6.15.dist-info → urwid-3.0.5.dist-info}/WHEEL +1 -1
- urwid-2.6.15.dist-info/RECORD +0 -74
- {urwid-2.6.15.dist-info → urwid-3.0.5.dist-info/licenses}/COPYING +0 -0
- {urwid-2.6.15.dist-info → urwid-3.0.5.dist-info}/top_level.txt +0 -0
urwid/widget/edit.py
CHANGED
|
@@ -99,11 +99,11 @@ class Edit(Text):
|
|
|
99
99
|
|
|
100
100
|
>>> Edit()
|
|
101
101
|
<Edit selectable flow widget '' edit_pos=0>
|
|
102
|
-
>>> Edit(
|
|
102
|
+
>>> Edit("Y/n? ", "yes")
|
|
103
103
|
<Edit selectable flow widget 'yes' caption='Y/n? ' edit_pos=3>
|
|
104
|
-
>>> Edit(
|
|
104
|
+
>>> Edit("Name ", "Smith", edit_pos=1)
|
|
105
105
|
<Edit selectable flow widget 'Smith' caption='Name ' edit_pos=1>
|
|
106
|
-
>>> Edit(
|
|
106
|
+
>>> Edit("", "3.14", align="right")
|
|
107
107
|
<Edit selectable flow widget '3.14' align='right' edit_pos=4>
|
|
108
108
|
"""
|
|
109
109
|
|
|
@@ -140,11 +140,11 @@ class Edit(Text):
|
|
|
140
140
|
|
|
141
141
|
Text returned includes the caption and edit_text, possibly masked.
|
|
142
142
|
|
|
143
|
-
>>> Edit(
|
|
143
|
+
>>> Edit("What? ", "oh, nothing.").get_text()
|
|
144
144
|
('What? oh, nothing.', [])
|
|
145
|
-
>>> Edit((
|
|
145
|
+
>>> Edit(("bright", "user@host:~$ "), "ls").get_text()
|
|
146
146
|
('user@host:~$ ls', [('bright', 13)])
|
|
147
|
-
>>> Edit(
|
|
147
|
+
>>> Edit("password:", "seekrit", mask="*").get_text()
|
|
148
148
|
('password:*******', [])
|
|
149
149
|
"""
|
|
150
150
|
|
|
@@ -184,21 +184,21 @@ class Edit(Text):
|
|
|
184
184
|
>>> size = (10,)
|
|
185
185
|
>>> Edit().get_pref_col(size)
|
|
186
186
|
0
|
|
187
|
-
>>> e = Edit(
|
|
187
|
+
>>> e = Edit("", "word")
|
|
188
188
|
>>> e.get_pref_col(size)
|
|
189
189
|
4
|
|
190
|
-
>>> e.keypress(size,
|
|
190
|
+
>>> e.keypress(size, "left")
|
|
191
191
|
>>> e.get_pref_col(size)
|
|
192
192
|
3
|
|
193
|
-
>>> e.keypress(size,
|
|
193
|
+
>>> e.keypress(size, "end")
|
|
194
194
|
>>> e.get_pref_col(size)
|
|
195
195
|
<Align.RIGHT: 'right'>
|
|
196
|
-
>>> e = Edit(
|
|
197
|
-
>>> e.keypress(size,
|
|
198
|
-
>>> e.keypress(size,
|
|
196
|
+
>>> e = Edit("", "2\\nwords")
|
|
197
|
+
>>> e.keypress(size, "left")
|
|
198
|
+
>>> e.keypress(size, "up")
|
|
199
199
|
>>> e.get_pref_col(size)
|
|
200
200
|
4
|
|
201
|
-
>>> e.keypress(size,
|
|
201
|
+
>>> e.keypress(size, "left")
|
|
202
202
|
>>> e.get_pref_col(size)
|
|
203
203
|
0
|
|
204
204
|
"""
|
|
@@ -220,7 +220,7 @@ class Edit(Text):
|
|
|
220
220
|
>>> e.set_caption("cap1")
|
|
221
221
|
>>> print(e.caption)
|
|
222
222
|
cap1
|
|
223
|
-
>>> e.set_caption((
|
|
223
|
+
>>> e.set_caption(("bold", "cap2"))
|
|
224
224
|
>>> print(e.caption)
|
|
225
225
|
cap2
|
|
226
226
|
>>> e.attrib
|
|
@@ -247,7 +247,7 @@ class Edit(Text):
|
|
|
247
247
|
:param pos: cursor position
|
|
248
248
|
:type pos: int
|
|
249
249
|
|
|
250
|
-
>>> e = Edit(
|
|
250
|
+
>>> e = Edit("", "word")
|
|
251
251
|
>>> e.edit_pos
|
|
252
252
|
4
|
|
253
253
|
>>> e.set_edit_pos(2)
|
|
@@ -294,12 +294,12 @@ class Edit(Text):
|
|
|
294
294
|
:type text: bytes or unicode
|
|
295
295
|
|
|
296
296
|
>>> e = Edit()
|
|
297
|
-
>>> e.set_edit_text(
|
|
297
|
+
>>> e.set_edit_text("yes")
|
|
298
298
|
>>> print(e.edit_text)
|
|
299
299
|
yes
|
|
300
300
|
>>> e
|
|
301
301
|
<Edit selectable flow widget 'yes' edit_pos=0>
|
|
302
|
-
>>> e.edit_text =
|
|
302
|
+
>>> e.edit_text = "no" # Urwid 0.9.9 or later
|
|
303
303
|
>>> print(e.edit_text)
|
|
304
304
|
no
|
|
305
305
|
"""
|
|
@@ -317,7 +317,7 @@ class Edit(Text):
|
|
|
317
317
|
"""
|
|
318
318
|
Return the edit text for this widget.
|
|
319
319
|
|
|
320
|
-
>>> e = Edit(
|
|
320
|
+
>>> e = Edit("What? ", "oh, nothing.")
|
|
321
321
|
>>> print(e.get_edit_text())
|
|
322
322
|
oh, nothing.
|
|
323
323
|
>>> print(e.edit_text)
|
|
@@ -343,12 +343,12 @@ class Edit(Text):
|
|
|
343
343
|
must match the text in the caption
|
|
344
344
|
:type text: bytes or unicode
|
|
345
345
|
|
|
346
|
-
>>> e = Edit(
|
|
347
|
-
>>> e.insert_text(
|
|
346
|
+
>>> e = Edit("", "42")
|
|
347
|
+
>>> e.insert_text(".5")
|
|
348
348
|
>>> e
|
|
349
349
|
<Edit selectable flow widget '42.5' edit_pos=4>
|
|
350
350
|
>>> e.set_edit_pos(2)
|
|
351
|
-
>>> e.insert_text(
|
|
351
|
+
>>> e.insert_text("a")
|
|
352
352
|
>>> print(e.edit_text)
|
|
353
353
|
42a.5
|
|
354
354
|
"""
|
|
@@ -381,7 +381,7 @@ class Edit(Text):
|
|
|
381
381
|
# if there's highlighted text, it'll get replaced by the new text
|
|
382
382
|
text = self._normalize_to_caption(text)
|
|
383
383
|
if self.highlight:
|
|
384
|
-
start, stop = self.highlight
|
|
384
|
+
start, stop = self.highlight
|
|
385
385
|
btext, etext = self.edit_text[:start], self.edit_text[stop:]
|
|
386
386
|
result_text = btext + etext
|
|
387
387
|
result_pos = start
|
|
@@ -406,17 +406,17 @@ class Edit(Text):
|
|
|
406
406
|
Handle editing keystrokes, return others.
|
|
407
407
|
|
|
408
408
|
>>> e, size = Edit(), (20,)
|
|
409
|
-
>>> e.keypress(size,
|
|
410
|
-
>>> e.keypress(size,
|
|
411
|
-
>>> e.keypress(size,
|
|
409
|
+
>>> e.keypress(size, "x")
|
|
410
|
+
>>> e.keypress(size, "left")
|
|
411
|
+
>>> e.keypress(size, "1")
|
|
412
412
|
>>> print(e.edit_text)
|
|
413
413
|
1x
|
|
414
|
-
>>> e.keypress(size,
|
|
415
|
-
>>> e.keypress(size,
|
|
416
|
-
>>> e.keypress(size,
|
|
414
|
+
>>> e.keypress(size, "backspace")
|
|
415
|
+
>>> e.keypress(size, "end")
|
|
416
|
+
>>> e.keypress(size, "2")
|
|
417
417
|
>>> print(e.edit_text)
|
|
418
418
|
x2
|
|
419
|
-
>>> e.keypress(size,
|
|
419
|
+
>>> e.keypress(size, "shift f1")
|
|
420
420
|
'shift f1'
|
|
421
421
|
"""
|
|
422
422
|
pos = self.edit_pos
|
|
@@ -517,7 +517,7 @@ class Edit(Text):
|
|
|
517
517
|
Returns True if move succeeded, False otherwise.
|
|
518
518
|
|
|
519
519
|
>>> size = (10,)
|
|
520
|
-
>>> e = Edit("","edit\\ntext")
|
|
520
|
+
>>> e = Edit("", "edit\\ntext")
|
|
521
521
|
>>> e.move_cursor_to_coords(size, 5, 0)
|
|
522
522
|
True
|
|
523
523
|
>>> e.edit_pos
|
|
@@ -555,8 +555,8 @@ class Edit(Text):
|
|
|
555
555
|
Move the cursor to the location clicked for button 1.
|
|
556
556
|
|
|
557
557
|
>>> size = (20,)
|
|
558
|
-
>>> e = Edit("","words here")
|
|
559
|
-
>>> e.mouse_event(size,
|
|
558
|
+
>>> e = Edit("", "words here")
|
|
559
|
+
>>> e.mouse_event(size, "mouse press", 1, 2, 0, True)
|
|
560
560
|
True
|
|
561
561
|
>>> e.edit_pos
|
|
562
562
|
2
|
|
@@ -572,7 +572,7 @@ class Edit(Text):
|
|
|
572
572
|
"""
|
|
573
573
|
if not self.highlight:
|
|
574
574
|
return False
|
|
575
|
-
start, stop = self.highlight
|
|
575
|
+
start, stop = self.highlight
|
|
576
576
|
btext, etext = self.edit_text[:start], self.edit_text[stop:]
|
|
577
577
|
self.set_edit_text(btext + etext)
|
|
578
578
|
self.edit_pos = start
|
|
@@ -588,14 +588,14 @@ class Edit(Text):
|
|
|
588
588
|
Render edit widget and return canvas. Include cursor when in
|
|
589
589
|
focus.
|
|
590
590
|
|
|
591
|
-
>>> edit = Edit("? ","yes")
|
|
591
|
+
>>> edit = Edit("? ", "yes")
|
|
592
592
|
>>> c = edit.render((10,), focus=True)
|
|
593
593
|
>>> c.text
|
|
594
594
|
[b'? yes ']
|
|
595
595
|
>>> c.cursor
|
|
596
596
|
(5, 0)
|
|
597
597
|
"""
|
|
598
|
-
self._shift_view_to_cursor = bool(focus)
|
|
598
|
+
self._shift_view_to_cursor = bool(focus)
|
|
599
599
|
|
|
600
600
|
canv: TextCanvas | CompositeCanvas = super().render(size, focus)
|
|
601
601
|
if focus:
|
|
@@ -639,7 +639,7 @@ class Edit(Text):
|
|
|
639
639
|
"""
|
|
640
640
|
Return the (*x*, *y*) coordinates of cursor within widget.
|
|
641
641
|
|
|
642
|
-
>>> Edit("? ","yes").get_cursor_coords((10,))
|
|
642
|
+
>>> Edit("? ", "yes").get_cursor_coords((10,))
|
|
643
643
|
(5, 0)
|
|
644
644
|
"""
|
|
645
645
|
(maxcol,) = size
|
|
@@ -672,7 +672,7 @@ class IntEdit(Edit):
|
|
|
672
672
|
caption -- caption markup
|
|
673
673
|
default -- default edit value
|
|
674
674
|
|
|
675
|
-
>>> IntEdit(
|
|
675
|
+
>>> IntEdit("", 42)
|
|
676
676
|
<IntEdit selectable flow widget '42' edit_pos=2>
|
|
677
677
|
"""
|
|
678
678
|
if default is not None:
|
|
@@ -689,32 +689,32 @@ class IntEdit(Edit):
|
|
|
689
689
|
"""
|
|
690
690
|
Handle editing keystrokes. Remove leading zeros.
|
|
691
691
|
|
|
692
|
-
>>> e, size = IntEdit(
|
|
693
|
-
>>> e.keypress(size,
|
|
694
|
-
>>> e.keypress(size,
|
|
692
|
+
>>> e, size = IntEdit("", 5002), (10,)
|
|
693
|
+
>>> e.keypress(size, "home")
|
|
694
|
+
>>> e.keypress(size, "delete")
|
|
695
695
|
>>> print(e.edit_text)
|
|
696
696
|
002
|
|
697
|
-
>>> e.keypress(size,
|
|
697
|
+
>>> e.keypress(size, "end")
|
|
698
698
|
>>> print(e.edit_text)
|
|
699
699
|
2
|
|
700
700
|
"""
|
|
701
|
-
unhandled
|
|
701
|
+
if unhandled := super().keypress(size, key):
|
|
702
|
+
return unhandled
|
|
702
703
|
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
self.set_edit_text(self.edit_text[1:])
|
|
704
|
+
# trim leading zeros
|
|
705
|
+
while self.edit_pos > 0 and self.edit_text[:1] == "0":
|
|
706
|
+
self.set_edit_pos(self.edit_pos - 1)
|
|
707
|
+
self.set_edit_text(self.edit_text[1:])
|
|
708
708
|
|
|
709
|
-
return
|
|
709
|
+
return None
|
|
710
710
|
|
|
711
711
|
def value(self) -> int:
|
|
712
712
|
"""
|
|
713
713
|
Return the numeric value of self.edit_text.
|
|
714
714
|
|
|
715
715
|
>>> e, size = IntEdit(), (10,)
|
|
716
|
-
>>> e.keypress(size,
|
|
717
|
-
>>> e.keypress(size,
|
|
716
|
+
>>> e.keypress(size, "5")
|
|
717
|
+
>>> e.keypress(size, "1")
|
|
718
718
|
>>> e.value() == 51
|
|
719
719
|
True
|
|
720
720
|
"""
|
urwid/widget/filler.py
CHANGED
|
@@ -162,8 +162,8 @@ class Filler(WidgetDecoration[WrappedWidget]):
|
|
|
162
162
|
def body(self) -> WrappedWidget:
|
|
163
163
|
"""backwards compatibility, widget used to be stored as body"""
|
|
164
164
|
warnings.warn(
|
|
165
|
-
"backwards compatibility, widget used to be stored as body",
|
|
166
|
-
|
|
165
|
+
"backwards compatibility, widget used to be stored as body. API will be removed in version 5.0.",
|
|
166
|
+
DeprecationWarning,
|
|
167
167
|
stacklevel=2,
|
|
168
168
|
)
|
|
169
169
|
return self.original_widget
|
|
@@ -171,8 +171,8 @@ class Filler(WidgetDecoration[WrappedWidget]):
|
|
|
171
171
|
@body.setter
|
|
172
172
|
def body(self, new_body: WrappedWidget) -> None:
|
|
173
173
|
warnings.warn(
|
|
174
|
-
"backwards compatibility, widget used to be stored as body",
|
|
175
|
-
|
|
174
|
+
"backwards compatibility, widget used to be stored as body. API will be removed in version 5.0.",
|
|
175
|
+
DeprecationWarning,
|
|
176
176
|
stacklevel=2,
|
|
177
177
|
)
|
|
178
178
|
self.original_widget = new_body
|
|
@@ -180,7 +180,7 @@ class Filler(WidgetDecoration[WrappedWidget]):
|
|
|
180
180
|
def get_body(self) -> WrappedWidget:
|
|
181
181
|
"""backwards compatibility, widget used to be stored as body"""
|
|
182
182
|
warnings.warn(
|
|
183
|
-
"backwards compatibility, widget used to be stored as body",
|
|
183
|
+
"backwards compatibility, widget used to be stored as body. API will be removed in version 4.0.",
|
|
184
184
|
DeprecationWarning,
|
|
185
185
|
stacklevel=2,
|
|
186
186
|
)
|
|
@@ -188,7 +188,7 @@ class Filler(WidgetDecoration[WrappedWidget]):
|
|
|
188
188
|
|
|
189
189
|
def set_body(self, new_body: WrappedWidget) -> None:
|
|
190
190
|
warnings.warn(
|
|
191
|
-
"backwards compatibility, widget used to be stored as body",
|
|
191
|
+
"backwards compatibility, widget used to be stored as body. API will be removed in version 4.0.",
|
|
192
192
|
DeprecationWarning,
|
|
193
193
|
stacklevel=2,
|
|
194
194
|
)
|
|
@@ -361,21 +361,21 @@ def calculate_top_bottom_filler(
|
|
|
361
361
|
bottom -- a fixed number of rows to fill on the bottom
|
|
362
362
|
|
|
363
363
|
>>> ctbf = calculate_top_bottom_filler
|
|
364
|
-
>>> ctbf(15,
|
|
364
|
+
>>> ctbf(15, "top", 0, "given", 10, None, 2, 0)
|
|
365
365
|
(2, 3)
|
|
366
|
-
>>> ctbf(15,
|
|
366
|
+
>>> ctbf(15, "relative", 0, "given", 10, None, 2, 0)
|
|
367
367
|
(2, 3)
|
|
368
|
-
>>> ctbf(15,
|
|
368
|
+
>>> ctbf(15, "relative", 100, "given", 10, None, 2, 0)
|
|
369
369
|
(5, 0)
|
|
370
|
-
>>> ctbf(15,
|
|
370
|
+
>>> ctbf(15, "middle", 0, "given", 4, None, 2, 0)
|
|
371
371
|
(6, 5)
|
|
372
|
-
>>> ctbf(15,
|
|
372
|
+
>>> ctbf(15, "middle", 0, "given", 18, None, 2, 0)
|
|
373
373
|
(0, 0)
|
|
374
|
-
>>> ctbf(20,
|
|
374
|
+
>>> ctbf(20, "top", 0, "relative", 60, None, 0, 0)
|
|
375
375
|
(0, 8)
|
|
376
|
-
>>> ctbf(20,
|
|
376
|
+
>>> ctbf(20, "relative", 30, "relative", 60, None, 0, 0)
|
|
377
377
|
(2, 6)
|
|
378
|
-
>>> ctbf(20,
|
|
378
|
+
>>> ctbf(20, "relative", 30, "relative", 60, 14, 0, 0)
|
|
379
379
|
(2, 4)
|
|
380
380
|
"""
|
|
381
381
|
if height_type == WHSettings.RELATIVE:
|
urwid/widget/frame.py
CHANGED
|
@@ -2,6 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import typing
|
|
4
4
|
import warnings
|
|
5
|
+
from collections.abc import MutableMapping
|
|
5
6
|
|
|
6
7
|
from urwid.canvas import CanvasCombine, CompositeCanvas
|
|
7
8
|
from urwid.split_repr import remove_defaults
|
|
@@ -13,7 +14,7 @@ from .filler import Filler
|
|
|
13
14
|
from .widget import Widget, WidgetError
|
|
14
15
|
|
|
15
16
|
if typing.TYPE_CHECKING:
|
|
16
|
-
from collections.abc import Iterator
|
|
17
|
+
from collections.abc import Iterator
|
|
17
18
|
|
|
18
19
|
from typing_extensions import Literal
|
|
19
20
|
|
|
@@ -121,8 +122,9 @@ class Frame(Widget, WidgetContainerMixin, typing.Generic[BodyWidget, HeaderWidge
|
|
|
121
122
|
def get_header(self) -> HeaderWidget:
|
|
122
123
|
warnings.warn(
|
|
123
124
|
f"method `{self.__class__.__name__}.get_header` is deprecated, "
|
|
124
|
-
f"standard property `{self.__class__.__name__}.header` should be used instead"
|
|
125
|
-
|
|
125
|
+
f"standard property `{self.__class__.__name__}.header` should be used instead."
|
|
126
|
+
"API will be removed in version 5.0.",
|
|
127
|
+
DeprecationWarning,
|
|
126
128
|
stacklevel=2,
|
|
127
129
|
)
|
|
128
130
|
return self.header
|
|
@@ -130,8 +132,9 @@ class Frame(Widget, WidgetContainerMixin, typing.Generic[BodyWidget, HeaderWidge
|
|
|
130
132
|
def set_header(self, header: HeaderWidget) -> None:
|
|
131
133
|
warnings.warn(
|
|
132
134
|
f"method `{self.__class__.__name__}.set_header` is deprecated, "
|
|
133
|
-
f"standard property `{self.__class__.__name__}.header` should be used instead"
|
|
134
|
-
|
|
135
|
+
f"standard property `{self.__class__.__name__}.header` should be used instead."
|
|
136
|
+
"API will be removed in version 5.0.",
|
|
137
|
+
DeprecationWarning,
|
|
135
138
|
stacklevel=2,
|
|
136
139
|
)
|
|
137
140
|
self.header = header
|
|
@@ -149,8 +152,9 @@ class Frame(Widget, WidgetContainerMixin, typing.Generic[BodyWidget, HeaderWidge
|
|
|
149
152
|
def get_body(self) -> BodyWidget:
|
|
150
153
|
warnings.warn(
|
|
151
154
|
f"method `{self.__class__.__name__}.get_body` is deprecated, "
|
|
152
|
-
f"standard property {self.__class__.__name__}.body should be used instead"
|
|
153
|
-
|
|
155
|
+
f"standard property {self.__class__.__name__}.body should be used instead."
|
|
156
|
+
"API will be removed in version 5.0.",
|
|
157
|
+
DeprecationWarning,
|
|
154
158
|
stacklevel=2,
|
|
155
159
|
)
|
|
156
160
|
return self.body
|
|
@@ -158,8 +162,9 @@ class Frame(Widget, WidgetContainerMixin, typing.Generic[BodyWidget, HeaderWidge
|
|
|
158
162
|
def set_body(self, body: BodyWidget) -> None:
|
|
159
163
|
warnings.warn(
|
|
160
164
|
f"method `{self.__class__.__name__}.set_body` is deprecated, "
|
|
161
|
-
f"standard property `{self.__class__.__name__}.body` should be used instead"
|
|
162
|
-
|
|
165
|
+
f"standard property `{self.__class__.__name__}.body` should be used instead."
|
|
166
|
+
"API will be removed in version 5.0.",
|
|
167
|
+
DeprecationWarning,
|
|
163
168
|
stacklevel=2,
|
|
164
169
|
)
|
|
165
170
|
self.body = body
|
|
@@ -179,8 +184,9 @@ class Frame(Widget, WidgetContainerMixin, typing.Generic[BodyWidget, HeaderWidge
|
|
|
179
184
|
def get_footer(self) -> FooterWidget:
|
|
180
185
|
warnings.warn(
|
|
181
186
|
f"method `{self.__class__.__name__}.get_footer` is deprecated, "
|
|
182
|
-
f"standard property `{self.__class__.__name__}.footer` should be used instead"
|
|
183
|
-
|
|
187
|
+
f"standard property `{self.__class__.__name__}.footer` should be used instead."
|
|
188
|
+
"API will be removed in version 5.0.",
|
|
189
|
+
DeprecationWarning,
|
|
184
190
|
stacklevel=2,
|
|
185
191
|
)
|
|
186
192
|
return self.footer
|
|
@@ -188,8 +194,9 @@ class Frame(Widget, WidgetContainerMixin, typing.Generic[BodyWidget, HeaderWidge
|
|
|
188
194
|
def set_footer(self, footer: FooterWidget) -> None:
|
|
189
195
|
warnings.warn(
|
|
190
196
|
f"method `{self.__class__.__name__}.set_footer` is deprecated, "
|
|
191
|
-
f"standard property `{self.__class__.__name__}.footer` should be used instead"
|
|
192
|
-
|
|
197
|
+
f"standard property `{self.__class__.__name__}.footer` should be used instead."
|
|
198
|
+
"API will be removed in version 5.0.",
|
|
199
|
+
DeprecationWarning,
|
|
193
200
|
stacklevel=2,
|
|
194
201
|
)
|
|
195
202
|
self.footer = footer
|
|
@@ -233,8 +240,9 @@ class Frame(Widget, WidgetContainerMixin, typing.Generic[BodyWidget, HeaderWidge
|
|
|
233
240
|
"""
|
|
234
241
|
warnings.warn(
|
|
235
242
|
"included for backwards compatibility."
|
|
236
|
-
"You should rather use the container property `.focus_position` to get this value."
|
|
237
|
-
|
|
243
|
+
"You should rather use the container property `.focus_position` to get this value."
|
|
244
|
+
"API will be removed in version 5.0.",
|
|
245
|
+
DeprecationWarning,
|
|
238
246
|
stacklevel=2,
|
|
239
247
|
)
|
|
240
248
|
return self.focus_position
|
|
@@ -242,8 +250,9 @@ class Frame(Widget, WidgetContainerMixin, typing.Generic[BodyWidget, HeaderWidge
|
|
|
242
250
|
def set_focus(self, part: Literal["header", "footer", "body"]) -> None:
|
|
243
251
|
warnings.warn(
|
|
244
252
|
"included for backwards compatibility."
|
|
245
|
-
"You should rather use the container property `.focus_position` to set this value."
|
|
246
|
-
|
|
253
|
+
"You should rather use the container property `.focus_position` to set this value."
|
|
254
|
+
"API will be removed in version 5.0.",
|
|
255
|
+
DeprecationWarning,
|
|
247
256
|
stacklevel=2,
|
|
248
257
|
)
|
|
249
258
|
self.focus_position = part
|
|
@@ -255,15 +264,6 @@ class Frame(Widget, WidgetContainerMixin, typing.Generic[BodyWidget, HeaderWidge
|
|
|
255
264
|
This is a read-only property."""
|
|
256
265
|
return {"header": self._header, "footer": self._footer, "body": self._body}[self.focus_part]
|
|
257
266
|
|
|
258
|
-
def _get_focus(self) -> BodyWidget | HeaderWidget | FooterWidget:
|
|
259
|
-
warnings.warn(
|
|
260
|
-
f"method `{self.__class__.__name__}._get_focus` is deprecated, "
|
|
261
|
-
f"please use `{self.__class__.__name__}.focus` property",
|
|
262
|
-
DeprecationWarning,
|
|
263
|
-
stacklevel=3,
|
|
264
|
-
)
|
|
265
|
-
return {"header": self._header, "footer": self._footer, "body": self._body}[self.focus_part]
|
|
266
|
-
|
|
267
267
|
@property
|
|
268
268
|
def contents(
|
|
269
269
|
self,
|
|
@@ -275,9 +275,9 @@ class Frame(Widget, WidgetContainerMixin, typing.Generic[BodyWidget, HeaderWidge
|
|
|
275
275
|
a dict-like object similar to::
|
|
276
276
|
|
|
277
277
|
{
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
278
|
+
"body": (body_widget, None),
|
|
279
|
+
"header": (header_widget, None), # if frame has a header
|
|
280
|
+
"footer": (footer_widget, None), # if frame has a footer
|
|
281
281
|
}
|
|
282
282
|
|
|
283
283
|
This object may be used to read or update the contents of the Frame.
|
|
@@ -294,9 +294,9 @@ class Frame(Widget, WidgetContainerMixin, typing.Generic[BodyWidget, HeaderWidge
|
|
|
294
294
|
|
|
295
295
|
# noinspection PyMethodParameters
|
|
296
296
|
class FrameContents(
|
|
297
|
-
|
|
297
|
+
MutableMapping[
|
|
298
298
|
str,
|
|
299
|
-
|
|
299
|
+
tuple[typing.Union[BodyWidget, HeaderWidget, FooterWidget], None],
|
|
300
300
|
]
|
|
301
301
|
):
|
|
302
302
|
# pylint: disable=no-self-argument
|
|
@@ -388,15 +388,6 @@ class Frame(Widget, WidgetContainerMixin, typing.Generic[BodyWidget, HeaderWidge
|
|
|
388
388
|
else:
|
|
389
389
|
self.footer = None
|
|
390
390
|
|
|
391
|
-
def _contents(self):
|
|
392
|
-
warnings.warn(
|
|
393
|
-
f"method `{self.__class__.__name__}._contents` is deprecated, "
|
|
394
|
-
f"please use property `{self.__class__.__name__}.contents`",
|
|
395
|
-
DeprecationWarning,
|
|
396
|
-
stacklevel=3,
|
|
397
|
-
)
|
|
398
|
-
return self.contents
|
|
399
|
-
|
|
400
391
|
def options(self) -> None:
|
|
401
392
|
"""
|
|
402
393
|
There are currently no options for Frame contents.
|