Skip to content

Commit

Permalink
Merge pull request #4140 from gauna85/PathStock
Browse files Browse the repository at this point in the history
Path: Fix #3914: Adding stock label prefix to name comparison in orde…
  • Loading branch information
sliptonic committed Jan 27, 2021
2 parents 9f5acaa + 6752ff8 commit ef2e209
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Mod/Path/PathScripts/PathJobGui.py
Expand Up @@ -522,6 +522,7 @@ def setupUi(self, obj):
class StockFromExistingEdit(StockEdit):
Index = 3
StockType = PathStock.StockType.Unknown
StockLabelPrefix = 'Stock'

def editorFrame(self):
return self.form.stockFromExisting
Expand All @@ -530,7 +531,7 @@ def getFields(self, obj):
stock = self.form.stockExisting.itemData(self.form.stockExisting.currentIndex())
if not (hasattr(obj.Stock, 'Objects') and len(obj.Stock.Objects) == 1 and obj.Stock.Objects[0] == stock):
if stock:
stock = PathJob.createResourceClone(obj, stock, 'Stock', 'Stock')
stock = PathJob.createResourceClone(obj, stock, self.StockLabelPrefix , 'Stock')
stock.ViewObject.Visibility = True
PathStock.SetupStockObject(stock, PathStock.StockType.Unknown)
stock.Proxy.execute(stock)
Expand All @@ -556,7 +557,9 @@ def setFields(self, obj):
index = -1
for i, solid in enumerate(self.candidates(obj)):
self.form.stockExisting.addItem(solid.Label, solid)
if solid.Label == stockName:
label="{}-{}".format(self.StockLabelPrefix, solid.Label)

if label == stockName:
index = i
self.form.stockExisting.setCurrentIndex(index if index != -1 else 0)

Expand Down

0 comments on commit ef2e209

Please sign in to comment.