- ESC no longer triggers the emergency stop (an ESC in another app stopped the run at 20:29); stopping only via ctrl-opt-cmd-S or the stop button - a table whose program runs counts as open even when its window is not visible (other desktop, Cockpit without screen recording): no reopening, no giving up, correct table count; teardown and closing a full table work over the channel - Cockpit checks and requests the screen recording permission - gapless tiling (sicht/kacheln.py): tables fill the full height, the Cockpit bar takes the rest and never goes below its minimum width; own animated resize no longer stored as minimum - earlier today: top-up safety net, leave after the hand (sit out next hand), tournament lock, waitlist left on close, Cockpit start lock, warning throttle, preflop raise-war reading, Bomb Pot practice, tournament break and level-up on the stage - teacher core for the streamer mode (betrieb/lehrer.py, betrieb/grund_lesen.py) and its plan
87 lines
2.8 KiB
Python
87 lines
2.8 KiB
Python
#!/usr/bin/env python3
|
|
"""Die Cockpit-Steuerung startet keinen blinden Laeufer.
|
|
|
|
5.11. 19:06: das neu gebaute Cockpit hatte keine macOS-Freigabe (Bedienungshilfen). Sein Hauptknopf
|
|
startet dann keinen Laeufer (CockpitKern/Hauptknopf: freigabeFehlt) - die Steuerung
|
|
`POST /api/steuern {"aktion": "laeufer_starten"}` startete ihn trotzdem: er oeffnete drei Tische,
|
|
sah keines ihrer Fenster und stuerzte beim Beenden ab. Jetzt verweigert auch die Steuerung den Start,
|
|
solange dieser Prozess die Tischfenster nicht lesen darf - mit dem Grund, was zu tun ist.
|
|
|
|
python3 tests/cockpit_startsperre_spec.py -v
|
|
"""
|
|
import os
|
|
import sys
|
|
import tempfile
|
|
import unittest
|
|
|
|
HIER = os.path.dirname(os.path.abspath(__file__))
|
|
WURZEL = os.path.dirname(HIER)
|
|
for _u in ("sicht", "hand", "client"):
|
|
_p = os.path.join(WURZEL, _u)
|
|
if _p not in sys.path:
|
|
sys.path.append(_p)
|
|
|
|
import fenster # noqa: E402
|
|
import steuern # noqa: E402
|
|
|
|
|
|
def unlesbar(sofort=False):
|
|
raise fenster.FensterUnlesbar("osascript is not allowed assistive access. (-25211)")
|
|
|
|
|
|
class _Start(unittest.TestCase):
|
|
def setUp(self):
|
|
self.ordner = tempfile.mkdtemp(prefix="pf-startsperre-")
|
|
self.gestartet = []
|
|
self.alt = (steuern.SCRATCH, steuern.PID_DATEI, steuern.LAEUFER_LOG, steuern.subprocess.Popen,
|
|
fenster.tischfenster, steuern._kind)
|
|
steuern.SCRATCH = self.ordner
|
|
steuern.PID_DATEI = os.path.join(self.ordner, "laeufer.pid")
|
|
steuern.LAEUFER_LOG = os.path.join(self.ordner, "laeufer.txt")
|
|
|
|
class Kind:
|
|
pid = 4711
|
|
|
|
def poll(self):
|
|
return None
|
|
steuern.subprocess.Popen = lambda befehl, **k: self.gestartet.append(befehl) or Kind()
|
|
|
|
def tearDown(self):
|
|
(steuern.SCRATCH, steuern.PID_DATEI, steuern.LAEUFER_LOG, steuern.subprocess.Popen,
|
|
fenster.tischfenster, steuern._kind) = self.alt
|
|
|
|
|
|
class OhneFreigabe(_Start):
|
|
def setUp(self):
|
|
super().setUp()
|
|
fenster.tischfenster = unlesbar
|
|
|
|
def test_kein_laeufer_wird_gestartet(self):
|
|
antwort = steuern.laeufer_starten()
|
|
self.assertFalse(antwort["ok"])
|
|
self.assertEqual(self.gestartet, [])
|
|
|
|
def test_die_antwort_sagt_was_zu_tun_ist(self):
|
|
text = steuern.laeufer_starten()["text"]
|
|
self.assertIn("Freigabe", text)
|
|
self.assertIn("Bedienungshilfen", text)
|
|
|
|
def test_keine_pid_datei(self):
|
|
steuern.laeufer_starten()
|
|
self.assertFalse(os.path.exists(steuern.PID_DATEI))
|
|
|
|
|
|
class MitFreigabe(_Start):
|
|
def setUp(self):
|
|
super().setUp()
|
|
fenster.tischfenster = lambda sofort=False: []
|
|
|
|
def test_der_laeufer_startet(self):
|
|
antwort = steuern.laeufer_starten()
|
|
self.assertTrue(antwort["ok"], antwort)
|
|
self.assertEqual(len(self.gestartet), 1)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|