diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 393f1e5634..48f3998d09 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -14,6 +14,7 @@ from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator from UM.Mesh.ReadMeshJob import ReadMeshJob from UM.Logger import Logger from UM.Preferences import Preferences +from UM.Platform import Platform from UM.JobQueue import JobQueue from UM.SaveFile import SaveFile from UM.Scene.Selection import Selection @@ -58,7 +59,7 @@ import urllib numpy.seterr(all="ignore") #WORKAROUND: GITHUB-88 GITHUB-385 GITHUB-612 -if platform.system() == "Linux": # Needed for platform.linux_distribution, which is not available on Windows and OSX +if Platform.isLinux(): # Needed for platform.linux_distribution, which is not available on Windows and OSX # For Ubuntu: https://bugs.launchpad.net/ubuntu/+source/python-qt4/+bug/941826 if platform.linux_distribution()[0] in ("Ubuntu", ): # TODO: Needs a "if X11_GFX == 'nvidia'" here. The workaround is only needed on Ubuntu+NVidia drivers. Other drivers are not affected, but fine with this fix. import ctypes diff --git a/cura_app.py b/cura_app.py index 15bdf10ad6..3548acedb6 100755 --- a/cura_app.py +++ b/cura_app.py @@ -33,10 +33,11 @@ sys.excepthook = exceptHook # first seems to prevent Sip from going into a state where it # tries to create PyQt objects on a non-main thread. import Arcus #@UnusedImport +from UM.Platform import Platform import cura.CuraApplication import cura.CuraContainerRegistry -if sys.platform == "win32" and hasattr(sys, "frozen"): +if Platform.isWindows() and hasattr(sys, "frozen"): dirpath = os.path.expanduser("~/AppData/Local/cura/") os.makedirs(dirpath, exist_ok = True) sys.stdout = open(os.path.join(dirpath, "stdout.log"), "w") diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index 9d2addabe8..c91e414a13 100644 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -11,6 +11,7 @@ from UM.Message import Message from UM.PluginRegistry import PluginRegistry from UM.Resources import Resources from UM.Settings.Validator import ValidatorState #To find if a setting is in an error state. We can't slice then. +from UM.Platform import Platform from cura.ExtruderManager import ExtruderManager @@ -42,7 +43,7 @@ class CuraEngineBackend(Backend): default_engine_location = os.path.join(Application.getInstallPrefix(), "bin", "CuraEngine") if hasattr(sys, "frozen"): default_engine_location = os.path.join(os.path.dirname(os.path.abspath(sys.executable)), "CuraEngine") - if sys.platform == "win32": + if Platform.isWindows(): default_engine_location += ".exe" default_engine_location = os.path.abspath(default_engine_location) Preferences.getInstance().addPreference("backend/location", default_engine_location)