Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLipu Fei <lipu.fei815@gmail.com>2019-04-29 15:33:48 +0300
committerLipu Fei <lipu.fei815@gmail.com>2019-04-29 16:53:08 +0300
commitd16da3da3ad207915b9d55abb37f902461249bf0 (patch)
tree88ad10fee5d8ebc3e1ef0a8487cf0ef291c01157 /plugins/VersionUpgrade/VersionUpgrade40to41
parent56c0cae71f764f6a7e94d1cc757395a85bc6f0e2 (diff)
Add group_id and fix remove printer
CURA-6483 - Added a unique group_id (a GUID) to all created GlobalStack. - Changed version upgrade to generate unique group_ids for GlobalStacks. - RemoveMachine() now uses group_ids to remove hidden GlobalStacks.
Diffstat (limited to 'plugins/VersionUpgrade/VersionUpgrade40to41')
-rw-r--r--plugins/VersionUpgrade/VersionUpgrade40to41/VersionUpgrade40to41.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/plugins/VersionUpgrade/VersionUpgrade40to41/VersionUpgrade40to41.py b/plugins/VersionUpgrade/VersionUpgrade40to41/VersionUpgrade40to41.py
index 03272e63d5..845e9cbb8c 100644
--- a/plugins/VersionUpgrade/VersionUpgrade40to41/VersionUpgrade40to41.py
+++ b/plugins/VersionUpgrade/VersionUpgrade40to41/VersionUpgrade40to41.py
@@ -3,6 +3,7 @@
import configparser
import io
+import uuid
from typing import Dict, List, Tuple
from UM.VersionUpgrade import VersionUpgrade
@@ -18,6 +19,7 @@ _renamed_quality_profiles = {
"gmax15plus_pla_very_thick": "gmax15plus_global_very_thick"
} # type: Dict[str, str]
+
## Upgrades configurations from the state they were in at version 4.0 to the
# state they should be in at version 4.1.
class VersionUpgrade40to41(VersionUpgrade):
@@ -95,6 +97,13 @@ class VersionUpgrade40to41(VersionUpgrade):
if parser["containers"]["4"] in _renamed_quality_profiles:
parser["containers"]["4"] = _renamed_quality_profiles[parser["containers"]["4"]]
+ # Assign a GlobalStack to a unique group_id. If the GlobalStack has a UM network connection, use the UM network
+ # key as the group_id.
+ if "um_network_key" in parser["metadata"]:
+ parser["metadata"]["group_id"] = parser["metadata"]["um_network_key"]
+ elif "group_id" not in parser["metadata"]:
+ parser["metadata"]["group_id"] = str(uuid.uuid4())
+
result = io.StringIO()
parser.write(result)
return [filename], [result.getvalue()]