def _platform_override_menu(self, menu, choice): """ Override a menu voice Args: menu (str): a menu identifier choice (int): a menu entry index Returns: int: 0 for normal, 1 for going back to the main menu of EasyCloud, 2 for closing the whole application """ if menu == "floating_ips": if choice == 5: # Detach floating ip SimpleTUI.msg_dialog( "Detach Floating IP", "Detaching an IP address from an instance is not supported on GCP: \n" + "an instance must always have an IP associated while running.\n" + "However, you can assign another address to the desired instance to\n" + "replace the current one.", SimpleTUI.DIALOG_INFO) return 0 SimpleTUI.error("Unavailable choice!") SimpleTUI.pause() SimpleTUI.clear_console() pass
def close(self, code): """ Close the application Args: code (int): an exit code (0 for normal termination) """ SimpleTUI.clear_console() exit(code)