Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLipu Fei <lipu.fei815@gmail.com>2020-01-31 14:52:10 +0300
committerLipu Fei <lipu.fei815@gmail.com>2020-02-08 01:14:47 +0300
commitb03f666bf527c4cfcf452bb96434126f9800b8d9 (patch)
tree59e04136854224494a849d2e3d4d3afbcef3d095
parent309f90ceb88e65a8892990e6f40eddb9ddae4d17 (diff)
WIP: Make it work with Python 3.7 packaing
-rwxr-xr-xcura/CuraApplication.py3
-rwxr-xr-xcura_app.py1
-rwxr-xr-xplugins/CuraEngineBackend/CuraEngineBackend.py20
3 files changed, 20 insertions, 4 deletions
diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py
index edd8872fe9..7b17583f68 100755
--- a/cura/CuraApplication.py
+++ b/cura/CuraApplication.py
@@ -348,6 +348,9 @@ class CuraApplication(QtApplication):
for dir_name in ["extruders", "machine_instances", "materials", "plugins", "quality", "quality_changes", "user", "variants", "intent"]:
Resources.addExpectedDirNameInData(dir_name)
+ app_root = os.path.abspath(os.path.join(os.path.dirname(sys.executable)))
+ Resources.addSearchPath(os.path.join(app_root, "share", "cura", "resources"))
+
Resources.addSearchPath(os.path.join(self._app_install_dir, "share", "cura", "resources"))
if not hasattr(sys, "frozen"):
resource_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), "..", "resources")
diff --git a/cura_app.py b/cura_app.py
index 5184a5ab8b..d1f7ad1c46 100755
--- a/cura_app.py
+++ b/cura_app.py
@@ -171,6 +171,7 @@ else:
# tries to create PyQt objects on a non-main thread.
import Arcus #@UnusedImport
import Savitar #@UnusedImport
+
from cura.CuraApplication import CuraApplication
diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py
index 1437153f32..247936bf77 100755
--- a/plugins/CuraEngineBackend/CuraEngineBackend.py
+++ b/plugins/CuraEngineBackend/CuraEngineBackend.py
@@ -55,10 +55,22 @@ class CuraEngineBackend(QObject, Backend):
if Platform.isWindows():
executable_name += ".exe"
default_engine_location = executable_name
- if os.path.exists(os.path.join(CuraApplication.getInstallPrefix(), "bin", executable_name)):
- default_engine_location = os.path.join(CuraApplication.getInstallPrefix(), "bin", executable_name)
- if hasattr(sys, "frozen"):
- default_engine_location = os.path.join(os.path.dirname(os.path.abspath(sys.executable)), executable_name)
+
+ search_path = [
+ os.path.abspath(os.path.dirname(sys.executable)),
+ os.path.abspath(os.path.join(os.path.dirname(sys.executable), "bin")),
+ os.path.abspath(os.path.join(os.path.dirname(sys.executable), "..")),
+
+ os.path.join(CuraApplication.getInstallPrefix(), "bin"),
+ os.path.dirname(os.path.abspath(sys.executable)),
+ ]
+
+ for path in search_path:
+ engine_path = os.path.join(path, executable_name)
+ if os.path.isfile(engine_path):
+ default_engine_location = engine_path
+ break
+
if Platform.isLinux() and not default_engine_location:
if not os.getenv("PATH"):
raise OSError("There is something wrong with your Linux installation.")