RASCSI/python/ctrlboard/src/ctrlboard_event_handler/rascsi_shutdown_cycler.py
nucleogenic 315ef9f248
Auto-format Python sources with black, fix all issues reported by flake8 (#1010)
* Update config for black and flake8
* Auto-format Python sources with black
* Fix issues reported by flake8
* Exclude protobuf files from black
* Address formatting feedback
2022-11-30 05:19:17 +00:00

37 lines
1.1 KiB
Python

"""Module providing the shutdown cycler for the RaSCSI Control Board UI """
from menu.cycler import Cycler
class RascsiShutdownCycler(Cycler):
"""Class implementing the shutdown cycler for the RaSCSI Control Board UI"""
def __init__(self, menu_controller, sock_cmd, ractl_cmd):
super().__init__(
menu_controller,
sock_cmd,
ractl_cmd,
return_entry=True,
empty_messages=False,
)
self.executed_once = False
def populate_cycle_entries(self):
cycle_entries = ["Shutdown"]
return cycle_entries
def perform_selected_entry_action(self, selected_entry):
if self.executed_once is False:
self.executed_once = True
self._menu_controller.show_timed_message("Shutting down...")
self.ractl_cmd.shutdown("system")
return "shutdown"
return None
def perform_return_action(self):
self._menu_controller.show_timed_mini_message("")
self._menu_controller.show_timed_message("")
return "return"