shift plus quit to kill daemon
This commit is contained in:
parent
676f2a392b
commit
808a78bad1
|
@ -4,3 +4,4 @@ dist/
|
|||
MANIFEST
|
||||
android/
|
||||
high-scores.old
|
||||
local/
|
||||
|
|
|
@ -170,6 +170,22 @@ class ElectricSieve(Game):
|
|||
rotated.h = rect.w
|
||||
return rotated
|
||||
|
||||
def end(self, event):
|
||||
"""
|
||||
Extend the parent end method to try adding a permanent quit feature in case there is a Raspbian Lite systemd autostart service running
|
||||
"""
|
||||
if event.type == QUIT or self.delegate.compare(event, "quit"):
|
||||
if self.confirming_quit or not self.get_configuration("input", "confirm-quit"):
|
||||
# If SHIFT is pressed, try permanently stopping the systemd service to get a console back in case this is running on
|
||||
# Raspbian Lite
|
||||
if pygame.key.get_mods() & pygame.KMOD_SHIFT:
|
||||
try:
|
||||
subprocess.run(["sudo", "systemctl", "stop", "scrapeboard"])
|
||||
print("Killing with permanent stop sent to systemd scrapeboard service")
|
||||
except:
|
||||
print("No scrapeboard system service detected, so permanent quit either failed or was unnecessary")
|
||||
super().end(event)
|
||||
|
||||
def update(self):
|
||||
# Test if the level is being played
|
||||
if self.triangles.active:
|
||||
|
|
Loading…
Reference in New Issue