本文整理汇总了Python中PyQt4.QtGui.QMenuBar.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python QMenuBar.__init__方法的具体用法?Python QMenuBar.__init__怎么用?Python QMenuBar.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QMenuBar
的用法示例。
在下文中一共展示了QMenuBar.__init__方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt4.QtGui import QMenuBar [as 别名]
# 或者: from PyQt4.QtGui.QMenuBar import __init__ [as 别名]
def __init__(self, parent, actionManager):
QMenuBar.__init__(self, parent)
self._manager = actionManager
for action in self._manager.allActions():
self._onActionInserted( action )
self._manager.actionInserted.connect(self._onActionInserted)
self._manager.actionRemoved.connect(self._onActionRemoved)
示例2: __init__
# 需要导入模块: from PyQt4.QtGui import QMenuBar [as 别名]
# 或者: from PyQt4.QtGui.QMenuBar import __init__ [as 别名]
def __init__(self, parent):
QMenuBar.__init__(self, parent)
file = self.addMenu("&Archivo")
n = file.addAction("&Nuevo Modelo")
n.triggered.connect(self.trigger_new)
n = file.addAction("Nueva &Pagina")
n.triggered.connect(self.trigger_newpage)
n = file.addAction("A&brir Modelo")
n.triggered.connect(self.load_dialog)
n = file.addAction("&Guardar Modelo")
n.triggered.connect(self.save_as_dialog)
n = file.addAction("&Importar Modulo")
n.triggered.connect(self.get_from_fich)
n = file.addAction("E&xportar Modulo")
n.triggered.connect(self.put_to_fich)
n = file.addAction("&Cerrar Modelo")
n.triggered.connect(self.trigger_reset)
file.addSeparator()
n = file.addAction("&Salir")
n.triggered.connect(self.exit.emit)
edit = self.addMenu("&Editar")
ex = self.addMenu("Ejecuc&ion")
n = ex.addAction("E&jecutar")
n.triggered.connect(self.play.emit)
n = ex.addAction("&Construir")
n.triggered.connect(self.build.emit)
#view = self.addMenu("V&istas")
opt = self.addMenu("&Opciones")
help = self.addMenu("Ay&uda")
help.addAction("&Tutorial")
help.addAction("Sobre el autor")
help.addAction("Sobre la aplicacion")
self.parent().say("Menu creado")
示例3: __init__
# 需要导入模块: from PyQt4.QtGui import QMenuBar [as 别名]
# 或者: from PyQt4.QtGui.QMenuBar import __init__ [as 别名]
def __init__(self,
tree_main,
tree_second,
configuration,
right_window,
main_window,
signal_wrapper):
""" Creates menu elements.
@param tree_main: Tree object of main file / tree
(left side)
@param tree_second: Tree object of second file / tree
(right side)
@param text_output_instance: QTextEdit object which should be
used / bind with the tree wiget.
@param configuration: Current Configuration object.
@param right_window: QWidget object of the second (right) file/tree
@param main_window: QMainWindow object to change the title
@param signal_wrapper: SignalWrapper object which wraps signals
"""
QMenuBar.__init__(self, main_window.centralWidget())
logging.info("menu foo")
self.tree_main = tree_main
self.tree_second = tree_second
self._conf = configuration
self.widget_right_window = right_window
self.main_window = main_window
self.signal_wrapper = signal_wrapper
self.two_windows_action = QAction("Two Windows", self)
self._importer = TextImporter(self._conf)
self._init_gui_menu_view()
self._init_gui_menu_main_file()
self.menu_second_file = QMenu("SecondFile",
self.main_window.centralWidget())
self._init_gui_menu_second_file()
gui_helper.change_window_title("", self.main_window)
示例4: __init__
# 需要导入模块: from PyQt4.QtGui import QMenuBar [as 别名]
# 或者: from PyQt4.QtGui.QMenuBar import __init__ [as 别名]
def __init__(self, parent):
QMenuBar.__init__(self, parent)
# TBD: manage the size
# self.setGeometry(QRect(0, 0, 929, 22))
self.setObjectName("menubar")
self.setNativeMenuBar(True)
示例5: __init__
# 需要导入模块: from PyQt4.QtGui import QMenuBar [as 别名]
# 或者: from PyQt4.QtGui.QMenuBar import __init__ [as 别名]
def __init__(self, parent=None, admin=False, *args, **kwargs):
QMenuBar.__init__(self, parent=parent, *args, **kwargs)
self.setWindowIcon(QIcon(QPixmap("{}".format(Config.APP_LOGO_ICO))))
self.parent = parent
# Menu File
self.file_ = self.addMenu(u"&Fichier")
# Export
backup = self.file_.addMenu(u"&Basse de données")
backup.addAction(u"Sauvegarder", self.goto_export_db)
backup.addAction(u"Importer", self.goto_import_backup)
backup.addAction(
u"Suppression de tout les enregistrements", self.goto_clean_db)
# Comptes utilisateur
admin = self.file_.addMenu(u"Outils")
admin_ = QAction(QIcon.fromTheme('emblem-system', QIcon('')),
u"Gestion Admistration", self)
admin_.setShortcut("Ctrl+G")
self.connect(admin_, SIGNAL("triggered()"), self.goto_admin)
admin.addAction(admin_)
license = QAction(QIcon.fromTheme('emblem-system', QIcon('')),
u"Licience", self)
license.setShortcut("Alt+L")
self.connect(license, SIGNAL("triggered()"), self.goto_license)
admin.addAction(license)
preference = self.addMenu(u"Préference")
_theme = preference.addMenu("Theme")
styles = dict_style()
list_theme = [({"name": k, "icon": '', "admin": False,
"shortcut": "", "theme": k}) for k in styles.keys()]
for m in list_theme:
icon = ""
if m.get('theme') == Organization.get(id=1).theme:
icon = "accept"
el_menu = QAction(QIcon("{}{}.png".format(
Config.img_cmedia, icon)), m.get('name'), self)
el_menu.setShortcut(m.get("shortcut"))
self.connect(
el_menu, SIGNAL("triggered()"), lambda m=m: self.change_theme(
m.get('theme')))
_theme.addSeparator()
_theme.addAction(el_menu)
# logout
lock = QAction(
QIcon("{}login.png".format(Config.img_cmedia)), "Verrouiller", self)
lock.setShortcut("Ctrl+V")
lock.setToolTip(u"Verrouile l'application")
self.connect(lock, SIGNAL("triggered()"), self.logout)
self.file_.addAction(lock)
# R
log_file = QAction(
QIcon(), "Log ", self)
log_file.setShortcut("Ctrl+l")
log_file.setToolTip(u"Verrouile l'application")
self.connect(log_file, SIGNAL("triggered()"), self.open_logo_file)
admin.addAction(log_file)
# Exit
exit_ = QAction(
QIcon.fromTheme('application-exit', QIcon('')), "Exit", self)
exit_.setShortcut("Ctrl+Q")
exit_.setToolTip(u"Quiter l'application")
self.connect(exit_, SIGNAL("triggered()"), self.parentWidget(),
SLOT("close()"))
self.file_.addAction(exit_)