本文整理汇总了Python中guidata.qt.QtGui.QMenu.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python QMenu.__init__方法的具体用法?Python QMenu.__init__怎么用?Python QMenu.__init__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类guidata.qt.QtGui.QMenu
的用法示例。
在下文中一共展示了QMenu.__init__方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from guidata.qt.QtGui import QMenu [as 别名]
# 或者: from guidata.qt.QtGui.QMenu import __init__ [as 别名]
def __init__(self, parent=None):
QMenu.__init__(self, parent)
self.options = {}
system_tray_menu = [
(self.START, lambda: agent_manager("start")),
(self.STOP, lambda: agent_manager("stop")),
(self.RESTART, lambda: agent_manager("restart")),
]
# First the version
self.addAction(self.ABOUT.format(get_version())).setEnabled(False)
self.addSeparator()
for name, action in system_tray_menu:
self.add_option(name, action)
# enable or disable mac login
if Platform.is_mac():
self.add_option(self.MAC_LOGIN.format(self.enable_or_disable_mac()),
lambda: self.enable_or_disable_login())
elif Platform.is_windows():
self.add_option(self.FLARE, lambda: thread.start_new_thread(windows_flare, ()))
# And finally the exit
self.add_option(self.EXIT, lambda: sys.exit(0))
self.connect(self, SIGNAL("aboutToShow()"), lambda: self.update_options())
示例2: __init__
# 需要导入模块: from guidata.qt.QtGui import QMenu [as 别名]
# 或者: from guidata.qt.QtGui.QMenu import __init__ [as 别名]
def __init__(self, settings, parent=None):
QMenu.__init__(self, parent)
self.options = {}
for name, action in settings:
menu_action = self.addAction(name)
self.connect(menu_action, SIGNAL("triggered()"), action)
self.options[name] = menu_action
示例3: __init__
# 需要导入模块: from guidata.qt.QtGui import QMenu [as 别名]
# 或者: from guidata.qt.QtGui.QMenu import __init__ [as 别名]
def __init__(self, parent=None, ):
QMenu.__init__(self, parent)
self.options = {}
for name, action in SYSTEM_TRAY_MENU:
menu_action = self.addAction(name)
self.connect(menu_action, SIGNAL('triggered()'), action)
self.options[name] = menu_action
self.connect(self, SIGNAL("aboutToShow()"), lambda: self.update_options())