diff --git a/CMakeLists.txt b/CMakeLists.txt index deb4e63935..be6c9d938e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,7 @@ if(CURA_DEBUGMODE) set(_cura_debugmode "ON") endif() +set(CURA_APP_NAME "cura" CACHE STRING "Short name of Cura, used for configuration folder") set(CURA_APP_DISPLAY_NAME "Ultimaker Cura" CACHE STRING "Display name of Cura") set(CURA_VERSION "master" CACHE STRING "Version name of Cura") set(CURA_BUILDTYPE "" CACHE STRING "Build type of Cura, eg. 'PPA'") diff --git a/cura/ApplicationMetadata.py b/cura/ApplicationMetadata.py index 4cb19edb72..153674d4dd 100644 --- a/cura/ApplicationMetadata.py +++ b/cura/ApplicationMetadata.py @@ -4,12 +4,20 @@ # --------- # Genearl constants used in Cura # --------- +DEFAULT_CURA_APP_NAME = "cura" DEFAULT_CURA_DISPLAY_NAME = "Ultimaker Cura" DEFAULT_CURA_VERSION = "master" DEFAULT_CURA_BUILD_TYPE = "" DEFAULT_CURA_DEBUG_MODE = False DEFAULT_CURA_SDK_VERSION = "6.0.0" +try: + from cura.CuraVersion import CuraAppName # type: ignore + if CuraAppName == "": + CuraAppName = DEFAULT_CURA_APP_NAME +except ImportError: + CuraAppName = DEFAULT_CURA_APP_NAME + try: from cura.CuraVersion import CuraAppDisplayName # type: ignore if CuraAppDisplayName == "": diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index c56c77e9f1..aeb26e9713 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -156,7 +156,7 @@ class CuraApplication(QtApplication): Q_ENUMS(ResourceTypes) def __init__(self, *args, **kwargs): - super().__init__(name = "cura", + super().__init__(name = ApplicationMetadata.CuraAppName, app_display_name = ApplicationMetadata.CuraAppDisplayName, version = ApplicationMetadata.CuraVersion, api_version = ApplicationMetadata.CuraSDKVersion, diff --git a/cura/CuraVersion.py.in b/cura/CuraVersion.py.in index 770a0efd7b..1a500df248 100644 --- a/cura/CuraVersion.py.in +++ b/cura/CuraVersion.py.in @@ -1,6 +1,7 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. +CuraAppName = "@CURA_APP_NAME@" CuraAppDisplayName = "@CURA_APP_DISPLAY_NAME@" CuraVersion = "@CURA_VERSION@" CuraBuildType = "@CURA_BUILDTYPE@" diff --git a/cura_app.py b/cura_app.py index 8df12d771a..3224a5b99b 100755 --- a/cura_app.py +++ b/cura_app.py @@ -9,6 +9,7 @@ import os import sys from UM.Platform import Platform +from cura.ApplicationMetadata import CuraAppName parser = argparse.ArgumentParser(prog = "cura", add_help = False) @@ -22,11 +23,11 @@ known_args = vars(parser.parse_known_args()[0]) if not known_args["debug"]: def get_cura_dir_path(): if Platform.isWindows(): - return os.path.expanduser("~/AppData/Roaming/cura") + return os.path.expanduser("~/AppData/Roaming/" + CuraAppName) elif Platform.isLinux(): - return os.path.expanduser("~/.local/share/cura") + return os.path.expanduser("~/.local/share/" + CuraAppName) elif Platform.isOSX(): - return os.path.expanduser("~/Library/Logs/cura") + return os.path.expanduser("~/Library/Logs/" + CuraAppName) if hasattr(sys, "frozen"): dirpath = get_cura_dir_path() diff --git a/plugins/PostProcessingPlugin/scripts/FilamentChange.py b/plugins/PostProcessingPlugin/scripts/FilamentChange.py index ed0f6eb174..febb93be4c 100644 --- a/plugins/PostProcessingPlugin/scripts/FilamentChange.py +++ b/plugins/PostProcessingPlugin/scripts/FilamentChange.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 Ultimaker B.V. +# Copyright (c) 2019 Ultimaker B.V. # The PostProcessingPlugin is released under the terms of the AGPLv3 or higher. from typing import Optional, Tuple @@ -45,6 +45,22 @@ class FilamentChange(Script): "unit": "mm", "type": "float", "default_value": 300.0 + }, + "x_position": + { + "label": "X Position", + "description": "Extruder X position. The print head will move here for filament change.", + "unit": "mm", + "type": "float", + "default_value": 0 + }, + "y_position": + { + "label": "Y Position", + "description": "Extruder Y position. The print head will move here for filament change.", + "unit": "mm", + "type": "float", + "default_value": 0 } } }""" @@ -55,6 +71,8 @@ class FilamentChange(Script): layer_nums = self.getSettingValueByKey("layer_number") initial_retract = self.getSettingValueByKey("initial_retract") later_retract = self.getSettingValueByKey("later_retract") + x_pos = self.getSettingValueByKey("x_position") + y_pos = self.getSettingValueByKey("y_position") color_change = "M600" @@ -64,6 +82,12 @@ class FilamentChange(Script): if later_retract is not None and later_retract > 0.: color_change = color_change + (" L%.2f" % later_retract) + if x_pos is not None: + color_change = color_change + (" X%.2f" % x_pos) + + if y_pos is not None: + color_change = color_change + (" Y%.2f" % y_pos) + color_change = color_change + " ; Generated by FilamentChange plugin" layer_targets = layer_nums.split(",")