An importable, single stage CLI menu package
Project description
Python Command Line Menu Selector (PyCoLiMS)
A command line menu, designed for single stage selection. Displays a given list on screen for user to select, either in single or multi mode. Returns selected item/s to the calling function in the same format as provided.
If given a dictionary, pycolims will return key/s, allowing easy user input to call a dict value
In the case of lists too large to display at once, pycolims breaks the list down into terminal-sized chunks, with a paging system to cycle between the chunks
* It's a series of pointers, not a bunch of new lists. Pycolims tries to stay memory friendly!
Installation
pip install pycolims
Single Selection menu
import pycolims
menu_single = pycolims.Single()
menu_single.run(array_in, header: str="")
A single selection menu will display items on screen and return a single user selected value This can be a single item or one nested list from a given matrix
Multi Selection Menu
import pycolims
menu_multi = pycolims.Multi()
menu_multi.run(array_in, header: str="")
When a multi pycolims is used, the menu returns the entire given array with each item converted to a list, where [0] is a boolean indicating selection
>>> list_with_booleans = menu_multi.run([0, 1, '2'])
# User selects first and last options...
>>> print(list_with_booleans)
[[True, 0], [False, 1], [True, '2']]
Multi pycolims can also parse a given list in similar format to display items 'already selected'
prev_settings = [[True, 'val_one'],
[False, 'val_two']]
Pycolims menu options
Each pycolims menu has a series of commands at the bottom
Single menu options
(-) Prev Page
(+) Next Page
(!!) Break
Multi Menu Options
(-) Prev Page
(+) Next Page
(**) Select All (//) Clear All (><) Flip All (..) Return Selected (!!) Break
(-) Prev Page (+) Next Page
Cycles through available pages
(!!) Break
Easy back out for end user use; throws a Keyboard interrupt error to interrupt code
(**) Select All (//) Clear All
Selects/Clears ALL available items
(><) Flip All
Inverts all item selections
(..) Return Selected
Finishes a multi selection menu and returns items
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 pycolims-0.2.0.tar.gz.
File metadata
- Download URL: pycolims-0.2.0.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f95c5346d16a77ec10cc130f2afd4675210775e8b10be760ee152b4e437ee17
|
|
| MD5 |
54feee61191871d06a56ec3455834bdb
|
|
| BLAKE2b-256 |
82297eedc8248ad4dbebd3707ec97606ee1d58072f8c26e6f50b0c1dc1110688
|
File details
Details for the file pycolims-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pycolims-0.2.0-py3-none-any.whl
- Upload date:
- Size: 14.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f8ac2db74ffb6c8bc668ae743d87e3b45a67caabf8f3c59187ef1e47eed824c
|
|
| MD5 |
876ef98593bb42034c86f4a495da5a9c
|
|
| BLAKE2b-256 |
7d1c99140a0bdbf9fe35aac01037cf65d590bb6cef719fa8efa9f0b30a02b25e
|