diff --git a/src/ConvexHullJob.py b/src/ConvexHullJob.py index 617a0a9c35..f233352d1a 100644 --- a/src/ConvexHullJob.py +++ b/src/ConvexHullJob.py @@ -4,7 +4,7 @@ from UM.Math.Polygon import Polygon import numpy -from ConvexHullNode import ConvexHullNode +from . import ConvexHullNode class ConvexHullJob(Job): def __init__(self, node): @@ -26,7 +26,7 @@ class ConvexHullJob(Job): # Then, do a Minkowski hull with a simple 1x1 quad to outset and round the normal convex hull. hull = hull.getMinkowskiHull(Polygon(numpy.array([[-1, -1], [-1, 1], [1, 1], [1, -1]], numpy.float32))) - hull_node = ConvexHullNode(self._node, hull, Application.getInstance().getController().getScene().getRoot()) + hull_node = ConvexHullNode.ConvexHullNode(self._node, hull, Application.getInstance().getController().getScene().getRoot()) self._node._convex_hull = hull delattr(self._node, "_convex_hull_job") diff --git a/src/PlatformPhysics.py b/src/PlatformPhysics.py index d422001c85..d2935cf5c7 100644 --- a/src/PlatformPhysics.py +++ b/src/PlatformPhysics.py @@ -9,8 +9,8 @@ from UM.Math.Vector import Vector from UM.Math.AxisAlignedBox import AxisAlignedBox from UM.Application import Application -from PlatformPhysicsOperation import PlatformPhysicsOperation -from ConvexHullJob import ConvexHullJob +from . import PlatformPhysicsOperation +from . import ConvexHullJob import time import threading @@ -54,7 +54,7 @@ class PlatformPhysics: # If there is no convex hull for the node, start calculating it and continue. if not hasattr(node, '_convex_hull'): if not hasattr(node, '_convex_hull_job'): - job = ConvexHullJob(node) + job = ConvexHullJob.ConvexHullJob(node) job.start() node._convex_hull_job = job else: @@ -81,7 +81,7 @@ class PlatformPhysics: move_vector.setZ(-overlap[1]) if move_vector != Vector(): - op = PlatformPhysicsOperation(node, move_vector) + op = PlatformPhysicsOperation.PlatformPhysicsOperation(node, move_vector) op.push() if node.getBoundingBox().intersectsBox(self._build_volume.getBoundingBox()) == AxisAlignedBox.IntersectionResult.FullIntersection: diff --git a/src/PrinterApplication.py b/src/PrinterApplication.py index 9635399b85..9646011a2f 100644 --- a/src/PrinterApplication.py +++ b/src/PrinterApplication.py @@ -12,6 +12,7 @@ from UM.Mesh.ReadMeshJob import ReadMeshJob from UM.Logger import Logger from UM.Preferences import Preferences from UM.Message import Message +from UM.PluginRegistry import PluginRegistry from UM.Scene.BoxRenderer import BoxRenderer from UM.Scene.Selection import Selection @@ -21,14 +22,15 @@ from UM.Operations.RemoveSceneNodeOperation import RemoveSceneNodeOperation from UM.Operations.GroupedOperation import GroupedOperation from UM.Operations.SetTransformOperation import SetTransformOperation -from PlatformPhysics import PlatformPhysics -from BuildVolume import BuildVolume -from CameraAnimation import CameraAnimation -from PrintInformation import PrintInformation +from . import PlatformPhysics +from . import BuildVolume +from . import CameraAnimation +from . import PrintInformation from PyQt5.QtCore import pyqtSlot, QUrl, Qt, pyqtSignal, pyqtProperty from PyQt5.QtGui import QColor +import sys import os.path import numpy numpy.seterr(all='ignore') @@ -36,6 +38,10 @@ numpy.seterr(all='ignore') class PrinterApplication(QtApplication): def __init__(self): super().__init__(name = 'cura', version = "14.2.1") + + if not hasattr(sys, 'frozen'): + Resources.addResourcePath(os.path.join(os.path.abspath(os.path.dirname(__file__)), '..')) + self.setRequiredPlugins([ 'CuraEngineBackend', 'MeshView', @@ -68,6 +74,9 @@ class PrinterApplication(QtApplication): ## Handle loading of all plugin types (and the backend explicitly) # \sa PluginRegistery def _loadPlugins(self): + if not hasattr(sys, 'frozen'): + self._plugin_registry.addPluginLocation(os.path.join(os.path.abspath(os.path.dirname(__file__)), '..', 'plugins')) + self._plugin_registry.loadPlugins({ "type": "logger"}) self._plugin_registry.loadPlugins({ "type": "storage_device" }) self._plugin_registry.loadPlugins({ "type": "view" }) @@ -96,26 +105,26 @@ class PrinterApplication(QtApplication): root = controller.getScene().getRoot() self._platform = Platform(root) - self._volume = BuildVolume(root) + self._volume = BuildVolume.BuildVolume(root) self.getRenderer().setLightPosition(Vector(0, 150, 0)) self.getRenderer().setBackgroundColor(QColor(245, 245, 245)) - self._physics = PlatformPhysics(controller, self._volume) + self._physics = PlatformPhysics.PlatformPhysics(controller, self._volume) camera = Camera('3d', root) camera.setPosition(Vector(-150, 150, 300)) camera.setPerspective(True) camera.lookAt(Vector(0, 0, 0)) - self._camera_animation = CameraAnimation() + self._camera_animation = CameraAnimation.CameraAnimation() self._camera_animation.setCameraTool(self.getController().getTool('CameraTool')) controller.getScene().setActiveCamera('3d') self.showSplashMessage('Loading interface...') - self.setMainQml(os.path.dirname(__file__), "qml/Printer.qml") + self.setMainQml(Resources.getPath(Resources.QmlFilesLocation, "Printer.qml")) self.initializeEngine() self.getStorageDevice('LocalFileStorage').removableDrivesChanged.connect(self._removableDrivesChanged) @@ -140,7 +149,7 @@ class PrinterApplication(QtApplication): def registerObjects(self, engine): engine.rootContext().setContextProperty('Printer', self) - self._print_information = PrintInformation() + self._print_information = PrintInformation.PrintInformation() engine.rootContext().setContextProperty('PrintInformation', self._print_information) def onSelectionChanged(self):