A small thing, but I was finding it really annoying when trying to write a definition.
|
unique_name = name |
|
i = 1 |
|
while self.findContainersMetadata(id = unique_name, ignore_case = True) or self.findContainersMetadata(name = unique_name): #A container already has this name. |
|
i += 1 #Try next numbering. |
|
unique_name = "%s #%d" % (name, i) #Fill name like this: "Extruder #2". |
|
return unique_name |
Since the while loop adds one before the function generates a new name, if the loop is entered, it will never give a string with the value #1 at the end.
Fixed either by changing the initialisation on L718 to i = 0, or by swapping the order of lines 720 and 721; in this case, i will be raised after every test, but only compiled into the string with a new value if the first fails.
A small thing, but I was finding it really annoying when trying to write a definition.
Uranium/UM/Settings/ContainerRegistry.py
Lines 717 to 722 in 925e1f0
Since the while loop adds one before the function generates a new name, if the loop is entered, it will never give a string with the value
#1at the end.Fixed either by changing the initialisation on L718 to
i = 0, or by swapping the order of lines 720 and 721; in this case,iwill be raised after every test, but only compiled into the string with a new value if the first fails.