本文整理汇总了Python中PM.PM_ComboBox.PM_ComboBox.setItemIcon方法的典型用法代码示例。如果您正苦于以下问题:Python PM_ComboBox.setItemIcon方法的具体用法?Python PM_ComboBox.setItemIcon怎么用?Python PM_ComboBox.setItemIcon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PM.PM_ComboBox.PM_ComboBox
的用法示例。
在下文中一共展示了PM_ComboBox.setItemIcon方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ColorScheme_PropertyManager
# 需要导入模块: from PM.PM_ComboBox import PM_ComboBox [as 别名]
# 或者: from PM.PM_ComboBox.PM_ComboBox import setItemIcon [as 别名]
#.........这里部分代码省略.........
self.win.glpane.setBackgroundColor(white)
elif idx == bg_GRAY:
self.win.glpane.setBackgroundColor(gray)
elif idx == bg_CUSTOM:
#change background color to Custom Color
self.chooseCustomBackgroundColor()
else:
msg = "Unknown color idx=", idx
print_compact_traceback(msg)
self.win.glpane.gl_update() # Needed!
return
def chooseCustomBackgroundColor(self):
"""
Choose a custom background color.
"""
c = QColorDialog.getColor(RGBf_to_QColor(self.win.glpane.getBackgroundColor()), self)
if c.isValid():
self.win.glpane.setBackgroundColor(QColor_to_RGBf(c))
self.updateCustomColorItemIcon(c)
else:
# User cancelled. Need to reset combobox to correct index.
self._updateBackgroundColorComboBoxIndex()
return
def updateCustomColorItemIcon(self, qcolor):
"""
Update the custom color item icon in the background color combobox
with I{qcolor}.
"""
pixmap = QPixmap(16, 16)
pixmap.fill(qcolor)
self.backgroundColorComboBox.setItemIcon(bg_CUSTOM, QIcon(pixmap))
return
def applyFavorite(self):
"""
Apply the color scheme settings stored in the current favorite
(selected in the combobox) to the current color scheme settings.
"""
# Rules and other info:
# The user has to press the button related to this method when he loads
# a previously saved favorite file
current_favorite = self.favoritesComboBox.currentText()
if current_favorite == 'Factory default settings':
env.prefs.restore_defaults(colorSchemePrefsList)
# set it back to blue sky
self.win.glpane.setBackgroundGradient(1)
else:
favfilepath = getFavoritePathFromBasename(current_favorite)
loadFavoriteFile(favfilepath)
if env.prefs[backgroundGradient_prefs_key]:
self.win.glpane.setBackgroundGradient(env.prefs[backgroundGradient_prefs_key])
else:
self.win.glpane.setBackgroundColor(env.prefs[backgroundColor_prefs_key])
#self.hoverHighlightingColorComboBox.setColor(env.prefs[hoverHighlightingColor_prefs_key])
#self.selectionColorComboBox.setColor(env.prefs[selectionColor_prefs_key])
self._updateAllWidgets()
self.win.glpane.gl_update()
return
def addFavorite(self):
"""
Adds a new favorite to the user's list of favorites.