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


Python Systray.setContextMenu方法代码示例

本文整理汇总了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"))
开发者ID:yattom,项目名称:snakefire,代码行数:70,代码来源:mainframe.py

示例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"))
开发者ID:zambot,项目名称:snakefire,代码行数:70,代码来源:mainframe.py

示例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"))
开发者ID:coredump,项目名称:snakefire,代码行数:70,代码来源:mainframe.py


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