mcp/stopp.py schreibt die Dateien nur noch ueber notaus.setzen/aufheben (eine Quelle). sicht/steuern.not_aus_setzen setzt die Dateien zuerst und ruft dann notaus() - der Not-Aus ist damit scharf, ohne ein Fenster nach vorn zu holen; scheitert der Kanal, raeumt notaus hart nach. Die Antwort nennt, was geschah (ausgesetzt / hart beendet). sicht_steuern_spec bleibt gruen.
34 lines
940 B
Python
34 lines
940 B
Python
"""Sicherheits-Not-Aus für CoinPoker-Aktionen.
|
|
|
|
Verwaltet die Stopp-Dateien über alle relevanten Pfade des Repositories
|
|
und verhindert Klick-Aktionen bei aktivem Not-Aus.
|
|
"""
|
|
import os
|
|
|
|
_w = os.path.dirname(os.path.abspath(__file__))
|
|
while _w != "/" and not os.path.isdir(os.path.join(_w, "lesen")):
|
|
_w = os.path.dirname(_w)
|
|
WURZEL = _w
|
|
|
|
import sys
|
|
sys.path.insert(0, os.path.join(WURZEL, "hand"))
|
|
sys.path.insert(0, os.path.join(WURZEL, "client"))
|
|
import notaus # noqa: E402 eine Quelle für die Stopp-Dateien
|
|
|
|
STOPP_PFADE = notaus.PFADE
|
|
|
|
|
|
def ist_gestoppt():
|
|
"""Prüft, ob an mindestens einem Stopp-Pfad eine Not-Aus-Datei existiert."""
|
|
return any(os.path.exists(p) for p in STOPP_PFADE)
|
|
|
|
|
|
def stopp_setzen():
|
|
"""Legt an allen Stopp-Pfaden die Not-Aus-Datei an."""
|
|
return notaus.setzen(STOPP_PFADE)
|
|
|
|
|
|
def stopp_aufheben():
|
|
"""Entfernt alle Not-Aus-Dateien."""
|
|
notaus.aufheben(STOPP_PFADE)
|