From 5a71201200be6e6a0bc2ad956b56b5fbb30d4b93 Mon Sep 17 00:00:00 2001 From: daid Date: Mon, 4 May 2015 17:28:09 +0200 Subject: [PATCH 01/12] Add __init__ file or else py2exe fails. --- src/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/__init__.py diff --git a/src/__init__.py b/src/__init__.py new file mode 100644 index 0000000000..e69de29bb2 From fdde91be67e53d02e1ac7cdd7749da56e6325974 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Mon, 11 May 2015 12:24:56 +0200 Subject: [PATCH 02/12] Set version to 15.05.90 to indicate first beta release of 15.06 --- src/CuraApplication.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CuraApplication.py b/src/CuraApplication.py index ddc2f2e404..526bb2b10e 100644 --- a/src/CuraApplication.py +++ b/src/CuraApplication.py @@ -45,7 +45,7 @@ class CuraApplication(QtApplication): if not hasattr(sys, "frozen"): Resources.addResourcePath(os.path.join(os.path.abspath(os.path.dirname(__file__)), "..")) - super().__init__(name = "cura", version = "master") + super().__init__(name = "cura", version = "15.05.90") self.setRequiredPlugins([ "CuraEngineBackend", From 6eb9f5139be9ea269b9193c40d378fdaffbb2e04 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Fri, 15 May 2015 15:18:27 +0200 Subject: [PATCH 03/12] Add support for loading files from command line Fixes #8 --- src/CuraApplication.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/CuraApplication.py b/src/CuraApplication.py index 526bb2b10e..99b206cd19 100644 --- a/src/CuraApplication.py +++ b/src/CuraApplication.py @@ -85,6 +85,9 @@ class CuraApplication(QtApplication): self._plugin_registry.loadPlugin("CuraEngineBackend") + def addCommandLineOptions(self, parser): + parser.add_argument("file", nargs="*", help="Files to load after starting the application.") + def run(self): self._i18n_catalog = i18nCatalog("cura"); @@ -153,6 +156,10 @@ class CuraApplication(QtApplication): if self._engine.rootObjects: self.closeSplash() + for file in self.getCommandLineOption("file", []): + job = ReadMeshJob(os.path.abspath(file)) + job.start() + self.exec_() def registerObjects(self, engine): From e62dee699379f66e412fb4a04bc4e42f16d09b2b Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Mon, 18 May 2015 14:59:37 +0200 Subject: [PATCH 04/12] Make it possible to ignore translation targets and add install target Contributes to #41 --- CMakeLists.txt | 87 +++++++++++++++++++++++++++++--------------------- 1 file changed, 50 insertions(+), 37 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 282f08fdf3..47a054dc25 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,45 +4,58 @@ cmake_minimum_required(VERSION 2.8.12) set(URANIUM_SCRIPTS_DIR "${CMAKE_SOURCE_DIR}/../uranium/scripts" CACHE DIRECTORY "The location of the scripts directory of the Uranium repository") -# Extract Strings -add_custom_target(extract-messages ${URANIUM_SCRIPTS_DIR}/extract-messages ${CMAKE_SOURCE_DIR} cura) +if(${URANIUM_SCRIPTS_DIR}) + # Extract Strings + add_custom_target(extract-messages ${URANIUM_SCRIPTS_DIR}/extract-messages ${CMAKE_SOURCE_DIR} cura) -# Build Translations -find_package(Gettext) -include(${URANIUM_SCRIPTS_DIR}/ECMPoQmTools.cmake) + # Build Translations + find_package(Gettext) + include(${URANIUM_SCRIPTS_DIR}/ECMPoQmTools.cmake) -if(GETTEXT_FOUND) - # translations target will convert .po files into .mo and .qm as needed. - # The files are checked for a _qt suffix and if it is found, converted to - # qm, otherwise they are converted to .po. - add_custom_target(translations) - # copy-translations can be used to copy the built translation files from the - # build directory to the source resources directory. This is mostly a convenience - # during development, normally you want to simply use the install target to install - # the files along side the rest of the application. - add_custom_target(copy-translations) + if(GETTEXT_FOUND) + # translations target will convert .po files into .mo and .qm as needed. + # The files are checked for a _qt suffix and if it is found, converted to + # qm, otherwise they are converted to .po. + add_custom_target(translations) + # copy-translations can be used to copy the built translation files from the + # build directory to the source resources directory. This is mostly a convenience + # during development, normally you want to simply use the install target to install + # the files along side the rest of the application. + add_custom_target(copy-translations) - #TODO: Properly install the built files. This should be done after we move the applications out of the Uranium repo. - set(languages - en - x-test - ) - foreach(lang ${languages}) - file(GLOB po_files resources/i18n/${lang}/*.po) - foreach(file ${po_files}) - string(REGEX MATCH "qt\\.po$" match "${file}") - if(match) - ecm_process_po_files_as_qm(${lang} PO_FILES ${file}) - else() - string(REGEX REPLACE ".*/(.*).po" "${lang}/\\1.mo" mofile ${file}) - add_custom_command(TARGET translations POST_BUILD COMMAND mkdir ARGS -p ${lang} COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} ARGS ${file} -o ${mofile}) - endif() + #TODO: Properly install the built files. This should be done after we move the applications out of the Uranium repo. + set(languages + en + x-test + ) + foreach(lang ${languages}) + file(GLOB po_files resources/i18n/${lang}/*.po) + foreach(file ${po_files}) + string(REGEX MATCH "qt\\.po$" match "${file}") + if(match) + ecm_process_po_files_as_qm(${lang} PO_FILES ${file}) + else() + string(REGEX REPLACE ".*/(.*).po" "${lang}/\\1.mo" mofile ${file}) + add_custom_command(TARGET translations POST_BUILD COMMAND mkdir ARGS -p ${lang} COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} ARGS ${file} -o ${mofile}) + endif() + endforeach() + + file(GLOB qm_files ${CMAKE_BINARY_DIR}/${lang}/*.qm) + file(GLOB mo_files ${CMAKE_BINARY_DIR}/${lang}/*.mo) + foreach(file ${qm_files} ${mo_files}) + add_custom_command(TARGET copy-translations POST_BUILD COMMAND mkdir ARGS -p ${CMAKE_SOURCE_DIR}/resources/i18n/${lang}/LC_MESSAGES/ COMMAND cp ARGS ${file} ${CMAKE_SOURCE_DIR}/resources/i18n/${lang}/LC_MESSAGES/ COMMENT "Copying ${file}...") + endforeach() endforeach() - - file(GLOB qm_files ${CMAKE_BINARY_DIR}/${lang}/*.qm) - file(GLOB mo_files ${CMAKE_BINARY_DIR}/${lang}/*.mo) - foreach(file ${qm_files} ${mo_files}) - add_custom_command(TARGET copy-translations POST_BUILD COMMAND mkdir ARGS -p ${CMAKE_SOURCE_DIR}/resources/i18n/${lang}/LC_MESSAGES/ COMMAND cp ARGS ${file} ${CMAKE_SOURCE_DIR}/resources/i18n/${lang}/LC_MESSAGES/ COMMENT "Copying ${file}...") - endforeach() - endforeach() + endif() endif() + +include(GNUInstallDirs) +find_package(PythonInterp 3.4.0 REQUIRED) + +set(PYTHON_SITE_PACKAGES_DIR ${CMAKE_INSTALL_LIBDIR}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages CACHE PATH "Install location of Python package") +install(DIRECTORY resources DESTINATION ${CMAKE_INSTALL_DATADIR}/cura) +file(GLOB cura_plugins_SRCS plugins/*) +install(DIRECTORY ${cura_plugins_SRCS} DESTINATION ${CMAKE_INSTALL_LIBDIR}/cura) +file(GLOB cura_SRCS src/*) +install(FILES ${cura_SRCS} DESTINATION ${PYTHON_SITE_PACKAGES_DIR}/cura) +install(FILES cura.py DESTINATION ${CMAKE_INSTALL_BINDIR}) \ No newline at end of file From 7e9870c6cb782febd0a76e592e072824fbc94aa7 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Mon, 18 May 2015 15:00:53 +0200 Subject: [PATCH 05/12] Set default engine location to unix standard bin dir Contributes to #41 Contributes to #42 --- plugins/CuraEngineBackend/CuraEngineBackend.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index 9655a4d08e..7c52a3c6cb 100644 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -26,7 +26,7 @@ class CuraEngineBackend(Backend): super().__init__() # Find out where the engine is located, and how it is called. This depends on how Cura is packaged and which OS we are running on. - default_engine_location = "../PinkUnicornEngine/CuraEngine" + 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": From 70f5dede95fbf5f7c4760fe7748175f0ba984f01 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Mon, 18 May 2015 15:01:40 +0200 Subject: [PATCH 06/12] Add standard Cura install directories to resource and plugin paths Contributes to #41 Contributes to #42 --- src/CuraApplication.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/CuraApplication.py b/src/CuraApplication.py index 99b206cd19..73b8b69955 100644 --- a/src/CuraApplication.py +++ b/src/CuraApplication.py @@ -35,6 +35,7 @@ from . import PrintInformation from PyQt5.QtCore import pyqtSlot, QUrl, Qt, pyqtSignal, pyqtProperty from PyQt5.QtGui import QColor +import platform import sys import os.path import numpy @@ -42,6 +43,7 @@ numpy.seterr(all="ignore") class CuraApplication(QtApplication): def __init__(self): + Resources.addResourcePath(os.path.join(QtApplication.getInstallPrefix(), "share", "cura")) if not hasattr(sys, "frozen"): Resources.addResourcePath(os.path.join(os.path.abspath(os.path.dirname(__file__)), "..")) @@ -72,6 +74,7 @@ class CuraApplication(QtApplication): ## Handle loading of all plugin types (and the backend explicitly) # \sa PluginRegistery def _loadPlugins(self): + self._plugin_registry.addPluginLocation(os.path.join(QtApplication.getInstallPrefix(), "lib", "cura")) if not hasattr(sys, "frozen"): self._plugin_registry.addPluginLocation(os.path.join(os.path.abspath(os.path.dirname(__file__)), "..", "plugins")) From ae71c309ace41d3c5c25e9b5a53579ae5ae7409b Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Mon, 18 May 2015 15:03:42 +0200 Subject: [PATCH 07/12] Move src to cura so we can use the same package for installed and source Contributes to #41 Contributes to #42 --- cura.py | 4 ++-- {src => cura}/BuildVolume.py | 0 {src => cura}/CameraAnimation.py | 0 {src => cura}/ConvexHullJob.py | 0 {src => cura}/ConvexHullNode.py | 0 {src => cura}/CuraApplication.py | 0 {src => cura}/PlatformPhysics.py | 0 {src => cura}/PlatformPhysicsOperation.py | 0 {src => cura}/PrintInformation.py | 0 {src => cura}/__init__.py | 0 10 files changed, 2 insertions(+), 2 deletions(-) rename {src => cura}/BuildVolume.py (100%) rename {src => cura}/CameraAnimation.py (100%) rename {src => cura}/ConvexHullJob.py (100%) rename {src => cura}/ConvexHullNode.py (100%) rename {src => cura}/CuraApplication.py (100%) rename {src => cura}/PlatformPhysics.py (100%) rename {src => cura}/PlatformPhysicsOperation.py (100%) rename {src => cura}/PrintInformation.py (100%) rename {src => cura}/__init__.py (100%) diff --git a/cura.py b/cura.py index 1d7a515e9b..cfe99284b3 100644 --- a/cura.py +++ b/cura.py @@ -3,7 +3,7 @@ # Copyright (c) 2015 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. -from src.CuraApplication import CuraApplication +import cura.CuraApplication -app = CuraApplication.getInstance() +app = cura.CuraApplication.CuraApplication.getInstance() app.run() diff --git a/src/BuildVolume.py b/cura/BuildVolume.py similarity index 100% rename from src/BuildVolume.py rename to cura/BuildVolume.py diff --git a/src/CameraAnimation.py b/cura/CameraAnimation.py similarity index 100% rename from src/CameraAnimation.py rename to cura/CameraAnimation.py diff --git a/src/ConvexHullJob.py b/cura/ConvexHullJob.py similarity index 100% rename from src/ConvexHullJob.py rename to cura/ConvexHullJob.py diff --git a/src/ConvexHullNode.py b/cura/ConvexHullNode.py similarity index 100% rename from src/ConvexHullNode.py rename to cura/ConvexHullNode.py diff --git a/src/CuraApplication.py b/cura/CuraApplication.py similarity index 100% rename from src/CuraApplication.py rename to cura/CuraApplication.py diff --git a/src/PlatformPhysics.py b/cura/PlatformPhysics.py similarity index 100% rename from src/PlatformPhysics.py rename to cura/PlatformPhysics.py diff --git a/src/PlatformPhysicsOperation.py b/cura/PlatformPhysicsOperation.py similarity index 100% rename from src/PlatformPhysicsOperation.py rename to cura/PlatformPhysicsOperation.py diff --git a/src/PrintInformation.py b/cura/PrintInformation.py similarity index 100% rename from src/PrintInformation.py rename to cura/PrintInformation.py diff --git a/src/__init__.py b/cura/__init__.py similarity index 100% rename from src/__init__.py rename to cura/__init__.py From f6fc81900919390c2dfa54c1504a2233217f3418 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Mon, 18 May 2015 17:20:02 +0200 Subject: [PATCH 08/12] Fix context menu entries Fixes Asana Issue 12 --- cura/CuraApplication.py | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 73b8b69955..1b608dd222 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -7,6 +7,7 @@ from UM.Scene.Camera import Camera from UM.Scene.Platform import Platform from UM.Math.Vector import Vector from UM.Math.Matrix import Matrix +from UM.Math.Quaternion import Quaternion from UM.Resources import Resources from UM.Scene.ToolHandle import ToolHandle from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator @@ -215,9 +216,7 @@ class CuraApplication(QtApplication): node = self.getController().getScene().findObject(object_id) if node: - transform = node.getLocalTransformation() - transform.setTranslation(Vector(0, 0, 0)) - op = SetTransformOperation(node, transform) + op = SetTransformOperation(node, Vector()) op.push() ## Delete all mesh data on the scene. @@ -250,9 +249,7 @@ class CuraApplication(QtApplication): op = GroupedOperation() for node in nodes: - transform = node.getLocalTransformation() - transform.setTranslation(Vector(0, 0, 0)) - op.addOperation(SetTransformOperation(node, transform)) + op.addOperation(SetTransformOperation(node, Vector())) op.push() @@ -269,8 +266,7 @@ class CuraApplication(QtApplication): op = GroupedOperation() for node in nodes: - transform = Matrix() - op.addOperation(SetTransformOperation(node, transform)) + op.addOperation(SetTransformOperation(node, Vector(), Quaternion(), Vector(1, 1, 1))) op.push() @@ -284,12 +280,18 @@ class CuraApplication(QtApplication): nodes.append(node) - if nodes: - file_name = node.getMeshData().getFileName() + if not nodes: + return - job = ReadMeshJob(file_name) - job.finished.connect(lambda j: node.setMeshData(j.getResult())) - job.start() + for node in nodes: + if not node.getMeshData(): + continue + + file_name = node.getMeshData().getFileName() + if file_name: + job = ReadMeshJob(file_name) + job.finished.connect(lambda j: node.setMeshData(j.getResult())) + job.start() ## Get logging data of the backend engine # \returns \type{string} Logging data From 8d6f72f4094ed9a83ee9175f6f5aa3e3f115e04e Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 21 May 2015 15:11:00 +0200 Subject: [PATCH 09/12] Set default brim size to 10 lines Fixes #2 --- resources/settings/fdmprinter.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/settings/fdmprinter.json b/resources/settings/fdmprinter.json index 16a8cab7f1..657102c5d2 100644 --- a/resources/settings/fdmprinter.json +++ b/resources/settings/fdmprinter.json @@ -912,7 +912,7 @@ "label": "Brim Line Count", "description": "The amount of lines used for a brim: More lines means a larger brim which sticks better, but this also makes your effective print area smaller.", "type": "int", - "default": 1, + "default": 10, "active_if": { "setting": "adhesion_type", "value": "Brim" From 96e0faf937f10b14d7d729639045a68f2c09180f Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 21 May 2015 15:12:05 +0200 Subject: [PATCH 10/12] Rename cura.py to cura_app.py to prevent conflicts with "cura" directory Contributes to Ultimaker/Uranium#41 --- CMakeLists.txt | 2 +- cura.py => cura_app.py | 0 setup.py | 4 ++-- 3 files changed, 3 insertions(+), 3 deletions(-) rename cura.py => cura_app.py (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 47a054dc25..c13e3e2eea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,4 +58,4 @@ file(GLOB cura_plugins_SRCS plugins/*) install(DIRECTORY ${cura_plugins_SRCS} DESTINATION ${CMAKE_INSTALL_LIBDIR}/cura) file(GLOB cura_SRCS src/*) install(FILES ${cura_SRCS} DESTINATION ${PYTHON_SITE_PACKAGES_DIR}/cura) -install(FILES cura.py DESTINATION ${CMAKE_INSTALL_BINDIR}) \ No newline at end of file +install(FILES cura_app.py DESTINATION ${CMAKE_INSTALL_BINDIR}) \ No newline at end of file diff --git a/cura.py b/cura_app.py similarity index 100% rename from cura.py rename to cura_app.py diff --git a/setup.py b/setup.py index c7804d1534..cfd59c47d2 100644 --- a/setup.py +++ b/setup.py @@ -46,9 +46,9 @@ setup(name="Cura", author_email="d.braam@ultimaker.com", url="http://software.ultimaker.com/", license="GNU AFFERO GENERAL PUBLIC LICENSE (AGPL)", - scripts=["cura.py"], + scripts=["cura_app.py"], #windows=[{"script": "printer.py", "dest_name": "Cura"}], - console=[{"script": "cura.py"}], + console=[{"script": "cura_app.py"}], options={"py2exe": {"skip_archive": False, "includes": includes}}) print("Coping Cura plugins.") From 5762b2dfe8d2ced34fd83c10bf5a75d9e2f4b2b4 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 26 May 2015 11:05:37 +0200 Subject: [PATCH 11/12] Install the right source files --- CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c13e3e2eea..8fee919062 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,6 +56,7 @@ set(PYTHON_SITE_PACKAGES_DIR ${CMAKE_INSTALL_LIBDIR}/python${PYTHON_VERSION_MAJO install(DIRECTORY resources DESTINATION ${CMAKE_INSTALL_DATADIR}/cura) file(GLOB cura_plugins_SRCS plugins/*) install(DIRECTORY ${cura_plugins_SRCS} DESTINATION ${CMAKE_INSTALL_LIBDIR}/cura) -file(GLOB cura_SRCS src/*) +file(GLOB cura_SRCS cura/*) install(FILES ${cura_SRCS} DESTINATION ${PYTHON_SITE_PACKAGES_DIR}/cura) -install(FILES cura_app.py DESTINATION ${CMAKE_INSTALL_BINDIR}) \ No newline at end of file +install(FILES cura_app.py DESTINATION ${CMAKE_INSTALL_BINDIR}) + From 27e734edb7e9b36c8837697abd554e3f40a326e6 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 26 May 2015 17:12:57 +0200 Subject: [PATCH 12/12] Install the entire plugins directory into $prefix/lib/cura instead of just the contents This makes it easier to add the directory to the plugin search paths. Contributes to Ultimaker/Uranium#41 --- CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8fee919062..4cbb9aebc0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,8 +54,7 @@ find_package(PythonInterp 3.4.0 REQUIRED) set(PYTHON_SITE_PACKAGES_DIR ${CMAKE_INSTALL_LIBDIR}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages CACHE PATH "Install location of Python package") install(DIRECTORY resources DESTINATION ${CMAKE_INSTALL_DATADIR}/cura) -file(GLOB cura_plugins_SRCS plugins/*) -install(DIRECTORY ${cura_plugins_SRCS} DESTINATION ${CMAKE_INSTALL_LIBDIR}/cura) +install(DIRECTORY plugins DESTINATION ${CMAKE_INSTALL_LIBDIR}/cura) file(GLOB cura_SRCS cura/*) install(FILES ${cura_SRCS} DESTINATION ${PYTHON_SITE_PACKAGES_DIR}/cura) install(FILES cura_app.py DESTINATION ${CMAKE_INSTALL_BINDIR})