summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2018-05-22 11:57:29 +0200
committerUlf Magnusson <ulfalizer@gmail.com>2018-05-22 12:08:10 +0200
commitfe0f2f8410787e2d177ae891e1c5422280fbb2be (patch)
treebb7e4a76e9c758c670ac9dfaada87ccbd8e87ebd
parent5104b1be4331c6b04b3aec0eab763d7dd1b2768b (diff)
menuconfig: Move symbol name from title into info text
It's easy to miss at the top, especially as it's centered. Have a generic 'Symbol information', 'Choice information', etc., title instead.
-rwxr-xr-xmenuconfig.py26
1 files changed, 12 insertions, 14 deletions
diff --git a/menuconfig.py b/menuconfig.py
index 77b9d07..5332b08 100755
--- a/menuconfig.py
+++ b/menuconfig.py
@@ -1798,20 +1798,10 @@ def _draw_info_dialog(node, lines, scroll, top_line_win, text_win,
if scroll > 0:
_safe_hline(top_line_win, 0, 4, curses.ACS_UARROW, _N_SCROLL_ARROWS)
-
- if isinstance(node.item, Symbol):
- title = "{}{}".format(_kconf.config_prefix, node.item.name)
-
- elif isinstance(node.item, Choice):
- title = node.item.name or "Choice"
-
- elif node.item == MENU:
- title = 'menu "{}"'.format(node.prompt[0])
-
- else: # node.item == COMMENT
- title = 'comment "{}"'.format(node.prompt[0])
-
-
+ title = ("Symbol" if isinstance(node.item, Symbol) else
+ "Choice" if isinstance(node.item, Choice) else
+ "Menu" if node.item == MENU else
+ "Comment") + " information"
_safe_addstr(top_line_win, 0, (text_win_width - len(title))//2, title)
top_line_win.noutrefresh()
@@ -1863,6 +1853,7 @@ def _info_str(node):
sym = node.item
return (
+ _name_info(sym) +
_prompt_info(sym) +
"Type: {}\n".format(TYPE_TO_STR[sym.type]) +
'Value: "{}"\n\n'.format(sym.str_value) +
@@ -1877,6 +1868,7 @@ def _info_str(node):
choice = node.item
return (
+ _name_info(choice) +
_prompt_info(choice) +
"Type: {}\n".format(TYPE_TO_STR[choice.type]) +
'Mode: "{}"\n\n'.format(choice.str_value) +
@@ -1890,6 +1882,12 @@ def _info_str(node):
# node.item in (MENU, COMMENT)
return _kconfig_def_info(node)
+def _name_info(sc):
+ # Returns a string with the name of the symbol/choice. Names are optional
+ # for choices.
+
+ return "Name: {}\n".format(sc.name) if sc.name else ""
+
def _prompt_info(sc):
# Returns a string listing the prompts of 'sc' (Symbol or Choice)