本文整理汇总了Python中PyQt5.QtWidgets.QMenuBar.addAction方法的典型用法代码示例。如果您正苦于以下问题:Python QMenuBar.addAction方法的具体用法?Python QMenuBar.addAction怎么用?Python QMenuBar.addAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QMenuBar
的用法示例。
在下文中一共展示了QMenuBar.addAction方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: EditorMainWindow
# 需要导入模块: from PyQt5.QtWidgets import QMenuBar [as 别名]
# 或者: from PyQt5.QtWidgets.QMenuBar import addAction [as 别名]
#.........这里部分代码省略.........
self.label_model_name.setObjectName("label_model_name")
self.label_4 = QLabel(self.centralwidget)
self.label_4.setObjectName("label_4")
self.label_5 = QLabel(self.centralwidget)
self.label_5.setObjectName("label_5")
for label in (self.label_object_id, self.label_position, self.label_model_name, self.label_4, self.label_5):
label.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
self.verticalLayout_2.addWidget(self.lineedit_angle)
self.verticalLayout_2.addWidget(self.label_object_id)
self.verticalLayout_2.addWidget(self.label_position)
self.verticalLayout_2.addWidget(self.label_model_name)
self.verticalLayout_2.addWidget(self.label_4)
self.verticalLayout_2.addWidget(self.label_5)
self.verticalLayout.addLayout(self.verticalLayout_2)
self.horizontalLayout.addWidget(self.vertLayoutWidget)
self.menubar = QMenuBar(MainWindow)
self.menubar.setGeometry(QRect(0, 0, 820, 29))
self.menubar.setObjectName("menubar")
self.file_menu = QMenu(self.menubar)
self.file_menu.setObjectName("menuLoad")
self.file_load_action = QAction("Load", self)
self.file_load_action.triggered.connect(self.button_load_level)
self.file_menu.addAction(self.file_load_action)
self.file_save_action = QAction("Save", self)
self.file_save_action.triggered.connect(self.button_save_level)
self.file_menu.addAction(self.file_save_action)
self.visibility_menu = MenuDontClose(self.menubar)#QMenu(self.menubar)
self.visibility_menu.setObjectName("visibility")
#self.visibility_menu.addAction(self.toggle_action)
self.visibility_actions = []
self.terrain_menu = QMenu(self.menubar)
self.terrain_menu.setObjectName("terrain")
self.terrain_load_action = QAction("Load Terrain", self)
self.terrain_load_action.triggered.connect(self.button_terrain_load_action)
self.terrain_menu.addAction(self.terrain_load_action)
self.terrain_display_actions = []
self.setup_terrain_display_toggles()
#self.menuLoad_2 = QMenu(self.menubar)
#self.menuLoad_2.setObjectName("menuLoad_2")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.menubar.addAction(self.file_menu.menuAction())
#self.menubar.addAction(self.menuLoad_2.menuAction())
self.menubar.addAction(self.visibility_menu.menuAction())
self.menubar.addAction(self.terrain_menu.menuAction())
self.retranslateUi(MainWindow)
示例2: ResultWindow
# 需要导入模块: from PyQt5.QtWidgets import QMenuBar [as 别名]
# 或者: from PyQt5.QtWidgets.QMenuBar import addAction [as 别名]
class ResultWindow(QMainWindow):
def __init__(self, parent, app, **kwargs):
super().__init__(parent, **kwargs)
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.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.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.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)
self.menubar.addAction(self.menuFile.menuAction())
#.........这里部分代码省略.........
示例3: MainWindow
# 需要导入模块: from PyQt5.QtWidgets import QMenuBar [as 别名]
# 或者: from PyQt5.QtWidgets.QMenuBar import addAction [as 别名]
#.........这里部分代码省略.........
self.actionSaveAs.setShortcut("Ctrl+Shift+S")
self.actionAbout = QAction(tr("About moneyGuru"), self)
self.actionToggleReconciliationMode = QAction(tr("Toggle Reconciliation Mode"), self)
self.actionToggleReconciliationMode.setShortcut("Ctrl+Shift+R")
self.actionToggleAccountExclusion = QAction(tr("Toggle Exclusion Status of Account"), self)
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.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.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.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.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)
self.menuEdit.addAction(self.actionMakeScheduleFromSelected)
self.menuEdit.addAction(self.actionReconcileSelected)
self.menuEdit.addAction(self.actionToggleReconciliationMode)
示例4: DirectoriesDialog
# 需要导入模块: from PyQt5.QtWidgets import QMenuBar [as 别名]
# 或者: from PyQt5.QtWidgets.QMenuBar import addAction [as 别名]
class DirectoriesDialog(QMainWindow):
def __init__(self, app, **kwargs):
super().__init__(None, **kwargs)
self.app = app
self.lastAddedFolder = platform.INITIAL_FOLDER_IN_DIALOGS
self.recentFolders = Recent(self.app, 'recentFolders')
self._setupUi()
self._updateScanTypeList()
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._updateActionsState()
self._setupBindings()
def _setupBindings(self):
self.appModeRadioBox.itemSelected.connect(self.appModeButtonSelected)
self.showPreferencesButton.clicked.connect(self.app.actionPreferences.trigger)
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.actionClearPictureCache)
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.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)
hl = QHBoxLayout()
label = QLabel(tr("Application Mode:"), self)
label.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
hl.addWidget(label)
self.appModeRadioBox = RadioBox(
self,
items=[tr("Standard"), tr("Music"), tr("Picture")],
spread=False
)
hl.addWidget(self.appModeRadioBox)
self.verticalLayout.addLayout(hl)
#.........这里部分代码省略.........
示例5: Dimili
# 需要导入模块: from PyQt5.QtWidgets import QMenuBar [as 别名]
# 或者: from PyQt5.QtWidgets.QMenuBar import addAction [as 别名]
class Dimili(QMainWindow):
def baslat(self, anaPencere):
anaPencere.resize(600, 400)
anaPencere.setWindowTitle("Dimili-Türkçe Sözlük")
anaPencere.setFixedSize(600,400)
icon =QIcon()
icon.addPixmap(QPixmap("Dictionary.png"),QIcon.Normal,QIcon.Off)
anaPencere.setWindowIcon(icon)
zemin=QWidget(anaPencere)
zemin.setGeometry(QRect(0,30,600,390))
zemin.setStyleSheet("background-color:rgb(167, 196, 233);")
self.araKutu = QLineEdit(anaPencere)
self.araKutu.setGeometry(QRect(10, 80, 200, 20))
self.araKutu.textChanged.connect(self.benzerKelimeler)
self.kelimeGir = QLabel("Kelimeler:",anaPencere)
self.kelimeGir.setGeometry(QRect(10, 110, 141, 21))
self.kelimeGor = QLabel("Kelime Ara",anaPencere)
self.kelimeGor.setGeometry(QRect(10, 30, 91, 16))
self.harfGrup=QButtonGroup(anaPencere)
aharf=QPushButton("â",anaPencere)
aharf.setGeometry(QRect(10,50,25,25))
eharf=QPushButton("é",anaPencere)
eharf.setGeometry(QRect(30,50,25,25))
self.DilGrup=QButtonGroup(anaPencere)
self.Dil1 = QPushButton("Zazaca-Türkçe",anaPencere)
self.Dil1.setGeometry(QRect(230, 80, 91, 23))
self.Dil1.setCheckable(True)
self.Dil1.setAutoExclusive(True)
self.Dil1.setChecked(True)
self.Dil1.setStyleSheet("background-color: rgb(102, 255, 0);")
self.Dil2 = QPushButton("Türkçe-Zazaca",anaPencere)
self.Dil2.setGeometry(QRect(330, 80, 91, 23))
self.Dil2.setCheckable(True)
self.Dil2.setAutoExclusive(True)
self.Dil2.setStyleSheet("background-color: rgb(255, 94, 105);")
self.DilGrup.addButton(self.Dil1,1)
self.DilGrup.addButton(self.Dil2,2)
self.DilGrup.buttonClicked[int].connect(self.dilSecme)
self.kelimeListesi=QListWidget(anaPencere)
self.kelimeListesi.setGeometry(QRect(10, 130, 191, 231))
self.kelimeListesi.itemClicked.connect(self.kelimeAcikla)
self.kelimeAnlam = QLabel("Kelimenin Anlamı:",anaPencere)
self.kelimeAnlam.setGeometry(QRect(230, 110, 131, 21))
self.cumleList1 = QListWidget(anaPencere)
self.cumleList1.setGeometry(QRect(230, 130, 351, 51))
self.ornekCumle1 = QLabel("Örnek Zazaca Cümle:",anaPencere)
self.ornekCumle1.setGeometry(QRect(230, 200, 101, 21))
self.cumleList2 = QListWidget(anaPencere)
self.cumleList2.setGeometry(QRect(230, 220, 351, 51))
self.ornekCumle2 = QLabel("Örnek Türkçe Cümle:",anaPencere)
self.ornekCumle2.setGeometry(QRect(230, 290, 111, 16))
self.cumleList3 = QListWidget(anaPencere)
self.cumleList3.setGeometry(QRect(230, 310, 351, 51))
self.anaMenu = QMenuBar(anaPencere)
self.anaMenu.setGeometry(QRect(0, 0, 600, 21))
self.menuDosya = QMenu("Dosya",self.anaMenu)
self.menuDuzenle = QMenu("Düzenle",self.anaMenu)
self.menuYardim = QMenu("Yardım",self.anaMenu)
anaPencere.setMenuBar(self.anaMenu)
self.durum = QStatusBar(zemin)
anaPencere.setStatusBar(self.durum)
self.durum.setStyleSheet("background-color:white")
self.durum.showMessage("Hazır")
self.cikis= QAction(QIcon("Exit.ico"),"&Çıkış",anaPencere)
self.cikis.setShortcut("Ctrl+X")
self.cikis.triggered.connect(anaPencere.close)
self.actionHakkinda = QAction("Hakkında",anaPencere)
self.actionHakkinda.triggered.connect(self.hakkinda)
self.actionSecenekler = QAction("Seçenekler",anaPencere)
self.menuDosya.addAction(self.cikis)
self.menuDuzenle.addAction(self.actionSecenekler)
self.menuYardim.addAction(self.actionHakkinda)
#.........这里部分代码省略.........
示例6: DirectoriesDialog
# 需要导入模块: from PyQt5.QtWidgets import QMenuBar [as 别名]
# 或者: from PyQt5.QtWidgets.QMenuBar import addAction [as 别名]
class DirectoriesDialog(QMainWindow):
def __init__(self, app, **kwargs):
super().__init__(None, **kwargs)
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.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()
self.removeFolderButton = QPushButton(self.centralwidget)
self.removeFolderButton.setIcon(QIcon(QPixmap(":/minus")))
#.........这里部分代码省略.........
示例7: MainWindow
# 需要导入模块: from PyQt5.QtWidgets import QMenuBar [as 别名]
# 或者: from PyQt5.QtWidgets.QMenuBar import addAction [as 别名]
#.........这里部分代码省略.........
self.progressBar.setSizePolicy(sizePolicy)
self.progressBar.setProperty("value", 0)
self.progressBar.setObjectName("progressBar")
self.horizontalLayout_4.addWidget(self.progressBar)
self.execute_button = QPushButton(self.layoutWidget)
sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.execute_button.sizePolicy().hasHeightForWidth())
self.execute_button.setSizePolicy(sizePolicy)
self.execute_button.setObjectName("execute_button")
self.horizontalLayout_4.addWidget(self.execute_button)
self.verticalLayout_5.addLayout(self.horizontalLayout_4)
self.setCentralWidget(self.centralwidget)
self.menubar = QMenuBar(self)
self.menubar.setGeometry(QRect(0, 0, 1040, 26))
self.menubar.setObjectName("menubar")
self.file_menu = QMenu(self.menubar)
self.file_menu.setObjectName("file_menu")
self.help_menu = QMenu(self.menubar)
self.help_menu.setObjectName("help_menu")
self.setMenuBar(self.menubar)
self.statusbar = QStatusBar(self)
self.statusbar.setObjectName("statusbar")
self.setStatusBar(self.statusbar)
self.action_add_data = QAction(self)
self.action_add_data.setObjectName("action_add_data")
self.action_help = QAction(self)
self.action_help.setObjectName("action_help")
self.action_about = QAction(self)
self.action_about.setObjectName("action_about")
self.action_save_pic = QAction(self)
self.action_save_pic.setObjectName("action_save_pic")
self.file_menu.addAction(self.action_add_data)
self.file_menu.addAction(self.action_save_pic)
self.help_menu.addAction(self.action_help)
self.help_menu.addAction(self.action_about)
self.menubar.addAction(self.file_menu.menuAction())
self.menubar.addAction(self.help_menu.menuAction())
self.retranslateUi()
self.tabWidget.setCurrentIndex(0)
QMetaObject.connectSlotsByName(self)
self.center()
self.show()
self.target_area.activated[str].connect(self.updateTargetArea)
self.datetime.dateChanged.connect(self.updateDatetime)
self.density_cell.valueChanged.connect(self.updateDensityCell)
self.density_class.valueChanged.connect(self.updateDensityClass)
self.day_cell.valueChanged.connect(self.updateDayCell)
self.day_class.valueChanged.connect(self.updateDayClass)
self.action_add_data.triggered.connect(self.addData)
self.action_save_pic.triggered.connect(self.savePic)
self.action_about.triggered.connect(self.showAbout)
self.action_help.triggered.connect(self.showHelp)
self.execute_button.clicked.connect(self.execute)
self.density_mxd.clicked.connect(self.openMxdDensity)
self.day_mxd.clicked.connect(self.openMxdDay)
self.density_mxd.setDisabled(True)
self.day_mxd.setDisabled(True)
self.action_save_pic.setDisabled(True)
示例8: __init__
# 需要导入模块: from PyQt5.QtWidgets import QMenuBar [as 别名]
# 或者: from PyQt5.QtWidgets.QMenuBar import addAction [as 别名]
def __init__(self, parent=None):
super(Assembler, self).__init__(parent)
self.resize(800, 600)
self.filename = None
self.filetuple = None
self.dirty = False # Refers to Data Page only.
self.nb = None
centralwidget = QWidget(self)
gridLayout = QGridLayout(centralwidget)
self.tabWidget = QTabWidget(centralwidget)
# textbox
self.tab = QWidget()
font = QFont()
font.setFamily("Inconsolata")
font.setPointSize(14)
self.tab.setFont(font)
gridLayout_3 = QGridLayout(self.tab)
self.plainTextEdit = QPlainTextEdit(self.tab)
self.plainTextEdit.installEventFilter(self)
self.plainTextEdit.setAcceptDrops(True)
gridLayout_3.addWidget(self.plainTextEdit, 0, 0, 1, 1)
self.tabWidget.addTab(self.tab, "")
self.tab_2 = QWidget()
self.tab_2.setFont(font)
gridLayout_2 = QGridLayout(self.tab_2)
self.plainTextEdit_2 = QPlainTextEdit(self.tab_2)
gridLayout_2.addWidget(self.plainTextEdit_2, 0, 0, 1, 1)
self.tabWidget.addTab(self.tab_2, "")
self.tab_3 = QWidget()
self.tab_3.setFont(font)
gridLayout_3 = QGridLayout(self.tab_3)
self.checkbox = QCheckBox("Cloning genes by tailed primers (no pYPKa_A vectors constructed)")
self.checkbox.setChecked(True)
gridLayout_3.addWidget(self.checkbox, 0, 0, 0, 0)
self.tabWidget.addTab(self.tab_3, "")
gridLayout.addWidget(self.tabWidget, 0, 0, 1, 1)
self.setCentralWidget(centralwidget)
menubar = QMenuBar(self)
menubar.setGeometry(QRect(0, 0, 800, 29))
menu_File = QMenu(menubar)
self.menu_Solve = QMenu(menubar)
self.menu_Help = QMenu(menubar)
self.setMenuBar(menubar)
self.statusbar = QStatusBar(self)
self.setStatusBar(self.statusbar)
self.action_New = QAction(self)
self.actionSave_As = QAction(self)
self.action_Save = QAction(self)
self.action_Open = QAction(self)
self.action_Quit = QAction(self)
self.action_About = QAction(self)
self.actionShow_CCPL = QAction(self)
self.action_Solve = QAction(self)
self.action_OpenNB = QAction(self)
self.action_CCPL = QAction(self)
self.action_Help = QAction(self)
menu_File.addAction(self.action_New)
menu_File.addAction(self.action_Open)
menu_File.addAction(self.actionSave_As)
menu_File.addAction(self.action_Save)
menu_File.addSeparator()
menu_File.addAction(self.action_Quit)
self.menu_Solve.addAction(self.action_Solve)
self.menu_Solve.addAction(self.action_OpenNB)
self.menu_Help.addAction(self.action_About)
#self.menu_Help.addAction(self.action_CCPL)
#self.menu_Help.addAction(self.action_Help)
menubar.addAction(menu_File.menuAction())
menubar.addAction(self.menu_Solve.menuAction())
menubar.addAction(self.menu_Help.menuAction())
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab),\
"Data Page")
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2),\
"Assembly log")
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3),\
"Settings")
menu_File.setTitle("&File")
self.menu_Solve.setTitle("&Assemble")
self.menu_Help.setTitle("&About")
self.tabWidget.setCurrentIndex(0)
self.action_New.setText("&New")
self.action_Open.setText("&Open")
self.actionSave_As.setText("Save &As")
self.action_Save.setText("&Save")
self.action_Quit.setText("&Quit")
self.action_Solve.setText("&Assemble")
self.action_OpenNB.setText("&Open &pathway")
self.action_About.setText("&About")
#self.action_CCPL.setText("&CCPL")
#.........这里部分代码省略.........
示例9: MainWindow
# 需要导入模块: from PyQt5.QtWidgets import QMenuBar [as 别名]
# 或者: from PyQt5.QtWidgets.QMenuBar import addAction [as 别名]
#.........这里部分代码省略.........
self.progressBar = QProgressBar(self.centralwidget)
self.progressBar.hide()
self.horizontalLayout.addWidget(self.progressBar)
self.label = QLabel(self.centralwidget)
self.horizontalLayout.addWidget(self.label)
spacerItem = QSpacerItem(40, 20, QSizePolicy.Minimum, QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem)
self.checkButton = QPushButton(self.centralwidget)
self.checkButton.setText(self.tr("Check"))
self.horizontalLayout.addWidget(self.checkButton)
self.updateButton = QPushButton(self.centralwidget)
self.updateButton.setText(self.tr("Update item"))
self.horizontalLayout.addWidget(self.updateButton)
self.editRuleButton = QPushButton(self.centralwidget)
self.editRuleButton.setText(self.tr("Edit rule"))
self.horizontalLayout.addWidget(self.editRuleButton)
self.verticalLayout.addLayout(self.horizontalLayout)
MainWindow.setCentralWidget(self.centralwidget)
# 菜单
self.menubar = QMenuBar(MainWindow)
self.menubar.setGeometry(QRect(0, 0, 780, 34))
MainWindow.setMenuBar(self.menubar)
self.fileMenu = QMenu(self.menubar)
self.fileMenu.setTitle(self.tr("File"))
self.menubar.addAction(self.fileMenu.menuAction())
self.toolMenu = QMenu(self.menubar)
self.toolMenu.setTitle(self.tr("Tool"))
self.menubar.addAction(self.toolMenu.menuAction())
self.helpMenu = QMenu(self.menubar)
self.helpMenu.setTitle(self.tr("Help"))
self.menubar.addAction(self.helpMenu.menuAction())
self.statusbar = QStatusBar(MainWindow)
MainWindow.setStatusBar(self.statusbar)
# 菜单项
self.aboutAction = QAction(MainWindow)
self.aboutAction.setText(self.tr("About"))
self.aboutAction.setObjectName("about")
self.aboutQtAction = QAction(MainWindow)
self.aboutQtAction.setText(self.tr("About Qt"))
self.aboutQtAction.setObjectName("about_qt")
self.openAction = QAction(MainWindow)
self.openAction.setText(self.tr("&Open"))
self.openAction.setShortcut('Ctrl+O')
self.openAction.setStatusTip(self.tr('Open a file'))
self.openAction.setObjectName("open")
self.openUrlAction = QAction(MainWindow)
self.openUrlAction.setText(self.tr("Open &url"))
self.openUrlAction.setShortcut('Ctrl+U')
self.openUrlAction.setStatusTip(self.tr('Open a file with url'))
self.saveAction = QAction(MainWindow)
self.saveAction.setText(self.tr("&Save"))
self.saveAction.setShortcut('Ctrl+S')
self.saveAction.setStatusTip(self.tr('Save a file'))