summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xguiconfig.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/guiconfig.py b/guiconfig.py
index 20ecfa1..d333be4 100755
--- a/guiconfig.py
+++ b/guiconfig.py
@@ -1475,9 +1475,8 @@ def _toggle_showall(_):
def _do_showall():
# Updates the UI for the current show-all setting
- # Don't allow turning off show-all if we're in single-menu mode and the
- # current menu would become empty
- if _single_menu and not _shown_menu_nodes(_cur_menu):
+ # Don't allow turning off show-all if we'd end up with no visible nodes
+ if _nothing_shown():
_show_all_var.set(True)
return
@@ -1512,6 +1511,17 @@ def _do_showall():
_tree.focus_set()
+def _nothing_shown():
+ # _do_showall() helper. Returns True if no nodes would get
+ # shown with the current show-all setting. Also handles the
+ # (obscure) case when there are no visible nodes in the entire
+ # tree, meaning guiconfig was automatically started in
+ # show-all mode, which mustn't be turned off.
+
+ return not _shown_menu_nodes(
+ _cur_menu if _single_menu else _kconf.top_node)
+
+
def _toggle_tree_mode(_):
# Toggles single-menu mode on/off