RASCSI/python/ctrlboard/src/ctrlboard_event_handler/piscsi_shutdown_cycler.py
dependabot[bot] 52e4a92aec
Bump black from 22.8.0 to 24.3.0 in /python/web (#1444)
* Bump black from 22.8.0 to 24.3.0 in /python/web

Bumps [black](https://github.com/psf/black) from 22.8.0 to 24.3.0.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md)
- [Commits](https://github.com/psf/black/compare/22.8.0...24.3.0)

---
updated-dependencies:
- dependency-name: black
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

* Github CI: Backend web test runner use python 3.9.19

* Reformat python sources with black

* Docker: Bump to python 3.9-slim image for pytest

* Bump pytest version to 8.1.1

* Bump more library versions, and freeze them

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Daniel Markstedt <daniel@mindani.net>
2024-03-22 00:19:13 -07:00

38 lines
1.1 KiB
Python

"""Module providing the shutdown cycler for the PiSCSI Control Board UI """
from menu.cycler import Cycler
class PiscsiShutdownCycler(Cycler):
"""Class implementing the shutdown cycler for the PiSCSI Control Board UI"""
def __init__(self, menu_controller, sock_cmd, piscsi_cmd):
super().__init__(
menu_controller,
sock_cmd,
piscsi_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.piscsi_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"