本文整理汇总了Python中PyQt4.Qt.QPalette.brush方法的典型用法代码示例。如果您正苦于以下问题:Python QPalette.brush方法的具体用法?Python QPalette.brush怎么用?Python QPalette.brush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.Qt.QPalette
的用法示例。
在下文中一共展示了QPalette.brush方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load_calibre_style
# 需要导入模块: from PyQt4.Qt import QPalette [as 别名]
# 或者: from PyQt4.Qt.QPalette import brush [as 别名]
def load_calibre_style(self):
# On OS X QtCurve resets the palette, so we preserve it explicitly
orig_pal = QPalette(self.palette())
path = os.path.join(sys.extensions_location, 'calibre_style.'+(
'pyd' if iswindows else 'so'))
if not self.pi.load_style(path, 'Calibre'):
prints('Failed to load calibre style')
# On OSX, on some machines, colors can be invalid. See https://bugs.launchpad.net/bugs/1014900
for role in (orig_pal.Button, orig_pal.Window):
c = orig_pal.brush(role).color()
if not c.isValid() or not c.toRgb().isValid():
orig_pal.setColor(role, QColor(u'lightgray'))
self.setPalette(orig_pal)
style = self.style()
icon_map = {}
pcache = {}
for k, v in {
'DialogYesButton': u'ok.png',
'DialogNoButton': u'window-close.png',
'DialogCloseButton': u'window-close.png',
'DialogOkButton': u'ok.png',
'DialogCancelButton': u'window-close.png',
'DialogHelpButton': u'help.png',
'DialogOpenButton': u'document_open.png',
'DialogSaveButton': u'save.png',
'DialogApplyButton': u'ok.png',
'DialogDiscardButton': u'trash.png',
'MessageBoxInformation': u'dialog_information.png',
'MessageBoxWarning': u'dialog_warning.png',
'MessageBoxCritical': u'dialog_error.png',
'MessageBoxQuestion': u'dialog_question.png',
'BrowserReload': u'view-refresh.png',
# These two are used to calculate the sizes for the doc widget
# title bar buttons, therefore, they have to exist. The actual
# icon is not used.
'TitleBarCloseButton': u'window-close.png',
'TitleBarNormalButton': u'window-close.png',
'DockWidgetCloseButton': u'window-close.png',
}.iteritems():
if v not in pcache:
p = I(v)
if isinstance(p, bytes):
p = p.decode(filesystem_encoding)
# if not os.path.exists(p): raise ValueError(p)
pcache[v] = p
v = pcache[v]
icon_map[type('')(getattr(style, 'SP_'+k))] = v
style.setProperty(u'calibre_icon_map', icon_map)
self.__icon_map_memory_ = icon_map