本文整理汇总了Python中PySide.QtGui.QAction.setIcon方法的典型用法代码示例。如果您正苦于以下问题:Python QAction.setIcon方法的具体用法?Python QAction.setIcon怎么用?Python QAction.setIcon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QAction
的用法示例。
在下文中一共展示了QAction.setIcon方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: makeAction
# 需要导入模块: from PySide.QtGui import QAction [as 别名]
# 或者: from PySide.QtGui.QAction import setIcon [as 别名]
def makeAction(self,title, method, icon = None):
action = QAction(title,None)
action.setIcon(QIcon(icon))
# We do this magic, so that the title string from the action is used to trigger the version change
def methodWrapper():
method(title)
action.triggered.connect( methodWrapper )
return action
示例2: titleStringTriggeredAction
# 需要导入模块: from PySide.QtGui import QAction [as 别名]
# 或者: from PySide.QtGui.QAction import setIcon [as 别名]
def titleStringTriggeredAction(title, method, icon = None):
action = QAction(title,None)
action.setIcon(QIcon(icon))
# We do this magic, so that the title string from the action is used to set the status
def methodWrapper():
method(title)
action.triggered.connect( methodWrapper )
return action
示例3: _createAction
# 需要导入模块: from PySide.QtGui import QAction [as 别名]
# 或者: from PySide.QtGui.QAction import setIcon [as 别名]
def _createAction(self, text, slot=None, shortcut=None, icon=None, tip=None, checkable=False, signal="triggered"):
action = QAction(text, self)
if icon is not None:
action.setIcon(QIcon(":/{0}.png".format(icon)))
if shortcut is not None:
action.setShortcut(shortcut)
if tip is not None:
action.setToolTip(tip)
action.setStatusTip(tip)
if slot is not None:
getattr(action, signal).connect(slot)
if checkable:
action.setCheckable(True)
return action
示例4: createactions
# 需要导入模块: from PySide.QtGui import QAction [as 别名]
# 或者: from PySide.QtGui.QAction import setIcon [as 别名]
def createactions(self, text, slot=None, shortcut="None", icon=None, tip=None, checkable=False,
signal="triggered()"):
action = QAction(text, self)
if icon is not None:
action.setIcon(QIcon(icon))
if shortcut is not None:
action.setShortcut(shortcut)
if tip is not None:
action.setToolTip(tip)
action.setStatusTip(tip)
if slot is not None:
self.connect(action, SIGNAL(signal), slot)
if checkable:
action.setCheckable(True)
return action
示例5: __init__
# 需要导入模块: from PySide.QtGui import QAction [as 别名]
# 或者: from PySide.QtGui.QAction import setIcon [as 别名]
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
# self.setObjectName("MainWindow")
self.resize(731, 475)
centralwidget = QWidget(self)
# centralwidget.setObjectName("centralwidget")
gridLayout = QGridLayout(centralwidget)
# gridLayout.setObjectName("gridLayout")
# textEdit needs to be a class variable.
self.textEdit = QTextEdit(centralwidget)
# self.textEdit.setObjectName("textEdit")
gridLayout.addWidget(self.textEdit, 0, 0, 1, 1)
self.setCentralWidget(centralwidget)
menubar = QMenuBar(self)
menubar.setGeometry(QRect(0, 0, 731, 29))
# menubar.setObjectName("menubar")
menu_File = QMenu(menubar)
# menu_File.setObjectName("menu_File")
self.setMenuBar(menubar)
statusbar = QStatusBar(self)
# statusbar.setObjectName("statusbar")
self.setStatusBar(statusbar)
actionShow_GPL = QAction(self)
# actionShow_GPL.setObjectName("actionShow_GPL")
actionShow_GPL.triggered.connect(self.showGPL)
action_About = QAction(self)
# action_About.setObjectName("action_About")
action_About.triggered.connect(self.about)
iconToolBar = self.addToolBar("iconBar.png")
#------------------------------------------------------
# Add icons to appear in tool bar - step 1
actionShow_GPL.setIcon(QIcon(":/showgpl.png"))
action_About.setIcon(QIcon(":/about.png"))
action_Close = QAction(self)
action_Close.setCheckable(False)
action_Close.setObjectName("action_Close")
action_Close.setIcon(QIcon(":/quit.png"))
#------------------------------------------------------
# Show a tip on the Status Bar - step 2
actionShow_GPL.setStatusTip("Show GPL Licence")
action_About.setStatusTip("Pop up the About dialog.")
action_Close.setStatusTip("Close the program.")
#------------------------------------------------------
menu_File.addAction(actionShow_GPL)
menu_File.addAction(action_About)
menu_File.addAction(action_Close)
menubar.addAction(menu_File.menuAction())
iconToolBar.addAction(actionShow_GPL)
iconToolBar.addAction(action_About)
iconToolBar.addAction(action_Close)
action_Close.triggered.connect(self.close)
示例6: __init__
# 需要导入模块: from PySide.QtGui import QAction [as 别名]
# 或者: from PySide.QtGui.QAction import setIcon [as 别名]
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.resize(800, 480)
self.setWindowTitle('PySide GUI')
#self.setWindowFlags(PySide.QtCore.Qt.FramelessWindowHint)
self.wgHome, self.dcHome = self.createHomePage()
# serial page
self.wgSerial = QWidget(self)
gridLayout = QGridLayout(self.wgSerial)
self.lb1 = QLabel('serial page')
self.lb2 = QLabel('label 2')
self.lb3 = QLabel('label 3')
gridLayout.addWidget(self.lb1, 0, 0)
gridLayout.addWidget(self.lb2, 1, 0)
gridLayout.addWidget(self.lb3, 2, 0)
self.sw = QStackedWidget(self)
self.sw.addWidget(self.wgHome)
self.sw.addWidget(self.wgSerial)
self.setCentralWidget(self.sw)
menubar = QMenuBar(self)
menubar.setGeometry(QRect(0, 0, 731, 29))
menu_File = QMenu(menubar)
self.setMenuBar(menubar)
statusbar = QStatusBar(self)
self.setStatusBar(statusbar)
actionHome = QAction(self)
actionHome.setIcon(QIcon("icon/Home-50.png"))
actionHome.setStatusTip("Home content")
actionHome.triggered.connect(
lambda: self.sw.setCurrentWidget(self.wgHome))
actionSerial = QAction(self)
actionSerial.setIcon(QIcon("icon/Unicast-50.png"))
actionSerial.setStatusTip("Serial polling task status")
actionSerial.triggered.connect(
lambda: self.sw.setCurrentWidget(self.wgSerial))
actionLogging = QAction(self)
actionLogging.setIcon(QIcon("icon/Database-50.png"))
actionLogging.setStatusTip("Logging task status")
actionLogging.triggered.connect(
lambda: self.sw.setCurrentWidget(self.wgLogging))
actionUpload = QAction(self)
actionUpload.setIcon(QIcon("icon/Upload to Cloud-50.png"))
actionUpload.setStatusTip("Uploading task status")
actionUpload.triggered.connect(
lambda: self.sw.setCurrentWidget(self.wgLogging))
actionDebug = QAction(self)
actionDebug.setIcon(QIcon("icon/Bug-50.png"))
actionDebug.setStatusTip("debug")
actionDebug.triggered.connect(self.debug)
actionAbout = QAction(self)
actionAbout.triggered.connect(self.about)
actionAbout.setIcon(QIcon("icon/Info-50.png"))
actionAbout.setStatusTip("Pop up the About dialog.")
actionSetting = QAction(self)
actionSetting.setCheckable(False)
actionSetting.setObjectName('action_clear')
actionSetting.setIcon(QIcon("icon/Settings-50.png"))
actionLeft = QAction(self)
actionLeft.setIcon(QIcon("icon/Left-50.png"))
actionLeft.setStatusTip("Left page")
actionLeft.triggered.connect(self.switchLeftWidget)
actionRight = QAction(self)
actionRight.setIcon(QIcon("icon/Right-50.png"))
actionRight.setStatusTip("Right page")
actionRight.triggered.connect(self.switchRightWidget)
actionClose = QAction(self)
actionClose.setCheckable(False)
actionClose.setObjectName("action_Close")
actionClose.setIcon(QIcon("icon/Delete-50.png"))
actionClose.setStatusTip("Close the program.")
actionClose.triggered.connect(self.close)
#------------------------------------------------------
menu_File.addAction(actionHome)
menu_File.addAction(actionAbout)
menu_File.addAction(actionClose)
menu_File.addAction(actionSetting)
#.........这里部分代码省略.........
示例7: MainWindow
# 需要导入模块: from PySide.QtGui import QAction [as 别名]
# 或者: from PySide.QtGui.QAction import setIcon [as 别名]
class MainWindow(QMainWindow):
""" Starting point of the GUI based application """
isMyProgressTimer = False
def __init__(self):
""" MainWindow Constructor Function"""
super(MainWindow, self).__init__()
wdgt = QWidget()
wdgt.setWindowTitle = "ManageHD"
self.setCentralWidget(wdgt)
self.InitUI()
self.GetParameterFileInfo()
def InitUI(self):
""" Initialize user created UI elements """
self.qlVidsDone = QLabel('0', self)
self.qlVidsInProgress = QLabel('0', self)
self.qlStartTime = QLabel(datetime.now().strftime("%a, %d %b %Y %H:%M:%S"), self)
self.qlEndTime = QLabel('', self)
self.qlTimeLeft = QLabel('', self)
self.qlDestinationSpace = QLabel('', self)
self.qlArcSpace = QLabel('', self)
self.qlProcessingSpeed = QLabel('', self)
self.qleSourceDir = QLineEditDirectoriesOnly()
self.qleArchiveDir = QLineEditDirectoriesOnly()
self.qleDestinationDir = QLineEditDirectoriesOnly()
self.qleMaxVidsCap = QLineEditIntsOnly()
self.qleVideoTypes = QLineEditNoPeriodsOrCommas()
self.qleVideoTypes.installEventFilter(self)
self.qpbSourceDir = self.__CreateButton('folder.png',"", 50, self.SelectSingleFileForSourceDirectory)
self.qpbArchiveDir = self.__CreateButton('folder.png',"", 50, self.SelectSingleFileForArchiveDirectory)
self.qpbTargetDir = self.__CreateButton('folder.png',"", 50, self.SelectSingleFileForTargetDirectory)
self.qpbRun = self.__CreateButton(None,"Run", 75, self.Process)
self.setWindowTitle("Manage HD Video")
self.videoExtensionFileFilter = "Video (*.mkv *.mp4 *.avi)"
self.qleVideoTypes.setText("mkv mp4 avi")
self.statusLabel = QLabel('Showing Progress')
self.progressBar = QProgressBar()
self.progressBar.setMinimum(0)
self.progressBar.setMaximum(100)
self.__CreateActions()
self.__CreateMenus()
self.fileMenu.addAction(self.stdAction)
self.fileMenu.addAction(self.altAction)
if Progress.runPlatform == 'win':
self.stdAction.setIcon(QIcon('checked.jpg'))
self.stdAction.setChecked(True)
self.fileMenu.addSeparator()
self.fileMenu.addAction(self.exitAction)
self.fileMenu.addSeparator()
self.helpMenu.addAction(self.aboutAction)
self.__SetIcon()
self.__CenterWindow()
self.__CreateGrid()
def eventFilter(self, source, event): #Override
""" Override the QMainWindow eventFilter method to add File Mask Validation. """
if (event.type() == QEvent.FocusOut and
source is self.qleVideoTypes):
self.ValidateFileMask()
return QMainWindow.eventFilter(self, source, event)
def DisableGuiElements(self):
""" Change the setEnabled property of the main GUI elements to False. """
self.qleArchiveDir.setEnabled(False)
self.qleDestinationDir.setEnabled(False)
self.qleMaxVidsCap.setEnabled(False)
self.qleSourceDir.setEnabled(False)
self.qleVideoTypes.setEnabled(False)
self.qpbArchiveDir.setEnabled(False)
self.qpbSourceDir.setEnabled(False)
self.qpbTargetDir.setEnabled(False)
self.qpbRun.setEnabled(False)
def EnableGuiElements(self):
""" Change the setEnabled property of the main GUI elements to True. """
self.qleArchiveDir.setEnabled(True)
self.qleDestinationDir.setEnabled(True)
self.qleMaxVidsCap.setEnabled(True)
self.qleSourceDir.setEnabled(True)
self.qleVideoTypes.setEnabled(True)
self.qpbArchiveDir.setEnabled(True)
self.qpbSourceDir.setEnabled(True)
self.qpbTargetDir.setEnabled(True)
self.qpbRun.setEnabled(True)
def __AddGridLabel(self, grid, lblText, custFont, row, column, justification):
sd = QLabel(lblText, self)
sd.setFont(custFont)
grid.addWidget(sd, row, column, alignment = justification)
def SelectSingleFileForSourceDirectory(self):
self.qleSourceDir.setText( self.InvokeSingleSelectionDirectoryDialog() )
self.ValidateFileMask()
def SelectSingleFileForArchiveDirectory(self):
#.........这里部分代码省略.........
示例8: createMenuAction
# 需要导入模块: from PySide.QtGui import QAction [as 别名]
# 或者: from PySide.QtGui.QAction import setIcon [as 别名]
def createMenuAction(title, method, icon=None):
action = QAction(title, None)
action.triggered.connect( method )
if icon:
action.setIcon(icon)
return action
示例9: createAction
# 需要导入模块: from PySide.QtGui import QAction [as 别名]
# 或者: from PySide.QtGui.QAction import setIcon [as 别名]
#.........这里部分代码省略.........
connect(ACTION, SIGNAL("triggered()"), self, SLOT("tipOfTheDay()"))
elif icon == "about":
connect(ACTION, SIGNAL("triggered()"), self, SLOT("about()"))
elif icon == "whatsthis":
connect(ACTION, SIGNAL("triggered()"), self, SLOT("whatsThisContextHelp()"))
elif icon == "icon16":
connect(ACTION, SIGNAL("triggered()"), self, SLOT("icon16()"))
elif icon == "icon24":
connect(ACTION, SIGNAL("triggered()"), self, SLOT("icon24()"))
elif icon == "icon32":
connect(ACTION, SIGNAL("triggered()"), self, SLOT("icon32()"))
elif icon == "icon48":
connect(ACTION, SIGNAL("triggered()"), self, SLOT("icon48()"))
elif icon == "icon64":
connect(ACTION, SIGNAL("triggered()"), self, SLOT("icon64()"))
elif icon == "icon128":
connect(ACTION, SIGNAL("triggered()"), self, SLOT("icon128()"))
elif icon == "settingsdialog":
connect(ACTION, SIGNAL("triggered()"), self, SLOT("settingsDialog()"))
elif icon == "undo":
connect(ACTION, SIGNAL("triggered()"), self, SLOT("undo()"))
elif icon == "redo":
connect(ACTION, SIGNAL("triggered()"), self, SLOT("redo()"))
elif icon == "makelayercurrent":
connect(ACTION, SIGNAL("triggered()"), self, SLOT("makeLayerActive()"))
elif icon == "layers":
connect(ACTION, SIGNAL("triggered()"), self, SLOT("layerManager()"))
elif icon == "layerprevious":
connect(ACTION, SIGNAL("triggered()"), self, SLOT("layerPrevious()"))
elif icon == "textbold":
ACTION.setCheckable(True)
connect(ACTION, SIGNAL("toggled(bool)"), self, SLOT("setTextBold(bool)"))
elif icon == "textitalic":
ACTION.setCheckable(True)
connect(ACTION, SIGNAL("toggled(bool)"), self, SLOT("setTextItalic(bool)"))
elif icon == "textunderline":
ACTION.setCheckable(True)
connect(ACTION, SIGNAL("toggled(bool)"), self, SLOT("setTextUnderline(bool)"))
elif icon == "textstrikeout":
ACTION.setCheckable(True)
connect(ACTION, SIGNAL("toggled(bool)"), self, SLOT("setTextStrikeOut(bool)"))
elif icon == "textoverline":
ACTION.setCheckable(True)
connect(ACTION, SIGNAL("toggled(bool)"), self, SLOT("setTextOverline(bool)"))
elif icon == "zoomrealtime":
connect(ACTION, SIGNAL("triggered()"), self, SLOT("zoomRealtime()"))
elif icon == "zoomprevious":
connect(ACTION, SIGNAL("triggered()"), self, SLOT("zoomPrevious()"))
elif icon == "zoomwindow":
connect(ACTION, SIGNAL("triggered()"), self, SLOT("zoomWindow()"))
elif icon == "zoomdynamic":
connect(ACTION, SIGNAL("triggered()"), self, SLOT("zoomDynamic()"))
elif icon == "zoomscale":
connect(ACTION, SIGNAL("triggered()"), self, SLOT("zoomScale()"))
elif icon == "zoomcenter":
connect(ACTION, SIGNAL("triggered()"), self, SLOT("zoomCenter()"))
elif icon == "zoomin":
connect(ACTION, SIGNAL("triggered()"), self, SLOT("zoomIn()"))
elif icon == "zoomout":
connect(ACTION, SIGNAL("triggered()"), self, SLOT("zoomOut()"))
elif icon == "zoomselected":
connect(ACTION, SIGNAL("triggered()"), self, SLOT("zoomSelected()"))
elif icon == "zoomall":
connect(ACTION, SIGNAL("triggered()"), self, SLOT("zoomAll()"))
elif icon == "zoomextents":
connect(ACTION, SIGNAL("triggered()"), self, SLOT("zoomExtents()"))
elif icon == "panrealtime":
connect(ACTION, SIGNAL("triggered()"), self, SLOT("panrealtime()"))
elif icon == "panpoint":
connect(ACTION, SIGNAL("triggered()"), self, SLOT("panpoint()"))
elif icon == "panleft":
connect(ACTION, SIGNAL("triggered()"), self, SLOT("panLeft()"))
elif icon == "panright":
connect(ACTION, SIGNAL("triggered()"), self, SLOT("panRight()"))
elif icon == "panup":
connect(ACTION, SIGNAL("triggered()"), self, SLOT("panUp()"))
elif icon == "pandown":
connect(ACTION, SIGNAL("triggered()"), self, SLOT("panDown()"))
elif icon == "day":
connect(ACTION, SIGNAL("triggered()"), self, SLOT("dayVision()"))
elif icon == "night":
connect(ACTION, SIGNAL("triggered()"), self, SLOT("nightVision()"))
elif scripted:
ACTION.setIcon(QIcon(self.gAppDir + os.sep + "commands/" + icon + "/" + icon + ".png"))
connect(ACTION, SIGNAL("triggered()"), self, SLOT("runCommand()"))
else:
ACTION.setEnabled(False)
connect(ACTION, SIGNAL("triggered()"), self, SLOT("stub_implement()"))
return ACTION