Live 30.10.: ESC at 11:03:09 set all stop files, yet the runner clicked "max" and "buyin" at 11:03:12 - stellen_klicken checked only before a sequence, the mouse path never, and cleanup clicked sitout/cross "trotz_stopp". hand/notaus.py is now the one source for the stop files (act, click, stopp); click.click checks before start, on every movement step and before pressing (KlickNotAus), pid_klick too, sequences check before each click, trotz_stopp no longer overrides Not-Aus, dialog.esc sends no key and the live pointer stops. The runner logs "nicht geklickt (Not-Aus)" instead of a sitout it did not do. The header counted every window of a table process (table + dialog = 2); it now counts rooms from the process list. Tests get their own stop folder (POKERFREAK_STOPP_ORDNER) so they never see or touch the machine's Not-Aus. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
44 lines
1.2 KiB
Python
44 lines
1.2 KiB
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, "hand")):
|
|
_w = os.path.dirname(_w)
|
|
WURZEL = _w
|
|
|
|
import sys
|
|
sys.path.insert(0, os.path.join(WURZEL, "hand"))
|
|
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."""
|
|
for p in STOPP_PFADE:
|
|
os.makedirs(os.path.dirname(p), exist_ok=True)
|
|
try:
|
|
with open(p, "w", encoding="utf-8") as f:
|
|
f.write("not-aus")
|
|
except OSError:
|
|
pass
|
|
|
|
|
|
def stopp_aufheben():
|
|
"""Entfernt alle Not-Aus-Dateien."""
|
|
for p in STOPP_PFADE:
|
|
if os.path.exists(p):
|
|
try:
|
|
os.remove(p)
|
|
except OSError:
|
|
pass
|