From e66875865ff81ee9f32b92e4d1ece33ff13bb8fd Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Tue, 13 Nov 2018 16:08:29 +0100 Subject: [PATCH 1/3] Make Cura app name configurable in CuraVersion --- CMakeLists.txt | 1 + cura/CuraApplication.py | 5 +++-- cura/CuraVersion.py.in | 1 + cura_app.py | 11 ++++++++--- 4 files changed, 13 insertions(+), 5 deletions(-) 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/CuraApplication.py b/cura/CuraApplication.py index 47cc94f972..bfc2c8bddc 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -128,8 +128,9 @@ if TYPE_CHECKING: numpy.seterr(all = "ignore") try: - from cura.CuraVersion import CuraAppDisplayName, CuraVersion, CuraBuildType, CuraDebugMode, CuraSDKVersion # type: ignore + from cura.CuraVersion import CuraAppName, CuraAppDisplayName, CuraVersion, CuraBuildType, CuraDebugMode, CuraSDKVersion # type: ignore except ImportError: + CuraAppName = "cura" CuraAppDisplayName = "Ultimaker Cura" CuraVersion = "master" # [CodeStyle: Reflecting imported value] CuraBuildType = "" @@ -161,7 +162,7 @@ class CuraApplication(QtApplication): Q_ENUMS(ResourceTypes) def __init__(self, *args, **kwargs): - super().__init__(name = "cura", + super().__init__(name = CuraAppName, app_display_name = CuraAppDisplayName, version = CuraVersion, api_version = CuraSDKVersion, diff --git a/cura/CuraVersion.py.in b/cura/CuraVersion.py.in index 7c6304231d..f4c02ee396 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 164e32e738..fea47e5a8b 100755 --- a/cura_app.py +++ b/cura_app.py @@ -26,13 +26,18 @@ parser.add_argument("--trigger-early-crash", known_args = vars(parser.parse_known_args()[0]) if not known_args["debug"]: + try: + from cura.CuraVersion import CuraAppName # type: ignore + except ImportError: + CuraAppName = "cura" + 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() From 7b1e20c95549a430a0751234c122ec38d26053d5 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Fri, 18 Jan 2019 12:21:19 +0100 Subject: [PATCH 2/3] Fix typo --- cura/ApplicationMetadata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/ApplicationMetadata.py b/cura/ApplicationMetadata.py index a38466a715..153674d4dd 100644 --- a/cura/ApplicationMetadata.py +++ b/cura/ApplicationMetadata.py @@ -4,7 +4,7 @@ # --------- # Genearl constants used in Cura # --------- -DEFAUKT_CURA_APP_NAME = "cura" +DEFAULT_CURA_APP_NAME = "cura" DEFAULT_CURA_DISPLAY_NAME = "Ultimaker Cura" DEFAULT_CURA_VERSION = "master" DEFAULT_CURA_BUILD_TYPE = "" From 9d02086585c2e05a44e96b75cc2c1475417ca076 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Fri, 18 Jan 2019 12:22:07 +0100 Subject: [PATCH 3/3] Get app name from ApplicationMetaData --- cura_app.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cura_app.py b/cura_app.py index bd6136f982..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) @@ -20,11 +21,6 @@ parser.add_argument("--debug", known_args = vars(parser.parse_known_args()[0]) if not known_args["debug"]: - try: - from cura.CuraVersion import CuraAppName # type: ignore - except ImportError: - CuraAppName = "cura" - def get_cura_dir_path(): if Platform.isWindows(): return os.path.expanduser("~/AppData/Roaming/" + CuraAppName)