Sebastian Lohff
12552d8e5b
Use right arrow to select/deselect in CliMultiMenu
...
For a menu where we only select one option right arrow is an okay-choice
for accept, but with multiple option selection toggling feels more
natural.
4 years ago
Sebastian Lohff
d01024d1be
Add initial_pos to choose initially selected item
4 years ago
Sebastian Lohff
3e3ea53f5e
Remove dead code
4 years ago
Sebastian Lohff
c363c187bd
Remove unused methods and unused arguments
4 years ago
Sebastian Lohff
94bb03dc07
Don't ignore cursor/style/icon if it is not None
...
To allow the user to set '' as a cursor we need to distinguish between
'' and None, same for select icons and styles.
4 years ago
Sebastian Lohff
4ba22a3a33
Make setup.cfg release ready, move to GitHub
4 years ago
Sebastian Lohff
34a3279e2f
Improve README.md a tiny bit
4 years ago
Sebastian Lohff
f20b5eac89
Add more examples
4 years ago
Sebastian Lohff
9b833db364
Check type of options passed to __init__
4 years ago
Sebastian Lohff
c74e3d68d6
Implement multiple selections with CliMultiMenu
...
CliMultiMenu works much in the same way as CliMenu but it allows for
selecting multiple items.
4 years ago
Sebastian Lohff
46a863b3cf
Remove broken space keyboard binding for accept
...
Originally space was thought out to also accept the selection, but only
a broken binding was added. As we want to use space for selections in
the future we now remove it entirely.
4 years ago
Sebastian Lohff
a28c76e001
Allow a default theme and cursor to be set
4 years ago
Sebastian Lohff
45d3395642
Rename add_header() to add_text()
...
add_header() does not necessarily add a header, it might be just text.
4 years ago
Sebastian Lohff
a17f7693e9
Renamed CLI_* cursors to ASCII_* cursors
4 years ago
Sebastian Lohff
648d5c956e
Use option text as title if no value is given
...
If the user only supplys a text for the option we used to return None as
item value. Now we return the text, so the user can easily get the value
back if they want to process it further and not only work with the given
option index (or supply the item twice).
4 years ago
Sebastian Lohff
8c6ee790bf
Fix get_options() and num_options to work on options
...
get_options() and num_options used to work on all menu items, including
blank spaces and headers. Now these work only on options, as they were
originally intended
4 years ago
Sebastian Lohff
9fe596bc01
Add option to return instantly on single item in cli_select_item()
...
cli_select_item() allows to quickly launch a menu from code, but if only
a single item is given a selection is not necessary in most cases.
Therefore we now instantly return the given value in these cases. This
can be turned off by setting return_single=False
4 years ago
Sebastian Lohff
d926606976
Add shortcut function to quickly get a selection result
...
cli_select_item() will instanciate a CliMenu and return a selection. If
the selection is aborted an exception of the given class will be thrown.
4 years ago
Sebastian Lohff
3d1d2d5acd
Add theme example
5 years ago
Sebastian Lohff
58d6170a5c
Add bold highlight style to defaults
5 years ago
Sebastian Lohff
206dcc46df
Correct typo in var name
5 years ago
Sebastian Lohff
58455be58a
Add methods to get all available menu options
5 years ago
Sebastian Lohff
f0e5b7bb58
Implement searching for menu items
...
This uses prompt-toolkit's builtin search functionality to search
through the buffer representing the menu, allowing the user
to navigate faster through the entries
5 years ago
Sebastian Lohff
ec07ebe536
Sort imports
5 years ago
Sebastian Lohff
6a128e13a6
Header indentation and tuple options for constructor
5 years ago
Sebastian Lohff
2f2049bfef
Add k/j as up/down keys
5 years ago
Sebastian Lohff
0517b4d996
Return no selection if the user aborted selection
...
Also expose success state
5 years ago
Sebastian Lohff
ad3fd751cc
Move cursor along with selection for scrolling
5 years ago
Sebastian Lohff
e0177d0e10
Fix inline header indentation
5 years ago
Sebastian Lohff
b18372e3b8
Allow passing an item to each option
5 years ago
Sebastian Lohff
6655fd097a
Add two simple examples
5 years ago
Sebastian Lohff
bd31b70e44
Initial commit
5 years ago