Skip to content

Commit

Permalink
Merge pull request #4748 from steelman/material-color-dialog
Browse files Browse the repository at this point in the history
Arch: Fix material color pickers
  • Loading branch information
yorikvanhavre committed Apr 22, 2021
2 parents 80728ed + c7b1e35 commit 819e15a
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/Mod/Arch/ArchMaterial.py
Expand Up @@ -645,18 +645,20 @@ def setFather(self,text):
self.material["Father"] = text

def getColor(self):
"opens a color picker dialog"
color = QtGui.QColorDialog.getColor()
colorPix = QtGui.QPixmap(16,16)
colorPix.fill(color)
self.form.ButtonColor.setIcon(QtGui.QIcon(colorPix))
self.getColorForButton(self.form.ButtonColor)

def getSectionColor(self):
self.getColorForButton(self.form.ButtonSectionColor)

def getColorForButton(self,button):
"opens a color picker dialog"
color = QtGui.QColorDialog.getColor()
colorPix = QtGui.QPixmap(16,16)
colorPix.fill(color)
self.form.ButtonSectionColor.setIcon(QtGui.QIcon(colorPix))
icon = button.icon()
pixel = icon.pixmap(16,16).toImage().pixel(0,0)
color = QtGui.QColorDialog.getColor(QtGui.QColor(pixel))
if color.isValid():
colorPix = QtGui.QPixmap(16,16)
colorPix.fill(color)
button.setIcon(QtGui.QIcon(colorPix))

def fillMaterialCombo(self):
"fills the combo with the existing FCMat cards"
Expand Down

0 comments on commit 819e15a

Please sign in to comment.