78 colorKey = button.property("colorKey") |
78 colorKey = button.property("colorKey") |
79 hasAlpha = button.property("hasAlpha") |
79 hasAlpha = button.property("hasAlpha") |
80 |
80 |
81 if hasAlpha: |
81 if hasAlpha: |
82 colour = QColorDialog.getColor( |
82 colour = QColorDialog.getColor( |
83 self.__coloursDict[colorKey][0], None, "", |
83 self.__coloursDict[colorKey][0], self, "", |
84 QColorDialog.ShowAlphaChannel) |
84 QColorDialog.ShowAlphaChannel) |
85 else: |
85 else: |
86 colour = QColorDialog.getColor(self.__coloursDict[colorKey][0]) |
86 colour = QColorDialog.getColor(self.__coloursDict[colorKey][0], |
|
87 self) |
87 if colour.isValid(): |
88 if colour.isValid(): |
88 size = button.iconSize() |
89 size = button.iconSize() |
89 pm = QPixmap(size.width(), size.height()) |
90 pm = QPixmap(size.width(), size.height()) |
90 pm.fill(colour) |
91 pm.fill(colour) |
91 button.setIcon(QIcon(pm)) |
92 button.setIcon(QIcon(pm)) |
111 @param fontVar reference to the variable containing the font (QFont) |
112 @param fontVar reference to the variable containing the font (QFont) |
112 @param showFontInfo flag indicating to show some font info |
113 @param showFontInfo flag indicating to show some font info |
113 as the sample (boolean) |
114 as the sample (boolean) |
114 @return selected font (QFont) |
115 @return selected font (QFont) |
115 """ |
116 """ |
116 font, ok = QFontDialog.getFont(fontVar) |
117 font, ok = QFontDialog.getFont(fontVar, self) |
117 if ok: |
118 if ok: |
118 fontSample.setFont(font) |
119 fontSample.setFont(font) |
119 if showFontInfo: |
120 if showFontInfo: |
120 fontSample.setText( |
121 fontSample.setText( |
121 "{0} {1}".format(font.family(), font.pointSize())) |
122 "{0} {1}".format(font.family(), font.pointSize())) |