From 6f9b9c7605ccff89c264ae9d2ad3ab03c87bff4b Mon Sep 17 00:00:00 2001 From: jaydee Date: Fri, 5 Dec 2025 17:12:37 +0100 Subject: [PATCH] build --- portainer.py | 83 ---------------------------------------------------- 1 file changed, 83 deletions(-) diff --git a/portainer.py b/portainer.py index ded11d7..9b00666 100755 --- a/portainer.py +++ b/portainer.py @@ -38,88 +38,6 @@ defaults = { cur_config = {} -def menu(title, options): - """ - Display a menu and return selected value. - options must be list of (value, text) or text (auto-wrapped) - """ - if isinstance(options[0], str): - options = [(item, item) for item in options] - - radio = RadioList(options) - - kb = KeyBindings() - - @kb.add("enter") - def _(event): - event.app.exit(result=radio.current_value) - @kb.add("q") - def _(event): - event.app.exit(result=None) - layout = Layout(HSplit([radio])) - - app = Application( - layout=layout, - key_bindings=kb, - full_screen=True - ) - - return app.run() - - -# -------------------------- -# MULTI-LEVEL MENU -# -------------------------- - -def main_menu(): - while True: - choice = menu("Main Menu", [ - "System", - "Network", - "Services", - "Exit" - ]) - - if choice == "System": - system_menu() - - elif choice == "Network": - network_menu() - - elif choice == "Services": - services_menu() - - elif choice == "Exit": - return - - -def system_menu(): - choice = menu("System Menu", [ - "Info", - "Reboot", - "Back" - ]) - print("SYSTEM →", choice) - - -def network_menu(): - choice = menu("Network Menu", [ - "Show IP", - "Restart Networking", - "Back" - ]) - print("NETWORK →", choice) - - -def services_menu(): - choice = menu("Services", [ - "Start Service", - "Stop Service", - "Status", - "Back" - ]) - print("SERVICES →", choice) - def load_config(defaults=defaults): @@ -455,7 +373,6 @@ if __name__ == "__main__": logger.warning("Killed manually %s, %s", sig, frame) print("\nTerminated by user") sys.exit(0) - main_menu() signal.signal(signal.SIGINT, signal_handler) os.system("cls" if os.name == "nt" else "clear") if args.action is None: