Ultimaker / Uranium

A Python framework for building Desktop applications.
GNU Lesser General Public License v3.0
328 stars 186 forks source link

QoL: uniqueName function always returns a name with count starting from 2 #840

Open DragRedSim opened 2 years ago

DragRedSim commented 2 years ago

A small thing, but I was finding it really annoying when trying to write a definition.

https://github.com/Ultimaker/Uranium/blob/925e1f045cc517ba22f8597495d4d4c8b084d5da/UM/Settings/ContainerRegistry.py#L717-L722

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.

nicholaslopiccolo commented 1 year ago

Hello, thanks for opening the issue. Did you open a pull request for this?