mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 20:48:59 +08:00
Merge pull request #4788 from fieldOfView/feature_curaversion_appname
Make Cura app name configurable in CuraVersion
This commit is contained in:
commit
c568759fbc
@ -17,6 +17,7 @@ if(CURA_DEBUGMODE)
|
|||||||
set(_cura_debugmode "ON")
|
set(_cura_debugmode "ON")
|
||||||
endif()
|
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_APP_DISPLAY_NAME "Ultimaker Cura" CACHE STRING "Display name of Cura")
|
||||||
set(CURA_VERSION "master" CACHE STRING "Version name of Cura")
|
set(CURA_VERSION "master" CACHE STRING "Version name of Cura")
|
||||||
set(CURA_BUILDTYPE "" CACHE STRING "Build type of Cura, eg. 'PPA'")
|
set(CURA_BUILDTYPE "" CACHE STRING "Build type of Cura, eg. 'PPA'")
|
||||||
|
@ -4,12 +4,20 @@
|
|||||||
# ---------
|
# ---------
|
||||||
# Genearl constants used in Cura
|
# Genearl constants used in Cura
|
||||||
# ---------
|
# ---------
|
||||||
|
DEFAULT_CURA_APP_NAME = "cura"
|
||||||
DEFAULT_CURA_DISPLAY_NAME = "Ultimaker Cura"
|
DEFAULT_CURA_DISPLAY_NAME = "Ultimaker Cura"
|
||||||
DEFAULT_CURA_VERSION = "master"
|
DEFAULT_CURA_VERSION = "master"
|
||||||
DEFAULT_CURA_BUILD_TYPE = ""
|
DEFAULT_CURA_BUILD_TYPE = ""
|
||||||
DEFAULT_CURA_DEBUG_MODE = False
|
DEFAULT_CURA_DEBUG_MODE = False
|
||||||
DEFAULT_CURA_SDK_VERSION = "6.0.0"
|
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:
|
try:
|
||||||
from cura.CuraVersion import CuraAppDisplayName # type: ignore
|
from cura.CuraVersion import CuraAppDisplayName # type: ignore
|
||||||
if CuraAppDisplayName == "":
|
if CuraAppDisplayName == "":
|
||||||
|
@ -156,7 +156,7 @@ class CuraApplication(QtApplication):
|
|||||||
Q_ENUMS(ResourceTypes)
|
Q_ENUMS(ResourceTypes)
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(name = "cura",
|
super().__init__(name = ApplicationMetadata.CuraAppName,
|
||||||
app_display_name = ApplicationMetadata.CuraAppDisplayName,
|
app_display_name = ApplicationMetadata.CuraAppDisplayName,
|
||||||
version = ApplicationMetadata.CuraVersion,
|
version = ApplicationMetadata.CuraVersion,
|
||||||
api_version = ApplicationMetadata.CuraSDKVersion,
|
api_version = ApplicationMetadata.CuraSDKVersion,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# Copyright (c) 2018 Ultimaker B.V.
|
# Copyright (c) 2018 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
|
CuraAppName = "@CURA_APP_NAME@"
|
||||||
CuraAppDisplayName = "@CURA_APP_DISPLAY_NAME@"
|
CuraAppDisplayName = "@CURA_APP_DISPLAY_NAME@"
|
||||||
CuraVersion = "@CURA_VERSION@"
|
CuraVersion = "@CURA_VERSION@"
|
||||||
CuraBuildType = "@CURA_BUILDTYPE@"
|
CuraBuildType = "@CURA_BUILDTYPE@"
|
||||||
|
@ -9,6 +9,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
from UM.Platform import Platform
|
from UM.Platform import Platform
|
||||||
|
from cura.ApplicationMetadata import CuraAppName
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(prog = "cura",
|
parser = argparse.ArgumentParser(prog = "cura",
|
||||||
add_help = False)
|
add_help = False)
|
||||||
@ -22,11 +23,11 @@ known_args = vars(parser.parse_known_args()[0])
|
|||||||
if not known_args["debug"]:
|
if not known_args["debug"]:
|
||||||
def get_cura_dir_path():
|
def get_cura_dir_path():
|
||||||
if Platform.isWindows():
|
if Platform.isWindows():
|
||||||
return os.path.expanduser("~/AppData/Roaming/cura")
|
return os.path.expanduser("~/AppData/Roaming/" + CuraAppName)
|
||||||
elif Platform.isLinux():
|
elif Platform.isLinux():
|
||||||
return os.path.expanduser("~/.local/share/cura")
|
return os.path.expanduser("~/.local/share/" + CuraAppName)
|
||||||
elif Platform.isOSX():
|
elif Platform.isOSX():
|
||||||
return os.path.expanduser("~/Library/Logs/cura")
|
return os.path.expanduser("~/Library/Logs/" + CuraAppName)
|
||||||
|
|
||||||
if hasattr(sys, "frozen"):
|
if hasattr(sys, "frozen"):
|
||||||
dirpath = get_cura_dir_path()
|
dirpath = get_cura_dir_path()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user