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


Python QSystemTrayIcon.__init__方法代码示例

本文整理汇总了Python中PyQt5.QtWidgets.QSystemTrayIcon.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python QSystemTrayIcon.__init__方法的具体用法?Python QSystemTrayIcon.__init__怎么用?Python QSystemTrayIcon.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtWidgets.QSystemTrayIcon的用法示例。


在下文中一共展示了QSystemTrayIcon.__init__方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from PyQt5.QtWidgets import QSystemTrayIcon [as 别名]
# 或者: from PyQt5.QtWidgets.QSystemTrayIcon import __init__ [as 别名]
    def __init__(self, manager: Manager, icon, parent=None, testing=False) -> None:
        QSystemTrayIcon.__init__(self, icon, parent)
        self.setToolTip("ActivityWatch" + (" (testing)" if testing else ""))

        self.manager = manager
        self.testing = testing

        self._build_rootmenu()
开发者ID:ActivityWatch,项目名称:activitywatch.github.io,代码行数:10,代码来源:trayicon.py

示例2: __init__

# 需要导入模块: from PyQt5.QtWidgets import QSystemTrayIcon [as 别名]
# 或者: from PyQt5.QtWidgets.QSystemTrayIcon import __init__ [as 别名]
	def __init__(self, icon, parent=None):
		QSystemTrayIcon.__init__(self, icon, parent)
		self.parent = parent
		
		self.timer = QtCore.QTimer(self)
		self.timer.timeout.connect(self.update)
		self.timer.setSingleShot(True)
		
		self.update()
开发者ID:anyc,项目名称:avahi-tray,代码行数:11,代码来源:avahi-tray.py

示例3: __init__

# 需要导入模块: from PyQt5.QtWidgets import QSystemTrayIcon [as 别名]
# 或者: from PyQt5.QtWidgets.QSystemTrayIcon import __init__ [as 别名]
 def __init__(self, icon, com, parent=None):
     QSystemTrayIcon.__init__(self, icon, parent)
     menu = QMenu(parent)
     showAction = menu.addAction("Mostrar")
     showAction.triggered.connect(self.show_action)
     exitAction = menu.addAction("Fechar")
     exitAction.triggered.connect(self.close_event)
     self.activated.connect(self.tray_activated)
     self.setContextMenu(menu)
     self.com = com
     self.show()
开发者ID:ROAND,项目名称:Series-Manager,代码行数:13,代码来源:semard3_anbient.py

示例4: __init__

# 需要导入模块: from PyQt5.QtWidgets import QSystemTrayIcon [as 别名]
# 或者: from PyQt5.QtWidgets.QSystemTrayIcon import __init__ [as 别名]
    def __init__(self, parent=None):
        QSystemTrayIcon.__init__(self, parent=None)

        # Initial state
        self.set_disabled()

        # Right Click
        right_menu = RightClicked()
        self.setContextMenu(right_menu)

        # left click
        self.activated.connect(self.toggle)
开发者ID:baronleonardo,项目名称:xautolock-indicator,代码行数:14,代码来源:xautolock_indicator.py

示例5: __init__

# 需要导入模块: from PyQt5.QtWidgets import QSystemTrayIcon [as 别名]
# 或者: from PyQt5.QtWidgets.QSystemTrayIcon import __init__ [as 别名]
	def __init__(self, icon,parent=None):
		QSystemTrayIcon.__init__(self,icon, parent)
		menu = QMenu(parent)

		showAction = menu.addAction("Show Moodly")
		showAction.triggered.connect(self.trigger.emit)

		exitAction = menu.addAction("Exit")
		exitAction.triggered.connect(self.qtrigger.emit)

		self.updateAction = menu.addAction("Update Now")
		self.updateAction.triggered.connect(self.uptrigger.emit)
		self.updateAction.setEnabled(False)

		self.activated.connect(self.activateIcon)
		self.setContextMenu(menu)
开发者ID:AkshayAgarwal007,项目名称:Moodly,代码行数:18,代码来源:view.py

示例6: __init__

# 需要导入模块: from PyQt5.QtWidgets import QSystemTrayIcon [as 别名]
# 或者: from PyQt5.QtWidgets.QSystemTrayIcon import __init__ [as 别名]
 def __init__(self, parent=None):
     QSystemTrayIcon.__init__(self, self.get_trayicon(), parent)
     self.activated.connect(self.on_activated) 
     
     self.menu_is_visible = False
开发者ID:diycp,项目名称:deepin-translator,代码行数:7,代码来源:system_tray.py

示例7: __init__

# 需要导入模块: from PyQt5.QtWidgets import QSystemTrayIcon [as 别名]
# 或者: from PyQt5.QtWidgets.QSystemTrayIcon import __init__ [as 别名]
    def __init__(self, basedir, app, parent=None):
        if PLATFORM == 'OSX':
            if app.devicePixelRatio() == 2:
                self.icon = QtGui.QIcon(BASEDIR+'Assets/aether-black-tray.svg')
                self.iconActive = QtGui.QIcon(BASEDIR+'Assets/aether-white-tray.svg')
                self.iconHighlight =  QtGui.QIcon(BASEDIR+'Assets/aether-blue-tray.svg')
            else:
                self.icon = QtGui.QIcon(BASEDIR+'Assets/aether-black-tray.png')
                self.iconActive = QtGui.QIcon(BASEDIR+'Assets/aether-white-tray.png')
                self.iconHighlight =  QtGui.QIcon(BASEDIR+'Assets/aether-blue-tray.png')
        elif PLATFORM == 'WIN':
            self.icon = QtGui.QIcon(BASEDIR+'Assets/aether-white-tray-win.svg')
            self.iconActive = self.icon
            self.iconHighlight = QtGui.QIcon(BASEDIR+'Assets/aether-green-tray-win.svg')
        else:
            pass

        QSystemTrayIcon.__init__(self, self.icon, parent)

        self.menu = QMenu(parent)
        if globals.appIsPaused:
            self.menu.addAction('Paused').setDisabled(True)
        else:
            self.menu.addAction('Online').setDisabled(True)
        self.globalStatusMenuItem = self.menu.actions()[0]

        self.menu.addSeparator() # 1
        self.menu.addAction('You have no replies.').setDisabled(True)
        self.messagesMenuItem = self.menu.actions()[2]
        def goToMessages():
            self.messagesMenuItem.setText('You have no replies.')
            self.messagesMenuItem.setDisabled(True)
            parent.show()
            parent.raise_()
            jsString = \
            ("firstFrameScope = angular.element(document.getElementById('first-frame-contents')).scope();"
             "firstFrameScope.repliesButtonClick();"
             "firstFrameScope.$apply();"
            )
            self.webView.JSContext(jsString)
            # reach out to jscontext and
            # Here, I need to call qtwebkit and tell it to open messages.
        self.messagesMenuItem.triggered.connect(goToMessages)
        self.menu.addSeparator() # 3
        if globals.appIsPaused:
            self.menu.addAction('Resume')
        else:
            self.menu.addAction('Pause')
        self.togglePauseMenuItem = self.menu.actions()[4]
        def togglePause():
            if globals.appIsPaused:
                globals.appIsPaused = False
                self.togglePauseMenuItem.setText('Pause')
                self.globalStatusMenuItem.setText('Online')
            else:
                globals.appIsPaused = True
                self.togglePauseMenuItem.setText('Resume')
                self.globalStatusMenuItem.setText('Paused')
        self.togglePauseMenuItem.triggered.connect(togglePause)
        self.menu.addAction('Show Aether')
        self.toggleVisibilityMenuItem = self.menu.actions()[5]
        def makeVisible():
            parent.show()
            parent.raise_()
            if PLATFORM == 'OSX':
                globals.raiseAndFocusApp()

        self.toggleVisibilityMenuItem.triggered.connect(makeVisible)

        self.menu.addAction('Email the developer')
        self.emailDevMenuItem = self.menu.actions()[6]
        def emailDev():
            mailInitialiser = \
                QUrl('mailto:[email protected]'
                     '?subject=Feedback for Aether'
                     '&body=Hello there! Thanks for taking time to give feedback, I really appreciate it. '
                     'If you are having problems, please follow the directions at www.getaether.net/sending_logs, '
                     'and send me the produced logs. Thanks! You can delete this text before sending. '
                     'You can find my PGP key here: pgp.mit.edu:11371/pks/lookup?search=Burak+Nehbit')
            QtGui.QDesktopServices.openUrl(mailInitialiser)
        self.emailDevMenuItem.triggered.connect(emailDev)

        self.menu.addSeparator() # 5

        self.menu.addAction('Settings')
        self.settingsMenuItem = self.menu.actions()[8]
        def goToSettings():
            self.settingsMenuItem.setText('Settings')
            self.settingsMenuItem.setDisabled(False)
            if parent.isHidden():
                parent.show()
                parent.raise_()
            jsString = \
            ("firstFrameScope = angular.element(document.getElementById('first-frame-contents')).scope();"
             "firstFrameScope.settingsButtonClick();"
             "firstFrameScope.$apply();"
            )
            self.webView.JSContext(jsString)
        self.settingsMenuItem.triggered.connect(goToSettings)

#.........这里部分代码省略.........
开发者ID:anastiel,项目名称:aether-public,代码行数:103,代码来源:guiElements.py

示例8: __init__

# 需要导入模块: from PyQt5.QtWidgets import QSystemTrayIcon [as 别名]
# 或者: from PyQt5.QtWidgets.QSystemTrayIcon import __init__ [as 别名]
	def __init__(self,  parent=None):
		QSystemTrayIcon.__init__(self, QIcon(os.path.join(get_image_file_path(),"ball_green.png")), parent)
		menu = QMenu(parent)
		self.exitAction = menu.addAction("Exit")
		self.exitAction.triggered.connect(self.callback_exit)
		self.setContextMenu(menu)
开发者ID:roderickmackenzie,项目名称:gpvdm,代码行数:8,代码来源:status_icon.py

示例9: __init__

# 需要导入模块: from PyQt5.QtWidgets import QSystemTrayIcon [as 别名]
# 或者: from PyQt5.QtWidgets.QSystemTrayIcon import __init__ [as 别名]
 def __init__(self, icon, parent=None):
     QSystemTrayIcon.__init__(self, icon, parent)
     self.activated.connect(self.on_activated) 
开发者ID:Jactry,项目名称:deepin-translator,代码行数:5,代码来源:system_tray.py

示例10: __init__

# 需要导入模块: from PyQt5.QtWidgets import QSystemTrayIcon [as 别名]
# 或者: from PyQt5.QtWidgets.QSystemTrayIcon import __init__ [as 别名]
 def __init__(self, parent=None):
     """
     Initialize the system tray icon.
     """
     QSystemTrayIcon.__init__(self, parent)
     self.initUI()
开发者ID:HaoDrang,项目名称:big-brother-bot,代码行数:8,代码来源:system.py

示例11: __init__

# 需要导入模块: from PyQt5.QtWidgets import QSystemTrayIcon [as 别名]
# 或者: from PyQt5.QtWidgets.QSystemTrayIcon import __init__ [as 别名]
    def __init__(self, basedir, app, parent=None):
        self.basedir = basedir
        if globals.PLATFORM == 'OSX':
            if app.devicePixelRatio() == 2:
                self.icon = QtGui.QIcon(basedir+'Assets/aether-black-tray.svg')
                self.iconActive = QtGui.QIcon(basedir+'Assets/aether-white-tray.svg')
                self.iconHighlight =  QtGui.QIcon(self.basedir+'Assets/aether-blue-tray.svg')
            else:
                self.icon = QtGui.QIcon(basedir+'Assets/aether-black-tray.png')
                self.iconActive = QtGui.QIcon(basedir+'Assets/aether-white-tray.png')
                self.iconHighlight =  QtGui.QIcon(self.basedir+'Assets/aether-blue-tray.png')
        elif globals.PLATFORM == 'LNX':
            self.icon = QtGui.QIcon(basedir+'Assets/aether-white-tray.png')
            self.iconActive = self.icon
            self.iconHighlight = self.icon
        elif globals.PLATFORM == 'WIN':
            self.icon = QtGui.QIcon(basedir+'Assets/aether-black-tray-win.svg')
            self.iconActive = self.icon
            self.iconHighlight = self.icon
        else:
            pass

        QSystemTrayIcon.__init__(self, self.icon, parent)

        self.menu = QMenu(parent)
        if globals.appIsPaused:
            self.menu.addAction('Aether is paused.').setDisabled(True)
        else:
            self.menu.addAction('Aether is connected.').setDisabled(True)
        globalStatusMenuItem = self.menu.actions()[0]

        self.menu.addSeparator() # 1
        self.menu.addAction('You have no replies.').setDisabled(True)
        self.messagesMenuItem = self.menu.actions()[2]
        def goToMessages():
            self.messagesMenuItem.setText('You have no replies.')
            self.messagesMenuItem.setDisabled(True)
            if parent.isHidden():
                parent.show()
                parent.raise_()
            jsString = \
            ("firstFrameScope = angular.element(document.getElementById('first-frame-contents')).scope();"
             "firstFrameScope.repliesButtonClick();"
             "firstFrameScope.$apply();"
            )
            self.webView.JSContext(jsString)
            # reach out to jscontext and
            # Here, I need to call qtwebkit and tell it to open messages.
        self.messagesMenuItem.triggered.connect(goToMessages)
        self.menu.addSeparator() # 3
        if globals.appIsPaused:
            self.menu.addAction('Resume')
        else:
            self.menu.addAction('Pause')
        self.togglePauseMenuItem = self.menu.actions()[4]
        def togglePause():
            if globals.appIsPaused:
                globals.appIsPaused = False
                self.togglePauseMenuItem.setText('Pause')
                globalStatusMenuItem.setText('Aether is connected.')
            else:
                globals.appIsPaused = True
                self.togglePauseMenuItem.setText('Resume')
                self.globalStatusMenuItem.setText('Aether is paused.')
        self.togglePauseMenuItem.triggered.connect(togglePause)

        if not globals.appStartedAtBoot:
            self.menu.addAction('Show Aether')
        else:
            self.menu.addAction('Hide Aether')
        self.toggleVisibilityMenuItem = self.menu.actions()[5]
        def toggleVisibility():
            if parent.isHidden():
                parent.show()
                parent.raise_()
                # if globals.PLATFORM == 'OSX':
                #     globals.raiseAndFocusApp() #FIXME BEFORE RELEASE
                self.toggleVisibilityMenuItem.setText('Hide Aether')

            else:
                parent.hide()
                parent.lower()
                self.toggleVisibilityMenuItem.setText('Show Aether')
        self.toggleVisibilityMenuItem.triggered.connect(toggleVisibility)

        self.menu.addAction('Email the developer')
        self.emailDevMenuItem = self.menu.actions()[6]
        def emailDev():
            mailInitialiser = \
                QUrl('mailto:[email protected]'
                     '?subject=Feedback for Aether'
                     '&body=<i><br><br>Hello there! Thanks for taking time to give feedback, I really appreciate it. '
                     'If you are having problems, please right click on Aether.app on your Applications folder, '
                     'click Show Package Contents, go to Contents/MacOS/Logs and attach the network.log file there to '
                     'this email. <br><br>'
                     'You can delete this text before sending.'
                     '<br><br>You can find my PGP key here:</i> '
                     'http://pgp.mit.edu:11371/pks/lookup?search=Burak+Nehbit')
            QtGui.QDesktopServices.openUrl(mailInitialiser)
        self.emailDevMenuItem.triggered.connect(emailDev)
#.........这里部分代码省略.........
开发者ID:gordol,项目名称:aether-public,代码行数:103,代码来源:guiElements.py

示例12: __init__

# 需要导入模块: from PyQt5.QtWidgets import QSystemTrayIcon [as 别名]
# 或者: from PyQt5.QtWidgets.QSystemTrayIcon import __init__ [as 别名]
    def __init__(self, activateCallback, parent=None):
        if app.devicePixelRatio() == 2:
            icon = QtGui.QIcon(basedir+'Assets/aether-black-tray.svg')
            iconActive = QtGui.QIcon(basedir+'Assets/aether-white-tray.svg')
        else:
            icon = QtGui.QIcon(basedir+'Assets/aether-black-tray.png')
            iconActive = QtGui.QIcon(basedir+'Assets/aether-white-tray.png')
        QSystemTrayIcon.__init__(self, icon, parent)
        menu = QMenu(parent)
        if globals.appIsPaused:
            menu.addAction('Aether is paused.').setDisabled(True)
        else:
            menu.addAction('Aether is connected.').setDisabled(True)
        globalStatusMenuItem = menu.actions()[0]

        menu.addSeparator() # 1
        if globals.appIsPaused:
            menu.addAction('Resume')
        else:
            menu.addAction('Pause')
        togglePauseMenuItem = menu.actions()[2]
        def togglePause():
            if globals.appIsPaused:
                globals.appIsPaused = False
                togglePauseMenuItem.setText('Pause')
                globalStatusMenuItem.setText('Aether is connected.')
            else:
                globals.appIsPaused = True
                togglePauseMenuItem.setText('Resume')
                globalStatusMenuItem.setText('Aether is paused.')
        togglePauseMenuItem.triggered.connect(togglePause)

        if not globals.appStartedAtBoot:
            menu.addAction('Show Aether')
        else:
            menu.addAction('Hide Aether')
        global toggleVisibilityMenuItem
        toggleVisibilityMenuItem = menu.actions()[3]
        def toggleVisibility():
            if parent.isHidden():
                parent.show()
                toggleVisibilityMenuItem.setText('Hide Aether')

            else:
                parent.close()
                toggleVisibilityMenuItem.setText('Show Aether')
        toggleVisibilityMenuItem.triggered.connect(toggleVisibility)

        menu.addAction('Email the developer')
        emailDevMenuItem = menu.actions()[4]
        def emailDev():
            mailInitialiser = \
                QUrl('mailto:[email protected]'
                     '?subject=Feedback for Aether'
                     '&body=<i><br><br>Hello there! Thanks for taking time to give feedback, I really appreciate it. '
                     'If you are having problems, please right click on Aether.app on your Applications folder, '
                     'click Show Package Contents, go to Contents/MacOS/Logs and attach the network.log file there to '
                     'this email. <br><br>'
                     'You can delete this text before sending.'
                     '<br><br>You can find my PGP key here:</i> '
                     'http://pgp.mit.edu:11371/pks/lookup?search=Burak+Nehbit')
            QtGui.QDesktopServices.openUrl(mailInitialiser)
        emailDevMenuItem.triggered.connect(emailDev)

        menu.addSeparator() # 5

        menu.addAction('Quit')
        quitAppMenuItem = menu.actions()[6]
        # This is below reactor.run to allow access from other places outside main.
        def quitApp():
            # This is buggy...
            if parent.reactor.threadpool is not None:
                parent.reactor.threadpool.stop()
            parent.close()
            parent.reactor.stop()
            app.quit()
            sys.exit()
        quitAppMenuItem.triggered.connect(quitApp)

        self.setContextMenu(menu)
        self.setIcon(icon)
        self.activated.connect(lambda r: activateCallback(self, r))
        def changeIconToActiveState():
            self.setIcon(iconActive)
        def changeIconToPassiveState():
            self.setIcon(icon)
        menu.aboutToShow.connect(changeIconToActiveState)
        menu.aboutToHide.connect(changeIconToPassiveState)
开发者ID:Ryman,项目名称:aether-public,代码行数:90,代码来源:main.py


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