inquirer-textual 0.4.0__tar.gz → 1.0.0__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.
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/.github/workflows/release.yml +1 -1
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/PKG-INFO +3 -42
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/README.md +1 -38
- inquirer_textual-1.0.0/docs/examples/prompts/checkbox.gif +0 -0
- inquirer_textual-1.0.0/docs/faq.md +6 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/docs/index.md +2 -11
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/examples/prompt_checkbox.py +4 -3
- inquirer_textual-1.0.0/examples/prompt_multi.py +18 -0
- inquirer_textual-0.4.0/examples/prompt_editor.py → inquirer_textual-1.0.0/examples/prompt_number.py +1 -1
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/examples/prompt_secret.py +2 -2
- inquirer_textual-1.0.0/examples/prompt_select.py +6 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/examples/prompt_text.py +2 -2
- inquirer_textual-1.0.0/examples/shortcuts.py +7 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/inquirer_textual/InquirerApp.py +22 -24
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/inquirer_textual/common/Choice.py +0 -3
- inquirer_textual-1.0.0/inquirer_textual/common/ChoiceLabel.py +18 -0
- inquirer_textual-0.4.0/inquirer_textual/common/Prompt.py → inquirer_textual-1.0.0/inquirer_textual/common/PromptMessage.py +3 -3
- inquirer_textual-1.0.0/inquirer_textual/common/Result.py +15 -0
- inquirer_textual-1.0.0/inquirer_textual/prompts.py +76 -0
- inquirer_textual-1.0.0/inquirer_textual/version.py +1 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/inquirer_textual/widgets/InquirerCheckbox.py +22 -30
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/inquirer_textual/widgets/InquirerConfirm.py +11 -31
- inquirer_textual-1.0.0/inquirer_textual/widgets/InquirerMulti.py +46 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/inquirer_textual/widgets/InquirerNumber.py +12 -20
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/inquirer_textual/widgets/InquirerSecret.py +6 -5
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/inquirer_textual/widgets/InquirerSelect.py +28 -32
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/inquirer_textual/widgets/InquirerText.py +7 -10
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/inquirer_textual/widgets/InquirerWidget.py +2 -8
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/mkdocs.yml +0 -9
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/pyproject.toml +4 -19
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/tests/__snapshots__/test_InquirerApp/test_snapshot_shortcut.svg +2 -2
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/tests/__snapshots__/test_InquirerApp/test_snapshot_shortcut_no_description.svg +2 -2
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/tests/test_InquirerApp.py +0 -1
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/tests/widgets/__snapshots__/test_InquirerMulti/test_snapshot.svg +1 -1
- inquirer_textual-1.0.0/tests/widgets/__snapshots__/test_InquirerMulti/test_snapshot_fifth_input.svg +152 -0
- inquirer_textual-1.0.0/tests/widgets/__snapshots__/test_InquirerMulti/test_snapshot_fifth_input_pick_default.svg +152 -0
- inquirer_textual-0.4.0/tests/widgets/__snapshots__/test_InquirerPath/test_snapshot.svg → inquirer_textual-1.0.0/tests/widgets/__snapshots__/test_InquirerMulti/test_snapshot_fourth_input.svg +2 -4
- inquirer_textual-1.0.0/tests/widgets/__snapshots__/test_InquirerMulti/test_snapshot_second_input.svg +152 -0
- inquirer_textual-0.4.0/tests/widgets/__snapshots__/test_InquirerCheckbox/test_snapshot_select_value.svg → inquirer_textual-1.0.0/tests/widgets/__snapshots__/test_InquirerMulti/test_snapshot_third_input.svg +3 -3
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/tests/widgets/__snapshots__/test_InquirerNumber/test_snapshot.svg +1 -1
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/tests/widgets/__snapshots__/test_InquirerSecret/test_snapshot.svg +1 -1
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/tests/widgets/__snapshots__/test_InquirerSecret/test_snapshot_hide_input.svg +1 -1
- inquirer_textual-1.0.0/tests/widgets/__snapshots__/test_InquirerSelect/test_snapshot_not_mandatory.svg +152 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/tests/widgets/__snapshots__/test_InquirerText/test_snapshot.svg +1 -1
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/tests/widgets/__snapshots__/test_InquirerText/test_snapshot_with_default_value.svg +1 -1
- inquirer_textual-1.0.0/tests/widgets/test_InquirerCheckbox.py +31 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/tests/widgets/test_InquirerConfirm.py +0 -12
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/tests/widgets/test_InquirerMulti.py +31 -36
- inquirer_textual-1.0.0/tests/widgets/test_InquirerNumber.py +9 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/tests/widgets/test_InquirerSecret.py +0 -12
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/tests/widgets/test_InquirerSelect.py +2 -28
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/tests/widgets/test_InquirerText.py +0 -14
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/uv.lock +406 -58
- inquirer_textual-0.4.0/docs/examples/prompts/checkbox.gif +0 -0
- inquirer_textual-0.4.0/docs/examples/prompts/editor.gif +0 -0
- inquirer_textual-0.4.0/docs/examples/prompts/editor.md +0 -11
- inquirer_textual-0.4.0/docs/examples/prompts/editor.tape +0 -17
- inquirer_textual-0.4.0/docs/examples/prompts/external.gif +0 -0
- inquirer_textual-0.4.0/docs/examples/prompts/external.md +0 -12
- inquirer_textual-0.4.0/docs/examples/prompts/external.tape +0 -24
- inquirer_textual-0.4.0/docs/examples/prompts/path.gif +0 -0
- inquirer_textual-0.4.0/docs/examples/prompts/path.md +0 -11
- inquirer_textual-0.4.0/docs/examples/prompts/path.tape +0 -10
- inquirer_textual-0.4.0/docs/examples/prompts/pattern.gif +0 -0
- inquirer_textual-0.4.0/docs/examples/prompts/pattern.md +0 -12
- inquirer_textual-0.4.0/docs/examples/prompts/pattern.tape +0 -12
- inquirer_textual-0.4.0/docs/faq.md +0 -11
- inquirer_textual-0.4.0/docs/getting-started/index.md +0 -39
- inquirer_textual-0.4.0/docs/getting-started/simple_multi_prompt.gif +0 -0
- inquirer_textual-0.4.0/docs/getting-started/simple_multi_prompt.py +0 -9
- inquirer_textual-0.4.0/docs/getting-started/simple_multi_prompt.tape +0 -14
- inquirer_textual-0.4.0/docs/getting-started/simple_text_prompt.gif +0 -0
- inquirer_textual-0.4.0/docs/getting-started/simple_text_prompt.py +0 -5
- inquirer_textual-0.4.0/docs/getting-started/simple_text_prompt.tape +0 -10
- inquirer_textual-0.4.0/docs/getting-started/simple_text_prompts.gif +0 -0
- inquirer_textual-0.4.0/docs/getting-started/simple_text_prompts.py +0 -6
- inquirer_textual-0.4.0/docs/getting-started/simple_text_prompts.tape +0 -14
- inquirer_textual-0.4.0/docs/reference/editor.md +0 -3
- inquirer_textual-0.4.0/docs/reference/path.md +0 -3
- inquirer_textual-0.4.0/docs/reference/pattern.md +0 -3
- inquirer_textual-0.4.0/docs/themes/catppuccin_mocha.gif +0 -0
- inquirer_textual-0.4.0/docs/themes/catppuccin_mocha.tape +0 -27
- inquirer_textual-0.4.0/docs/themes/index.md +0 -18
- inquirer_textual-0.4.0/docs/themes/nord.gif +0 -0
- inquirer_textual-0.4.0/docs/themes/nord.tape +0 -27
- inquirer_textual-0.4.0/docs/themes/solarized_light.gif +0 -0
- inquirer_textual-0.4.0/docs/themes/solarized_light.tape +0 -27
- inquirer_textual-0.4.0/docs/themes/textual_dark.gif +0 -0
- inquirer_textual-0.4.0/docs/themes/textual_dark.tape +0 -27
- inquirer_textual-0.4.0/docs/themes/textual_light.gif +0 -0
- inquirer_textual-0.4.0/docs/themes/textual_light.tape +0 -27
- inquirer_textual-0.4.0/examples/alternatives/inquirerpy/main.py +0 -34
- inquirer_textual-0.4.0/examples/alternatives/python-inquirer/main.py +0 -43
- inquirer_textual-0.4.0/examples/pizza.py +0 -21
- inquirer_textual-0.4.0/examples/prompt_external.py +0 -51
- inquirer_textual-0.4.0/examples/prompt_multi.py +0 -18
- inquirer_textual-0.4.0/examples/prompt_number.py +0 -5
- inquirer_textual-0.4.0/examples/prompt_path.py +0 -6
- inquirer_textual-0.4.0/examples/prompt_pattern.py +0 -6
- inquirer_textual-0.4.0/examples/prompt_select.py +0 -6
- inquirer_textual-0.4.0/examples/shortcuts.py +0 -11
- inquirer_textual-0.4.0/examples/themes.py +0 -36
- inquirer_textual-0.4.0/inquirer_textual/common/Answer.py +0 -22
- inquirer_textual-0.4.0/inquirer_textual/common/ChoiceLabel.py +0 -27
- inquirer_textual-0.4.0/inquirer_textual/common/InquirerResult.py +0 -24
- inquirer_textual-0.4.0/inquirer_textual/common/defaults.py +0 -24
- inquirer_textual-0.4.0/inquirer_textual/prompts.py +0 -88
- inquirer_textual-0.4.0/inquirer_textual/version.py +0 -1
- inquirer_textual-0.4.0/inquirer_textual/widgets/InquirerEditor.py +0 -72
- inquirer_textual-0.4.0/inquirer_textual/widgets/InquirerMulti.py +0 -45
- inquirer_textual-0.4.0/inquirer_textual/widgets/InquirerPath.py +0 -95
- inquirer_textual-0.4.0/inquirer_textual/widgets/InquirerPattern.py +0 -175
- inquirer_textual-0.4.0/tests/common/__snapshots__/test_ChoiceLabel/test_snapshot_with_pattern.svg +0 -151
- inquirer_textual-0.4.0/tests/common/__snapshots__/test_ChoiceLabel/test_snapshot_with_pointer.svg +0 -150
- inquirer_textual-0.4.0/tests/common/__snapshots__/test_ChoiceLabel/test_snapshot_without_pointer.svg +0 -150
- inquirer_textual-0.4.0/tests/common/test_ChoiceLabel.py +0 -37
- inquirer_textual-0.4.0/tests/widgets/__init__.py +0 -0
- inquirer_textual-0.4.0/tests/widgets/__snapshots__/test_InquirerEditor/test_snapshot.svg +0 -152
- inquirer_textual-0.4.0/tests/widgets/__snapshots__/test_InquirerMulti/test_snapshot_fifth_input.svg +0 -152
- inquirer_textual-0.4.0/tests/widgets/__snapshots__/test_InquirerMulti/test_snapshot_fifth_input_pick_default.svg +0 -153
- inquirer_textual-0.4.0/tests/widgets/__snapshots__/test_InquirerMulti/test_snapshot_fourth_input.svg +0 -152
- inquirer_textual-0.4.0/tests/widgets/__snapshots__/test_InquirerMulti/test_snapshot_second_input.svg +0 -153
- inquirer_textual-0.4.0/tests/widgets/__snapshots__/test_InquirerMulti/test_snapshot_third_input.svg +0 -153
- inquirer_textual-0.4.0/tests/widgets/__snapshots__/test_InquirerPath/test_snapshot_with_default_value.svg +0 -154
- inquirer_textual-0.4.0/tests/widgets/__snapshots__/test_InquirerPath/test_validation_failure.svg +0 -154
- inquirer_textual-0.4.0/tests/widgets/__snapshots__/test_InquirerPattern/test_snapshot_pattern_search.svg +0 -155
- inquirer_textual-0.4.0/tests/widgets/__snapshots__/test_InquirerPattern/test_snapshot_select.svg +0 -152
- inquirer_textual-0.4.0/tests/widgets/__snapshots__/test_InquirerSelect/test_snapshot_not_mandatory.svg +0 -152
- inquirer_textual-0.4.0/tests/widgets/__snapshots__/test_InquirerSelect/test_snapshot_select.svg +0 -152
- inquirer_textual-0.4.0/tests/widgets/test_InquirerCheckbox.py +0 -62
- inquirer_textual-0.4.0/tests/widgets/test_InquirerEditor.py +0 -23
- inquirer_textual-0.4.0/tests/widgets/test_InquirerExternal.py +0 -35
- inquirer_textual-0.4.0/tests/widgets/test_InquirerNumber.py +0 -23
- inquirer_textual-0.4.0/tests/widgets/test_InquirerPath.py +0 -44
- inquirer_textual-0.4.0/tests/widgets/test_InquirerPattern.py +0 -63
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/.capm.yml +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/.github/dependabot.yml +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/.github/workflows/code-analysis.yml +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/.github/workflows/documentation.yml +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/.github/workflows/main.yml +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/.gitignore +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/CHANGELOG.md +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/LICENSE +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/docs/assets/favicon.ico +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/docs/assets/logo-light.png +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/docs/examples/apps/app.gif +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/docs/examples/apps/app.md +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/docs/examples/apps/app.tape +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/docs/examples/prompts/checkbox.md +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/docs/examples/prompts/checkbox.tape +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/docs/examples/prompts/confirm.gif +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/docs/examples/prompts/confirm.md +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/docs/examples/prompts/confirm.tape +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/docs/examples/prompts/multi.gif +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/docs/examples/prompts/multi.md +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/docs/examples/prompts/multi.tape +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/docs/examples/prompts/number.gif +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/docs/examples/prompts/number.md +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/docs/examples/prompts/number.tape +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/docs/examples/prompts/secret.gif +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/docs/examples/prompts/secret.md +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/docs/examples/prompts/secret.tape +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/docs/examples/prompts/select.gif +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/docs/examples/prompts/select.md +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/docs/examples/prompts/select.tape +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/docs/examples/prompts/text.gif +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/docs/examples/prompts/text.md +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/docs/examples/prompts/text.tape +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/docs/reference/checkbox.md +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/docs/reference/confirm.md +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/docs/reference/multi.md +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/docs/reference/number.md +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/docs/reference/secret.md +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/docs/reference/select.md +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/docs/reference/text.md +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/examples/app.py +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/examples/app_header.py +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/examples/app_shortcuts.py +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/examples/prompt_confirm.py +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/examples/validator.py +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/inquirer_textual/__init__.py +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/inquirer_textual/common/ChoiceCheckboxLabel.py +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/inquirer_textual/common/InquirerHeader.py +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/inquirer_textual/common/Shortcut.py +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/inquirer_textual/common/__init__.py +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/inquirer_textual/widgets/__init__.py +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/tests/__init__.py +0 -0
- {inquirer_textual-0.4.0/tests/common → inquirer_textual-1.0.0/tests/widgets}/__init__.py +0 -0
- /inquirer_textual-0.4.0/tests/widgets/__snapshots__/test_InquirerCheckbox/test_snapshot_select_items.svg → /inquirer_textual-1.0.0/tests/widgets/__snapshots__/test_InquirerCheckbox/test_snapshot.svg +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/tests/widgets/__snapshots__/test_InquirerConfirm/test_snapshot.svg +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/tests/widgets/__snapshots__/test_InquirerConfirm/test_snapshot_custom_chars.svg +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/tests/widgets/__snapshots__/test_InquirerConfirm/test_snapshot_default_yes.svg +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/tests/widgets/__snapshots__/test_InquirerSelect/test_snapshot_fullscreen.svg +0 -0
- {inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/tests/widgets/__snapshots__/test_InquirerSelect/test_snapshot_mandatory.svg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: inquirer-textual
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.0
|
|
4
4
|
Summary: Inquirer based on Textual
|
|
5
5
|
Project-URL: Changelog, https://github.com/robvanderleek/inquirer-textual/blob/master/CHANGELOG.md
|
|
6
6
|
Project-URL: Documentation, https://robvanderleek.github.io/inquirer-textual/
|
|
@@ -9,9 +9,7 @@ Author-email: Rob van der Leek <robvanderleek@gmail.com>
|
|
|
9
9
|
License-Expression: GPL-3.0-or-later
|
|
10
10
|
License-File: LICENSE
|
|
11
11
|
Requires-Python: <3.15,>=3.9
|
|
12
|
-
Requires-Dist: textual>=7.1
|
|
13
|
-
Provides-Extra: examples
|
|
14
|
-
Requires-Dist: textual-slider>=0.2.0; extra == 'examples'
|
|
12
|
+
Requires-Dist: textual>=6.7.1
|
|
15
13
|
Description-Content-Type: text/markdown
|
|
16
14
|
|
|
17
15
|
# Inquirer-Textual
|
|
@@ -38,20 +36,11 @@ Description-Content-Type: text/markdown
|
|
|
38
36
|
|
|
39
37
|
All terminal programs start small. Some stay small, and some become incredibly
|
|
40
38
|
big. The goal of this Python library is to make user input simple for small
|
|
41
|
-
programs,
|
|
39
|
+
programs, but also support a smooth transition to a comprehensive UI library as
|
|
42
40
|
your program grows.
|
|
43
41
|
|
|
44
42
|
Read the [documentation here](https://robvanderleek.github.io/inquirer-textual/)
|
|
45
43
|
|
|
46
|
-
## Installation
|
|
47
|
-
|
|
48
|
-
Create and activate a virtual environment (for example with
|
|
49
|
-
[uv](https://docs.astral.sh/uv/)), and then install this package:
|
|
50
|
-
|
|
51
|
-
```shell
|
|
52
|
-
pip install inquirer-textual
|
|
53
|
-
```
|
|
54
|
-
|
|
55
44
|
## Development
|
|
56
45
|
|
|
57
46
|
Add this library as an editable local dependency to another project using `uv`:
|
|
@@ -59,31 +48,3 @@ Add this library as an editable local dependency to another project using `uv`:
|
|
|
59
48
|
```shell
|
|
60
49
|
uv add --editable <path-to-inquirer-textual>
|
|
61
50
|
```
|
|
62
|
-
|
|
63
|
-
### Textual console
|
|
64
|
-
|
|
65
|
-
1. Open the Textual Development Console:
|
|
66
|
-
|
|
67
|
-
```shell
|
|
68
|
-
uv run textual console
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
2. Run application in development mode:
|
|
72
|
-
|
|
73
|
-
```shell
|
|
74
|
-
uv run textual run --dev examples/prompt_pattern.py
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
### Static documentation
|
|
78
|
-
|
|
79
|
-
Generating the static documentation:
|
|
80
|
-
|
|
81
|
-
```shell
|
|
82
|
-
uv run mkdocs build
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
Viewing the static documentation:
|
|
86
|
-
|
|
87
|
-
```shell
|
|
88
|
-
uv run mkdocs serve
|
|
89
|
-
```
|
|
@@ -22,20 +22,11 @@
|
|
|
22
22
|
|
|
23
23
|
All terminal programs start small. Some stay small, and some become incredibly
|
|
24
24
|
big. The goal of this Python library is to make user input simple for small
|
|
25
|
-
programs,
|
|
25
|
+
programs, but also support a smooth transition to a comprehensive UI library as
|
|
26
26
|
your program grows.
|
|
27
27
|
|
|
28
28
|
Read the [documentation here](https://robvanderleek.github.io/inquirer-textual/)
|
|
29
29
|
|
|
30
|
-
## Installation
|
|
31
|
-
|
|
32
|
-
Create and activate a virtual environment (for example with
|
|
33
|
-
[uv](https://docs.astral.sh/uv/)), and then install this package:
|
|
34
|
-
|
|
35
|
-
```shell
|
|
36
|
-
pip install inquirer-textual
|
|
37
|
-
```
|
|
38
|
-
|
|
39
30
|
## Development
|
|
40
31
|
|
|
41
32
|
Add this library as an editable local dependency to another project using `uv`:
|
|
@@ -43,31 +34,3 @@ Add this library as an editable local dependency to another project using `uv`:
|
|
|
43
34
|
```shell
|
|
44
35
|
uv add --editable <path-to-inquirer-textual>
|
|
45
36
|
```
|
|
46
|
-
|
|
47
|
-
### Textual console
|
|
48
|
-
|
|
49
|
-
1. Open the Textual Development Console:
|
|
50
|
-
|
|
51
|
-
```shell
|
|
52
|
-
uv run textual console
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
2. Run application in development mode:
|
|
56
|
-
|
|
57
|
-
```shell
|
|
58
|
-
uv run textual run --dev examples/prompt_pattern.py
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
### Static documentation
|
|
62
|
-
|
|
63
|
-
Generating the static documentation:
|
|
64
|
-
|
|
65
|
-
```shell
|
|
66
|
-
uv run mkdocs build
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
Viewing the static documentation:
|
|
70
|
-
|
|
71
|
-
```shell
|
|
72
|
-
uv run mkdocs serve
|
|
73
|
-
```
|
|
Binary file
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
</a>
|
|
22
22
|
</div>
|
|
23
23
|
|
|
24
|
-
##
|
|
24
|
+
## About
|
|
25
25
|
|
|
26
26
|
All terminal programs start small. Some stay small, and some become incredibly
|
|
27
27
|
big. The goal of this Python library is to make user input simple for small
|
|
28
|
-
programs,
|
|
28
|
+
programs, but also support a smooth transition to a comprehensive UI library as
|
|
29
29
|
your program grows.
|
|
30
30
|
|
|
31
31
|
This library is based on the sophisticated
|
|
@@ -47,15 +47,6 @@ With `uv` you can run the example out of the box:
|
|
|
47
47
|
uv run --with inquirer-textual checkbox.py
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
## Installation
|
|
51
|
-
|
|
52
|
-
Create and activate a virtual environment (for example with
|
|
53
|
-
[uv](https://docs.astral.sh/uv/)), and then install this package:
|
|
54
|
-
|
|
55
|
-
```shell
|
|
56
|
-
pip install inquirer-textual
|
|
57
|
-
```
|
|
58
|
-
|
|
59
50
|
## Key features and design principles
|
|
60
51
|
|
|
61
52
|
* **Keep simple things simple**: High-level prompts API for getting user input
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
from inquirer_textual import prompts
|
|
2
2
|
|
|
3
3
|
if __name__ == '__main__':
|
|
4
|
-
|
|
5
|
-
'Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn',
|
|
4
|
+
answer = prompts.checkbox("Planets:", choices=[
|
|
5
|
+
'Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn',
|
|
6
|
+
'Uranus', 'Neptune'
|
|
6
7
|
])
|
|
7
|
-
print(
|
|
8
|
+
print(answer)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from inquirer_textual import prompts
|
|
2
|
+
from inquirer_textual.widgets.InquirerCheckbox import InquirerCheckbox
|
|
3
|
+
from inquirer_textual.widgets.InquirerConfirm import InquirerConfirm
|
|
4
|
+
from inquirer_textual.widgets.InquirerNumber import InquirerNumber
|
|
5
|
+
from inquirer_textual.widgets.InquirerSecret import InquirerSecret
|
|
6
|
+
from inquirer_textual.widgets.InquirerText import InquirerText
|
|
7
|
+
from inquirer_textual.widgets.InquirerSelect import InquirerSelect
|
|
8
|
+
|
|
9
|
+
if __name__ == '__main__':
|
|
10
|
+
text_widget = InquirerText('Name:')
|
|
11
|
+
password_widget = InquirerSecret('Password:')
|
|
12
|
+
number_widget = InquirerNumber('Memory:')
|
|
13
|
+
confirm_widget = InquirerConfirm('Proceed?')
|
|
14
|
+
select_widget = InquirerSelect('Planet?', ['Earth', 'Mars', 'Venus'], default='Mars')
|
|
15
|
+
checkbox_widget = InquirerCheckbox("People?", choices=['Alice', 'Bob', 'Charlie'])
|
|
16
|
+
answer = prompts.multi(
|
|
17
|
+
[text_widget, password_widget, number_widget, confirm_widget, select_widget, checkbox_widget])
|
|
18
|
+
print(answer)
|
|
@@ -10,19 +10,22 @@ from textual.binding import Binding, BindingsMap
|
|
|
10
10
|
from textual.widgets import Footer
|
|
11
11
|
|
|
12
12
|
from inquirer_textual.common.InquirerHeader import InquirerHeader
|
|
13
|
-
from inquirer_textual.common.
|
|
13
|
+
from inquirer_textual.common.Result import Result
|
|
14
14
|
from inquirer_textual.common.Shortcut import Shortcut
|
|
15
|
-
from inquirer_textual.common.defaults import DEFAULT_THEME
|
|
16
15
|
from inquirer_textual.widgets.InquirerWidget import InquirerWidget
|
|
17
16
|
|
|
18
17
|
T = TypeVar('T')
|
|
19
18
|
|
|
20
19
|
|
|
21
|
-
class InquirerApp(App[
|
|
20
|
+
class InquirerApp(App[Result[T]], inherit_bindings=False): # type: ignore[call-arg]
|
|
22
21
|
CSS = """
|
|
22
|
+
App {
|
|
23
|
+
background: black;
|
|
24
|
+
}
|
|
23
25
|
Screen {
|
|
24
26
|
border-top: none;
|
|
25
27
|
border-bottom: none;
|
|
28
|
+
background: transparent;
|
|
26
29
|
height: auto;
|
|
27
30
|
}
|
|
28
31
|
"""
|
|
@@ -32,21 +35,18 @@ class InquirerApp(App[InquirerResult[T]], inherit_bindings=False): # type: igno
|
|
|
32
35
|
Binding("ctrl+d", "quit", "Quit", show=False, priority=True)
|
|
33
36
|
]
|
|
34
37
|
|
|
35
|
-
def __init__(self
|
|
36
|
-
self._theme = theme
|
|
38
|
+
def __init__(self) -> None:
|
|
37
39
|
self.widget: InquirerWidget | None = None
|
|
38
40
|
self.shortcuts: list[Shortcut] | None = None
|
|
39
41
|
self.header: str | list[str] | None = None
|
|
40
42
|
self.show_footer: bool = False
|
|
41
|
-
self.result:
|
|
43
|
+
self.result: Result[T] | None = None
|
|
42
44
|
self.result_ready: Event | None = None
|
|
43
45
|
self.inquiry_func: Callable[[InquirerApp[T]], None] | None = None
|
|
44
46
|
self.inquiry_func_stop: bool = False
|
|
45
47
|
super().__init__()
|
|
46
48
|
|
|
47
49
|
def on_mount(self) -> None:
|
|
48
|
-
self.register_theme(DEFAULT_THEME)
|
|
49
|
-
self.theme = self._theme
|
|
50
50
|
self._update_bindings()
|
|
51
51
|
if self.inquiry_func:
|
|
52
52
|
self.run_worker(self.inquiry_func_worker, thread=True)
|
|
@@ -63,24 +63,21 @@ class InquirerApp(App[InquirerResult[T]], inherit_bindings=False): # type: igno
|
|
|
63
63
|
if self.inquiry_func:
|
|
64
64
|
self.inquiry_func(self)
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
def action_shortcut(self, command: str):
|
|
67
67
|
value = self.widget.current_value() if self.widget else None
|
|
68
|
-
|
|
68
|
+
self._handle_result(command, value)
|
|
69
69
|
|
|
70
70
|
async def action_quit(self):
|
|
71
|
-
|
|
71
|
+
self._handle_result('quit', None)
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
def on_inquirer_widget_submit(self, event: InquirerWidget.Submit) -> None:
|
|
74
|
+
self._handle_result(event.command, event.value)
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
def _handle_result(self, command: str | None, value: Any | None):
|
|
77
77
|
if self.result_ready is not None:
|
|
78
|
-
self.result =
|
|
79
|
-
command)
|
|
78
|
+
self.result = Result(command, value) # type: ignore[arg-type]
|
|
80
79
|
self.result_ready.set()
|
|
81
80
|
else:
|
|
82
|
-
if self.widget:
|
|
83
|
-
await self.widget.set_selected_value(value)
|
|
84
81
|
self.call_after_refresh(lambda: self._terminate(command, value))
|
|
85
82
|
|
|
86
83
|
def _terminate(self, command: str | None = None, value: Any | None = None):
|
|
@@ -88,9 +85,9 @@ class InquirerApp(App[InquirerResult[T]], inherit_bindings=False): # type: igno
|
|
|
88
85
|
if self.result_ready:
|
|
89
86
|
self.result_ready.set()
|
|
90
87
|
if command is not None:
|
|
91
|
-
self.app.exit(
|
|
88
|
+
self.app.exit(Result(command, value))
|
|
92
89
|
else:
|
|
93
|
-
self.exit(
|
|
90
|
+
self.exit(value)
|
|
94
91
|
|
|
95
92
|
def compose(self) -> ComposeResult:
|
|
96
93
|
if self.header is not None:
|
|
@@ -105,7 +102,7 @@ class InquirerApp(App[InquirerResult[T]], inherit_bindings=False): # type: igno
|
|
|
105
102
|
if self.widget:
|
|
106
103
|
self.call_after_refresh(self.widget.focus)
|
|
107
104
|
|
|
108
|
-
def prompt(self, widget: InquirerWidget, shortcuts: list[Shortcut] | None = None) ->
|
|
105
|
+
def prompt(self, widget: InquirerWidget, shortcuts: list[Shortcut] | None = None) -> Result[T]:
|
|
109
106
|
if shortcuts:
|
|
110
107
|
self.shortcuts = shortcuts
|
|
111
108
|
self.show_footer = True
|
|
@@ -138,7 +135,7 @@ class InquirerApp(App[InquirerResult[T]], inherit_bindings=False): # type: igno
|
|
|
138
135
|
auto_pilot: AutopilotCallbackType | None = None,
|
|
139
136
|
loop: AbstractEventLoop | None = None,
|
|
140
137
|
inquiry_func: Callable[[InquirerApp[T]], None] | None = None,
|
|
141
|
-
) ->
|
|
138
|
+
) -> Result[T]:
|
|
142
139
|
if not self.inquiry_func:
|
|
143
140
|
self.inquiry_func = inquiry_func
|
|
144
141
|
return super().run(
|
|
@@ -153,6 +150,7 @@ class InquirerApp(App[InquirerResult[T]], inherit_bindings=False): # type: igno
|
|
|
153
150
|
|
|
154
151
|
def get_theme_variable_defaults(self) -> dict[str, str]:
|
|
155
152
|
return {
|
|
156
|
-
'
|
|
157
|
-
'
|
|
153
|
+
'select-question-mark': '#e5c07b',
|
|
154
|
+
'select-list-item-highlight-foreground': '#61afef',
|
|
155
|
+
'input-color': '#98c379'
|
|
158
156
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from textual.widgets import Label
|
|
4
|
+
|
|
5
|
+
from inquirer_textual.common.Choice import Choice
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ChoiceLabel(Label):
|
|
9
|
+
def __init__(self, item: str | Choice):
|
|
10
|
+
super().__init__(f' {item if isinstance(item, str) else item.name}')
|
|
11
|
+
self._text = item if isinstance(item, str) else item.name
|
|
12
|
+
self.item = item
|
|
13
|
+
|
|
14
|
+
def add_pointer(self):
|
|
15
|
+
self.update(f'\u276f {self._text}')
|
|
16
|
+
|
|
17
|
+
def remove_pointer(self):
|
|
18
|
+
self.update(f' {self._text}')
|
|
@@ -4,9 +4,9 @@ from textual.widget import Widget
|
|
|
4
4
|
from textual.widgets import Static, Label
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
class
|
|
7
|
+
class PromptMessage(Widget):
|
|
8
8
|
DEFAULT_CSS = """
|
|
9
|
-
|
|
9
|
+
PromptMessage {
|
|
10
10
|
width: auto;
|
|
11
11
|
height: auto;
|
|
12
12
|
}
|
|
@@ -16,7 +16,7 @@ class Prompt(Widget):
|
|
|
16
16
|
}
|
|
17
17
|
#prompt-message-question-mark {
|
|
18
18
|
width: auto;
|
|
19
|
-
color: $
|
|
19
|
+
color: $select-question-mark;
|
|
20
20
|
}
|
|
21
21
|
"""
|
|
22
22
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import TypeVar, Generic
|
|
5
|
+
|
|
6
|
+
T = TypeVar('T')
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@dataclass
|
|
10
|
+
class Result(Generic[T]):
|
|
11
|
+
command: str | None
|
|
12
|
+
value: T
|
|
13
|
+
|
|
14
|
+
def __str__(self):
|
|
15
|
+
return str(self.value)
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
from typing import Any, Iterable
|
|
2
|
+
|
|
3
|
+
from textual.validation import Validator
|
|
4
|
+
|
|
5
|
+
from inquirer_textual.InquirerApp import InquirerApp
|
|
6
|
+
from inquirer_textual.common.Choice import Choice
|
|
7
|
+
from inquirer_textual.common.Result import Result
|
|
8
|
+
from inquirer_textual.common.Shortcut import Shortcut
|
|
9
|
+
from inquirer_textual.widgets.InquirerCheckbox import InquirerCheckbox
|
|
10
|
+
from inquirer_textual.widgets.InquirerConfirm import InquirerConfirm
|
|
11
|
+
from inquirer_textual.widgets.InquirerMulti import InquirerMulti
|
|
12
|
+
from inquirer_textual.widgets.InquirerNumber import InquirerNumber
|
|
13
|
+
from inquirer_textual.widgets.InquirerSecret import InquirerSecret
|
|
14
|
+
from inquirer_textual.widgets.InquirerSelect import InquirerSelect
|
|
15
|
+
from inquirer_textual.widgets.InquirerText import InquirerText
|
|
16
|
+
from inquirer_textual.widgets.InquirerWidget import InquirerWidget
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def text(message: str, shortcuts: list[Shortcut] | None = None,
|
|
20
|
+
validators: Validator | Iterable[Validator] | None = None) -> Result[str]:
|
|
21
|
+
app: InquirerApp[str] = InquirerApp()
|
|
22
|
+
app.widget = InquirerText(message, validators=validators)
|
|
23
|
+
app.shortcuts = shortcuts
|
|
24
|
+
app.show_footer = bool(shortcuts)
|
|
25
|
+
return app.run(inline=True)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def secret(message: str, shortcuts: list[Shortcut] | None = None) -> Result[str]:
|
|
29
|
+
app: InquirerApp[str] = InquirerApp()
|
|
30
|
+
app.widget = InquirerSecret(message)
|
|
31
|
+
app.shortcuts = shortcuts
|
|
32
|
+
app.show_footer = bool(shortcuts)
|
|
33
|
+
return app.run(inline=True)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def number(message: str, shortcuts: list[Shortcut] | None = None) -> Result[int]:
|
|
37
|
+
app: InquirerApp[int] = InquirerApp()
|
|
38
|
+
app.widget = InquirerNumber(message)
|
|
39
|
+
app.shortcuts = shortcuts
|
|
40
|
+
app.show_footer = bool(shortcuts)
|
|
41
|
+
return app.run(inline=True)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def confirm(message: str, shortcuts: list[Shortcut] | None = None, default: bool = False, mandatory: bool = True) -> \
|
|
45
|
+
Result[bool]:
|
|
46
|
+
app: InquirerApp[bool] = InquirerApp()
|
|
47
|
+
app.widget = InquirerConfirm(message, default=default, mandatory=mandatory)
|
|
48
|
+
app.shortcuts = shortcuts
|
|
49
|
+
app.show_footer = bool(shortcuts)
|
|
50
|
+
return app.run(inline=True)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def select(message: str, choices: list[str | Choice], shortcuts: list[Shortcut] | None = None,
|
|
54
|
+
default: str | Choice | None = None, mandatory: bool = True) -> Result[str | Choice]:
|
|
55
|
+
app: InquirerApp[str | Choice] = InquirerApp()
|
|
56
|
+
app.widget = InquirerSelect(message, choices, default, mandatory)
|
|
57
|
+
app.shortcuts = shortcuts
|
|
58
|
+
app.show_footer = bool(shortcuts)
|
|
59
|
+
return app.run(inline=True)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def checkbox(message: str, choices: list[str | Choice], shortcuts: list[Shortcut] | None = None,
|
|
63
|
+
enabled: list[str | Choice] | None = None) -> Result[list[str | Choice]]:
|
|
64
|
+
app: InquirerApp[list[str | Choice]] = InquirerApp()
|
|
65
|
+
app.widget = InquirerCheckbox(message, choices, enabled)
|
|
66
|
+
app.shortcuts = shortcuts
|
|
67
|
+
app.show_footer = bool(shortcuts)
|
|
68
|
+
return app.run(inline=True)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def multi(widgets: list[InquirerWidget], shortcuts: list[Shortcut] | None = None) -> Result[list[Any]]:
|
|
72
|
+
app: InquirerApp[list[Any]] = InquirerApp()
|
|
73
|
+
app.widget = InquirerMulti(widgets)
|
|
74
|
+
app.shortcuts = shortcuts
|
|
75
|
+
app.show_footer = bool(shortcuts)
|
|
76
|
+
return app.run(inline=True)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
version = "1.0.0"
|
{inquirer_textual-0.4.0 → inquirer_textual-1.0.0}/inquirer_textual/widgets/InquirerCheckbox.py
RENAMED
|
@@ -1,43 +1,46 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
from textual.app import ComposeResult
|
|
4
|
-
from textual.containers import VerticalGroup
|
|
4
|
+
from textual.containers import VerticalGroup
|
|
5
5
|
from textual.widgets import ListItem, ListView
|
|
6
6
|
from typing_extensions import Self
|
|
7
7
|
|
|
8
|
-
from inquirer_textual.common.Answer import Answer
|
|
9
8
|
from inquirer_textual.common.Choice import Choice
|
|
10
9
|
from inquirer_textual.common.ChoiceCheckboxLabel import ChoiceCheckboxLabel
|
|
11
|
-
from inquirer_textual.common.
|
|
10
|
+
from inquirer_textual.common.PromptMessage import PromptMessage
|
|
12
11
|
from inquirer_textual.widgets.InquirerWidget import InquirerWidget
|
|
13
12
|
|
|
14
13
|
|
|
15
14
|
class InquirerCheckbox(InquirerWidget):
|
|
16
15
|
"""A checkbox widget that allows multiple selections from a list of choices."""
|
|
17
16
|
|
|
17
|
+
DEFAULT_CSS = """
|
|
18
|
+
#inquirer-checkbox-list-view {
|
|
19
|
+
background: transparent;
|
|
20
|
+
}
|
|
21
|
+
#inquirer-checkbox-list-view ListItem.-highlight {
|
|
22
|
+
color: $select-list-item-highlight-foreground;
|
|
23
|
+
background: transparent;
|
|
24
|
+
}
|
|
25
|
+
"""
|
|
18
26
|
BINDINGS = [
|
|
19
27
|
("space", "toggle_selected", "Toggle selection"),
|
|
20
28
|
]
|
|
21
29
|
|
|
22
|
-
def __init__(self, message: str, choices: list[str | Choice],
|
|
23
|
-
enabled: list[str | Choice] | None = None, mandatory: bool = False):
|
|
30
|
+
def __init__(self, message: str, choices: list[str | Choice], enabled: list[str | Choice] | None = None):
|
|
24
31
|
"""
|
|
25
32
|
Args:
|
|
26
33
|
message (str): The prompt message to display.
|
|
27
34
|
choices (list[str | Choice]): A list of choices to present to the user.
|
|
28
|
-
name (str | None): The name of the input field.
|
|
29
35
|
enabled (list[str | Choice] | None): A list of choices that should be pre-selected.
|
|
30
|
-
mandatory (bool): Whether at least one selection is mandatory.
|
|
31
36
|
"""
|
|
32
|
-
super().__init__(
|
|
37
|
+
super().__init__()
|
|
33
38
|
self.message = message
|
|
34
39
|
self.choices = choices
|
|
35
40
|
self.enabled = enabled
|
|
36
41
|
self.list_view: ListView | None = None
|
|
37
42
|
self.selected_label: ChoiceCheckboxLabel | None = None
|
|
38
43
|
self.selected_item: str | Choice | None = None
|
|
39
|
-
self.selected_value: list[str | Choice] | None = None
|
|
40
|
-
self.show_selected_value: bool = False
|
|
41
44
|
|
|
42
45
|
def on_mount(self):
|
|
43
46
|
self.styles.height = min(10, len(self.choices) + 1)
|
|
@@ -52,7 +55,7 @@ class InquirerCheckbox(InquirerWidget):
|
|
|
52
55
|
self.selected_item = label.item
|
|
53
56
|
|
|
54
57
|
def on_list_view_selected(self, _: ListView.Selected) -> None:
|
|
55
|
-
self.
|
|
58
|
+
self.post_message(InquirerWidget.Submit(self.current_value()))
|
|
56
59
|
|
|
57
60
|
def focus(self, scroll_visible: bool = True) -> Self:
|
|
58
61
|
if self.list_view:
|
|
@@ -64,23 +67,12 @@ class InquirerCheckbox(InquirerWidget):
|
|
|
64
67
|
labels = self.query(ChoiceCheckboxLabel)
|
|
65
68
|
return [label.item for label in labels if label.checked]
|
|
66
69
|
|
|
67
|
-
async def set_selected_value(self, value: list[str | Choice]) -> None:
|
|
68
|
-
self.selected_value = value
|
|
69
|
-
self.styles.height = 1
|
|
70
|
-
self.show_selected_value = True
|
|
71
|
-
await self.recompose()
|
|
72
|
-
|
|
73
70
|
def compose(self) -> ComposeResult:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
list_item = ListItem(ChoiceCheckboxLabel(choice))
|
|
83
|
-
items.append(list_item)
|
|
84
|
-
self.list_view = ListView(*items, id='inquirer-checkbox-list-view')
|
|
85
|
-
yield Prompt(self.message)
|
|
86
|
-
yield self.list_view
|
|
71
|
+
with VerticalGroup():
|
|
72
|
+
items: list[ListItem] = []
|
|
73
|
+
for idx, choice in enumerate(self.choices):
|
|
74
|
+
list_item = ListItem(ChoiceCheckboxLabel(choice))
|
|
75
|
+
items.append(list_item)
|
|
76
|
+
self.list_view = ListView(*items, id='inquirer-checkbox-list-view')
|
|
77
|
+
yield PromptMessage(self.message)
|
|
78
|
+
yield self.list_view
|