console-window 2.1.0__tar.gz → 2.1.1__tar.gz
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.
- {console_window-2.1.0 → console_window-2.1.1}/PKG-INFO +1 -1
- {console_window-2.1.0 → console_window-2.1.1}/console_window/__init__.py +1 -1
- {console_window-2.1.0 → console_window-2.1.1}/console_window/screens.py +13 -4
- {console_window-2.1.0 → console_window-2.1.1}/console_window/widgets.py +3 -1
- {console_window-2.1.0 → console_window-2.1.1}/console_window/window.py +4 -2
- {console_window-2.1.0 → console_window-2.1.1}/.github/workflows/ci.yml +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/.gitignore +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/LICENSE +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/README.md +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/SampleApp.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/console_window/backend.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/console_window/context.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/console_window/geometry.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/console_window/header.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/console_window/keys.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/console_window/opts.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/console_window/signals.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/console_window/spinner.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/console_window/textwidth.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/console_window/theme.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/pyproject.toml +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/runner +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/tests/AUDIT.md +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/tests/CHANGELOG.md +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/tests/test_backend.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/tests/test_context.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/tests/test_demo_mode.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/tests/test_dialogs.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/tests/test_flash.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/tests/test_geometry.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/tests/test_header.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/tests/test_interactive.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/tests/test_low_colour.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/tests/test_overflow.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/tests/test_prompt_line.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/tests/test_prompt_window.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/tests/test_public_api.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/tests/test_render_retry.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/tests/test_sample_app.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/tests/test_screens.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/tests/test_signals.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/tests/test_spinner.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/tests/test_status.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/tests/test_taken_nav_keys.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/tests/test_textwidth.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/tests/test_theme.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/tests/test_viewport_pad.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/tests/test_widechars.py +0 -0
- {console_window-2.1.0 → console_window-2.1.1}/tests/test_widgets.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Single source of truth for the package version: pyproject.toml declares
|
|
2
2
|
# ``dynamic = ["version"]``, so flit reads this value instead of duplicating it.
|
|
3
|
-
__version__ = "2.1.
|
|
3
|
+
__version__ = "2.1.1"
|
|
4
4
|
|
|
5
5
|
from .context import Context
|
|
6
6
|
from .header import HeaderLine, Span
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
from collections.abc import Iterable
|
|
3
4
|
from types import SimpleNamespace
|
|
4
5
|
from typing import TYPE_CHECKING, Protocol
|
|
5
6
|
|
|
@@ -15,6 +16,12 @@ class _AppLike(Protocol):
|
|
|
15
16
|
win: ConsoleWindow
|
|
16
17
|
|
|
17
18
|
|
|
19
|
+
#: One body row: plain text, or text paired with a curses attribute.
|
|
20
|
+
_LineItem = str | tuple[str, int | None]
|
|
21
|
+
#: One header entry, or a specification of one or more of them.
|
|
22
|
+
_HeadSpec = str | HeaderLine | Iterable[str | HeaderLine] | None
|
|
23
|
+
|
|
24
|
+
|
|
18
25
|
# Default home screen constant (applications should define their own)
|
|
19
26
|
HOME_ST = 0
|
|
20
27
|
|
|
@@ -267,26 +274,28 @@ class BasicTextScreen(Screen):
|
|
|
267
274
|
|
|
268
275
|
come_from_whitelist = None
|
|
269
276
|
|
|
270
|
-
def __init__(self, app: _AppLike, lines=(),
|
|
277
|
+
def __init__(self, app: _AppLike, lines: Iterable[_LineItem] = (),
|
|
278
|
+
head: _HeadSpec = ()) -> None:
|
|
271
279
|
super().__init__(app)
|
|
272
280
|
self._lines: list[tuple[str, int | None]] = []
|
|
273
281
|
self._heads: list[str | HeaderLine] = []
|
|
274
282
|
self.set_text(lines, head)
|
|
275
283
|
|
|
276
|
-
def set_text(self, lines=(),
|
|
284
|
+
def set_text(self, lines: Iterable[_LineItem] = (),
|
|
285
|
+
head: _HeadSpec = ()) -> None:
|
|
277
286
|
"""Replace the screen's content. Safe before or after the first draw."""
|
|
278
287
|
self._lines = [self._normalize_line(item) for item in (lines or ())]
|
|
279
288
|
self._heads = self._normalize_heads(head)
|
|
280
289
|
|
|
281
290
|
@staticmethod
|
|
282
|
-
def _normalize_line(item) -> tuple[str, int | None]:
|
|
291
|
+
def _normalize_line(item: _LineItem) -> tuple[str, int | None]:
|
|
283
292
|
if isinstance(item, str):
|
|
284
293
|
return item, None
|
|
285
294
|
text, attr = item
|
|
286
295
|
return str(text), attr
|
|
287
296
|
|
|
288
297
|
@staticmethod
|
|
289
|
-
def _normalize_heads(head) -> list[str | HeaderLine]:
|
|
298
|
+
def _normalize_heads(head: _HeadSpec) -> list[str | HeaderLine]:
|
|
290
299
|
if head is None:
|
|
291
300
|
return []
|
|
292
301
|
if isinstance(head, (str, HeaderLine)):
|
|
@@ -349,7 +349,9 @@ class PromptLine:
|
|
|
349
349
|
|
|
350
350
|
def start(self, prompt: str, *, hint: str = '', mode: str = 'y',
|
|
351
351
|
identity: str | None = None, seed: str = '',
|
|
352
|
-
choices
|
|
352
|
+
choices: str | list[str] | tuple[str, ...] | None = None,
|
|
353
|
+
on_confirm: Callable[[str], object] | None = None,
|
|
354
|
+
on_cancel: Callable[[], object] | None = None,
|
|
353
355
|
min_abbrev_chars: int | None = None) -> None:
|
|
354
356
|
self._editor.start(action_type=None, identity=identity, choices=choices,
|
|
355
357
|
mode=mode, min_abbrev_chars=min_abbrev_chars,
|
|
@@ -1151,8 +1151,9 @@ class ConsoleWindow:
|
|
|
1151
1151
|
|
|
1152
1152
|
def begin_prompt(self, prompt: str, *, hint: str = '', mode: str = 'y',
|
|
1153
1153
|
identity: str | None = None, seed: str = '',
|
|
1154
|
-
choices
|
|
1155
|
-
|
|
1154
|
+
choices: str | list[str] | tuple[str, ...] | None = None,
|
|
1155
|
+
on_confirm: Callable[[str], object] | None = None,
|
|
1156
|
+
on_cancel: Callable[[], object] | None = None) -> bool:
|
|
1156
1157
|
"""Start an in-place prompt and enable passthrough key routing.
|
|
1157
1158
|
|
|
1158
1159
|
The window *is* the receiver, so there is no window-existence branch
|
|
@@ -1188,6 +1189,7 @@ class ConsoleWindow:
|
|
|
1188
1189
|
answer, on_confirm, on_cancel = self.prompt_line.take()
|
|
1189
1190
|
self.end_prompt() # passthrough restored FIRST
|
|
1190
1191
|
if result == 'confirmed' and on_confirm:
|
|
1192
|
+
assert answer is not None
|
|
1191
1193
|
on_confirm(answer) # may begin_prompt() the next prompt
|
|
1192
1194
|
elif result == 'cancelled' and on_cancel:
|
|
1193
1195
|
on_cancel()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|