本文整理汇总了Python中PyQt4.QtGui.QMenuBar.setGeometry方法的典型用法代码示例。如果您正苦于以下问题:Python QMenuBar.setGeometry方法的具体用法?Python QMenuBar.setGeometry怎么用?Python QMenuBar.setGeometry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QMenuBar
的用法示例。
在下文中一共展示了QMenuBar.setGeometry方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Ui_SLim
# 需要导入模块: from PyQt4.QtGui import QMenuBar [as 别名]
# 或者: from PyQt4.QtGui.QMenuBar import setGeometry [as 别名]
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: ResultWindow
# 需要导入模块: from PyQt4.QtGui import QMenuBar [as 别名]
# 或者: from PyQt4.QtGui.QMenuBar import setGeometry [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)
#.........这里部分代码省略.........
示例3: MainWindow
# 需要导入模块: from PyQt4.QtGui import QMenuBar [as 别名]
# 或者: from PyQt4.QtGui.QMenuBar import setGeometry [as 别名]
#.........这里部分代码省略.........
self.newItemButton.setSizePolicy(buttonSizePolicy)
self.newItemButton.setIcon(QIcon(QPixmap(':/plus_8')))
self.horizontalLayout.addWidget(self.newItemButton)
self.deleteItemButton = QPushButton(self.bottomBar)
self.deleteItemButton.setSizePolicy(buttonSizePolicy)
self.deleteItemButton.setIcon(QIcon(QPixmap(':/minus_8')))
self.horizontalLayout.addWidget(self.deleteItemButton)
self.editItemButton = QPushButton(self.bottomBar)
self.editItemButton.setSizePolicy(buttonSizePolicy)
self.editItemButton.setIcon(QIcon(QPixmap(':/info_gray_12')))
self.horizontalLayout.addWidget(self.editItemButton)
self.horizontalLayout.addItem(horizontalSpacer(size=20))
self.graphVisibilityButton = QPushButton()
self.graphVisibilityButton.setSizePolicy(buttonSizePolicy)
self.graphVisibilityButton.setIcon(QIcon(QPixmap(':/graph_visibility_on_16')))
self.horizontalLayout.addWidget(self.graphVisibilityButton)
self.piechartVisibilityButton = QPushButton()
self.piechartVisibilityButton.setSizePolicy(buttonSizePolicy)
self.piechartVisibilityButton.setIcon(QIcon(QPixmap(':/piechart_visibility_on_16')))
self.horizontalLayout.addWidget(self.piechartVisibilityButton)
self.columnsVisibilityButton = QPushButton()
self.columnsVisibilityButton.setSizePolicy(buttonSizePolicy)
self.columnsVisibilityButton.setIcon(QIcon(QPixmap(':/columns_16')))
self.horizontalLayout.addWidget(self.columnsVisibilityButton)
self.statusLabel = QtGui.QLabel(tr("Status"))
self.statusLabel.setAlignment(Qt.AlignCenter)
self.horizontalLayout.addWidget(self.statusLabel)
self.verticalLayout.addWidget(self.bottomBar)
self.setCentralWidget(self.centralwidget)
self.menubar = QMenuBar(self)
self.menubar.setGeometry(QRect(0, 0, 700, 20))
self.menuFile = QMenu(tr("File"))
self.menuOpenRecent = QMenu(tr("Open Recent"))
self.menuView = QMenu(tr("View"))
self.menuDateRange = QMenu(tr("Date Range"))
self.menuEdit = QMenu(tr("Edit"))
self.menuHelp = QMenu(tr("Help"))
self.setMenuBar(self.menubar)
self.actionOpenDocument = QAction(tr("Open..."), self)
self.actionOpenDocument.setShortcut("Ctrl+O")
self.actionShowNetWorth = QAction(tr("Net Worth"), self)
self.actionShowNetWorth.setShortcut("Ctrl+1")
self.actionShowNetWorth.setIcon(QIcon(QPixmap(':/balance_sheet_48')))
self.actionShowProfitLoss = QAction(escapeamp(tr("Profit & Loss")), self)
self.actionShowProfitLoss.setShortcut("Ctrl+2")
self.actionShowProfitLoss.setIcon(QIcon(QPixmap(':/income_statement_48')))
self.actionShowTransactions = QAction(tr("Transactions"), self)
self.actionShowTransactions.setShortcut("Ctrl+3")
self.actionShowTransactions.setIcon(QIcon(QPixmap(':/transaction_table_48')))
self.actionShowSelectedAccount = QAction(tr("Show Account"), self)
self.actionShowSelectedAccount.setShortcut("Ctrl+]")
self.actionNewItem = QAction(tr("New Item"), self)
self.actionNewItem.setShortcut("Ctrl+N")
self.actionDeleteItem = QAction(tr("Remove Selected"), self)
self.actionEditItem = QAction(tr("Show Info"), self)
self.actionEditItem.setShortcut("Ctrl+I")
self.actionToggleGraph = QAction(tr("Toggle Graph"), self)
self.actionToggleGraph.setShortcut("Ctrl+Alt+G")
self.actionTogglePieChart = QAction(tr("Toggle Pie Chart"), self)
self.actionTogglePieChart.setShortcut("Ctrl+Alt+P")
self.actionMoveUp = QAction(tr("Move Up"), self)
self.actionMoveUp.setShortcut("Ctrl++")
self.actionMoveDown = QAction(tr("Move Down"), self)
示例4: GuiMain
# 需要导入模块: from PyQt4.QtGui import QMenuBar [as 别名]
# 或者: from PyQt4.QtGui.QMenuBar import setGeometry [as 别名]
class GuiMain(object):
def __init__(self, data):
self.data = data
self.loadSave = False
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
#Set size of window and make it non-resizeable
MainWindow.resize(818, 665)
MainWindow.setFixedHeight(665)
MainWindow.setFixedWidth(818)
MainWindow.setWindowTitle("Map Master: Search for the Lost City")
MainWindow.setWindowIcon(QIcon("icon_medium.ico"))
#Set window backgrounds
self.background = QLabel(MainWindow)
self.backgroundPixmapMenu = QPixmap(normpath("images/gameMenu2.png"))
self.backgroundPixmapSettings = QPixmap(normpath("images/gameMenuSettings2.png"))
self.background.setPixmap(self.backgroundPixmapMenu)
self.background.setGeometry(QtCore.QRect(0, 0, 818, 665))
#Stylesheet settings for labels and buttons
self.fg = "QLabel {color:black}"
self.fgb = "QPushButton {color:black}"
self.centralwidget = QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.gridLayout = QGridLayout(self.centralwidget)
self.gridLayout.setObjectName("gridLayout")
self.stackedWidget = QStackedWidget(self.centralwidget)
self.stackedWidget.setEnabled(True)
self.stackedWidget.setObjectName("stackedWidget")
#Main Menu page
self.menuPage = QWidget()
self.menuPage.setObjectName("menuPage")
self.startButton = QPushButton(self.menuPage)
self.startButton.setStyleSheet(self.fgb)
self.startButton.setGeometry(QtCore.QRect(600, 200, 180, 60))
self.startButton.setText(QApplication.translate("MainWindow", "Start Game", None, QApplication.UnicodeUTF8))
self.startButton.setObjectName("startButton")
self.loadButton = QPushButton(self.menuPage)
self.loadButton.setStyleSheet(self.fgb)
self.loadButton.setGeometry(QtCore.QRect(600, 280, 180, 60))
self.loadButton.setText(QApplication.translate("MainWindow", "Load Game", None, QApplication.UnicodeUTF8))
self.loadButton.setObjectName("loadButton")
self.settingsButton = QPushButton(self.menuPage)
self.settingsButton.setStyleSheet(self.fgb)
self.settingsButton.setGeometry(QtCore.QRect(600, 440, 180, 60))
self.settingsButton.setText(QApplication.translate("MainWindow", "Settings", None, QApplication.UnicodeUTF8))
self.settingsButton.setObjectName("settingsButton")
self.quitButton = QPushButton(self.menuPage)
self.quitButton.setStyleSheet(self.fgb)
self.quitButton.setGeometry(QtCore.QRect(600, 520, 180, 60))
self.quitButton.setText(QApplication.translate("MainWindow", "Quit", None, QApplication.UnicodeUTF8))
self.quitButton.setObjectName("quitButton")
self.instrButton = QPushButton(self.menuPage)
self.instrButton.setStyleSheet(self.fgb)
self.instrButton.setGeometry(QtCore.QRect(600, 360, 180, 60))
self.instrButton.setText(QApplication.translate("MainWindow", "Instructions", None, QApplication.UnicodeUTF8))
self.instrButton.setObjectName("instrButton")
self.stackedWidget.addWidget(self.menuPage)
#Settings page
self.settingsPage = QWidget()
self.settingsPage.setObjectName("settingsPage")
self.volumeSlider = QSlider(self.settingsPage)
self.volumeSlider.setGeometry(QtCore.QRect(200, 200, 400, 30))
self.volumeSlider.setProperty("value", 50)
self.volumeSlider.setOrientation(QtCore.Qt.Horizontal)
self.volumeSlider.setObjectName("volumeSlider")
self.soundLabel = QLabel(self.settingsPage)
self.soundLabel.setGeometry(QtCore.QRect(340, 160, 120, 30))
font = QFont()
font.setFamily("Century Schoolbook L")
font.setPointSize(20)
self.soundLabel.setFont(font)
self.soundLabel.setStyleSheet(self.fg)
self.soundLabel.setText(QApplication.translate("MainWindow", "Volume", None, QApplication.UnicodeUTF8))
self.soundLabel.setAlignment(QtCore.Qt.AlignCenter)
self.soundLabel.setObjectName("soundLabel")
#Quiet Sound Graphic
self.quietGraphic = QLabel(self.settingsPage)
self.quietGraphic.setPixmap(QPixmap(normpath("images/speakerQuiet.png")))
self.quietGraphic.setGeometry(QtCore.QRect(90, 180, 80, 80))
self.quietGraphic.setObjectName("quietGraphic")
#Loud Sound Graphic
self.loudGraphic = QLabel(self.settingsPage)
self.loudGraphic.setPixmap(QPixmap(normpath("images/speakerLoud.png")))
self.loudGraphic.setEnabled(True)
self.loudGraphic.setGeometry(QtCore.QRect(630, 180, 80, 80))
self.loudGraphic.setObjectName("loudGraphic")
#.........这里部分代码省略.........
示例5: MainWindow
# 需要导入模块: from PyQt4.QtGui import QMenuBar [as 别名]
# 或者: from PyQt4.QtGui.QMenuBar import setGeometry [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)
示例6: Gui
# 需要导入模块: from PyQt4.QtGui import QMenuBar [as 别名]
# 或者: from PyQt4.QtGui.QMenuBar import setGeometry [as 别名]
class Gui(object):
def __init__(self, MainWindow):
MainWindow.setObjectName("MainWindow")
#Set size of window and make it non-resizeable
MainWindow.resize(818, 665)
MainWindow.setFixedHeight(665)
MainWindow.setFixedWidth(818)
MainWindow.setWindowTitle("Map Master: Search for the Lost City")
MainWindow.setWindowIcon(QIcon("icon_medium.ico"))
#Set window backgrounds
self.background = QLabel(MainWindow)
self.backgroundPixmapMenu = QPixmap(normpath("images/gameMenu2.png"))
self.backgroundPixmapSettings = QPixmap(normpath(
"images/gameMenuSettings2.png"))
self.background.setPixmap(self.backgroundPixmapMenu)
self.background.setGeometry(QtCore.QRect(0, 0, 818, 665))
self.popupPixmap = QPixmap(normpath("images/popupBG.png"))
font = QFont()
if "linux" in platform:
font.setFamily("Century Schoolbook L")
else:
font.setFamily("Century Schoolbook")
#Stylesheet settings for labels and buttons
self.fg = "QLabel {color:black}"
self.fgb = "QPushButton {color:black}"
self.centralwidget = QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.gridLayout = QGridLayout(self.centralwidget)
self.gridLayout.setObjectName("gridLayout")
self.stackedWidget = QStackedWidget(self.centralwidget)
self.stackedWidget.setEnabled(True)
self.stackedWidget.setObjectName("stackedWidget")
#Main Menu page
self.menuPage = QWidget()
self.menuPage.setObjectName("menuPage")
self.startButton = QPushButton(self.menuPage)
self.startButton.setStyleSheet(self.fgb)
self.startButton.setGeometry(QtCore.QRect(600, 200, 180, 60))
self.startButton.setText(QApplication.translate("MainWindow",
"Start Game", None, QApplication.UnicodeUTF8))
self.startButton.setObjectName("startButton")
font.setPointSize(15)
self.startButton.setFont(font)
self.loadButton = QPushButton(self.menuPage)
self.loadButton.setStyleSheet(self.fgb)
self.loadButton.setGeometry(QtCore.QRect(600, 280, 180, 60))
self.loadButton.setText(QApplication.translate("MainWindow",
"Load Game", None, QApplication.UnicodeUTF8))
self.loadButton.setObjectName("loadButton")
self.loadButton.setFont(font)
self.settingsButton = QPushButton(self.menuPage)
self.settingsButton.setStyleSheet(self.fgb)
self.settingsButton.setGeometry(QtCore.QRect(600, 440, 180, 60))
self.settingsButton.setText(QApplication.translate("MainWindow",
"Settings", None, QApplication.UnicodeUTF8))
self.settingsButton.setObjectName("settingsButton")
self.settingsButton.setFont(font)
self.quitButton = QPushButton(self.menuPage)
self.quitButton.setStyleSheet(self.fgb)
self.quitButton.setGeometry(QtCore.QRect(600, 520, 180, 60))
self.quitButton.setText(QApplication.translate("MainWindow",
"Quit", None, QApplication.UnicodeUTF8))
self.quitButton.setObjectName("quitButton")
self.quitButton.setFont(font)
self.instrButton = QPushButton(self.menuPage)
self.instrButton.setStyleSheet(self.fgb)
self.instrButton.setGeometry(QtCore.QRect(600, 360, 180, 60))
self.instrButton.setText(QApplication.translate("MainWindow",
"Instructions", None, QApplication.UnicodeUTF8))
self.instrButton.setObjectName("instrButton")
self.instrButton.setFont(font)
self.stackedWidget.addWidget(self.menuPage)
#Settings page
self.settingsPage = QWidget()
self.settingsPage.setObjectName("settingsPage")
self.volumeSlider = QSlider(self.settingsPage)
self.volumeSlider.setGeometry(QtCore.QRect(200, 200, 400, 30))
self.volumeSlider.setProperty("value", 50)
self.volumeSlider.setOrientation(QtCore.Qt.Horizontal)
self.volumeSlider.setObjectName("volumeSlider")
self.soundLabel = QLabel(self.settingsPage)
#.........这里部分代码省略.........
示例7: MainWindow
# 需要导入模块: from PyQt4.QtGui import QMenuBar [as 别名]
# 或者: from PyQt4.QtGui.QMenuBar import setGeometry [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))
#.........这里部分代码省略.........
示例8: DirectoriesDialog
# 需要导入模块: from PyQt4.QtGui import QMenuBar [as 别名]
# 或者: from PyQt4.QtGui.QMenuBar import setGeometry [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()
#.........这里部分代码省略.........