本文整理汇总了Python中PyQt4.QtGui.QMenuBar.addAction方法的典型用法代码示例。如果您正苦于以下问题:Python QMenuBar.addAction方法的具体用法?Python QMenuBar.addAction怎么用?Python QMenuBar.addAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QMenuBar
的用法示例。
在下文中一共展示了QMenuBar.addAction方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initStartScreen
# 需要导入模块: from PyQt4.QtGui import QMenuBar [as 别名]
# 或者: from PyQt4.QtGui.QMenuBar import addAction [as 别名]
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)
示例2: initMenuBar
# 需要导入模块: from PyQt4.QtGui import QMenuBar [as 别名]
# 或者: from PyQt4.QtGui.QMenuBar import addAction [as 别名]
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)
示例3: setupUi
# 需要导入模块: from PyQt4.QtGui import QMenuBar [as 别名]
# 或者: from PyQt4.QtGui.QMenuBar import addAction [as 别名]
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)
示例4: ResultWindow
# 需要导入模块: from PyQt4.QtGui import QMenuBar [as 别名]
# 或者: from PyQt4.QtGui.QMenuBar import addAction [as 别名]
class ResultWindow(QMainWindow):
def __init__(self, app):
QMainWindow.__init__(self, None)
self.app = app
self._setupUi()
self.resultsModel = app.RESULT_MODEL_CLASS(self.app, self.resultsView)
self.stats = StatsLabel(app.model.stats_label, self.statusLabel)
self._update_column_actions_status()
self.menuColumns.triggered[QAction].connect(self.columnToggled)
self.resultsView.doubleClicked.connect(self.resultsDoubleClicked)
self.resultsView.spacePressed.connect(self.resultsSpacePressed)
self.detailsButton.clicked.connect(self.actionDetails.triggered)
self.dupesOnlyCheckBox.stateChanged.connect(self.powerMarkerTriggered)
self.deltaValuesCheckBox.stateChanged.connect(self.deltaTriggered)
self.searchEdit.searchChanged.connect(self.searchChanged)
self.app.willSavePrefs.connect(self.appWillSavePrefs)
def _setupActions(self):
# (name, shortcut, icon, desc, func)
ACTIONS = [
('actionDetails', 'Ctrl+I', '', tr("Details"), self.detailsTriggered),
('actionActions', '', '', tr("Actions"), self.actionsTriggered),
('actionPowerMarker', 'Ctrl+1', '', tr("Show Dupes Only"), self.powerMarkerTriggered),
('actionDelta', 'Ctrl+2', '', tr("Show Delta Values"), self.deltaTriggered),
('actionDeleteMarked', 'Ctrl+D', '', tr("Send Marked to Recycle Bin..."), self.deleteTriggered),
('actionMoveMarked', 'Ctrl+M', '', tr("Move Marked to..."), self.moveTriggered),
('actionCopyMarked', 'Ctrl+Shift+M', '', tr("Copy Marked to..."), self.copyTriggered),
('actionRemoveMarked', 'Ctrl+R', '', tr("Remove Marked from Results"), self.removeMarkedTriggered),
('actionReprioritize', '', '', tr("Re-Prioritize Results..."), self.reprioritizeTriggered),
('actionRemoveSelected', 'Ctrl+Del', '', tr("Remove Selected from Results"), self.removeSelectedTriggered),
('actionIgnoreSelected', 'Ctrl+Shift+Del', '', tr("Add Selected to Ignore List"), self.addToIgnoreListTriggered),
('actionMakeSelectedReference', 'Ctrl+Space', '', tr("Make Selected into Reference"), self.app.model.make_selected_reference),
('actionOpenSelected', 'Ctrl+O', '', tr("Open Selected with Default Application"), self.openTriggered),
('actionRevealSelected', 'Ctrl+Shift+O', '', tr("Open Containing Folder of Selected"), self.revealTriggered),
('actionRenameSelected', 'F2', '', tr("Rename Selected"), self.renameTriggered),
('actionMarkAll', 'Ctrl+A', '', tr("Mark All"), self.markAllTriggered),
('actionMarkNone', 'Ctrl+Shift+A', '', tr("Mark None"), self.markNoneTriggered),
('actionInvertMarking', 'Ctrl+Alt+A', '', tr("Invert Marking"), self.markInvertTriggered),
('actionMarkSelected', '', '', tr("Mark Selected"), self.markSelectedTriggered),
('actionExportToHTML', '', '', tr("Export To HTML"), self.app.model.export_to_xhtml),
('actionExportToCSV', '', '', tr("Export To CSV"), self.app.model.export_to_csv),
('actionSaveResults', 'Ctrl+S', '', tr("Save Results..."), self.saveResultsTriggered),
('actionInvokeCustomCommand', 'Ctrl+Alt+I', '', tr("Invoke Custom Command"), self.app.invokeCustomCommand),
]
createActions(ACTIONS, self)
self.actionDelta.setCheckable(True)
self.actionPowerMarker.setCheckable(True)
def _setupMenu(self):
self.menubar = QMenuBar(self)
self.menubar.setGeometry(QRect(0, 0, 630, 22))
self.menuFile = QMenu(self.menubar)
self.menuFile.setTitle(tr("File"))
self.menuMark = QMenu(self.menubar)
self.menuMark.setTitle(tr("Mark"))
self.menuActions = QMenu(self.menubar)
self.menuActions.setTitle(tr("Actions"))
self.menuColumns = QMenu(self.menubar)
self.menuColumns.setTitle(tr("Columns"))
self.menuView = QMenu(self.menubar)
self.menuView.setTitle(tr("View"))
self.menuHelp = QMenu(self.menubar)
self.menuHelp.setTitle(tr("Help"))
self.setMenuBar(self.menubar)
self.menuActions.addAction(self.actionDeleteMarked)
self.menuActions.addAction(self.actionMoveMarked)
self.menuActions.addAction(self.actionCopyMarked)
self.menuActions.addAction(self.actionRemoveMarked)
self.menuActions.addAction(self.actionReprioritize)
self.menuActions.addSeparator()
self.menuActions.addAction(self.actionRemoveSelected)
self.menuActions.addAction(self.actionIgnoreSelected)
self.menuActions.addAction(self.actionMakeSelectedReference)
self.menuActions.addSeparator()
self.menuActions.addAction(self.actionOpenSelected)
self.menuActions.addAction(self.actionRevealSelected)
self.menuActions.addAction(self.actionInvokeCustomCommand)
self.menuActions.addAction(self.actionRenameSelected)
self.menuMark.addAction(self.actionMarkAll)
self.menuMark.addAction(self.actionMarkNone)
self.menuMark.addAction(self.actionInvertMarking)
self.menuMark.addAction(self.actionMarkSelected)
self.menuView.addAction(self.actionPowerMarker)
self.menuView.addAction(self.actionDelta)
self.menuView.addSeparator()
self.menuView.addAction(self.actionDetails)
self.menuView.addAction(self.app.actionIgnoreList)
self.menuView.addAction(self.app.actionPreferences)
self.menuHelp.addAction(self.app.actionShowHelp)
self.menuHelp.addAction(self.app.actionCheckForUpdate)
self.menuHelp.addAction(self.app.actionOpenDebugLog)
self.menuHelp.addAction(self.app.actionAbout)
self.menuFile.addAction(self.actionSaveResults)
self.menuFile.addAction(self.actionExportToHTML)
self.menuFile.addAction(self.actionExportToCSV)
self.menuFile.addSeparator()
self.menuFile.addAction(self.app.actionQuit)
#.........这里部分代码省略.........
示例5: MainWindow
# 需要导入模块: from PyQt4.QtGui import QMenuBar [as 别名]
# 或者: from PyQt4.QtGui.QMenuBar import addAction [as 别名]
#.........这里部分代码省略.........
self.actionToggleAccountExclusion.setShortcut("Ctrl+Shift+X")
self.actionShowSchedules = QAction(tr("Schedules"), self)
self.actionShowSchedules.setShortcut("Ctrl+4")
self.actionShowSchedules.setIcon(QIcon(QPixmap(':/schedules_48')))
self.actionShowBudgets = QAction(tr("Budgets"), self)
self.actionShowBudgets.setShortcut("Ctrl+5")
self.actionShowBudgets.setIcon(QIcon(QPixmap(':/budget_48')))
self.actionReconcileSelected = QAction(tr("Reconcile Selection"), self)
self.actionReconcileSelected.setShortcut("Ctrl+R")
self.actionMakeScheduleFromSelected = QAction(tr("Make Schedule from Selected"), self)
self.actionMakeScheduleFromSelected.setShortcut("Ctrl+M")
self.actionShowPreferences = QAction(tr("Preferences..."), self)
self.actionPrint = QAction(tr("Print..."), self)
self.actionPrint.setShortcut("Ctrl+P")
self.actionQuit = QAction(tr("Quit moneyGuru"), self)
self.actionQuit.setShortcut("Ctrl+Q")
self.actionUndo = QAction(tr("Undo"), self)
self.actionUndo.setShortcut("Ctrl+Z")
self.actionRedo = QAction(tr("Redo"), self)
self.actionRedo.setShortcut("Ctrl+Y")
self.actionShowHelp = QAction(tr("moneyGuru Help"), self)
self.actionShowHelp.setShortcut("F1")
self.actionCheckForUpdate = QAction(tr("Check for update"), self)
self.actionOpenDebugLog = QAction(tr("Open Debug Log"), self)
self.actionDuplicateTransaction = QAction(tr("Duplicate Transaction"), self)
self.actionDuplicateTransaction.setShortcut("Ctrl+D")
self.actionJumpToAccount = QAction(tr("Jump to Account..."), self)
self.actionJumpToAccount.setShortcut("Ctrl+Shift+A")
self.actionNewTab = QAction(tr("New Tab"), self)
self.actionNewTab.setShortcut("Ctrl+T")
self.actionCloseTab = QAction(tr("Close Tab"), self)
self.actionCloseTab.setShortcut("Ctrl+W")
self.menuFile.addAction(self.actionNewDocument)
self.menuFile.addAction(self.actionNewTab)
self.menuFile.addAction(self.actionOpenDocument)
self.menuFile.addAction(self.menuOpenRecent.menuAction())
self.menuFile.addAction(self.actionOpenExampleDocument)
self.menuFile.addAction(self.actionOpenPluginFolder)
self.menuFile.addAction(self.actionImport)
self.menuFile.addSeparator()
self.menuFile.addAction(self.actionCloseTab)
self.menuFile.addAction(self.actionSave)
self.menuFile.addAction(self.actionSaveAs)
self.menuFile.addAction(self.actionExport)
self.menuFile.addAction(self.actionPrint)
self.menuFile.addAction(self.actionQuit)
self.menuView.addAction(self.actionShowNetWorth)
self.menuView.addAction(self.actionShowProfitLoss)
self.menuView.addAction(self.actionShowTransactions)
self.menuView.addAction(self.actionShowSchedules)
self.menuView.addAction(self.actionShowBudgets)
self.menuView.addAction(self.actionShowPreviousView)
self.menuView.addAction(self.actionShowNextView)
self.menuView.addAction(self.menuDateRange.menuAction())
self.menuView.addAction(self.actionShowPreferences)
self.menuView.addAction(self.actionToggleGraph)
self.menuView.addAction(self.actionTogglePieChart)
self.menuEdit.addAction(self.actionNewItem)
self.menuEdit.addAction(self.actionNewAccountGroup)
self.menuEdit.addAction(self.actionDeleteItem)
self.menuEdit.addAction(self.actionEditItem)
self.menuEdit.addSeparator()
self.menuEdit.addAction(self.actionMoveUp)
self.menuEdit.addAction(self.actionMoveDown)
self.menuEdit.addAction(self.actionDuplicateTransaction)
示例6: GuiMain
# 需要导入模块: from PyQt4.QtGui import QMenuBar [as 别名]
# 或者: from PyQt4.QtGui.QMenuBar import addAction [as 别名]
#.........这里部分代码省略.........
self.nextButton.setText(QApplication.translate("MainWindow", "Next", None, QApplication.UnicodeUTF8))
self.nextButton.setObjectName("nextButton")
self.stackedWidget.addWidget(self.storyPage)
self.gridLayout.addWidget(self.stackedWidget, 0, 0, 1, 1)
MainWindow.setCentralWidget(self.centralwidget)
#Menu bar
self.menubar = QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 818, 25))
self.menubar.setObjectName("menubar")
self.menuMenu = QMenu(self.menubar)
self.menuMenu.setTitle(QApplication.translate("MainWindow", "Menu", None, QApplication.UnicodeUTF8))
self.menuMenu.setObjectName("menuMenu")
MainWindow.setMenuBar(self.menubar)
self.actionSave_Game = QAction(MainWindow)
self.actionSave_Game.setText(QApplication.translate("MainWindow", "Save Game", None, QApplication.UnicodeUTF8))
self.actionSave_Game.setObjectName("actionSave_Game")
self.actionCredits = QAction(MainWindow)
self.actionCredits.setText(QApplication.translate("MainWindow", "Credits", None, QApplication.UnicodeUTF8))
self.actionCredits.setObjectName("actionCredits")
self.actionQuit = QAction(MainWindow)
self.actionQuit.setText(QApplication.translate("MainWindow", "Quit", None, QApplication.UnicodeUTF8))
self.actionQuit.setObjectName("actionQuit")
self.actionSettings = QAction(MainWindow)
self.actionSettings.setText(QApplication.translate("MainWindow", "Settings", None, QApplication.UnicodeUTF8))
self.actionSettings.setObjectName("actionSettings")
self.actionHelp = QAction(MainWindow)
self.actionHelp.setText(QApplication.translate("MainWindow", "Help", None, QApplication.UnicodeUTF8))
self.actionHelp.setObjectName("actionHelp")
self.actionMain_Menu = QAction(MainWindow)
self.actionMain_Menu.setText(QApplication.translate("MainWindow", "Main Menu", None, QApplication.UnicodeUTF8))
self.actionMain_Menu.setObjectName("actionMain_Menu")
self.menuMenu.addAction(self.actionSettings)
self.menuMenu.addAction(self.actionHelp)
self.menuMenu.addAction(self.actionSave_Game)
self.menuMenu.addAction(self.actionCredits)
self.menuMenu.addAction(self.actionMain_Menu)
self.menuMenu.addAction(self.actionQuit)
self.menubar.addAction(self.menuMenu.menuAction())
self.retranslateUi(MainWindow)
self.stackedWidget.setCurrentIndex(0)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
#These are the slots and signals to connect buttons to other functions
self.location = 0
QtCore.QObject.connect(self.actionQuit, QtCore.SIGNAL("triggered()"), MainWindow.close)
QtCore.QObject.connect(self.quitButton, QtCore.SIGNAL("released()"), MainWindow.close)
QtCore.QObject.connect(self.settingsButton, QtCore.SIGNAL("released()"), self.setSettings)
QtCore.QObject.connect(self.actionSettings, QtCore.SIGNAL("triggered()"), self.setSettings)
QtCore.QObject.connect(self.loadButton, QtCore.SIGNAL("released()"), self.load_file_dialog)
QtCore.QObject.connect(self.actionSave_Game, QtCore.SIGNAL("triggered()"),self.save_file_dialog)
QtCore.QObject.connect(self.doneButton, QtCore.SIGNAL("released()"), self.goBack)
QtCore.QObject.connect(self.startButton, QtCore.SIGNAL("released()"), self.newGame)
QtCore.QObject.connect(self.actionMain_Menu, QtCore.SIGNAL("triggered()"), self.setMain)
QtCore.QObject.connect(self.actionHelp, QtCore.SIGNAL("triggered()"), self.setInstructions)
QtCore.QObject.connect(self.instrButton, QtCore.SIGNAL("released()"), self.setInstructions)
QtCore.QObject.connect(self.doneButton2, QtCore.SIGNAL("released()"), self.goBack)
QtCore.QObject.connect(self.doneButton3, QtCore.SIGNAL("released()"), self.goBack)
QtCore.QObject.connect(self.actionCredits, QtCore.SIGNAL("triggered()"), self.setCredits)
self.latLongCheck.stateChanged.connect(self.latLong)
self.colorCheck.stateChanged.connect(self.colorize)
self.legendCheck.stateChanged.connect(self.legend)
QtCore.QObject.connect(self.searchButton, QtCore.SIGNAL("released()"), self.doSearch)
示例7: MainWindow
# 需要导入模块: from PyQt4.QtGui import QMenuBar [as 别名]
# 或者: from PyQt4.QtGui.QMenuBar import addAction [as 别名]
class MainWindow(QMainWindow):
def __init__(self, app):
QMainWindow.__init__(self, None)
self.app = app
self._setupUi()
self.elementTable = ElementTable(self.app.model.element_table, self.elementTableView)
self.openedFileLabel = TextField(self.app.model.opened_file_label, self.openedFileLabelView)
self.openButton.clicked.connect(self.actionLoadPDF.trigger)
def _setupActions(self):
ACTIONS = [
('actionLoadPDF', 'Ctrl+O', '', tr("Load PDF"), self.app.model.load_pdf),
]
createActions(ACTIONS, self)
def _setupMenu(self):
self.menubar = QMenuBar(self)
self.menubar.setGeometry(QRect(0, 0, 42, 22))
self.menuFile = QMenu(self.menubar)
self.menuFile.setTitle(tr("File"))
self.menuHelp = QMenu(self.menubar)
self.menuHelp.setTitle(tr("Help"))
self.setMenuBar(self.menubar)
self.menuFile.addAction(self.actionLoadPDF)
self.menuFile.addAction(self.app.actionLoadProject)
self.menuFile.addAction(self.app.actionSaveProject)
self.menuFile.addAction(self.app.actionQuit)
self.menuHelp.addAction(self.app.actionShowHelp)
self.menuHelp.addAction(self.app.actionCheckForUpdate)
self.menuHelp.addAction(self.app.actionOpenDebugLog)
self.menuHelp.addAction(self.app.actionAbout)
self.menubar.addAction(self.menuFile.menuAction())
self.menubar.addAction(self.menuHelp.menuAction())
def _setupUi(self):
self.setWindowTitle(QCoreApplication.instance().applicationName())
self.resize(900, 600)
self.mainWidget = QWidget(self)
self.verticalLayout = QVBoxLayout(self.mainWidget)
self.fileLayout = QHBoxLayout()
self.openButton = QPushButton("Open File")
# We want to leave the space to the label
sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
self.openButton.setSizePolicy(sizePolicy)
self.fileLayout.addWidget(self.openButton)
self.openedFileLabelView = QLabel()
sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
self.openedFileLabelView.setSizePolicy(sizePolicy)
self.fileLayout.addWidget(self.openedFileLabelView)
self.verticalLayout.addLayout(self.fileLayout)
self.tabViewsLayout = QHBoxLayout()
self.topTabWidget = QTabWidget()
self.elementTableView = ElementTableView()
self.topTabWidget.addTab(self.elementTableView, "Table")
self.pageController = PageController(self.app.model.page_controller)
self.topTabWidget.addTab(self.pageController, "Page")
self.tabViewsLayout.addWidget(self.topTabWidget)
self.bottomTabWidget = QTabWidget()
# We want to leave the most screen estate possible to the table.
sizePolicy = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Expanding)
self.bottomTabWidget.setSizePolicy(sizePolicy)
self.editTab = EditPane(self.app.model.edit_pane)
self.bottomTabWidget.addTab(self.editTab, "Edit")
self.buildTab = BuildPane(self.app.model.build_pane)
self.bottomTabWidget.addTab(self.buildTab, "Build")
self.tabViewsLayout.addWidget(self.bottomTabWidget)
self.verticalLayout.addLayout(self.tabViewsLayout)
self.setCentralWidget(self.mainWidget)
self._setupActions()
self._setupMenu()
moveToScreenCenter(self)
示例8: Gui
# 需要导入模块: from PyQt4.QtGui import QMenuBar [as 别名]
# 或者: from PyQt4.QtGui.QMenuBar import addAction [as 别名]
#.........这里部分代码省略.........
self.credits.setText(QApplication.translate("MainWindow",
"Gary Lent\n"
"Grant Stafford\n"
"Jessie Liu\n"
"Peter Andrien\n"
"Nokia (Qt4 framework)\n"
"Riverbank Computing Ltd (PyQt)\n"
"Celestial Aeon Project", None, QApplication.UnicodeUTF8))
self.credits.setAlignment(
QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
self.credits.setObjectName("credits")
self.doneButton3 = QPushButton(self.creditsPage)
self.doneButton3.setStyleSheet(self.fgb)
self.doneButton3.setGeometry(QtCore.QRect(600, 520, 161, 61))
self.doneButton3.setText(QApplication.translate("MainWindow",
"Done", None, QApplication.UnicodeUTF8))
self.doneButton3.setObjectName("doneButton3")
font.setPointSize(15)
self.doneButton3.setFont(font)
self.stackedWidget.addWidget(self.creditsPage)
#Story page
self.storyPage = QWidget()
self.storyPage.setObjectName("storyPage")
self.storyLabel = QLabel(self.storyPage)
self.storyLabel.setStyleSheet(self.fg)
self.storyLabel.setGeometry(QtCore.QRect(100, 50, 600, 400))
font.setPointSize(25)
self.storyLabel.setFont(font)
self.storyLabel.setText(QApplication.translate("MainWindow",
"My name is Travis Sinclair.\n I'm a skilled cartographer.\n I recently"
" lost my job, but stumbled\n on a clue that may change my life"
" \nforever. I've set off on a quest - a quest\n to find a lost city. "
"I've found a clue,\n and believe there may be more.\n Help me find "
"the lost city. ", None, QApplication.UnicodeUTF8))
self.storyLabel.setAlignment(
QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
self.storyLabel.setObjectName("storyLabel")
self.nextButton = QPushButton(self.storyPage)
self.nextButton.setGeometry(QtCore.QRect(600, 520, 161, 61))
self.nextButton.setText(QApplication.translate("MainWindow",
"Next", None, QApplication.UnicodeUTF8))
self.nextButton.setObjectName("nextButton")
self.nextButton.setStyleSheet(self.fgb)
font.setPointSize(15)
self.nextButton.setFont(font)
self.stackedWidget.addWidget(self.storyPage)
self.gridLayout.addWidget(self.stackedWidget, 0, 0, 1, 1)
MainWindow.setCentralWidget(self.centralwidget)
#Menu bar
self.menubar = QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 818, 25))
self.menubar.setObjectName("menubar")
self.menuMenu = QMenu(self.menubar)
self.menuMenu.setTitle(QApplication.translate("MainWindow",
"Menu", None, QApplication.UnicodeUTF8))
self.menuMenu.setObjectName("menuMenu")
MainWindow.setMenuBar(self.menubar)
self.actionSave_Game = QAction(MainWindow)
self.actionSave_Game.setText(QApplication.translate("MainWindow",
"Save Game", None, QApplication.UnicodeUTF8))
self.actionSave_Game.setObjectName("actionSave_Game")
self.actionCredits = QAction(MainWindow)
self.actionCredits.setText(QApplication.translate("MainWindow",
"Credits", None, QApplication.UnicodeUTF8))
self.actionCredits.setObjectName("actionCredits")
self.actionQuit = QAction(MainWindow)
self.actionQuit.setText(QApplication.translate("MainWindow",
"Quit", None, QApplication.UnicodeUTF8))
self.actionQuit.setObjectName("actionQuit")
self.actionSettings = QAction(MainWindow)
self.actionSettings.setText(QApplication.translate("MainWindow",
"Settings", None, QApplication.UnicodeUTF8))
self.actionSettings.setObjectName("actionSettings")
self.actionHelp = QAction(MainWindow)
self.actionHelp.setText(QApplication.translate("MainWindow",
"Help", None, QApplication.UnicodeUTF8))
self.actionHelp.setObjectName("actionHelp")
self.actionMain_Menu = QAction(MainWindow)
self.actionMain_Menu.setText(QApplication.translate("MainWindow",
"Main Menu", None, QApplication.UnicodeUTF8))
self.actionMain_Menu.setObjectName("actionMain_Menu")
self.menuMenu.addAction(self.actionSettings)
self.menuMenu.addAction(self.actionHelp)
self.menuMenu.addAction(self.actionSave_Game)
self.menuMenu.addAction(self.actionCredits)
self.menuMenu.addAction(self.actionMain_Menu)
self.menuMenu.addAction(self.actionQuit)
self.menubar.addAction(self.menuMenu.menuAction())
self.retranslateUi(MainWindow)
self.stackedWidget.setCurrentIndex(0)
self.stackIndex = 0
def retranslateUi(self, MainWindow):
pass
示例9: __init__
# 需要导入模块: from PyQt4.QtGui import QMenuBar [as 别名]
# 或者: from PyQt4.QtGui.QMenuBar import addAction [as 别名]
def __init__(self):
QMainWindow.__init__(self)
widget = QWidget(self)
self.setCentralWidget(widget)
self.hbox = QHBoxLayout(widget)
self.vbox = QVBoxLayout()
self.hbox.addLayout(self.vbox)
self.lineEdit = QLineEdit()
self.lookupButton = QPushButton(self.tr("Lookup"))
self.vbox.addWidget(self.lineEdit)
self.vbox.addWidget(self.lookupButton)
self.numPadLayout = QGridLayout()
gridHSpacing = 0
self.numPadLayout.setHorizontalSpacing(gridHSpacing)
singleButtonWidth = 58
button1 = self.createNumKey("1", singleButtonWidth)
button2 = self.createNumKey("2", singleButtonWidth)
button3 = self.createNumKey("3", singleButtonWidth)
button4 = self.createNumKey("4", singleButtonWidth)
button5 = self.createNumKey("5", singleButtonWidth)
button6 = self.createNumKey("6", singleButtonWidth)
button7 = self.createNumKey("7", singleButtonWidth)
button8 = self.createNumKey("8", singleButtonWidth)
button9 = self.createNumKey("9", singleButtonWidth)
button0 = self.createNumKey("0", 2 * singleButtonWidth + gridHSpacing)
buttonCE = self.createNumKey("CE", singleButtonWidth)
self.numPadLayout.addWidget(button7, 0, 0, 1, 1)
self.numPadLayout.addWidget(button8, 0, 1, 1, 1)
self.numPadLayout.addWidget(button9, 0, 2, 1, 1)
self.numPadLayout.addWidget(button4, 1, 0, 1, 1)
self.numPadLayout.addWidget(button5, 1, 1, 1, 1)
self.numPadLayout.addWidget(button6, 1, 2, 1, 1)
self.numPadLayout.addWidget(button1, 2, 0, 1, 1)
self.numPadLayout.addWidget(button2, 2, 1, 1, 1)
self.numPadLayout.addWidget(button3, 2, 2, 1, 1)
self.numPadLayout.addWidget(button0, 3, 0, 1, 2)
self.numPadLayout.addWidget(buttonCE, 3, 2, 1, 1)
self.numPadLayout.setHorizontalSpacing(gridHSpacing)
self.vbox.addLayout(self.numPadLayout)
self.vbox.addStretch()
self.table = StockMatchTableView()
self.hbox.addWidget(self.table)
self.model = StockMatchTableModel()
self.delegate = StockMatchTableDelegate()
self.table.setModel(self.model)
self.table.setItemDelegate(self.delegate)
self.stockMatcher = StockMatchGoogleFinance()
self.hbox.setStretchFactor(self.vbox, 1)
self.hbox.setStretchFactor(self.table, 10)
self.setWindowTitle(self.tr("Stock Matcher"))
self.connect(self.lineEdit, SIGNAL("returnPressed()"), self.lookupButton.click)
self.connect(self.lookupButton, SIGNAL("clicked()"), self.processNewQuery)
self.connect(button0, SIGNAL("pressed()"), lambda: self.pressedNum(0))
self.connect(button1, SIGNAL("pressed()"), lambda: self.pressedNum(1))
self.connect(button2, SIGNAL("pressed()"), lambda: self.pressedNum(2))
self.connect(button3, SIGNAL("pressed()"), lambda: self.pressedNum(3))
self.connect(button4, SIGNAL("pressed()"), lambda: self.pressedNum(4))
self.connect(button5, SIGNAL("pressed()"), lambda: self.pressedNum(5))
self.connect(button6, SIGNAL("pressed()"), lambda: self.pressedNum(6))
self.connect(button7, SIGNAL("pressed()"), lambda: self.pressedNum(7))
self.connect(button8, SIGNAL("pressed()"), lambda: self.pressedNum(8))
self.connect(button9, SIGNAL("pressed()"), lambda: self.pressedNum(9))
self.connect(buttonCE, SIGNAL("pressed()"), self.pressedCE)
self.table.resizeRowsToContents()
self.table.resizeColumnsToContents()
changeAppLocaleAction = QAction(self.tr("Change language"), self)
self.connect(changeAppLocaleAction, SIGNAL("triggered()"), self.changeLocale)
changeUrlAction = QAction(self.tr("Change Google Finance URL"), self)
self.connect(changeUrlAction, SIGNAL("triggered()"), self.changeUrl)
menuBar = QMenuBar()
menuBar.addAction(changeAppLocaleAction)
menuBar.addAction(changeUrlAction)
self.setMenuBar(menuBar)
示例10: MainWindow
# 需要导入模块: from PyQt4.QtGui import QMenuBar [as 别名]
# 或者: from PyQt4.QtGui.QMenuBar import addAction [as 别名]
class MainWindow(QMainWindow, object):
"""
QMainWindow displays pipeline
Parameters
----------
port : str
used port to communicate with pipeline
Note: The firewall must be configure to accept input/output on this port
"""
def __init__(self, port):
super(MainWindow, self).__init__()
self.setupUi(port)
def setupUi(self, port):
self.setObjectName("MainWindow")
self.resize(600,600)
self.centralwidget = QWidget(self)
p = self.centralwidget.palette()
self.centralwidget.setAutoFillBackground(True)
p.setColor(self.centralwidget.backgroundRole(), QColor(126, 135, 152))
self.centralwidget.setPalette(p)
self.centralwidget.setObjectName("centralwidget")
self.gridLayout = QGridLayout(self.centralwidget)
self.gridLayout.setObjectName("gridLayout")
self.setCentralWidget(self.centralwidget)
self.menubar = QMenuBar(self)
self.menubar.setGeometry(QRect(0, 0, 808, 25))
self.menubar.setObjectName("menubar")
self.menuFile = QMenu(self.menubar)
self.menuFile.setObjectName("menuFile")
self.setMenuBar(self.menubar)
self.statusbar = QStatusBar(self)
self.statusbar.setObjectName("statusbar")
self.setStatusBar(self.statusbar)
self.actionQuit = QAction(self)
self.actionQuit.setObjectName("actionQuit")
self.menuFile.addSeparator()
self.menuFile.addAction(self.actionQuit)
self.menubar.addAction(self.menuFile.menuAction())
self.actionReset = QAction(self)
self.actionReset.setObjectName("reset")
self.menuFile.addSeparator()
self.menuFile.addAction(self.actionReset)
self.menubar.addAction(self.menuFile.menuAction())
# add other GUI objects
self.graph_widget = GraphWidget(self.statusbar)
self.gridLayout.addWidget(self.graph_widget, 1, 11, 10, 10 )
pixmap = QPixmap(':/images/cta-logo-mini.png')
lbl = QLabel()
lbl.setPixmap(pixmap)
self.gridLayout.addWidget(lbl, 0, 0)
p = self.graph_widget.palette()
self.graph_widget.setAutoFillBackground(True)
p.setColor(
self.graph_widget.backgroundRole(),QColor(255,255,255))# QColor(226, 235, 252))
self.graph_widget.setPalette(p)
self.quitButton = QPushButton() # self.centralwidget)
self.quitButton.setObjectName("quitButton")
self.quitButton.setText(QApplication.translate
("MainWindow", "Quit", None, QApplication.UnicodeUTF8))
self.gridLayout.addWidget(self.quitButton, 12, 0, 1, 1)
self.info_label = InfoLabel(0,4)
self.info_label.setAutoFillBackground(True)
self.gridLayout.addWidget(self.info_label,1, 0, 1, 5)
#self.info_label.setAlignment(PyQt4.Qt.AlignCenter);
palette = QPalette()
palette.setColor(self.info_label.backgroundRole(),Qt.lightGray)
self.info_label.setPalette(palette)
QObject.connect(
self.quitButton, SIGNAL("clicked()"), self.stop)
QObject.connect(
self.actionQuit, SIGNAL("triggered()"), self.stop)
QMetaObject.connectSlotsByName(self)
self.retranslateUi()
QObject.connect(
self.actionQuit, SIGNAL("triggered()"), self.close)
QMetaObject.connectSlotsByName(self)
# Create GuiConnexion for ZMQ comminucation with pipeline
self.guiconnection = GuiConnexion(gui_port=port, statusBar=self.statusbar)
self.guiconnection.message.connect(self.graph_widget.pipechange)
self.guiconnection.message.connect(self.info_label.pipechange)
self.guiconnection.reset_message.connect(self.graph_widget.reset)
self.guiconnection.reset_message.connect(self.info_label.reset)
self.guiconnection.mode_message.connect(self.info_label.mode_receive)
QObject.connect(
self.actionReset, SIGNAL("triggered()"), self.guiconnection.reset)
QMetaObject.connectSlotsByName(self)
# start the process
self.guiconnection.start()
def retranslateUi(self):
self.setWindowTitle(QApplication.translate(
"ctapipe flow based GUI", "ctapipe flow based GUI", None, QApplication.UnicodeUTF8))
self.menuFile.setTitle(QApplication.translate(
"MainWindow", "File", None, QApplication.UnicodeUTF8))
self.actionQuit.setText(QApplication.translate(
"MainWindow", "Quit", None, QApplication.UnicodeUTF8))
self.actionReset.setText(QApplication.translate(
"MainWindow", "Reset", None, QApplication.UnicodeUTF8))
#.........这里部分代码省略.........
示例11: DirectoriesDialog
# 需要导入模块: from PyQt4.QtGui import QMenuBar [as 别名]
# 或者: from PyQt4.QtGui.QMenuBar import addAction [as 别名]
class DirectoriesDialog(QMainWindow):
def __init__(self, parent, app):
QMainWindow.__init__(self, None)
self.app = app
self.lastAddedFolder = platform.INITIAL_FOLDER_IN_DIALOGS
self.recentFolders = Recent(self.app, "recentFolders")
self._setupUi()
self.directoriesModel = DirectoriesModel(self.app.model.directory_tree, view=self.treeView)
self.directoriesDelegate = DirectoriesDelegate()
self.treeView.setItemDelegate(self.directoriesDelegate)
self._setupColumns()
self.app.recentResults.addMenu(self.menuLoadRecent)
self.app.recentResults.addMenu(self.menuRecentResults)
self.recentFolders.addMenu(self.menuRecentFolders)
self._updateAddButton()
self._updateRemoveButton()
self._updateLoadResultsButton()
self._setupBindings()
def _setupBindings(self):
self.scanButton.clicked.connect(self.scanButtonClicked)
self.loadResultsButton.clicked.connect(self.actionLoadResults.trigger)
self.addFolderButton.clicked.connect(self.actionAddFolder.trigger)
self.removeFolderButton.clicked.connect(self.removeFolderButtonClicked)
self.treeView.selectionModel().selectionChanged.connect(self.selectionChanged)
self.app.recentResults.itemsChanged.connect(self._updateLoadResultsButton)
self.recentFolders.itemsChanged.connect(self._updateAddButton)
self.recentFolders.mustOpenItem.connect(self.app.model.add_directory)
self.directoriesModel.foldersAdded.connect(self.directoriesModelAddedFolders)
self.app.willSavePrefs.connect(self.appWillSavePrefs)
def _setupActions(self):
# (name, shortcut, icon, desc, func)
ACTIONS = [
("actionLoadResults", "Ctrl+L", "", tr("Load Results..."), self.loadResultsTriggered),
("actionShowResultsWindow", "", "", tr("Results Window"), self.app.showResultsWindow),
("actionAddFolder", "", "", tr("Add Folder..."), self.addFolderTriggered),
]
createActions(ACTIONS, self)
def _setupMenu(self):
self.menubar = QMenuBar(self)
self.menubar.setGeometry(QRect(0, 0, 42, 22))
self.menuFile = QMenu(self.menubar)
self.menuFile.setTitle(tr("File"))
self.menuView = QMenu(self.menubar)
self.menuView.setTitle(tr("View"))
self.menuHelp = QMenu(self.menubar)
self.menuHelp.setTitle(tr("Help"))
self.menuLoadRecent = QMenu(self.menuFile)
self.menuLoadRecent.setTitle(tr("Load Recent Results"))
self.setMenuBar(self.menubar)
self.menuFile.addAction(self.actionLoadResults)
self.menuFile.addAction(self.menuLoadRecent.menuAction())
self.menuFile.addSeparator()
self.menuFile.addAction(self.app.actionQuit)
self.menuView.addAction(self.app.actionPreferences)
self.menuView.addAction(self.actionShowResultsWindow)
self.menuView.addAction(self.app.actionIgnoreList)
self.menuHelp.addAction(self.app.actionShowHelp)
self.menuHelp.addAction(self.app.actionRegister)
self.menuHelp.addAction(self.app.actionCheckForUpdate)
self.menuHelp.addAction(self.app.actionOpenDebugLog)
self.menuHelp.addAction(self.app.actionAbout)
self.menubar.addAction(self.menuFile.menuAction())
self.menubar.addAction(self.menuView.menuAction())
self.menubar.addAction(self.menuHelp.menuAction())
# Recent folders menu
self.menuRecentFolders = QMenu()
self.menuRecentFolders.addAction(self.actionAddFolder)
self.menuRecentFolders.addSeparator()
# Recent results menu
self.menuRecentResults = QMenu()
self.menuRecentResults.addAction(self.actionLoadResults)
self.menuRecentResults.addSeparator()
def _setupUi(self):
self.setWindowTitle(self.app.NAME)
self.resize(420, 338)
self.centralwidget = QWidget(self)
self.verticalLayout = QVBoxLayout(self.centralwidget)
self.promptLabel = QLabel(tr('Select folders to scan and press "Scan".'), self.centralwidget)
self.verticalLayout.addWidget(self.promptLabel)
self.treeView = QTreeView(self.centralwidget)
self.treeView.setSelectionMode(QAbstractItemView.ExtendedSelection)
self.treeView.setSelectionBehavior(QAbstractItemView.SelectRows)
self.treeView.setAcceptDrops(True)
triggers = (
QAbstractItemView.DoubleClicked | QAbstractItemView.EditKeyPressed | QAbstractItemView.SelectedClicked
)
self.treeView.setEditTriggers(triggers)
self.treeView.setDragDropOverwriteMode(True)
self.treeView.setDragDropMode(QAbstractItemView.DropOnly)
self.treeView.setUniformRowHeights(True)
self.verticalLayout.addWidget(self.treeView)
self.horizontalLayout = QHBoxLayout()
#.........这里部分代码省略.........
示例12: initWidgets
# 需要导入模块: from PyQt4.QtGui import QMenuBar [as 别名]
# 或者: from PyQt4.QtGui.QMenuBar import addAction [as 别名]
def initWidgets(self):
# create subwidgets
self.player = Player(self)
self.playlist = Playlist(self)
self.browser = Browser(self)
if have_maemo:
# build Maemo stack hierarchy
self.playlist.setParent(self.player)
self.browser.setParent(self.player)
for w in [ self.player, self.playlist, self.browser ]:
w.setAttribute( Qt.WA_Maemo5StackedWindow)
w.setWindowFlags( w.windowFlags() | Qt.Window)
# add menu bar
menu = QMenuBar(self.player)
menu.addAction(self.actionPlaylist)
menu.addAction(self.actionBrowser)
menu.addAction(self.actionStats)
menu.addAction(self.actionOutputs)
menu.addAction(self.actionPrefs)
menu.addAction(self.actionConnect)
else:
self.stack = QStackedWidget()
for w in [ self.player, self.playlist, self.browser ]:
w.setParent(self.stack)
self.stack.addWidget(w)