mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 07:27:29 -06:00
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.
This commit is contained in:
parent
56c0cae71f
commit
d16da3da3a
3 changed files with 16 additions and 3 deletions
|
@ -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()]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue