BIM: Fixed material dialog's merge duplicates button - fixes #20124
This commit is contained in:
committed by
Chris Hennes
parent
a32478349b
commit
d8ceec8fba
@@ -150,7 +150,10 @@ class BIM_Material:
|
||||
)
|
||||
buttonMergeDupes.setIcon(QtGui.QIcon(":/icons/view-refresh.svg"))
|
||||
createButtonsLayout.addWidget(buttonMergeDupes, 1, 0)
|
||||
self.dlg.buttonMergeDupes = buttonMergeDupes
|
||||
buttonMergeDupes.clicked.connect(self.onMergeDupes)
|
||||
if len(self.dlg.materials) < 2:
|
||||
buttonMergeDupes.setEnabled(False)
|
||||
|
||||
# delete unused
|
||||
buttonDeleteUnused = QtGui.QPushButton(
|
||||
@@ -208,20 +211,15 @@ class BIM_Material:
|
||||
first = True
|
||||
for mat in self.dlg.materials:
|
||||
orig = None
|
||||
for om in mats:
|
||||
if om.Label == mat.Label:
|
||||
orig = om
|
||||
break
|
||||
else:
|
||||
if (
|
||||
mat.Label[-1].isdigit()
|
||||
and mat.Label[-2].isdigit()
|
||||
and mat.Label[-3].isdigit()
|
||||
):
|
||||
for om in self.dlg.materials:
|
||||
if om.Label == mat.Label[:-3].strip():
|
||||
orig = om
|
||||
break
|
||||
if (
|
||||
mat.Label[-1].isdigit()
|
||||
and mat.Label[-2].isdigit()
|
||||
and mat.Label[-3].isdigit()
|
||||
):
|
||||
for om in self.dlg.materials:
|
||||
if om.Label == mat.Label[:-3].strip():
|
||||
orig = om
|
||||
break
|
||||
if orig:
|
||||
for par in mat.InList:
|
||||
for prop in par.PropertiesList:
|
||||
@@ -522,6 +520,11 @@ class BIM_Material:
|
||||
i.setFlags(i.flags() | QtCore.Qt.ItemIsEditable)
|
||||
if o.Name == name:
|
||||
self.dlg.matList.setCurrentItem(i)
|
||||
if hasattr(self.dlg, "buttonMergeDupes"):
|
||||
if len(self.dlg.materials) > 1:
|
||||
self.dlg.buttonMergeDupes.setEnabled(True)
|
||||
else:
|
||||
self.dlg.buttonMergeDupes.setEnabled(False)
|
||||
|
||||
def createIcon(self, obj):
|
||||
from PySide import QtCore, QtGui
|
||||
|
||||
Reference in New Issue
Block a user