urwid 2.6.10__py3-none-any.whl → 2.6.12__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/canvas.py CHANGED
@@ -935,7 +935,7 @@ def shard_body_row(sbody):
935
935
  else: # noqa: PLR5501 # pylint: disable=else-if-used # readability
936
936
  # need to skip this unchanged canvas
937
937
  if row and isinstance(row[-1], int):
938
- row[-1] = row[-1] + cview[2]
938
+ row[-1] += cview[2]
939
939
  else:
940
940
  row.append(cview[2])
941
941
 
@@ -544,9 +544,7 @@ class Screen(BaseScreen, RealTerminal):
544
544
  def is_blank_row(row: list[tuple[object, Literal["0", "U"] | None], bytes]) -> bool:
545
545
  if len(row) > 1:
546
546
  return False
547
- if row[0][2].strip():
548
- return False
549
- return True
547
+ return not row[0][2].strip()
550
548
 
551
549
  def attr_to_escape(a: AttrSpec | str | None) -> str:
552
550
  if a in self._pal_escape:
urwid/version.py CHANGED
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '2.6.10'
16
- __version_tuple__ = version_tuple = (2, 6, 10)
15
+ __version__ = version = '2.6.12'
16
+ __version_tuple__ = version_tuple = (2, 6, 12)
urwid/widget/bar_graph.py CHANGED
@@ -380,7 +380,7 @@ class BarGraph(Widget, metaclass=BarGraphMeta):
380
380
  row_combine_last(count, row)
381
381
  y_count -= count # noqa: PLW2901
382
382
  r += count
383
- r = r % 8
383
+ r %= 8
384
384
  if not y_count:
385
385
  continue
386
386
  if r != 0:
@@ -508,7 +508,7 @@ def calculate_bargraph_display(bardata, top: float, bar_widths: list[int], maxro
508
508
 
509
509
  for r in rows:
510
510
  if r is None:
511
- y_count = y_count + 1
511
+ y_count += 1
512
512
  continue
513
513
  if y_count:
514
514
  rowsets.append((y_count, last))
@@ -24,9 +24,9 @@ import typing
24
24
  import warnings
25
25
 
26
26
  if typing.TYPE_CHECKING:
27
- from collections.abc import Callable, Collection, Iterator
27
+ from collections.abc import Callable, Collection, Iterable, Iterator
28
28
 
29
- from typing_extensions import Concatenate, ParamSpec
29
+ from typing_extensions import Concatenate, ParamSpec, Self
30
30
 
31
31
  ArgSpec = ParamSpec("ArgSpec")
32
32
  Ret = typing.TypeVar("Ret")
@@ -88,23 +88,69 @@ class MonitoredList(typing.List[_T], typing.Generic[_T]):
88
88
  for item in self:
89
89
  yield None, item
90
90
 
91
- __add__ = _call_modified(list.__add__) # type: ignore[assignment] # magic like old __super__
92
- __delitem__ = _call_modified(list.__delitem__) # type: ignore[assignment] # magic like old __super__
93
-
94
- __iadd__ = _call_modified(list.__iadd__) # type: ignore[assignment] # magic like old __super__
95
- __imul__ = _call_modified(list.__imul__) # type: ignore[assignment] # magic like old __super__
96
- __rmul__ = _call_modified(list.__rmul__) # type: ignore[assignment] # magic like old __super__
97
- __setitem__ = _call_modified(list.__setitem__) # type: ignore[assignment] # magic like old __super__
98
-
99
- append = _call_modified(list.append) # type: ignore[assignment] # magic like old __super__
100
- extend = _call_modified(list.extend) # type: ignore[assignment] # magic like old __super__
101
- insert = _call_modified(list.insert) # type: ignore[assignment] # magic like old __super__
102
- pop = _call_modified(list.pop) # type: ignore[assignment] # magic like old __super__
103
- remove = _call_modified(list.remove) # type: ignore[assignment] # magic like old __super__
104
- reverse = _call_modified(list.reverse) # type: ignore[assignment] # magic like old __super__
105
- sort = _call_modified(list.sort) # type: ignore[assignment] # magic like old __super__
106
- if hasattr(list, "clear"):
107
- clear = _call_modified(list.clear) # type: ignore[assignment] # magic like old __super__
91
+ @_call_modified
92
+ def __add__(self, __value: list[_T]) -> Self:
93
+ return super().__add__(__value)
94
+
95
+ @_call_modified
96
+ def __delitem__(self, __key: typing.SupportsIndex | slice) -> None:
97
+ super().__delitem__(__key)
98
+
99
+ @_call_modified
100
+ def __iadd__(self, __value: Iterable[_T]) -> Self:
101
+ return super().__iadd__(__value)
102
+
103
+ @_call_modified
104
+ def __rmul__(self, __value: typing.SupportsIndex) -> Self:
105
+ return super().__rmul__(__value)
106
+
107
+ @_call_modified
108
+ def __imul__(self, __value: typing.SupportsIndex) -> Self:
109
+ return super().__imul__(__value)
110
+
111
+ @typing.overload
112
+ @_call_modified
113
+ def __setitem__(self, __key: typing.SupportsIndex, __value: _T) -> None: ...
114
+
115
+ @typing.overload
116
+ @_call_modified
117
+ def __setitem__(self, __key: slice, __value: Iterable[_T]) -> None: ...
118
+
119
+ @_call_modified
120
+ def __setitem__(self, __key: typing.SupportsIndex | slice, __value: _T | Iterable[_T]) -> None:
121
+ super().__setitem__(__key, __value)
122
+
123
+ @_call_modified
124
+ def append(self, __object: _T) -> None:
125
+ super().append(__object)
126
+
127
+ @_call_modified
128
+ def extend(self, __iterable: Iterable[_T]) -> None:
129
+ super().extend(__iterable)
130
+
131
+ @_call_modified
132
+ def pop(self, __index: typing.SupportsIndex = -1) -> _T:
133
+ return super().pop(__index)
134
+
135
+ @_call_modified
136
+ def insert(self, __index: typing.SupportsIndex, __object: _T) -> None:
137
+ super().insert(__index, __object)
138
+
139
+ @_call_modified
140
+ def remove(self, __value: _T) -> None:
141
+ super().remove(__value)
142
+
143
+ @_call_modified
144
+ def reverse(self) -> None:
145
+ super().reverse()
146
+
147
+ @_call_modified
148
+ def sort(self, *, key: Callable[[_T], typing.Any] | None = None, reverse: bool = False) -> None:
149
+ super().sort(key=key, reverse=reverse)
150
+
151
+ @_call_modified
152
+ def clear(self) -> None:
153
+ super().clear()
108
154
 
109
155
 
110
156
  class MonitoredFocusList(MonitoredList[_T], typing.Generic[_T]):
urwid/widget/padding.py CHANGED
@@ -40,12 +40,14 @@ class Padding(WidgetDecoration[WrappedWidget], typing.Generic[WrappedWidget]):
40
40
  self,
41
41
  w: WrappedWidget,
42
42
  align: (
43
- Literal["left", "center", "right"] | Align | tuple[Literal["relative", WHSettings.RELATIVE], int]
43
+ Literal["left", "center", "right"]
44
+ | Align
45
+ | tuple[Literal["relative", WHSettings.RELATIVE, "fixed left", "fixed right"], int]
44
46
  ) = Align.LEFT,
45
47
  width: (
46
48
  int
47
49
  | Literal["pack", "clip", WHSettings.PACK, WHSettings.CLIP]
48
- | tuple[Literal["relative", WHSettings.RELATIVE], int]
50
+ | tuple[Literal["relative", WHSettings.RELATIVE, "fixed left", "fixed right"], int]
49
51
  ) = RELATIVE_100,
50
52
  min_width: int | None = None,
51
53
  left: int = 0,
urwid/widget/popup.py CHANGED
@@ -24,7 +24,7 @@ import typing
24
24
 
25
25
  from urwid.canvas import CompositeCanvas
26
26
 
27
- from .constants import Sizing
27
+ from .constants import Align, Sizing, VAlign
28
28
  from .overlay import Overlay
29
29
  from .widget import delegate_to_widget_mixin
30
30
  from .widget_decoration import WidgetDecoration
@@ -86,8 +86,7 @@ class PopUpLauncher(delegate_to_widget_mixin("_original_widget"), WidgetDecorati
86
86
 
87
87
 
88
88
  class PopUpTarget(WidgetDecoration[WrappedWidget]):
89
- # FIXME: this whole class is a terrible hack and must be fixed
90
- # when layout and rendering are separated
89
+ # FIXME: this whole class is a terrible hack and must be fixed when layout and rendering are separated
91
90
  _sizing = frozenset((Sizing.BOX,))
92
91
  _selectable = True
93
92
 
@@ -105,19 +104,23 @@ class PopUpTarget(WidgetDecoration[WrappedWidget]):
105
104
  if self._pop_up != w:
106
105
  self._pop_up = w
107
106
  self._current_widget = Overlay(
108
- w,
109
- self._original_widget,
110
- ("fixed left", left),
111
- overlay_width,
112
- ("fixed top", top),
113
- overlay_height,
107
+ top_w=w,
108
+ bottom_w=self._original_widget,
109
+ align=Align.LEFT,
110
+ width=overlay_width,
111
+ valign=VAlign.TOP,
112
+ height=overlay_height,
113
+ left=left,
114
+ top=top,
114
115
  )
115
116
  else:
116
117
  self._current_widget.set_overlay_parameters(
117
- ("fixed left", left),
118
- overlay_width,
119
- ("fixed top", top),
120
- overlay_height,
118
+ align=Align.LEFT,
119
+ width=overlay_width,
120
+ valign=VAlign.TOP,
121
+ height=overlay_height,
122
+ left=left,
123
+ top=top,
121
124
  )
122
125
  else:
123
126
  self._pop_up = None
@@ -137,6 +137,17 @@ class SupportsRelativeScroll(WidgetProto, Protocol):
137
137
  def get_visible_amount(self, size: tuple[int, int], focus: bool = False) -> int: ...
138
138
 
139
139
 
140
+ def orig_iter(w: Widget) -> Iterator[Widget]:
141
+ visited = {w}
142
+ yield w
143
+ while hasattr(w, "original_widget"):
144
+ w = w.original_widget
145
+ if w in visited:
146
+ break
147
+ visited.add(w)
148
+ yield w
149
+
150
+
140
151
  class Scrollable(WidgetDecoration[WrappedWidget]):
141
152
  def sizing(self) -> frozenset[Sizing]:
142
153
  return frozenset((Sizing.BOX,))
@@ -481,7 +492,8 @@ class ScrollBar(WidgetDecoration[WrappedWidget]):
481
492
  """
482
493
  if Sizing.BOX not in widget.sizing():
483
494
  raise ValueError(f"Not a box widget: {widget!r}")
484
- if not isinstance(widget, SupportsScroll):
495
+
496
+ if not any(isinstance(w, SupportsScroll) for w in orig_iter(widget)):
485
497
  raise TypeError(f"Not a scrollable widget: {widget!r}")
486
498
 
487
499
  super().__init__(widget)
@@ -612,12 +624,6 @@ class ScrollBar(WidgetDecoration[WrappedWidget]):
612
624
  def scrolling_base_widget(self) -> SupportsScroll | SupportsRelativeScroll:
613
625
  """Nearest `original_widget` that is compatible with the scrolling API"""
614
626
 
615
- def orig_iter(w: Widget) -> Iterator[Widget]:
616
- while hasattr(w, "original_widget"):
617
- w = w.original_widget
618
- yield w
619
- yield w
620
-
621
627
  w = self
622
628
 
623
629
  for w in orig_iter(self):
urwid/widget/widget.py CHANGED
@@ -592,7 +592,7 @@ class FlowWidget(Widget):
592
592
  )
593
593
  super().__init__()
594
594
 
595
- def rows(self, size: int, focus: bool = False) -> int:
595
+ def rows(self, size: tuple[int], focus: bool = False) -> int:
596
596
  """
597
597
  All flow widgets must implement this function.
598
598
  """
@@ -105,9 +105,13 @@ class WidgetDecoration(Widget, typing.Generic[WrappedWidget]): # pylint: disabl
105
105
  >>> wd3.base_widget is t
106
106
  True
107
107
  """
108
+ visited = {self}
108
109
  w = self
109
110
  while hasattr(w, "_original_widget"):
110
111
  w = w._original_widget
112
+ if w in visited:
113
+ break
114
+ visited.add(w)
111
115
  return w
112
116
 
113
117
  def _get_base_widget(self) -> Widget:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: urwid
3
- Version: 2.6.10
3
+ Version: 2.6.12
4
4
  Summary: A full-featured console (xterm et al.) user interface library
5
5
  Home-page: https://urwid.org/
6
6
  Author-email: Ian Ward <ian@excess.org>
@@ -1,5 +1,5 @@
1
1
  urwid/__init__.py,sha256=UMQZuTCtUPN9jHAEJ35lasW7IbBYRXy7NiRAKvyz4iE,8041
2
- urwid/canvas.py,sha256=6f3pSAJqg2pPsVaqcHfYx5robqvJ2JBX7xP_NQV8fqo,46750
2
+ urwid/canvas.py,sha256=8awQrNgD6zewFAzPOYcjyiKUC8mv8yDZme7_hVpKnSE,46741
3
3
  urwid/command_map.py,sha256=M_OjrGY4yKn0jU3MEF9UOhBo2R6y_zZ-qo3LVIKNT_g,4310
4
4
  urwid/container.py,sha256=mikK50qN_Cu-8VlBRqQZzU4DcOvz8P_5CfozyyoIf3Q,1589
5
5
  urwid/decoration.py,sha256=sKfCe8SdSWZ4V0Ed_G4aumLxwwhnjoVvF70vlAhoXBE,1772
@@ -11,12 +11,12 @@ urwid/split_repr.py,sha256=pXzuddzQ4RnfIl537Gvoe8PVaBRHCPnxgdYvKK0qm8k,3899
11
11
  urwid/str_util.py,sha256=1ss-LHAhjXTynTVBcoSgYWIpBeN_RirqHYhP7fq7MrA,10844
12
12
  urwid/text_layout.py,sha256=lHiGfo7clmwHt5dMl_AaQSs2ov9IbY9JySTATZBm7h0,22821
13
13
  urwid/util.py,sha256=pGXnma03_IBx3v6_qN9cDWPXPj_YjkhQ9IxLjm_0TpU,15747
14
- urwid/version.py,sha256=Q6B6SJpzx7ArqUrw_2w87t72hs-NzqHnm-ERmJDUGVM,413
14
+ urwid/version.py,sha256=Q7bo66dj80WEpDoVmCtISYC3ZL0QcWJqe3SGYxcts9s,413
15
15
  urwid/vterm.py,sha256=q9-8dxJpVr_7a0Bj_z_FYDiRgzos3IS17BjhYcy1RDw,58410
16
16
  urwid/wimp.py,sha256=o1YsjL_tBLXba8ZRr1MTHH0poLSlXT_atY3-uD_Ualg,567
17
17
  urwid/display/__init__.py,sha256=y90WbHPNRHlimPrXhzsSfFsBbBHy8QErmB1y4Xza-xo,1732
18
18
  urwid/display/_posix_raw_display.py,sha256=EkywAUNhhqgLquknP4tyicoo6QMdKG6uH6LApRmjoW8,14501
19
- urwid/display/_raw_display_base.py,sha256=dTpsLqNkaP7kPCfhPUMbEPgXhUhjzidq-uO_cWgZyow,33581
19
+ urwid/display/_raw_display_base.py,sha256=B6mBR02J0kyBqWS6To0zdc_2hyl35czVfWnVzAV7wTY,33535
20
20
  urwid/display/_web.css,sha256=6HarEsIspH2egt51HSrgI8Yl2lGi-DbziWOdS4RHNlk,359
21
21
  urwid/display/_web.js,sha256=aWEOQ4EsADsiNgdw-zHEUMCRD2bnfR8M1mu4dOc2Tqk,12947
22
22
  urwid/display/_win32.py,sha256=hD4hytElpfIv5qxGNTMSa2QeBNByqJDNVpmiiQSj6CM,5401
@@ -41,7 +41,7 @@ urwid/event_loop/zmq_loop.py,sha256=wt4lE0hnDODTVaAMuB5wCSAD5yQ6D9pj8_G_7iNGBUI,
41
41
  urwid/widget/__init__.py,sha256=lEFAuQKYnGKS9-dhUggItnnm9Bvbbuk7RAKvzrs8xkI,4683
42
42
  urwid/widget/attr_map.py,sha256=L6svBcabtXeSaU2cNrgDv4Nne6QYk-nvVbr88sA4WnY,6205
43
43
  urwid/widget/attr_wrap.py,sha256=pJQHVNlwcX5IgpdSmTqYOt63EX-p5hA0mJfXtWXJ6wg,4830
44
- urwid/widget/bar_graph.py,sha256=Ui2Z-DJ7Try9rkAQ14rK__-oSGfsWncpJH-AxSF00bk,21615
44
+ urwid/widget/bar_graph.py,sha256=1xQPKKVczMw_lDG4UBk5urUTAgtINN6SgEkVyZkaIU4,21603
45
45
  urwid/widget/big_text.py,sha256=Zvjbkdh4H1Wv9ZTdCbX23vfNyeybO8au-kUssE58Bbs,2393
46
46
  urwid/widget/box_adapter.py,sha256=uOFlZUaCK9A4H8Pmw6-OoS9QTYi9nn-LhlSa-JpC9Iw,4276
47
47
  urwid/widget/columns.py,sha256=Jz-0oR27uAoUV8LdhPWuCrkMgSHSYTxciNjxDCXPTbs,46508
@@ -54,21 +54,21 @@ urwid/widget/frame.py,sha256=AOe4FwjvwcIwrpXqyZkCwSZWwAALNl1XRMAKx6ZXYWs,21834
54
54
  urwid/widget/grid_flow.py,sha256=otujeOTWYDr4gwuDikBm9zZd8SUgma9yvQ1hDWI-dGk,21514
55
55
  urwid/widget/line_box.py,sha256=V750xiZtkw6_uRXLhNY91ER3pXwwrZstVv_IJUZd_YY,6884
56
56
  urwid/widget/listbox.py,sha256=EaGo13fpt4Oy9V00n27U-2PhOWa7-nmsTgnddKv9GII,74392
57
- urwid/widget/monitored_list.py,sha256=8lBb8kowLAqKMKByiBZp4jt9PSnXjYAoAjXFXm-7xcg,18773
57
+ urwid/widget/monitored_list.py,sha256=mZUPYB1yhuKN6su6_VjmoiE0LlTXsYxkH14pbif0tbc,19264
58
58
  urwid/widget/overlay.py,sha256=7EtTHOomIF4xzwYiY7SiMCQZF2IHrmO88YeosFOMFo0,34505
59
- urwid/widget/padding.py,sha256=tdBJybrKJqR8OLo5DHixn6KZA3tefYlfo9kkqvxYLEc,21252
59
+ urwid/widget/padding.py,sha256=pBXQsnkySV1GXgveg2Ivm6SCqHiGa2YkYSjXaoCUIHk,21334
60
60
  urwid/widget/pile.py,sha256=aIzKYNrSQtbHVk_bn2PElHUiSdsO_NKnL4mTu-sXm4I,38628
61
- urwid/widget/popup.py,sha256=UQ1MTzt8RNcfIvmwIqDM4mypxxXUOMsGoiozom8HfTg,5814
61
+ urwid/widget/popup.py,sha256=vw9_S1UC6UMy5Roc4qK8NXgH5_dDGxoHmpDAi_u9wsI,5974
62
62
  urwid/widget/progress_bar.py,sha256=HRnIu2V2_4wgsnAdrhK-GVVToyLaXRH0gtlkWllA4Mo,4767
63
- urwid/widget/scrollable.py,sha256=yB3S3k5dOdZ-wrQMlgxQH-1AZONSf5X6Y2accIa9tpk,24279
63
+ urwid/widget/scrollable.py,sha256=5L7axfY0Nn63H-NGIgJEyogl8e09ZdyKL5YxGHcmP1M,24352
64
64
  urwid/widget/solid_fill.py,sha256=NZRDSRK0lP4r7gXcKDgVaKEoeOcWvtrY5k2aueQEEL4,1260
65
65
  urwid/widget/text.py,sha256=jy15hL6rCBoJdZviq2jJ-i9eO6vEcxvzCIVAZs12AUw,12187
66
66
  urwid/widget/treetools.py,sha256=5s3Dnp2PCz4wQccutmdvsTTbAROJMLehXe4moB5POY0,17387
67
- urwid/widget/widget.py,sha256=dMGNVewj2NGFdGKAtDJYgOzhuJAtrr_BALOMwNzUyj0,29550
68
- urwid/widget/widget_decoration.py,sha256=aHP9Y7JKVCI2dw2OdRrzMj9p--C1pMIbxSJskWBLIgc,5633
67
+ urwid/widget/widget.py,sha256=A0ZjvDjLqhdzelPFC96Ozo1voIoGkxftNmJh8X1IyNI,29557
68
+ urwid/widget/widget_decoration.py,sha256=6eEPvtF7wk2n1csIBWrnXAosprFl2pZiQ7SoCpwKnJM,5736
69
69
  urwid/widget/wimp.py,sha256=4wfzTQBLMbhicSlL64hBPb-1W5FAFrIKfb43i10MKSY,27305
70
- urwid-2.6.10.dist-info/COPYING,sha256=NrbT-keRaUP9X-wxPFhHhJRgR-wTN6eLRA5ZkstZX4k,26434
71
- urwid-2.6.10.dist-info/METADATA,sha256=o9GKYe-Nt5Hkz7EF_S6E3DXp8CblUs66umXNmAj5-jI,11043
72
- urwid-2.6.10.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
73
- urwid-2.6.10.dist-info/top_level.txt,sha256=AwxQA43kNkjHbhYELXHBKrQ01X5CR2KnDzU07cVqilY,6
74
- urwid-2.6.10.dist-info/RECORD,,
70
+ urwid-2.6.12.dist-info/COPYING,sha256=NrbT-keRaUP9X-wxPFhHhJRgR-wTN6eLRA5ZkstZX4k,26434
71
+ urwid-2.6.12.dist-info/METADATA,sha256=vu73SUW1PsgXOQBYsO0xEawmoT0WNQcMYbmW-ROhWDg,11043
72
+ urwid-2.6.12.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
73
+ urwid-2.6.12.dist-info/top_level.txt,sha256=AwxQA43kNkjHbhYELXHBKrQ01X5CR2KnDzU07cVqilY,6
74
+ urwid-2.6.12.dist-info/RECORD,,
File without changes