本文整理汇总了Python中PyQt4.QtGui.QMenuBar.setObjectName方法的典型用法代码示例。如果您正苦于以下问题:Python QMenuBar.setObjectName方法的具体用法?Python QMenuBar.setObjectName怎么用?Python QMenuBar.setObjectName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QMenuBar
的用法示例。
在下文中一共展示了QMenuBar.setObjectName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Ui_SLim
# 需要导入模块: from PyQt4.QtGui import QMenuBar [as 别名]
# 或者: from PyQt4.QtGui.QMenuBar import setObjectName [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: GuiMain
# 需要导入模块: from PyQt4.QtGui import QMenuBar [as 别名]
# 或者: from PyQt4.QtGui.QMenuBar import setObjectName [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")
#.........这里部分代码省略.........
示例3: Gui
# 需要导入模块: from PyQt4.QtGui import QMenuBar [as 别名]
# 或者: from PyQt4.QtGui.QMenuBar import setObjectName [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)
#.........这里部分代码省略.........
示例4: MainWindow
# 需要导入模块: from PyQt4.QtGui import QMenuBar [as 别名]
# 或者: from PyQt4.QtGui.QMenuBar import setObjectName [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))
#.........这里部分代码省略.........