summaryrefslogtreecommitdiff
path: root/menuconfig.py
AgeCommit message (Collapse)Author
2018-05-16Record which MenuNode has each propertyUlf Magnusson
This allows accurate documentation to be generated for symbols and choices defined in multiple locations. There are now MenuNode.defaults, MenuNode.selects, etc., lists that mirror the corresponding Symbol/Choice lists. Symbol/Choice.__str__() now correctly show property locations as well, by simply concatenating the strings returned by MenuNode.__str__() for each node. _parse_properties() was modified to add all properties directly to the menu node instead of adding them to the contained symbol or choice. The properties are then copied up to symbols and choices in _finalize_tree(). Dependency propagation is handled at the same time. As a side effect, this cleans up the code a bit and de-bloats _parse_properties(). Update the menuconfig implementation to use the new functionality. It now lists the menu nodes for symbols and choices with the correct properties for each node (previously, all defaults, selects, implies, and ranges appeared on the first definition).
2018-05-14menuconfig: Fix _CONVERT_C_LC_CTYPE_TO_UTF8 commentUlf Magnusson
Was using an older name.
2018-05-13menuconfig: Add Ctrl-W support to edit boxesUlf Magnusson
Works like in readline/Vim.
2018-05-11menuconfig: Style nitUlf Magnusson
2018-05-11menuconfig: Jump-to code nitUlf Magnusson
2018-05-11menucomment: Comment clarity nitUlf Magnusson
2018-05-11menuconfig: Code style nitUlf Magnusson
2018-05-11Fix _search_strings() cacheUlf Magnusson
The cache was broken due to using an old variable name. Piggyback a neat trick for storing globals in default arguments that I had missed until now.
2018-05-11menuconfig: Add prompts to incremental searchUlf Magnusson
Search and display prompts for menu nodes that have them. They often contain useful strings. Add a pre-search pass that generates a string to search/display for each menu node, to allow the search regex(es) to run over a single string. That also makes 'foo bar' match for a symbol that has 'FOO' in its name and 'bar' in its prompt, which is handy. Remove the '(in menu X)' string that was added previously for symbols defined in multiple locations. You'd usually be able to tell which menu node is which from the (lack of) prompt.
2018-05-10menuconfig: Add search with multiple search stringsUlf Magnusson
A search like 'host usb' now finds all symbol names that match both 'host' and 'usb' (as regular expressions), including e.g. USB_MTU3_HOST. This saves typing a bunch of '.*' and makes it easier to find symbols when you aren't sure what order the components appear in.
2018-05-10menuconfig: Refactor resizing after fullscreen dialogsUlf Magnusson
Cleaner to do it in _menuconfig(), as it makes the fullscreen dialogs fully independent. Saves some code too.
2018-05-10menuconfig: Remove confusing menu list commentUlf Magnusson
Might have made it sound like _parent_menu() returns a list.
2018-05-10Style nitsUlf Magnusson
Air some long conditionals out a bit. Be more consistent with format().
2018-05-09menuconfig: Misleading comment nitUlf Magnusson
Can't get { } since {} implies n isn't assignable.
2018-05-09menuconfig: Fix rendering of long prefilled edit box stringUlf Magnusson
The horizontal scroll (hscroll) wasn't initialized properly when the initial (prefilled) contents of an edit box was longer than the edit box itself (e.g. when saving with a long path in KCONFIG_CONFIG). Things snapped back into place once a key was pressed. Initialize hscroll properly to fix the initial rendering.
2018-05-08menuconfig: Convert the C locale to a UTF-8 locale for LC_CTYPEUlf Magnusson
If LC_CTYPE is set to the C locale, try to convert it to a UTF-8 locale. Use a list of commonly available UTF-8 locales. Give up and use the C locale if none of them are available. This fixes curses Unicode I/O issues on systems with bad defaults: ncurses configures itself from the locale settings, and the C locale implies ASCII. The logic mirrors https://www.python.org/dev/peps/pep-0538/. I took the list of locales to try from the CPython code (in Python/pylifecycle.c).
2018-05-08Increase indent for implicit submenus to 4Ulf Magnusson
Makes it easier to see the menu structure. Make the indent configurable via a _SUBMENU_INDENT configuration variable.
2018-05-07menuconfig: Add incremental regex search and jump-toUlf Magnusson
Pressing [/] brings up a dialog with an edit box where a regex can be entered. The list of matching symbols is always shown below it. Selecting a symbol and pressing [Enter] jumps directly to it in the menu tree. If the symbol is invisible, show-all mode is turned on automatically. This commit also includes a bunch of more-or-less unrelated changes from poking around with the code: - Some redundant styles were merged. Probably wouldn't want to have a different style for each separator line, for example... - [ESC] in the top menu now works like [Q] - Returning to a parent menu now makes sure that the selected row is visible, even if the terminal was shrunk between entering the child menu and leaving it. - A _max_scroll() helper was factored out to reduce code duplication. It takes a list of items and a window in which the list is displayed, with one row per item, and returns the minimum scroll value that will make the final item visible. - The save dialog now pops up a message to confirm that the save was successful. - Lots of minor code nits all over (renamings, etc.)
2018-05-03menuconfig: Scroll to show current menu in menu pathUlf Magnusson
Previously, the title of the current menu disappeared off the right edge of the terminal for long menu paths. Scroll the menu path to the right if needed to make sure it is always shown.
2018-05-03menuconfig: Quit immediately when configuration is unchangedUlf Magnusson
Don't bother to show the save-and-quit dialog. Also quit immediately if the configuration hasn't been changed since the last time it was explicitly saved with the save dialog. Rename _set_node() to _set_node_tri_val(), as the old name gets confusing with the new _set_val() function.
2018-05-03menuconfig: Support setting values with [N]/[M]/[Y]Ulf Magnusson
Works the same as in mconf.
2018-05-03menuconfig: Add a mode that shows invisible itemsUlf Magnusson
When show-all mode is enabled, all items in the current menu are shown, including promptless and invisible items. Promptless items are shown with their name within <> brackets in place of the prompt. This will make it possible to jump to invisible items once the jump-to feature is added. It is also a handy feature on its own. .config loading from within the interface will make use of it as well, in case the current menu becomes complete invisible. Piggyback various code cleanups. Rename _visible* to _shown*, as it now includes invisible items in show-all mode.
2018-05-01Add a terminal menuconfig implementationUlf Magnusson
Uses the 'curses' module, which is in the Python standard library. Only Python 3 is supported, mostly due to Unicode support. Windows support is provided through an external package which adds support for the 'curses' module on Windows. See the changes and the docstring in the newly added menuconfig.py for more information. Piggyback a README notes mentioning that Kconfiglib supports Unicode.