当前位置: 首页>>代码示例>>Python>>正文


Python QtGui.QSystemTrayIcon方法代码示例

本文整理汇总了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() 
开发者ID:younfor,项目名称:PyLinuxQQ,代码行数:27,代码来源:run.py

示例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) 
开发者ID:pyskell,项目名称:slouchy,代码行数:13,代码来源:slouchy.py

示例3: __del__

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QSystemTrayIcon [as 别名]
def __del__(self):
    QtGui.QSystemTrayIcon.__del__(self)
    self.workThread.terminate() 
开发者ID:pyskell,项目名称:slouchy,代码行数:5,代码来源:slouchy.py

示例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) 
开发者ID:TheZ3ro,项目名称:nsaway,代码行数:30,代码来源:tray.py

示例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() 
开发者ID:openairplay,项目名称:openairplay,代码行数:9,代码来源:main.py

示例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) 
开发者ID:openairplay,项目名称:openairplay,代码行数:9,代码来源:main.py

示例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) 
开发者ID:openairplay,项目名称:openairplay,代码行数:12,代码来源:main.py

示例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) 
开发者ID:Warflop,项目名称:Telebix,代码行数:8,代码来源:design.py

示例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) 
开发者ID:Warflop,项目名称:Telebix,代码行数:10,代码来源:design.py

示例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) 
开发者ID:FOSSEE,项目名称:eSim,代码行数:32,代码来源:Application.py

示例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() 
开发者ID:l7dpi,项目名称:openQPA,代码行数:9,代码来源:QPA.py

示例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 ) 
开发者ID:beville,项目名称:ComicStreamer,代码行数:9,代码来源:gui_qt.py

示例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' 
开发者ID:younfor,项目名称:PyLinuxQQ,代码行数:11,代码来源:run.py

示例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) 
开发者ID:lakewik,项目名称:EasyStorj,代码行数:5,代码来源:storj_tray_icon.py

示例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) 
开发者ID:openairplay,项目名称:openairplay,代码行数:53,代码来源:main.py


注:本文中的PyQt4.QtGui.QSystemTrayIcon方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。