mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 22:54:01 -06:00
Fixed code style and machine default name is retrieved from machine definition
CURA-4345
This commit is contained in:
parent
89de83254d
commit
3082038261
3 changed files with 7 additions and 8 deletions
|
@ -21,7 +21,7 @@ class CuraStackBuilder:
|
|||
#
|
||||
# \return The new global stack or None if an error occurred.
|
||||
@classmethod
|
||||
def createMachine(cls, name: str, definition_id: str, default_name: str) -> Optional[GlobalStack]:
|
||||
def createMachine(cls, name: str, definition_id: str) -> Optional[GlobalStack]:
|
||||
registry = ContainerRegistry.getInstance()
|
||||
definitions = registry.findDefinitionContainers(id = definition_id)
|
||||
if not definitions:
|
||||
|
@ -29,7 +29,7 @@ class CuraStackBuilder:
|
|||
return None
|
||||
|
||||
machine_definition = definitions[0]
|
||||
generated_name = registry.createUniqueName("machine", "", default_name, machine_definition.name)
|
||||
generated_name = registry.createUniqueName("machine", "", machine_definition.name, machine_definition.name)
|
||||
# Make sure the new name does not collide with any definition or (quality) profile
|
||||
# createUniqueName() only looks at other stacks, but not at definitions or quality profiles
|
||||
# Note that we don't go for uniqueName() immediately because that function matches with ignore_case set to true
|
||||
|
@ -45,7 +45,7 @@ class CuraStackBuilder:
|
|||
)
|
||||
|
||||
# after creating a global stack can be set custom defined name
|
||||
if(name != generated_name):
|
||||
if name != generated_name:
|
||||
name = registry.createUniqueName("machine", "", name, machine_definition.name)
|
||||
if registry.findContainers(id = name):
|
||||
name = registry.uniqueName(name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue