Volans has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/348055 )

Change subject: Menu: don't allow to quit from submenu
......................................................................

Menu: don't allow to quit from submenu

- also fix a minor bug with pressing 'b' while in the main menu

Bug: T160178
Change-Id: I8f9fffc0fe78e71840237cad33ccc34f4a4bd7f1
---
M switchdc/menu.py
M switchdc/switch.py
2 files changed, 6 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/switchdc 
refs/changes/55/348055/1

diff --git a/switchdc/menu.py b/switchdc/menu.py
index 1f10f12..0b29a04 100644
--- a/switchdc/menu.py
+++ b/switchdc/menu.py
@@ -52,10 +52,10 @@
             item = self.items[idx]
             print(' {i: >2} [{status}] {title}'.format(i=idx, 
title=item.title, status=item.status))
 
-        if self.parent is not None:
+        if self.parent is None:
+            print('  q - Quit')
+        else:
             print('  b - Back to parent menu')
-
-        print('  q - Quit')
 
     @staticmethod
     def calculate_status(menu):
diff --git a/switchdc/switch.py b/switchdc/switch.py
index b544e3b..cc3433a 100644
--- a/switchdc/switch.py
+++ b/switchdc/switch.py
@@ -30,10 +30,11 @@
 
         if not answer:
             continue
-        elif answer == 'q':
+        elif answer == 'q' and menu.parent is None:
             break
-        elif answer == 'b':
+        elif answer == 'b' and menu.parent is not None:
             menu = menu.parent
+            continue
 
         try:
             index = int(answer)

-- 
To view, visit https://gerrit.wikimedia.org/r/348055
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8f9fffc0fe78e71840237cad33ccc34f4a4bd7f1
Gerrit-PatchSet: 1
Gerrit-Project: operations/switchdc
Gerrit-Branch: master
Gerrit-Owner: Volans <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to