Merge pull request #277 from newtonick/fix-restart-poweroff

fix restart/poweroff functions
This commit is contained in:
Nick Klockenga
2022-12-04 22:51:01 -05:00
committed by GitHub
+12 -3
View File
@@ -5,7 +5,7 @@ from seedsigner.gui.components import FontAwesomeIconConstants, GUIConstants
from seedsigner.gui.screens import RET_CODE__POWER_BUTTON
from seedsigner.gui.screens.screen import RET_CODE__BACK_BUTTON, DireWarningScreen, LargeButtonScreen, PowerOffScreen, ResetScreen, WarningScreen
from seedsigner.models.threads import BaseThread
from seedsigner.models import Settings
class BackStackView:
@@ -190,7 +190,10 @@ class RestartView(View):
# Kill the SeedSigner process; Running the process again.
# `.*` is a wildcard to detect either `python`` or `python3`.
call("kill $(pidof python*) & python /opt/src/main.py", shell=True)
if Settings.HOSTNAME == Settings.SEEDSIGNER_OS:
call("kill $(pidof python*) & python /opt/src/main.py", shell=True)
else:
call("kill $(ps aux | grep '[p]ython.*main.py' | awk '{print $2}')", shell=True)
@@ -207,7 +210,13 @@ class PowerOffView(View):
from subprocess import call
while self.keep_running:
time.sleep(5)
call("poweroff", shell=True)
if Settings.HOSTNAME == Settings.SEEDSIGNER_OS:
# disable microsd detection before shutdown to prevent display of toast notification during shutdown
from seedsigner.controller import Controller
Controller.get_instance().microsd.stop()
call("poweroff", shell=True)
else:
call("sudo shutdown --poweroff now", shell=True)