本文整理匯總了Python中PyQt4.QtGui.QSystemTrayIcon方法的典型用法代碼示例。如果您正苦於以下問題:Python QtGui.QSystemTrayIcon方法的具體用法?Python QtGui.QSystemTrayIcon怎麽用?Python QtGui.QSystemTrayIcon使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt4.QtGui
的用法示例。
在下文中一共展示了QtGui.QSystemTrayIcon方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QSystemTrayIcon [as 別名]
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.signal.connect(self.execute)
self.ui = Ui_Main()
self.ui.setupUi(self)
self.show()
thread.start_new_thread(load_data, (self,))
thread.start_new_thread(load_msg, (self,))
# trayicon
self.trayicon = QtGui.QSystemTrayIcon(self)
self.trayicon.setIcon(QtGui.QIcon(r'tmp/sys/QQ.png'))
self.trayicon.setToolTip(u' QQ ')
self.trayicon.show()
self.trayicon.activated.connect(self.trayclick)
# traymenu
self.min = QAction(u' 最小化 ', self, triggered=self.hide)
self.Hy = QAction(u' 還原 ', self, triggered=self.showNormal)
self.qiuct = QAction(u' 退出 ', self, triggered=qApp.quit)
self.traymen = QMenu(QApplication.desktop())
self.traymen.addAction(self.min)
self.traymen.addAction(self.Hy)
self.traymen.addAction(self.qiuct)
self.trayicon.setContextMenu(self.traymen)
self.trayicon.activated.connect(self.trayclick)
self.trayflash()
示例2: __init__
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QSystemTrayIcon [as 別名]
def __init__(self, icon, parent=None):
QtGui.QSystemTrayIcon.__init__(self, icon, parent)
self.workThread = SlouchingThread()
menu = QtGui.QMenu(parent)
setupAction = menu.addAction("Setup")
exitAction = menu.addAction("Quit")
self.setContextMenu(menu)
self.connect(exitAction, QtCore.SIGNAL('triggered()'), sys.exit)
self.connect(setupAction, QtCore.SIGNAL('triggered()'), setup)
示例3: __del__
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QSystemTrayIcon [as 別名]
def __del__(self):
QtGui.QSystemTrayIcon.__del__(self)
self.workThread.terminate()
示例4: __init__
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QSystemTrayIcon [as 別名]
def __init__(self, icon, parent=None):
QtGui.QSystemTrayIcon.__init__(self, icon, parent)
menu = QtGui.QMenu(parent)
s = os.popen("nsaway --plugins").read().split("\n")
# Magic
s = s[2].split("[")[1].replace("]", "").split(", ")
s = [si.replace("'","") for si in s]
# It's clean
# Plugin
for item in s:
entry = menu.addAction(item)
self.connect(entry,QtCore.SIGNAL('triggered()'), lambda item=item: self.exec_plugin(item))
# Finished plugin loading
menu.addSeparator()
changeicon = menu.addAction("Reset Status")
menu.addSeparator()
exitAction = menu.addAction("Exit")
self.setContextMenu(menu)
exitAction.triggered.connect(self.quit)
changeicon.triggered.connect(self.reset_icon)
self.thread = QtCore.QThread()
self.listener = Listener()
self.listener.moveToThread(self.thread)
self.thread.started.connect(self.listener.loop)
self.listener.message.connect(self.signal_received)
QtCore.QTimer.singleShot(0, self.thread.start)
示例5: iconActivated
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QSystemTrayIcon [as 別名]
def iconActivated(self, reason):
if reason in (QtGui.QSystemTrayIcon.Trigger, QtGui.QSystemTrayIcon.DoubleClick):
self.iconComboBox.setCurrentIndex(
(self.iconComboBox.currentIndex() + 1)
% self.iconComboBox.count())
elif reason == QtGui.QSystemTrayIcon.MiddleClick:
self.showMessage()
示例6: showMessage
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QSystemTrayIcon [as 別名]
def showMessage(self):
# Show the message that was typed in the boxes
icon = QtGui.QSystemTrayIcon.MessageIcon(
self.typeComboBox.itemData(self.typeComboBox.currentIndex()))
self.trayIcon.showMessage(self.titleEdit.text(),
self.bodyEdit.toPlainText(), icon,
self.durationSpinBox.value() * 1000)
示例7: createTrayIcon
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QSystemTrayIcon [as 別名]
def createTrayIcon(self):
self.trayIconMenu = QtGui.QMenu(self)
self.trayIconMenu.addAction(self.minimizeAction)
#self.trayIconMenu.addAction(self.maximizeAction)
self.trayIconMenu.addAction(self.restoreAction)
self.trayIconMenu.addSeparator()
self.trayIconMenu.addAction(self.quitAction)
self.trayIcon = QtGui.QSystemTrayIcon(self)
self.trayIcon.setContextMenu(self.trayIconMenu)
示例8: showMessage
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QSystemTrayIcon [as 別名]
def showMessage(self):
icon = QtGui.QSystemTrayIcon.MessageIcon(
self.typeComboBox.itemData(self.typeComboBox.currentIndex()))
self.trayIcon.showMessage(self.titleEdit.text(),
self.bodyEdit.toPlainText(), icon,
self.durationSpinBox.value() * 1000)
示例9: createTrayIcon
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QSystemTrayIcon [as 別名]
def createTrayIcon(self):
self.trayIconMenu = QtGui.QMenu(self)
self.trayIconMenu.addAction(self.minimizeAction)
self.trayIconMenu.addAction(self.restoreAction)
self.trayIconMenu.addSeparator()
self.trayIconMenu.addAction(self.quitAction)
self.trayIcon = QtGui.QSystemTrayIcon(self)
self.trayIcon.setContextMenu(self.trayIconMenu)
示例10: __init__
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QSystemTrayIcon [as 別名]
def __init__(self, *args):
"""Initialize main Application window."""
# Calling __init__ of super class
QtGui.QMainWindow.__init__(self, *args)
# Flag for mode of operation. Default is set to offline mode.
self.online_flag = False
# Creating require Object
self.obj_workspace = Workspace.Workspace()
self.obj_Mainview = MainView()
self.obj_kicad = Kicad(self.obj_Mainview.obj_dockarea)
self.obj_appconfig = Appconfig()
self.obj_validation = Validation()
# Initialize all widget
self.setCentralWidget(self.obj_Mainview)
self.initToolBar()
self.setGeometry(self.obj_appconfig._app_xpos,
self.obj_appconfig._app_ypos,
self.obj_appconfig._app_width,
self.obj_appconfig._app_heigth)
self.setWindowTitle(self.obj_appconfig._APPLICATION)
self.showMaximized()
self.setWindowIcon(QtGui.QIcon('images/logo.png'))
self.systemTrayIcon = QtGui.QSystemTrayIcon(self)
self.systemTrayIcon.setIcon(QtGui.QIcon('images/logo.png'))
self.systemTrayIcon.setVisible(True)
示例11: createTray
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QSystemTrayIcon [as 別名]
def createTray():
#托盤
AppProperty.TrayIcon=QSystemTrayIcon(AppProperty.AppIcon,AppProperty.MainWin)
AppProperty.TrayIcon.activated.connect(trayClick)
AppProperty.TrayIcon.setToolTip("QPA")
AppProperty.TrayIcon.setContextMenu(createTrayMenu(AppProperty.TrayIcon))
AppProperty.TrayIcon.show()
示例12: __init__
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QSystemTrayIcon [as 別名]
def __init__(self, icon, app):
QtGui.QSystemTrayIcon.__init__(self, icon, None)
self.app = app
self.menu = QtGui.QMenu(None)
exitAction = self.menu.addAction("Exit")
self.setContextMenu(self.menu)
exitAction.triggered.connect( self.quit )
示例13: trayclick
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QSystemTrayIcon [as 別名]
def trayclick(self, res):
global traymsg, trayhead
if res == QSystemTrayIcon.DoubleClick:
self.showNormal()
if res == QSystemTrayIcon.Trigger:
# print 'click', trayhead, traymsg
qqchat.showNormal()
traymsg = False
trayhead = 'tmp/sys/QQ.png'
示例14: __init__
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QSystemTrayIcon [as 別名]
def __init__(self, icon, parent=None):
QtGui.QSystemTrayIcon.__init__(self, icon, parent)
menu = QtGui.QMenu(parent)
示例15: createMessageGroupBox
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QSystemTrayIcon [as 別名]
def createMessageGroupBox(self): # Add the message test GUI window grouping.
self.messageGroupBox = QtGui.QGroupBox("Balloon Message Test:")
typeLabel = QtGui.QLabel("Type:")
self.typeComboBox = QtGui.QComboBox()
self.typeComboBox.addItem("None", QtGui.QSystemTrayIcon.NoIcon)
self.typeComboBox.addItem(self.style().standardIcon(
QtGui.QStyle.SP_MessageBoxInformation), "Information", QtGui.QSystemTrayIcon.Information)
self.typeComboBox.addItem(self.style().standardIcon(
QtGui.QStyle.SP_MessageBoxWarning), "Warning", QtGui.QSystemTrayIcon.Warning)
self.typeComboBox.addItem(self.style().standardIcon(
QtGui.QStyle.SP_MessageBoxCritical), "Critical", QtGui.QSystemTrayIcon.Critical)
self.typeComboBox.setCurrentIndex(1)
self.durationLabel = QtGui.QLabel("Duration:")
self.durationSpinBox = QtGui.QSpinBox()
self.durationSpinBox.setRange(2, 15)
self.durationSpinBox.setSuffix("s")
self.durationSpinBox.setValue(5)
durationWarningLabel = QtGui.QLabel("(some systems might ignore this hint)")
durationWarningLabel.setIndent(10)
titleLabel = QtGui.QLabel("Title:")
self.titleEdit = QtGui.QLineEdit("Cannot connect to network")
bodyLabel = QtGui.QLabel("Body:")
self.bodyEdit = QtGui.QTextEdit()
self.bodyEdit.setPlainText("Don't believe me. Honestly, I don't have a clue.")
self.showMessageButton = QtGui.QPushButton("Show Message")
self.showMessageButton.setDefault(True)
messageLayout = QtGui.QGridLayout()
messageLayout.addWidget(typeLabel, 0, 0)
messageLayout.addWidget(self.typeComboBox, 0, 1, 1, 2)
messageLayout.addWidget(self.durationLabel, 1, 0)
messageLayout.addWidget(self.durationSpinBox, 1, 1)
messageLayout.addWidget(durationWarningLabel, 1, 2, 1, 3)
messageLayout.addWidget(titleLabel, 2, 0)
messageLayout.addWidget(self.titleEdit, 2, 1, 1, 4)
messageLayout.addWidget(bodyLabel, 3, 0)
messageLayout.addWidget(self.bodyEdit, 3, 1, 2, 4)
messageLayout.addWidget(self.showMessageButton, 5, 4)
messageLayout.setColumnStretch(3, 1)
messageLayout.setRowStretch(4, 1)
self.messageGroupBox.setLayout(messageLayout)