本文整理汇总了Python中PyQt4.QtGui.QMenuBar类的典型用法代码示例。如果您正苦于以下问题:Python QMenuBar类的具体用法?Python QMenuBar怎么用?Python QMenuBar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QMenuBar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Ui_SLim
class Ui_SLim(object):
def setupUi(self, SLim):
SLim.setObjectName(_fromUtf8("SLim"))
SLim.resize(800, 601)
self.centralwidget = QWidget(SLim)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
self.verticalLayout = QVBoxLayout(self.centralwidget)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
SLim.setCentralWidget(self.centralwidget)
self.menubar = QMenuBar(SLim)
self.menubar.setGeometry(QRect(0, 0, 800, 20))
self.menubar.setObjectName(_fromUtf8("menubar"))
SLim.setMenuBar(self.menubar)
self.statusbar = QStatusBar(SLim)
self.statusbar.setObjectName(_fromUtf8("statusbar"))
SLim.setStatusBar(self.statusbar)
ui_settings = slimUISettings()
QMetaObject.connectSlotsByName(SLim)
self.loopers = []
self.loopers.append(LooperWidget(self.centralwidget, 0, ui_settings.looper))
self.loopers.append(LooperWidget(self.centralwidget, 1, ui_settings.looper))
for looper in self.loopers:
self.verticalLayout.addWidget(looper)
self.retranslateUi(SLim)
def retranslateUi(self, SLim):
for looper in SLim.ui.loopers:
looper.retranslateUi()
SLim.setWindowTitle(QApplication.translate("SLim", "MainWindow", None, QApplication.UnicodeUTF8))
示例2: BaseFenetrePrinc
class BaseFenetrePrinc(QMainWindow):
""" Classe BaseFenetrePrinc
Cette classe définit les widgets contenus dans la fenetre principale de
PyFt. Elle est héritée par fen.FenetrePrinc.
"""
def __init__(self, parent=None):
""" Fait des initialisations """
super(BaseFenetrePrinc, self).__init__(parent)
self.resize(800, 600)
self.setWindowTitle('PyFt - 0.1')
# barre de menu
self.menuBar = QMenuBar()
self.mFic = QMenu('Fichier')
self.a_quit = QAction('Quitter', self)
self.menuBar.addMenu(self.mFic)
self.setMenuBar(self.menuBar)
# zone centrale
self.mdi = QMdiArea()
self.setCentralWidget(self.mdi)
示例3: initStartScreen
def initStartScreen(self):
self.startscreen = StartScreen(self)
self.startscreen.clicked.connect(self.connectActivated)
if have_maemo:
menu = QMenuBar(self.startscreen)
menu.addAction(self.actionConnect)
menu.addAction(self.actionPrefs)
示例4: __init__
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)
示例5: __init__
def __init__(self, config):
# Initialize the object as a QWidget and
# set its title and minimum width
QWidget.__init__(self)
self.config = config
self.peerList = config.peerList
self.setWindowTitle('BlastShare')
self.setMinimumSize(320, 480)
self.setMaximumWidth(320)
self.prefw = None
# connects the signals!
self.connect(self.peerList,
SIGNAL("initTransfer"), self.sendFileToPeer)
''' Will add feature in future version '''
'''
shareFilesAction = QAction(QIcon('exit.png'), '&Share File(s)', self)
shareFilesAction.setShortcut('Ctrl+O')
shareFilesAction.setStatusTip('Share File(s)')
shareFilesAction.triggered.connect(quitApp)
'''
preferencesAction = QAction(QIcon('exit.png'), '&Preferences', self)
preferencesAction.setShortcut('Ctrl+P')
preferencesAction.setStatusTip('Preferences')
preferencesAction.triggered.connect(self.editPreferences)
exitAction = QAction(QIcon('exit.png'), '&Exit', self)
exitAction.setShortcut('Ctrl+Q')
exitAction.setStatusTip('Exit application')
exitAction.triggered.connect(quitApp)
menubar = QMenuBar()
fileMenu = menubar.addMenu('&File')
''' Will enable in future versions '''
# fileMenu.addAction(shareFilesAction)
fileMenu.addAction(preferencesAction)
fileMenu.addAction(exitAction)
layout = QVBoxLayout()
layout.setContentsMargins(QMargins(0, 0, 0, 0))
self.setLayout(layout)
statusBar = QStatusBar()
statusBar.showMessage('Ready')
layout.addWidget(menubar)
layout.addWidget(self.peerList)
layout.addWidget(statusBar)
示例6: menubar
def menubar():
"""Return a newly created parent-less menu bar that's used when there is no main window."""
m = QMenuBar()
m.addMenu(menu_file(m))
m.addMenu(menu_edit(m))
m.addMenu(menu_window(m))
m.addMenu(menu_sessions(m))
m.addMenu(menu_help(m))
return m
示例7: setupUi
def setupUi(self, SLim):
SLim.setObjectName(_fromUtf8("SLim"))
SLim.resize(800, 601)
self.centralwidget = QWidget(SLim)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
self.verticalLayout = QVBoxLayout(self.centralwidget)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
SLim.setCentralWidget(self.centralwidget)
self.menubar = QMenuBar(SLim)
self.menubar.setGeometry(QRect(0, 0, 800, 20))
self.menubar.setObjectName(_fromUtf8("menubar"))
SLim.setMenuBar(self.menubar)
self.statusbar = QStatusBar(SLim)
self.statusbar.setObjectName(_fromUtf8("statusbar"))
SLim.setStatusBar(self.statusbar)
ui_settings = slimUISettings()
QMetaObject.connectSlotsByName(SLim)
self.loopers = []
self.loopers.append(LooperWidget(self.centralwidget, 0, ui_settings.looper))
self.loopers.append(LooperWidget(self.centralwidget, 1, ui_settings.looper))
for looper in self.loopers:
self.verticalLayout.addWidget(looper)
self.retranslateUi(SLim)
示例8: initMenuBar
def initMenuBar(self):
menuBar = QMenuBar()
file = menuBar.addMenu("&File")
quit = file.addAction("&Quit", QApplication.instance().quit)
quit.setShortcutContext(Qt.ApplicationShortcut)
quit.setShortcut(QKeySequence.Quit)
self.changeName = QAction("Change Name", self, triggered=self.__changeName)
self.changeColor = QAction("Change Color", self, triggered=self.__changeColor)
self.cashCards = QAction("Cash in Cards", self, enabled=False, triggered=self.__cashCards)
self.endAttack = QAction("End Attack", self, enabled=False, triggered=self.endAttackReleased)
self.endTurn = QAction("End Turn", self, enabled=False, triggered=self.endTurnReleased)
menuBar.addAction(self.changeName)
menuBar.addAction(self.changeColor)
menuBar.addAction(self.cashCards)
menuBar.addAction(self.endAttack)
menuBar.addAction(self.endTurn)
self.setMenuBar(menuBar)
示例9: __init__
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")
示例10: MainWindow
class MainWindow(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
self.menubar = QMenuBar()
file_ = self.menubar.addMenu(u"&Fichier")
exit = QAction(u"Quitter", self)
exit.setShortcut("Ctrl+Q")
exit.setToolTip("Quitter l'application")
self.menubar.connect(exit, SIGNAL("triggered()"), \
self, \
SLOT("close()"))
file_.addAction(exit)
self.setMenuBar(self.menubar)
self.web = QWebView()
self.web.load(QUrl(APP_URL))
self.setCentralWidget(self.web)
def goto(self, url):
self.web.load(QUrl(url))
示例11: create_menu_bar
def create_menu_bar ( self, parent, controller = None ):
""" Creates a menu bar representation of the manager.
"""
# If a controller is required it can either be set as a facet on the
# menu bar manager (the facet is part of the 'ActionManager' API), or
# passed in here (if one is passed in here it takes precedence over the
# facet).
if controller is None:
controller = self.controller
menu_bar = QMenuBar( parent )
# Every item in every group must be a menu manager:
for group in self.groups:
for item in group.items:
menu = item.create_menu( parent, controller )
menu.menuAction().setText( item.name )
menu_bar.addMenu( menu )
return menu_bar
#-- EOF ------------------------------------------------------------------------
示例12: __init__
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)
示例13: setupUi
def setupUi(self):
if self.prop.isPortraitMode():
self.setAttributeAndCatch(self.WA_Maemo5PortraitOrientation, True)
self.changeOrientationText = self.switchToLandscapeText
else:
self.setAttributeAndCatch(self.WA_Maemo5LandscapeOrientation, True)
self.changeOrientationText = self.switchToPortraitText
self.setWindowTitle(self.tr("MaeMoney"))
self.setMinimumSize(QtCore.QSize(400, 400))
self.gridLayout = QGridLayout()
widget = QWidget(self)
widget.setLayout(self.gridLayout)
self.setCentralWidget(widget)
self.btnLoadPortfolio = QtGui.QPushButton(self.tr("Sign in to Google Finance"))
self.gridLayout.addWidget(self.btnLoadPortfolio, 0, 0, 1, 1)
# List of portfolios
self.portfolioListView = QComboBox()
self.portfolioListView.setStyleSheet("QComboBox, QListView { font: 28px; } ")
self.portfolioListView.setProperty(self.PROP_FINGER_SCROLLABLE, True)
# Positions within the selected portfolio
self.positionsListView = PortfolioListView(self)
self.positionsListView.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.positionsListView.setProperty(self.PROP_FINGER_SCROLLABLE, True)
menuBar = QMenuBar()
self.setMenuBar(menuBar)
self.changeAppLocaleAction = QAction(self.tr("Change language"), self)
menuBar.addAction(self.changeAppLocaleAction)
self.changeUrlAction = QAction(self.tr("Change Google Finance URL"), self)
menuBar.addAction(self.changeUrlAction)
self.changeOrientationAction = QAction(self.changeOrientationText, self)
menuBar.addAction(self.changeOrientationAction)
self.changeUpdateIntervalAction = QAction(self.tr("Change update interval"), self)
menuBar.addAction(self.changeUpdateIntervalAction)
示例14: createMenubar
def createMenubar(self):
self._menuBar_ = QMenuBar(None)
#Create File Menu
self._fileMenu_ = QMenu(self)
am = ActionManager.getInstance()
#todo add actions from ActionManager
for action in am.getBloopFileMenuActions():
print "MainView.createMenuBar() adding action to file menu", action
print self._fileMenu_.addAction(action)
#Create Help Menu
self._menuBar_.addMenu(self._fileMenu_)
#self.setMenuWidget(self._menuBar_)
#self._menuBar_.setVisible(True)
示例15: __init__
def __init__(self, parent=None):
""" Fait des initialisations """
super(BaseFenetrePrinc, self).__init__(parent)
self.resize(800, 600)
self.setWindowTitle('PyFt - 0.1')
# barre de menu
self.menuBar = QMenuBar()
self.mFic = QMenu('Fichier')
self.a_quit = QAction('Quitter', self)
self.menuBar.addMenu(self.mFic)
self.setMenuBar(self.menuBar)
# zone centrale
self.mdi = QMdiArea()
self.setCentralWidget(self.mdi)