urwid 2.6.16__py3-none-any.whl → 3.0.1__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.

Files changed (53) hide show
  1. urwid/__init__.py +1 -4
  2. urwid/canvas.py +19 -38
  3. urwid/command_map.py +4 -3
  4. urwid/container.py +1 -1
  5. urwid/decoration.py +1 -1
  6. urwid/display/_raw_display_base.py +8 -5
  7. urwid/display/_win32_raw_display.py +11 -13
  8. urwid/display/common.py +26 -55
  9. urwid/display/curses.py +1 -1
  10. urwid/display/escape.py +6 -8
  11. urwid/display/lcd.py +4 -6
  12. urwid/display/web.py +7 -12
  13. urwid/event_loop/asyncio_loop.py +33 -15
  14. urwid/event_loop/main_loop.py +13 -18
  15. urwid/event_loop/tornado_loop.py +4 -5
  16. urwid/event_loop/trio_loop.py +1 -1
  17. urwid/font.py +10 -15
  18. urwid/signals.py +2 -1
  19. urwid/str_util.py +15 -18
  20. urwid/text_layout.py +6 -7
  21. urwid/util.py +6 -17
  22. urwid/version.py +9 -4
  23. urwid/vterm.py +9 -44
  24. urwid/widget/__init__.py +0 -6
  25. urwid/widget/attr_wrap.py +8 -10
  26. urwid/widget/bar_graph.py +2 -7
  27. urwid/widget/big_text.py +9 -7
  28. urwid/widget/box_adapter.py +4 -4
  29. urwid/widget/columns.py +50 -81
  30. urwid/widget/container.py +29 -75
  31. urwid/widget/edit.py +8 -8
  32. urwid/widget/filler.py +6 -6
  33. urwid/widget/frame.py +28 -37
  34. urwid/widget/grid_flow.py +24 -109
  35. urwid/widget/line_box.py +13 -0
  36. urwid/widget/listbox.py +12 -50
  37. urwid/widget/monitored_list.py +6 -4
  38. urwid/widget/overlay.py +4 -37
  39. urwid/widget/padding.py +11 -48
  40. urwid/widget/pile.py +177 -156
  41. urwid/widget/popup.py +2 -2
  42. urwid/widget/progress_bar.py +0 -10
  43. urwid/widget/scrollable.py +24 -32
  44. urwid/widget/treetools.py +27 -48
  45. urwid/widget/widget.py +7 -124
  46. urwid/widget/widget_decoration.py +4 -33
  47. urwid/wimp.py +1 -1
  48. {urwid-2.6.16.dist-info → urwid-3.0.1.dist-info}/METADATA +10 -15
  49. urwid-3.0.1.dist-info/RECORD +74 -0
  50. {urwid-2.6.16.dist-info → urwid-3.0.1.dist-info}/WHEEL +1 -1
  51. urwid-2.6.16.dist-info/RECORD +0 -74
  52. {urwid-2.6.16.dist-info → urwid-3.0.1.dist-info/licenses}/COPYING +0 -0
  53. {urwid-2.6.16.dist-info → urwid-3.0.1.dist-info}/top_level.txt +0 -0
urwid/widget/columns.py CHANGED
@@ -121,7 +121,8 @@ class Columns(Widget, WidgetContainerMixin, WidgetContainerListContentsMixin):
121
121
  flow_fixed = _ContainerElementSizingFlag.FLOW | _ContainerElementSizingFlag.FIXED
122
122
  given_box = _ContainerElementSizingFlag.BOX | _ContainerElementSizingFlag.WH_GIVEN
123
123
 
124
- flags: set[_ContainerElementSizingFlag] = set()
124
+ # This is a set of _ContainerElementSizingFlag ORed together.
125
+ flags: set[int] = set()
125
126
 
126
127
  for idx, (widget, (size_kind, _size_weight, is_box)) in enumerate(self.contents):
127
128
  w_sizing = widget.sizing()
@@ -190,7 +191,7 @@ class Columns(Widget, WidgetContainerMixin, WidgetContainerListContentsMixin):
190
191
  if not supported:
191
192
  warnings.warn(
192
193
  f"Columns widget contents flags not allow to determine supported render kind:\n"
193
- f"{', '.join(sorted(flag.log_string for flag in flags))}\n"
194
+ f"{', '.join(sorted(_ContainerElementSizingFlag.log_string(flag) for flag in flags))}\n"
194
195
  f"Using fallback hardcoded BOX|FLOW sizing kind.",
195
196
  ColumnsWarning,
196
197
  stacklevel=3,
@@ -372,8 +373,9 @@ class Columns(Widget, WidgetContainerMixin, WidgetContainerListContentsMixin):
372
373
  standard container property :attr:`contents`.
373
374
  """
374
375
  warnings.warn(
375
- "only for backwards compatibility. You should use the new standard container `contents`",
376
- PendingDeprecationWarning,
376
+ "only for backwards compatibility. You should use the new standard container `contents`."
377
+ "API will be removed in version 5.0.",
378
+ DeprecationWarning,
377
379
  stacklevel=2,
378
380
  )
379
381
  ml = MonitoredList(w for w, t in self.contents)
@@ -387,8 +389,9 @@ class Columns(Widget, WidgetContainerMixin, WidgetContainerListContentsMixin):
387
389
  @widget_list.setter
388
390
  def widget_list(self, widgets):
389
391
  warnings.warn(
390
- "only for backwards compatibility. You should use the new standard container `contents`",
391
- PendingDeprecationWarning,
392
+ "only for backwards compatibility. You should use the new standard container `contents`."
393
+ "API will be removed in version 5.0.",
394
+ DeprecationWarning,
392
395
  stacklevel=2,
393
396
  )
394
397
  focus_position = self.focus_position
@@ -412,8 +415,9 @@ class Columns(Widget, WidgetContainerMixin, WidgetContainerListContentsMixin):
412
415
  """
413
416
  warnings.warn(
414
417
  "for backwards compatibility only."
415
- "You should use the new standard container property .contents to modify Pile contents.",
416
- PendingDeprecationWarning,
418
+ "You should use the new standard container property .contents to modify Pile contents."
419
+ "API will be removed in version 5.0.",
420
+ DeprecationWarning,
417
421
  stacklevel=2,
418
422
  )
419
423
  ml = MonitoredList(
@@ -432,8 +436,9 @@ class Columns(Widget, WidgetContainerMixin, WidgetContainerListContentsMixin):
432
436
  def column_types(self, column_types):
433
437
  warnings.warn(
434
438
  "for backwards compatibility only."
435
- "You should use the new standard container property .contents to modify Pile contents.",
436
- PendingDeprecationWarning,
439
+ "You should use the new standard container property .contents to modify Pile contents."
440
+ "API will be removed in version 5.0.",
441
+ DeprecationWarning,
437
442
  stacklevel=2,
438
443
  )
439
444
  focus_position = self.focus_position
@@ -454,8 +459,9 @@ class Columns(Widget, WidgetContainerMixin, WidgetContainerListContentsMixin):
454
459
  standard container property :attr:`contents`.
455
460
  """
456
461
  warnings.warn(
457
- "only for backwards compatibility.You should use the new standard container property `contents`",
458
- PendingDeprecationWarning,
462
+ "only for backwards compatibility.You should use the new standard container property `contents`."
463
+ "API will be removed in version 5.0.",
464
+ DeprecationWarning,
459
465
  stacklevel=2,
460
466
  )
461
467
  ml = MonitoredList(i for i, (w, (t, n, b)) in enumerate(self.contents) if b)
@@ -469,8 +475,9 @@ class Columns(Widget, WidgetContainerMixin, WidgetContainerListContentsMixin):
469
475
  @box_columns.setter
470
476
  def box_columns(self, box_columns):
471
477
  warnings.warn(
472
- "only for backwards compatibility.You should use the new standard container property `contents`",
473
- PendingDeprecationWarning,
478
+ "only for backwards compatibility.You should use the new standard container property `contents`."
479
+ "API will be removed in version 5.0.",
480
+ DeprecationWarning,
474
481
  stacklevel=2,
475
482
  )
476
483
  box_columns = set(box_columns)
@@ -482,7 +489,7 @@ class Columns(Widget, WidgetContainerMixin, WidgetContainerListContentsMixin):
482
489
  .. deprecated:: 1.0 Read values from :attr:`contents` instead.
483
490
  """
484
491
  warnings.warn(
485
- ".has_flow_type is deprecated, read values from .contents instead.",
492
+ ".has_flow_type is deprecated, read values from .contents instead. API will be removed in version 4.0.",
486
493
  DeprecationWarning,
487
494
  stacklevel=2,
488
495
  )
@@ -491,7 +498,7 @@ class Columns(Widget, WidgetContainerMixin, WidgetContainerListContentsMixin):
491
498
  @has_flow_type.setter
492
499
  def has_flow_type(self, value):
493
500
  warnings.warn(
494
- ".has_flow_type is deprecated, read values from .contents instead.",
501
+ ".has_flow_type is deprecated, read values from .contents instead. API will be removed in version 4.0.",
495
502
  DeprecationWarning,
496
503
  stacklevel=2,
497
504
  )
@@ -582,8 +589,9 @@ class Columns(Widget, WidgetContainerMixin, WidgetContainerListContentsMixin):
582
589
  standard container property :attr:`focus_position` to set the focus.
583
590
  """
584
591
  warnings.warn(
585
- "only for backwards compatibility.You may also use the new standard container property `focus_position`",
586
- PendingDeprecationWarning,
592
+ "only for backwards compatibility.You may also use the new standard container property `focus_position`."
593
+ "API will be removed in version 5.0.",
594
+ DeprecationWarning,
587
595
  stacklevel=2,
588
596
  )
589
597
  self.focus_position = num
@@ -596,8 +604,9 @@ class Columns(Widget, WidgetContainerMixin, WidgetContainerListContentsMixin):
596
604
  standard container property :attr:`focus_position` to get the focus.
597
605
  """
598
606
  warnings.warn(
599
- "only for backwards compatibility.You may also use the new standard container property `focus_position`",
600
- PendingDeprecationWarning,
607
+ "only for backwards compatibility.You may also use the new standard container property `focus_position`."
608
+ "API will be removed in version 5.0.",
609
+ DeprecationWarning,
601
610
  stacklevel=2,
602
611
  )
603
612
  return self.focus_position
@@ -612,8 +621,9 @@ class Columns(Widget, WidgetContainerMixin, WidgetContainerListContentsMixin):
612
621
  :param item: widget or integer index"""
613
622
  warnings.warn(
614
623
  "only for backwards compatibility."
615
- "You may also use the new standard container property `focus_position` to get the focus.",
616
- PendingDeprecationWarning,
624
+ "You may also use the new standard container property `focus_position` to get the focus."
625
+ "API will be removed in version 5.0.",
626
+ DeprecationWarning,
617
627
  stacklevel=2,
618
628
  )
619
629
  if isinstance(item, int):
@@ -638,17 +648,6 @@ class Columns(Widget, WidgetContainerMixin, WidgetContainerListContentsMixin):
638
648
  return None
639
649
  return self.contents[self.focus_position][0]
640
650
 
641
- def _get_focus(self) -> Widget:
642
- warnings.warn(
643
- f"method `{self.__class__.__name__}._get_focus` is deprecated, "
644
- f"please use `{self.__class__.__name__}.focus` property",
645
- DeprecationWarning,
646
- stacklevel=3,
647
- )
648
- if not self.contents:
649
- return None
650
- return self.contents[self.focus_position][0]
651
-
652
651
  def get_focus(self):
653
652
  """
654
653
  Return the widget in focus, for backwards compatibility.
@@ -658,8 +657,9 @@ class Columns(Widget, WidgetContainerMixin, WidgetContainerListContentsMixin):
658
657
  """
659
658
  warnings.warn(
660
659
  "only for backwards compatibility."
661
- "You may also use the new standard container property `focus` to get the focus.",
662
- PendingDeprecationWarning,
660
+ "You may also use the new standard container property `focus` to get the focus."
661
+ "API will be removed in version 5.0.",
662
+ DeprecationWarning,
663
663
  stacklevel=2,
664
664
  )
665
665
  if not self.contents:
@@ -692,38 +692,6 @@ class Columns(Widget, WidgetContainerMixin, WidgetContainerListContentsMixin):
692
692
  ) from exc
693
693
  self.contents.focus = position
694
694
 
695
- def _get_focus_position(self) -> int | None:
696
- warnings.warn(
697
- f"method `{self.__class__.__name__}._get_focus_position` is deprecated, "
698
- f"please use `{self.__class__.__name__}.focus_position` property",
699
- DeprecationWarning,
700
- stacklevel=3,
701
- )
702
- if not self.contents:
703
- raise IndexError("No focus_position, Columns is empty")
704
- return self.contents.focus
705
-
706
- def _set_focus_position(self, position: int) -> None:
707
- """
708
- Set the widget in focus.
709
-
710
- position -- index of child widget to be made focus
711
- """
712
- warnings.warn(
713
- f"method `{self.__class__.__name__}._set_focus_position` is deprecated, "
714
- f"please use `{self.__class__.__name__}.focus_position` property",
715
- DeprecationWarning,
716
- stacklevel=3,
717
- )
718
- try:
719
- if position < 0 or position >= len(self.contents):
720
- raise IndexError(f"No Columns child widget at position {position}")
721
- except TypeError as exc:
722
- raise IndexError(f"No Columns child widget at position {position}").with_traceback(
723
- exc.__traceback__
724
- ) from exc
725
- self.contents.focus = position
726
-
727
695
  @property
728
696
  def focus_col(self):
729
697
  """
@@ -735,8 +703,9 @@ class Columns(Widget, WidgetContainerMixin, WidgetContainerListContentsMixin):
735
703
  """
736
704
  warnings.warn(
737
705
  "only for backwards compatibility."
738
- "You may also use the new standard container property `focus_position` to get the focus.",
739
- PendingDeprecationWarning,
706
+ "You may also use the new standard container property `focus_position` to get the focus."
707
+ "API will be removed in version 5.0.",
708
+ DeprecationWarning,
740
709
  stacklevel=2,
741
710
  )
742
711
  return self.focus_position
@@ -745,8 +714,9 @@ class Columns(Widget, WidgetContainerMixin, WidgetContainerListContentsMixin):
745
714
  def focus_col(self, new_position) -> None:
746
715
  warnings.warn(
747
716
  "only for backwards compatibility."
748
- "You may also use the new standard container property `focus_position` to get the focus.",
749
- PendingDeprecationWarning,
717
+ "You may also use the new standard container property `focus_position` to get the focus."
718
+ "API will be removed in version 5.0.",
719
+ DeprecationWarning,
750
720
  stacklevel=2,
751
721
  )
752
722
  self.focus_position = new_position
@@ -1032,7 +1002,7 @@ class Columns(Widget, WidgetContainerMixin, WidgetContainerListContentsMixin):
1032
1002
 
1033
1003
  if not data:
1034
1004
  if size:
1035
- return SolidCanvas(" ", size[0], (size[1:] + (1,))[0])
1005
+ return SolidCanvas(" ", size[0], (*size[1:], 1)[0])
1036
1006
  raise ColumnsError("No data to render")
1037
1007
 
1038
1008
  canvas = CanvasJoin(data)
@@ -1053,13 +1023,12 @@ class Columns(Widget, WidgetContainerMixin, WidgetContainerListContentsMixin):
1053
1023
  if len(widths) <= self.focus_position:
1054
1024
  return None
1055
1025
 
1056
- coords = w.get_cursor_coords(size_args[self.focus_position])
1057
- if coords is None:
1058
- return None
1026
+ if (coords := w.get_cursor_coords(size_args[self.focus_position])) is not None:
1027
+ x, y = coords
1028
+ x += sum(self.dividechars + wc for wc in widths[: self.focus_position] if wc > 0)
1029
+ return x, y
1059
1030
 
1060
- x, y = coords
1061
- x += sum(self.dividechars + wc for wc in widths[: self.focus_position] if wc > 0)
1062
- return x, y
1031
+ return None
1063
1032
 
1064
1033
  def move_cursor_to_coords(
1065
1034
  self,
@@ -1103,8 +1072,8 @@ class Columns(Widget, WidgetContainerMixin, WidgetContainerListContentsMixin):
1103
1072
  move_x = min(max(0, col - x), end - x - 1)
1104
1073
  else:
1105
1074
  move_x = col
1106
- rval = w.move_cursor_to_coords(size_args[i], move_x, row)
1107
- if rval is False:
1075
+
1076
+ if w.move_cursor_to_coords(size_args[i], move_x, row) is False:
1108
1077
  return False
1109
1078
 
1110
1079
  self.focus_position = i
@@ -1176,7 +1145,7 @@ class Columns(Widget, WidgetContainerMixin, WidgetContainerListContentsMixin):
1176
1145
  col += sum(widths[: self.focus_position])
1177
1146
  return col
1178
1147
 
1179
- def rows(self, size: tuple[int] | tuple[int, int], focus: bool = False) -> int:
1148
+ def rows(self, size: tuple[int], focus: bool = False) -> int:
1180
1149
  """
1181
1150
  Return the number of rows required by the columns.
1182
1151
  This only makes sense if :attr:`widget_list` contains flow widgets.
urwid/widget/container.py CHANGED
@@ -3,7 +3,6 @@ from __future__ import annotations
3
3
  import abc
4
4
  import enum
5
5
  import typing
6
- import warnings
7
6
 
8
7
  from .constants import Sizing, WHSettings
9
8
 
@@ -13,39 +12,45 @@ if typing.TYPE_CHECKING:
13
12
  from .widget import Widget
14
13
 
15
14
 
16
- class _ContainerElementSizingFlag(enum.IntFlag):
17
- NONE = 0
18
- BOX = enum.auto()
19
- FLOW = enum.auto()
20
- FIXED = enum.auto()
21
- WH_WEIGHT = enum.auto()
22
- WH_PACK = enum.auto()
23
- WH_GIVEN = enum.auto()
24
-
25
- @property
26
- def reverse_flag(self) -> tuple[frozenset[Sizing], WHSettings | None]:
15
+ # Ideally, we would like to use an IntFlag coupled with enum.auto().
16
+ # However, doing many bitwise operations (which happens when nesting too many
17
+ # widgets ...) on IntFlag is orders of magnitude slower than doing the same
18
+ # operations on IntEnum.
19
+ class _ContainerElementSizingFlag(enum.IntEnum):
20
+ # fmt: off
21
+ NONE = 0b000000
22
+ BOX = 0b000001
23
+ FLOW = 0b000010
24
+ FIXED = 0b000100
25
+ WH_WEIGHT = 0b001000
26
+ WH_PACK = 0b010000
27
+ WH_GIVEN = 0b100000
28
+ # fmt: on
29
+
30
+ @staticmethod
31
+ def reverse_flag(bitfield: int) -> tuple[frozenset[Sizing], WHSettings | None]:
27
32
  """Get flag in public API format."""
28
33
  sizing: set[Sizing] = set()
29
34
 
30
- if self & self.BOX:
35
+ if bitfield & _ContainerElementSizingFlag.BOX:
31
36
  sizing.add(Sizing.BOX)
32
- if self & self.FLOW:
37
+ if bitfield & _ContainerElementSizingFlag.FLOW:
33
38
  sizing.add(Sizing.FLOW)
34
- if self & self.FIXED:
39
+ if bitfield & _ContainerElementSizingFlag.FIXED:
35
40
  sizing.add(Sizing.FIXED)
36
41
 
37
- if self & self.WH_WEIGHT:
42
+ if bitfield & _ContainerElementSizingFlag.WH_WEIGHT:
38
43
  return frozenset(sizing), WHSettings.WEIGHT
39
- if self & self.WH_PACK:
44
+ if bitfield & _ContainerElementSizingFlag.WH_PACK:
40
45
  return frozenset(sizing), WHSettings.PACK
41
- if self & self.WH_GIVEN:
46
+ if bitfield & _ContainerElementSizingFlag.WH_GIVEN:
42
47
  return frozenset(sizing), WHSettings.GIVEN
43
48
  return frozenset(sizing), None
44
49
 
45
- @property
46
- def log_string(self) -> str:
50
+ @staticmethod
51
+ def log_string(bitfield: int) -> str:
47
52
  """Get desctiprion in public API format."""
48
- sizing, render = self.reverse_flag
53
+ sizing, render = _ContainerElementSizingFlag.reverse_flag(bitfield)
49
54
  render_string = f" {render.upper()}" if render else ""
50
55
  return "|".join(sorted(mode.upper() for mode in sizing)) + render_string
51
56
 
@@ -115,12 +120,11 @@ class WidgetContainerMixin:
115
120
  """
116
121
  out = []
117
122
  w = self
118
- while True:
119
- w = w.base_widget.focus
120
- if w is None:
121
- return out
123
+ while (w := w.base_widget.focus) is not None:
122
124
  out.append(w)
123
125
 
126
+ return out
127
+
124
128
  @property
125
129
  @abc.abstractmethod
126
130
  def focus(self) -> Widget:
@@ -130,15 +134,6 @@ class WidgetContainerMixin:
130
134
  always returns ``None``, indicating that this widget has no children.
131
135
  """
132
136
 
133
- def _get_focus(self) -> Widget:
134
- warnings.warn(
135
- f"method `{self.__class__.__name__}._get_focus` is deprecated, "
136
- f"please use `{self.__class__.__name__}.focus` property",
137
- DeprecationWarning,
138
- stacklevel=3,
139
- )
140
- return self.focus
141
-
142
137
 
143
138
  class WidgetContainerListContentsMixin:
144
139
  """
@@ -172,24 +167,6 @@ class WidgetContainerListContentsMixin:
172
167
  def contents(self, new_contents: list[tuple[Widget, typing.Any]]) -> None:
173
168
  """The contents of container as a list of (widget, options)"""
174
169
 
175
- def _get_contents(self) -> list[tuple[Widget, typing.Any]]:
176
- warnings.warn(
177
- f"method `{self.__class__.__name__}._get_contents` is deprecated, "
178
- f"please use `{self.__class__.__name__}.contents` property",
179
- DeprecationWarning,
180
- stacklevel=2,
181
- )
182
- return self.contents
183
-
184
- def _set_contents(self, c: list[tuple[Widget, typing.Any]]) -> None:
185
- warnings.warn(
186
- f"method `{self.__class__.__name__}._set_contents` is deprecated, "
187
- f"please use `{self.__class__.__name__}.contents` property",
188
- DeprecationWarning,
189
- stacklevel=2,
190
- )
191
- self.contents = c
192
-
193
170
  @property
194
171
  @abc.abstractmethod
195
172
  def focus_position(self) -> int | None:
@@ -202,26 +179,3 @@ class WidgetContainerListContentsMixin:
202
179
  """
203
180
  index of child widget in focus.
204
181
  """
205
-
206
- def _get_focus_position(self) -> int | None:
207
- warnings.warn(
208
- f"method `{self.__class__.__name__}._get_focus_position` is deprecated, "
209
- f"please use `{self.__class__.__name__}.focus_position` property",
210
- DeprecationWarning,
211
- stacklevel=3,
212
- )
213
- return self.focus_position
214
-
215
- def _set_focus_position(self, position: int) -> None:
216
- """
217
- Set the widget in focus.
218
-
219
- position -- index of child widget to be made focus
220
- """
221
- warnings.warn(
222
- f"method `{self.__class__.__name__}._set_focus_position` is deprecated, "
223
- f"please use `{self.__class__.__name__}.focus_position` property",
224
- DeprecationWarning,
225
- stacklevel=3,
226
- )
227
- self.focus_position = position
urwid/widget/edit.py CHANGED
@@ -595,7 +595,7 @@ class Edit(Text):
595
595
  >>> c.cursor
596
596
  (5, 0)
597
597
  """
598
- self._shift_view_to_cursor = bool(focus) # noqa: FURB123,RUF100
598
+ self._shift_view_to_cursor = bool(focus)
599
599
 
600
600
  canv: TextCanvas | CompositeCanvas = super().render(size, focus)
601
601
  if focus:
@@ -698,15 +698,15 @@ class IntEdit(Edit):
698
698
  >>> print(e.edit_text)
699
699
  2
700
700
  """
701
- unhandled = super().keypress(size, key)
701
+ if unhandled := super().keypress(size, key):
702
+ return unhandled
702
703
 
703
- if not unhandled:
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:])
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 unhandled
709
+ return None
710
710
 
711
711
  def value(self) -> int:
712
712
  """
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
- PendingDeprecationWarning,
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
- PendingDeprecationWarning,
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
  )
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, MutableMapping
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
- PendingDeprecationWarning,
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
- PendingDeprecationWarning,
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
- PendingDeprecationWarning,
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
- PendingDeprecationWarning,
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
- PendingDeprecationWarning,
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
- PendingDeprecationWarning,
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
- PendingDeprecationWarning,
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
- PendingDeprecationWarning,
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,
@@ -294,9 +294,9 @@ class Frame(Widget, WidgetContainerMixin, typing.Generic[BodyWidget, HeaderWidge
294
294
 
295
295
  # noinspection PyMethodParameters
296
296
  class FrameContents(
297
- typing.MutableMapping[
297
+ MutableMapping[
298
298
  str,
299
- typing.Tuple[typing.Union[BodyWidget, HeaderWidget, FooterWidget], None],
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.