本文整理汇总了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()
示例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()
示例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()
示例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)
示例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)
示例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
示例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)
#.........这里部分代码省略.........
示例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)
示例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)
示例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()
示例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)
#.........这里部分代码省略.........
示例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)