本文整理汇总了Python中systray.Systray.setContextMenu方法的典型用法代码示例。如果您正苦于以下问题:Python Systray.setContextMenu方法的具体用法?Python Systray.setContextMenu怎么用?Python Systray.setContextMenu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类systray.Systray
的用法示例。
在下文中一共展示了Systray.setContextMenu方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Snakefire
# 需要导入模块: from systray import Systray [as 别名]
# 或者: from systray.Systray import setContextMenu [as 别名]
#.........这里部分代码省略.........
widget = QtGui.QWidget()
widget.setLayout(grid)
self.setCentralWidget(widget)
tabWidgetFocusEventFilter = TabWidgetFocusEventFilter(self)
self.connect(tabWidgetFocusEventFilter, QtCore.SIGNAL("tabFocused()"), self._roomTabFocused)
widget.installEventFilter(tabWidgetFocusEventFilter)
self.centralWidget().hide()
size = self.getSetting("window", "size")
if not size:
size = QtCore.QSize(640, 480)
self.resize(size)
position = self.getSetting("window", "position")
if not position:
screen = QtGui.QDesktopWidget().screenGeometry()
position = QtCore.QPoint((screen.width()-size.width())/2, (screen.height()-size.height())/2)
self.move(position)
self._updateLayout()
menu = QtGui.QMenu(self)
menu.addAction(self._menus["file"]["connect"])
menu.addAction(self._menus["file"]["disconnect"])
menu.addSeparator()
menu.addAction(self._menus["file"]["exit"])
self._trayIcon = Systray(self._icon, self)
self._trayIcon.setContextMenu(menu)
self._trayIcon.setToolTip(self.DESCRIPTION)
def _addMenu(self):
self._menus = {
"file": {
"connect": self._createAction(self._("&Connect"), self.connectNow, icon="connect.png"),
"disconnect": self._createAction(self._("&Disconnect"), self.disconnectNow, icon="disconnect.png"),
"exit": self._createAction(self._("E&xit"), self.exit)
},
"settings": {
"alerts": self._createAction(self._("&Alerts..."), self.alerts, icon="alerts.png"),
"options": self._createAction(self._("&Options..."), self.options)
},
"help": {
"about": self._createAction(self._("A&bout"), self.about)
}
}
menu = self.menuBar()
file_menu = menu.addMenu(self._("&File"))
file_menu.addAction(self._menus["file"]["connect"])
file_menu.addAction(self._menus["file"]["disconnect"])
file_menu.addSeparator()
file_menu.addAction(self._menus["file"]["exit"])
settings_menu = menu.addMenu(self._("S&ettings"))
settings_menu.addAction(self._menus["settings"]["alerts"])
settings_menu.addSeparator()
settings_menu.addAction(self._menus["settings"]["options"])
help_menu = menu.addMenu(self._("&Help"))
示例2: Snakefire
# 需要导入模块: from systray import Systray [as 别名]
# 或者: from systray.Systray import setContextMenu [as 别名]
#.........这里部分代码省略.........
widget = QtGui.QWidget()
widget.setLayout(grid)
self.setCentralWidget(widget)
tabWidgetFocusEventFilter = TabWidgetFocusEventFilter(self)
self.connect(tabWidgetFocusEventFilter, QtCore.SIGNAL("tabFocused()"), self._roomTabFocused)
widget.installEventFilter(tabWidgetFocusEventFilter)
self.centralWidget().hide()
size = self.getSetting("window", "size")
if not size:
size = QtCore.QSize(640, 480)
self.resize(size)
position = self.getSetting("window", "position")
if not position:
screen = QtGui.QDesktopWidget().screenGeometry()
position = QtCore.QPoint((screen.width()-size.width())/2, (screen.height()-size.height())/2)
self.move(position)
self._updateLayout()
menu = QtGui.QMenu(self)
menu.addAction(self._menus["file"]["connect"])
menu.addAction(self._menus["file"]["disconnect"])
menu.addSeparator()
menu.addAction(self._menus["file"]["exit"])
self._trayIcon = Systray(self._icon, self)
self._trayIcon.setContextMenu(menu)
self._trayIcon.setToolTip(self.DESCRIPTION)
def _addMenu(self):
self._menus = {
"file": {
"connect": self._createAction(self._("&Connect"), self.connectNow, icon="connect.png"),
"disconnect": self._createAction(self._("&Disconnect"), self.disconnectNow, icon="disconnect.png"),
"exit": self._createAction(self._("E&xit"), self.exit)
},
"settings": {
"alerts": self._createAction(self._("&Alerts..."), self.alerts, icon="alerts.png"),
"options": self._createAction(self._("&Options..."), self.options)
},
"help": {
"about": self._createAction(self._("A&bout"))
}
}
menu = self.menuBar()
file_menu = menu.addMenu(self._("&File"))
file_menu.addAction(self._menus["file"]["connect"])
file_menu.addAction(self._menus["file"]["disconnect"])
file_menu.addSeparator()
file_menu.addAction(self._menus["file"]["exit"])
settings_menu = menu.addMenu(self._("S&ettings"))
settings_menu.addAction(self._menus["settings"]["alerts"])
settings_menu.addSeparator()
settings_menu.addAction(self._menus["settings"]["options"])
help_menu = menu.addMenu(self._("&Help"))
示例3: Snakefire
# 需要导入模块: from systray import Systray [as 别名]
# 或者: from systray.Systray import setContextMenu [as 别名]
#.........这里部分代码省略.........
widget = QtGui.QWidget()
widget.setLayout(grid)
self.setCentralWidget(widget)
tabWidgetFocusEventFilter = TabWidgetFocusEventFilter(self)
self.connect(tabWidgetFocusEventFilter, QtCore.SIGNAL("tabFocused()"), self._roomTabFocused)
widget.installEventFilter(tabWidgetFocusEventFilter)
self.centralWidget().hide()
size = self.getSetting("window", "size")
if not size:
size = QtCore.QSize(640, 480)
self.resize(size)
position = self.getSetting("window", "position")
if not position:
screen = QtGui.QDesktopWidget().screenGeometry()
position = QtCore.QPoint((screen.width()-size.width())/2, (screen.height()-size.height())/2)
self.move(position)
self._updateLayout()
menu = QtGui.QMenu(self)
menu.addAction(self._menus["file"]["connect"])
menu.addAction(self._menus["file"]["disconnect"])
menu.addSeparator()
menu.addAction(self._menus["file"]["exit"])
self._trayIcon = Systray(self._icon, self)
self._trayIcon.setContextMenu(menu)
self._trayIcon.setToolTip(self.DESCRIPTION)
def _addMenu(self):
self._menus = {
"file": {
"connect": self._createAction(self._("&Connect"), self.connectNow, icon="connect.png"),
"disconnect": self._createAction(self._("&Disconnect"), self.disconnectNow, icon="disconnect.png"),
"exit": self._createAction(self._("E&xit"), self.exit)
},
"settings": {
"alerts": self._createAction(self._("&Alerts..."), self.alerts, icon="alerts.png"),
"options": self._createAction(self._("&Options..."), self.options)
},
"help": {
"about": self._createAction(self._("A&bout"))
}
}
menu = self.menuBar()
file_menu = menu.addMenu(self._("&File"))
file_menu.addAction(self._menus["file"]["connect"])
file_menu.addAction(self._menus["file"]["disconnect"])
file_menu.addSeparator()
file_menu.addAction(self._menus["file"]["exit"])
settings_menu = menu.addMenu(self._("S&ettings"))
settings_menu.addAction(self._menus["settings"]["alerts"])
settings_menu.addSeparator()
settings_menu.addAction(self._menus["settings"]["options"])
help_menu = menu.addMenu(self._("&Help"))