Browse Source

Make Cura app name configurable in CuraVersion

fieldOfView 6 years ago
parent
commit
e66875865f
4 changed files with 13 additions and 5 deletions
  1. 1 0
      CMakeLists.txt
  2. 3 2
      cura/CuraApplication.py
  3. 1 0
      cura/CuraVersion.py.in
  4. 8 3
      cura_app.py

+ 1 - 0
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'")

+ 3 - 2
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,

+ 1 - 0
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@"

+ 8 - 3
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()