本文整理汇总了Python中PySide.QtGui.QIcon.addPixmap方法的典型用法代码示例。如果您正苦于以下问题:Python QIcon.addPixmap方法的具体用法?Python QIcon.addPixmap怎么用?Python QIcon.addPixmap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QIcon
的用法示例。
在下文中一共展示了QIcon.addPixmap方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: apply_status_to_icon
# 需要导入模块: from PySide.QtGui import QIcon [as 别名]
# 或者: from PySide.QtGui.QIcon import addPixmap [as 别名]
def apply_status_to_icon(icon, index_status, work_tree_status):
result = QIcon()
overlay = status_icon[index_status, work_tree_status]
for size in icon.availableSizes():
pixmap = icon.pixmap(size).copy()
x, y = (size - overlay.size()).toTuple()
QPainter(pixmap).drawPixmap(x, y, overlay)
result.addPixmap(pixmap)
return result
示例2: __init__
# 需要导入模块: from PySide.QtGui import QIcon [as 别名]
# 或者: from PySide.QtGui.QIcon import addPixmap [as 别名]
def __init__(self, parent=None):
super(About, self).__init__(parent)
icon = QIcon()
icon.addPixmap(
QPixmap(":/Images/aktools_48x48.png"), QIcon.Normal, QIcon.Off)
self.setWindowIcon(icon)
self.setWindowTitle("Tietoja")
label = QLabel("Tehnyt: Aleksi Kauppila 2014")
layout = QVBoxLayout()
layout.addWidget(label)
self.setLayout(layout)
示例3: __getitem__
# 需要导入模块: from PySide.QtGui import QIcon [as 别名]
# 或者: from PySide.QtGui.QIcon import addPixmap [as 别名]
def __getitem__(self, path):
icon = QIcon()
has_images = False
with disposable_hicon(get_file_icon(path)) as hicon:
pixmap = pixmap_from_hicon(hicon)
if pixmap:
icon.addPixmap(pixmap)
has_images = True
with disposable_hicon(get_file_icon(path, large=True)) as hicon:
pixmap = pixmap_from_hicon(hicon)
if pixmap:
icon.addPixmap(pixmap)
has_images = True
if has_images: return icon
return self.qt_provider.icon(QFileIconProvider.File)
示例4: ChangeButton
# 需要导入模块: from PySide.QtGui import QIcon [as 别名]
# 或者: from PySide.QtGui.QIcon import addPixmap [as 别名]
def ChangeButton(self, buttonChosen, imageOpen):
icon = QIcon()
icon.addPixmap(QPixmap(":/icons/assets/drawable/" + imageOpen + ".png"), QIcon.Normal, QIcon.Off)
buttonChosen.setIcon(icon)
示例5: setupUi
# 需要导入模块: from PySide.QtGui import QIcon [as 别名]
# 或者: from PySide.QtGui.QIcon import addPixmap [as 别名]
def setupUi(self):
#The superclass sets up most of the UI.
super(MainWindow, self).setupUi(self)
#self.setUnifiedTitleAndToolBarOnMac(True)
webview = self.webViewController().webView()
self.setCentralWidget(webview)
#Connect all the actions.
#File actions
self.connect(self.actionNew, SIGNAL("triggered()"), self.doActionNew)
self.connect(self.actionOpen, SIGNAL("triggered()"), self.doActionOpen)
self.connect(self.actionSave, SIGNAL("triggered()"), self.doActionSave)
self.connect(self.actionSaveAs, SIGNAL("triggered()"), self.doActionSaveAs)
self.connect(self.actionSaveAll, SIGNAL("triggered()"), self.doActionSaveAll)
self.connect(self.actionPrint, SIGNAL("triggered()"), self.doActionPrint)
self.connect(self.actionQuit, SIGNAL("triggered()"), self.doActionQuit)
#Edit actions
#These actions are provided by the WebView instance.
self.actionCopy = webview.pageAction(QWebPage.Copy)
iconCopy = QIcon()
iconCopy.addPixmap(QPixmap(":/images/images/copy-item.png"), QIcon.Normal, QIcon.Off)
self.actionCopy.setIcon(iconCopy)
self.actionCopy.setObjectName("actionCopy")
self.actionCut = webview.pageAction(QWebPage.Cut)
iconCut = QIcon()
iconCut.addPixmap(QPixmap(":/images/images/Scissors.png"), QIcon.Normal, QIcon.Off)
self.actionCut.setIcon(iconCut)
self.actionCut.setObjectName("actionCut")
self.actionPaste = webview.pageAction(QWebPage.Paste)
iconPaste = QIcon()
iconPaste.addPixmap(QPixmap(":/images/images/paste2_30.png"), QIcon.Normal, QIcon.Off)
self.actionPaste.setIcon(iconPaste)
self.actionPaste.setObjectName("actionPaste")
self.actionUndo = webview.pageAction(QWebPage.Undo)
self.actionUndo.setObjectName("actionUndo")
self.actionRedo = webview.pageAction(QWebPage.Redo)
self.actionRedo.setObjectName("actionRedo")
self.menuEdit.addAction(self.actionCopy)
self.menuEdit.addAction(self.actionCut)
self.menuEdit.addAction(self.actionPaste)
self.menuEdit.addAction(self.actionUndo)
self.menuEdit.addAction(self.actionRedo)
self.toolBar.insertAction(self.actionEvaluateWorksheet, self.actionCopy)
self.toolBar.insertAction(self.actionEvaluateWorksheet, self.actionCut)
self.toolBar.insertAction(self.actionEvaluateWorksheet, self.actionPaste)
self.toolBar.insertSeparator(self.actionEvaluateWorksheet)
#This is normally done in retranslateUi, but that method has already been called.
self.retranslateEditMenuUi()
#Worksheet actions
self.connect(self.actionWorksheetProperties, SIGNAL("triggered()"), self.doActionWorksheetProperties)
self.connect(self.actionEvaluateWorksheet, SIGNAL("triggered()"), self.doActionEvaluateWorksheet)
self.connect(self.actionInterrupt, SIGNAL("triggered()"), self.doActionInterrupt)
self.connect(self.actionRestartWorksheet, SIGNAL("triggered()"), self.doActionRestartWorksheet)
self.connect(self.actionHideAllOutput, SIGNAL("triggered()"), self.doActionHideAllOutput)
self.connect(self.actionShowAllOutput, SIGNAL("triggered()"), self.doActionShowAllOutput)
self.connect(self.actionDeleteAllOutput, SIGNAL("triggered()"), self.doActionDeleteAllOutput)
#Miscellaneous actions
self.connect(self.actionAbout, SIGNAL("triggered()"), self.doActionAbout)
self.connect(self.actionOnlineDocumentation, SIGNAL("triggered()"), self.doActionOnlineDocumentation)
self.connect(self.actionSageServer, SIGNAL("triggered()"), self.doActionSageServer)
if self.isWelcome:
#Display the welcome screen.
self.showWelcome()
示例6: WarningsDialog
# 需要导入模块: from PySide.QtGui import QIcon [as 别名]
# 或者: from PySide.QtGui.QIcon import addPixmap [as 别名]
class WarningsDialog(QDialog, Ui_WarningsDialog):
"""
This is the Controller (more in the line of a code-behind file)
for the small Warnings Dialog.
The UI is handled separately by QT Designer 4 with the
*.ui file.
@since: 2011-05-20
"""
__author__ = "Moritz Wade"
__contact__ = "[email protected]"
__copyright__ = "Zuse Institute Berlin 2011"
def __init__(self, parent=None, warningAction=None, warningService=None):
"""
Constructor
@param parent: Qt widget parent of this dialog window
@type parent: QWidget
@param warningAction: The action to connect to.
@type warningAction: QAction
"""
super(WarningsDialog, self).__init__(parent)
self.setupUi(self)
self.setWarningAction(warningAction)
self.setWarningService(warningService)
self.statusBarService = StatusBarService()
self.errorString = ""
self.errorMsgTextEdit.setPlainText(self.errorString)
self.iconWarning = QIcon()
self.iconWarning.addPixmap(QPixmap(":/tango-status-32px/images/tango-icon-theme/32x32/status/weather-severe-alert.png"), QIcon.Normal, QIcon.Off)
self.iconNoWarning = QIcon()
self.iconNoWarning.addPixmap(QPixmap(":/tango-status-32px/images/tango-icon-theme/32x32/status/weather-clear.png"), QIcon.Normal, QIcon.Off)
def setWarningAction(self, warningAction):
"""
Sets the warning QAction (for setting icons and to connect to
its triggered SIGNAL to show self).
"""
self.warningAction = warningAction
self._connectToWarningAction()
def setWarningService(self, warningService):
"""
Sets the WarningService (to whose SIGNALs to listen to).
"""
self.warningService = warningService
self._connectToWarningService()
def updateWarnings(self, errorString, desc):
"""
Having updated the errorString elsewhere,
this method updates the error string in the UI and
sets the correct warning icon.
"""
self.errorString = errorString
self.errorMsgTextEdit.setPlainText(self.errorString)
if self.warningAction:
# todo: figure out how to use the tooltip to show desc
# self.warningAction.setToolTip(desc)
self.warningAction.setIcon(self.iconWarning)
if not desc:
desc = "There are new warnings. Open the Warnings Window to see them."
logging.info(desc)
@Slot(str, str)
def appendWarning(self, msg, desc):
"""
Public slot to append a warning to the list of warnings.
Usually, this is called by the WarningsService.
"""
errorString = "%s\n%s" % (self.errorString,msg)
self.updateWarnings(errorString, desc)
@Slot(str, str)
def setWarning(self, msg, desc):
"""
Public slot to clear all warnings and send this one as the only one.
Usually, this is called by the WarningsService.
"""
errorString = msg
self.updateWarnings(errorString, desc)
def _connectToWarningAction(self):
if self.warningAction:
self.warningAction.triggered.connect(self._showDialog)
def _showDialog(self):
self.show()
scrollBar = self.errorMsgTextEdit.verticalScrollBar()
#.........这里部分代码省略.........