Skip to content

Commit 1d654cb

Browse files
committed
work on windows shutdown
1 parent 9d094c1 commit 1d654cb

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed

Actions/actions.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,12 @@ def processAction(self, msg):
234234

235235
def shutdown(self):
236236
try:
237-
self.data.ui_queue1.put("WebMCP","shutdown","")
238-
return True
237+
print(self.data.platform)
238+
if self.data.platform == "WIN":
239+
os._exit(0)
240+
else:
241+
self.data.ui_queue1.put("WebMCP", "shutdown", "")
242+
return True
239243
except Exception as e:
240244
self.data.console_queue.put(str(e))
241245
return False
@@ -968,9 +972,9 @@ def processSettingRequest(self, section, setting):
968972

969973
def upgradeFirmware(self, version):
970974
try:
971-
if hasattr(sys, '_MEIPASS'):
972-
home = os.path.join(sys._MEIPASS)
973-
print(home)
975+
if self.data.platform == "WIN":
976+
home = os.path.join(self.data.platformHome)
977+
#print(home)
974978
else:
975979
home = ""
976980
if version == 0:

Connection/nonVisibleWidgets.py

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import sys
2+
import os
13
from DataStructures.makesmithInitFuncs import MakesmithInitFuncs
24
from Connection.serialPort import SerialPort
35
from File.gcodeFile import GCodeFile
@@ -66,6 +68,10 @@ def setUpData(self, data):
6668
data.gpioActions = self.gpioActions
6769
data.boardManager = self.boardManager
6870

71+
if hasattr(sys, '_MEIPASS'):
72+
data.platform = "WIN"
73+
data.platformHome = sys._MEIPASS
74+
6975
self.serialPort.setUpData(data)
7076
self.gcodeFile.setUpData(data)
7177
self.importFile.setUpData(data)

DataStructures/data.py

+2
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ class Data:
181181
shutdown = False
182182

183183
hostAddress = "-"
184+
platform = "RPI"
185+
platformHome = ""
184186

185187
def __init__(self):
186188
"""

config/config.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -573,21 +573,21 @@ def computeSettings(self, section, key, value, doAll=False):
573573
self.setValue("Computed Settings", "fPWMComputed", 3, True)
574574

575575
def parseFirmwareVersions(self):
576-
home = ""
576+
home = "."
577577
if hasattr(sys, '_MEIPASS'):
578578
home = os.path.join(sys._MEIPASS)
579579
print(self.home)
580-
path = home+"firmware/madgrizzle/*.hex"
580+
path = home+"/firmware/madgrizzle/*.hex"
581581
for filename in glob.glob(path):
582582
version = filename.split("-")
583583
version = version[1].split(".hex")
584584
self.data.customFirmwareVersion = version[0]
585-
path = home+"firmware/maslowcnc/*.hex"
585+
path = home+"/firmware/maslowcnc/*.hex"
586586
for filename in glob.glob(path):
587587
version = filename.split("-")
588588
version = version[1].split(".hex")
589589
self.data.stockFirmwareVersion = version[0]
590-
path = home+"firmware/holey/*.hex"
590+
path = home+"/firmware/holey/*.hex"
591591
for filename in glob.glob(path):
592592
version = filename.split("-")
593593
version = version[1].split(".hex")

0 commit comments

Comments
 (0)