A WIP procedurally generated TUI made in NCurses using Python for CCSM
Project description
Curses UI
An easy-to-use procedurally-generated widget system for curses in Python.
item format:
item format is the main format used by the majority of widgets in this system.
definitions
An "arg," from here on out, is a key-value pair, from within a dictionary, that is itself a value of a key-value pair from within the dictionary passed to dict_ui
A sub arg is an arg that is only passed with a certain functionality
global args
These arguments will be on every item listed here, optionally unless otherwise specified.
functionality: strrequired - the functionality of the item, valid values will be covered later. The program will most likely panic if this is ever not specifieddescription: str- a description of the optionalways_show_description: bool- whether or not to always show the description of the item, if set toFalse, the description will only be shown while the item is selected.exit_after_action- exits the current menu after the option is selected and its functionality is performed. Can be used with thenonefunctionality to implement an exit button.
dict_ui
Arguments:
base_window: curses.window- a curses windowdictionary: dict[str, dict]- a dictionary with values of dicts in item format. This is what the UI is generated from.item_display: Callable[[tuple[str, dict], bool], tuple[str, int]]- an optional keyword argument that allows users to overwrite the way items are listed
functionalities
-
noneDoes nothing. Will not inhibit functionality of global args. -
run_functionRuns a function with arbitrary argumentsSub Args:
function: Callable[[Unknown], None]- a reference to the function to runargs: list- a list of positional arguments to pass to the functionkwargs: dict[str, Unknown]- a dictionary of keyword arguments to pass to the function
-
editOpens the editor widgetSub Args:
value: str- the value assigned before editing - this gets overwritten after a successful editvalidator: Callable[[str], bool]- a reference to a function. The input is the entire submitted string, and the output will determine whether or not it will get accepted. If it does not get accepted, the input box will be reset to the previous value, and the user will be prompted to input again. This will repeat until the uset inputs a valid value.allowed_human_readable: str- a string that gets printed after the name of the value the user is editing. This is intended to instruct users in an understandable fashion what values are valid or invalid.
-
selectOpens the selection widgetsub args:
value: str- the value assigned before editing - this gets overwritten when the user selects a new valueoptions: dict[str, dict]- a dictionary containing dictionaries in item format with theoptionfunctionality
-
optionAn option in a selection menu. Only intended to be used within the selection widget. The key is the value that will be selected. -
sub menuA new instance ofdict_uiwith the input menu dictionarySub Args:
menu: dicta menu dictionary
selection_ui
Arguments:
base_window: curses.window- a curses windowoptions: dict[str, dict]- a dictionary containing dictionaries in item format with theoptionfunctionalityitem_display: Callable[[tuple[str, dict], bool], tuple[str, int]]- an optional keyword argument that allows users to overwrite the way items are listed
editor_ui
base_window: curses.window- a curses windowname: str- the "name" of the value being assigned, ususally analagous to the name of the variable being assigned to. This gets displayed to the uservalue: str- the default value before modificationvalidator: Callable[[str], bool]- a reference to a function. The input is the entire submitted string, and the output will determine whether or not it will get accepted. If it does not get accepted, the input box will be reset to the previous value, and the user will be prompted to input again. This will repeat until the uset inputs a valid value.allowed_human_readable: str- a string that gets printed after the name of the value the user is editing. This is intended to instruct users in an understandable fashion what values are valid or invalid.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ui_forge-1.2.0.tar.gz.
File metadata
- Download URL: ui_forge-1.2.0.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.12.7 Linux/6.10.10-zen1-1-zen
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6fbe07b16d3cbecd1e7bd3a0a05a4bf1081685debc33c0d82c1ff31cf2556ef8
|
|
| MD5 |
66a3a4f125d0cfd596cd894d284562c8
|
|
| BLAKE2b-256 |
53107e95e1b9dd7c555a30fdfbde09bca42a680adec2d51def9dc3f092e7cc94
|
File details
Details for the file ui_forge-1.2.0-py3-none-any.whl.
File metadata
- Download URL: ui_forge-1.2.0-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.12.7 Linux/6.10.10-zen1-1-zen
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7fb30e96204401bfcf05839b753f6eb85fd5365d0e8372a9a825b55330e24c0f
|
|
| MD5 |
9a444e5148c532b54f877e01ecd99060
|
|
| BLAKE2b-256 |
e7af8a25c855142fb1c6daa6e104bc8b6d8a1a2cb14a0ad3040a3f9456b4a4c1
|