本文整理汇总了Python中PySide.QtGui.QDialog.setLayout方法的典型用法代码示例。如果您正苦于以下问题:Python QDialog.setLayout方法的具体用法?Python QDialog.setLayout怎么用?Python QDialog.setLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QDialog
的用法示例。
在下文中一共展示了QDialog.setLayout方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: settings
# 需要导入模块: from PySide.QtGui import QDialog [as 别名]
# 或者: from PySide.QtGui.QDialog import setLayout [as 别名]
def settings(self):
if self.settings_window is None:
window = QDialog(self)
self.settings_window = window
else: window = self.settings_window
window = self.settings_window
window.setWindowTitle('Settings')
window.notelabel = QLabel("Currently these settings are only guaranteed to work prior to loading the first MIDI!\nYou'll have to restart ADLMIDI pyGui to change them again if they stop working. \n\nSorry! This will be fixed soon!")
window.notelabel.setWordWrap(True)
window.notelabel.setStyleSheet("font-size: 8pt; border-style: dotted; border-width: 1px; padding: 12px;")
window.banklabel = QLabel("<B>Choose Instrument Bank</B>")
window.space = QLabel("")
window.optlabel = QLabel("<B>Options</B>")
window.combo = QComboBox()
window.combo.addItems(self.banks)
#window.combo.setMaximumWidth(350)
window.combo.setMaxVisibleItems(12)
window.combo.setStyleSheet("combobox-popup: 0;")
window.combo.setCurrentIndex(int(self.progset.value("sound/bank", 1)))
window.combo.currentIndexChanged.connect(self.saveSettings)
window.perc = QCheckBox("Adlib Percussion Instrument Mode")
#window.perc.stateChanged.connect(self.checkOpts)
window.tremamp = QCheckBox("Tremolo Amplification Mode")
#window.tremamp.stateChanged.connect(self.checkOpts)
window.vibamp = QCheckBox("Vibrato Amplification Mode")
#window.vibamp.stateChanged.connect(self.checkOpts)
window.modscale = QCheckBox("Scaling of Modulator Volume")
#window.modscale.stateChanged.connect(self.checkOpts)
window.okButton = QPushButton('OK')
window.okButton.clicked.connect(window.hide)
vbox = QVBoxLayout()
vbox.addWidget(window.space)
vbox.addWidget(window.banklabel)
vbox.addWidget(window.combo)
vbox.addWidget(window.space)
vbox.addWidget(window.optlabel)
vbox.addWidget(window.perc)
vbox.addWidget(window.tremamp)
vbox.addWidget(window.vibamp)
vbox.addWidget(window.modscale)
vbox.addWidget(window.notelabel)
hbox = QHBoxLayout()
hbox.addStretch(1)
hbox.addWidget(window.okButton)
vbox.addLayout(hbox)
window.setLayout(vbox)
window.setFixedSize(530, 369)
window.show()
window.activateWindow()
window.raise_()
示例2: _showpostviewerdialog
# 需要导入模块: from PySide.QtGui import QDialog [as 别名]
# 或者: from PySide.QtGui.QDialog import setLayout [as 别名]
def _showpostviewerdialog(self, post):
d = QDialog(self)
d.resize(1024, 768)
l = QVBoxLayout()
w = PostViewerWidget(post, self._backend, self._masterobserver, self)
w.nextpostrequested.connect(self._putnextpost)
w.previouspostrequested.connect(self._putpreviouspost)
w.closing.connect(d.close)
l.addWidget(w)
d.setLayout(l)
d.setModal(False)
d.show()
示例3: createProject
# 需要导入模块: from PySide.QtGui import QDialog [as 别名]
# 或者: from PySide.QtGui.QDialog import setLayout [as 别名]
class createProject():
def __init__(self, parent):
self.parent = parent
self.directory = ""
self.dialog = QDialog(parent.parent)
mainLayout = QVBoxLayout()
aux = QHBoxLayout()
name = QLabel("Project Name: ")
self.textBox = QLineEdit()
aux.addWidget(name)
aux.addWidget(self.textBox)
aux2 = QWidget()
aux2.setLayout(aux)
mainLayout.addWidget(aux2)
auxBox = QHBoxLayout()
self.directoryLabel = QLabel("Directory: ")
button = QPushButton("...")
button.clicked.connect(self.fileChoosing)
auxBox.addWidget(self.directoryLabel)
auxBox.addWidget(button)
auxWidget = QWidget()
auxWidget.setLayout(auxBox)
mainLayout.addWidget(auxWidget)
buttonOk = QPushButton("Create Project")
buttonOk.clicked.connect(self.okClicked)
mainLayout.addWidget(buttonOk)
self.dialog.setLayout(mainLayout)
self.dialog.show()
def fileChoosing(self):
filePicker = QFileDialog()
self.directory = filePicker.getExistingDirectory(self.parent, "Get Directory")
self.directoryLabel.setText("Directory: " + self.directory)
filePicker.destroy()
def okClicked(self):
if self.directory != "" and self.textBox.text() != "":
try:
if self.parent.parent.platform == "linux2":
os.mkdir(self.directory + "/"+ self.textBox.text())
self.parent.parent.project = Project(self.directory + "/"+ self.textBox.text(), self.textBox.text(), "linux2")
elif self.parent.parent.platform == "win32":
os.mkdir(self.directory + "\\"+ self.textBox.text())
self.parent.parent.project = Project(self.directory + "\\"+ self.textBox.text(), self.textBox.text(), "win32")
self.parent.parent.project.save()
self.dialog.setVisible(False)
self.parent.parent.fileMenu.saveProjectAction.setEnabled(True)
self.parent.parent.signalMenu.addSignalAction.setEnabled(True)
self.parent.parent.signalMenu.applyOperationAction.setEnabled(True)
msg = QMessageBox(self.parent.parent)
msg.setText("Project created")
msg.show()
except OSError:
msg = QErrorMessage(self.parent.parent)
msg.showMessage("Project already exists")
示例4: addSignal
# 需要导入模块: from PySide.QtGui import QDialog [as 别名]
# 或者: from PySide.QtGui.QDialog import setLayout [as 别名]
class addSignal():
def __init__(self, parent):
self.parent = parent
self.dialog = QDialog(self.parent.parent)
mainLayout = QVBoxLayout()
aux = QHBoxLayout()
name = QLabel("Signal Name: ")
self.nameBox = QLineEdit()
aux.addWidget(name)
aux.addWidget(self.nameBox)
aux2 = QWidget()
aux2.setLayout(aux)
mainLayout.addWidget(aux2)
auxBox = QHBoxLayout()
self.fileLabel = QLabel("File: ")
button = QPushButton("...")
button.clicked.connect(self.fileChoosing)
auxBox.addWidget(self.fileLabel)
auxBox.addWidget(button)
auxWidget = QWidget()
auxWidget.setLayout(auxBox)
mainLayout.addWidget(auxWidget)
hBox = QHBoxLayout()
hBox.addWidget(QLabel("Sample Rate (Hz): "))
self.sampleRate = QLineEdit()
self.sampleRate.setText("60")
hBox.addWidget(self.sampleRate)
auxW = QWidget()
auxW.setLayout(hBox)
mainLayout.addWidget(auxW)
auxBox = QHBoxLayout()
commentaryLabel = QLabel("Commentary: ")
self.commentaryBox = QTextEdit()
auxBox.addWidget(commentaryLabel)
auxBox.addWidget(self.commentaryBox)
auxWidget = QWidget()
auxWidget.setLayout(auxBox)
mainLayout.addWidget(auxWidget)
buttonOk = QPushButton("Add Signal")
buttonOk.clicked.connect(self.addSignalClicked)
mainLayout.addWidget(buttonOk)
self.dialog.setLayout(mainLayout)
self.dialog.show()
def fileChoosing(self):
filePicker = QFileDialog()
self.fileName = filePicker.getOpenFileName(self.parent, 'Select File')[0]
filePicker.destroy()
self.fileLabel.setText("File: " + self.fileName)
filePicker.destroy()
def addSignalClicked(self):
if self.fileName != "" and self.nameBox.text() != "":
self.parent.parent.project.addSignal(self.nameBox.text(), self.fileName, self.commentaryBox.toPlainText(), self.sampleRate.text())
self.dialog.setVisible(False)
label = self.parent.parent.project.signalList[-1][0].getImage()
if self.parent.parent.table.columnCount() == 0: self.parent.parent.table.setColumnCount(1)
self.parent.parent.table.setRowCount(self.parent.parent.table.rowCount() + 1)
self.parent.parent.table.setCellWidget(len(self.parent.parent.project.signalList)-1,0,label)
self.parent.parent.table.resizeColumnsToContents()
self.parent.parent.table.resizeRowsToContents()
self.parent.parent.setLabels()
msg = QMessageBox(self.parent.parent)
msg.setText("Signal added")
msg.show()
示例5: __init__
# 需要导入模块: from PySide.QtGui import QDialog [as 别名]
# 或者: from PySide.QtGui.QDialog import setLayout [as 别名]
def __init__(self, parent):
dialog = QDialog(parent.parent)
mainLayout = QVBoxLayout()
aux = QHBoxLayout()
name = QLabel("Signal Name: ")
nameBox = QLineEdit()
aux.addWidget(name)
aux.addWidget(nameBox)
aux2 = QWidget()
aux2.setLayout(aux)
mainLayout.addWidget(aux2)
def fileChoosing():
global fileName
filePicker = QFileDialog()
fileName = filePicker.getOpenFileName(parent, 'Select File')[0]
filePicker.destroy()
fileLabel.setText("File: " + fileName)
filePicker.destroy()
def addSignalClicked():
global directory
if fileName != "" and nameBox.text() != "":
parent.parent.project.addSignal(nameBox.text(), fileName, commentaryBox.toPlainText())
dialog.setVisible(False)
label = parent.parent.project.signalList[-1][0].getImage()
if parent.parent.mainWidget.columnCount() == 0: parent.parent.mainWidget.setColumnCount(1)
parent.parent.mainWidget.setRowCount(parent.parent.mainWidget.rowCount() + 1)
parent.parent.mainWidget.setCellWidget(len(parent.parent.project.signalList)-1,0,label)
parent.parent.mainWidget.resizeColumnsToContents()
parent.parent.mainWidget.resizeRowsToContents()
msg = QMessageBox(parent.parent)
msg.setText("Signal added")
msg.show()
auxBox = QHBoxLayout()
fileLabel = QLabel("File: ")
button = QPushButton("...")
button.clicked.connect(fileChoosing)
auxBox.addWidget(fileLabel)
auxBox.addWidget(button)
auxWidget = QWidget()
auxWidget.setLayout(auxBox)
mainLayout.addWidget(auxWidget)
auxBox = QHBoxLayout()
commentaryLabel = QLabel("Commentary: ")
commentaryBox = QTextEdit()
auxBox.addWidget(commentaryLabel)
auxBox.addWidget(commentaryBox)
auxWidget = QWidget()
auxWidget.setLayout(auxBox)
mainLayout.addWidget(auxWidget)
buttonOk = QPushButton("Add Signal")
buttonOk.clicked.connect(addSignalClicked)
mainLayout.addWidget(buttonOk)
dialog.setLayout(mainLayout)
dialog.show()
示例6: __init__
# 需要导入模块: from PySide.QtGui import QDialog [as 别名]
# 或者: from PySide.QtGui.QDialog import setLayout [as 别名]
def __init__(self, parent):
directory = ""
dialog = QDialog(parent.parent)
mainLayout = QVBoxLayout()
aux = QHBoxLayout()
name = QLabel("Project Name: ")
textBox = QLineEdit()
aux.addWidget(name)
aux.addWidget(textBox)
aux2 = QWidget()
aux2.setLayout(aux)
mainLayout.addWidget(aux2)
def fileChoosing():
global directory
filePicker = QFileDialog()
directory = filePicker.getExistingDirectory(parent, "Get Directory")
directoryLabel.setText("Directory: " + directory)
filePicker.destroy()
def okClicked():
global directory
if directory != "" and textBox.text() != "":
try:
os.mkdir(directory + "/"+ textBox.text())
parent.parent.project = Project(directory + "/"+ textBox.text(), textBox.text())
parent.parent.project.save()
dialog.setVisible(False)
parent.parent.fileMenu.saveProjectAction.setEnabled(True)
parent.parent.signalMenu.addSignalAction.setEnabled(True)
parent.parent.signalMenu.applyOperationAction.setEnabled(True)
msg = QMessageBox(parent.parent)
msg.setText("Project created")
msg.show()
except OSError:
msg = QErrorMessage(parent.parent)
msg.showMessage("Project already exists")
auxBox = QHBoxLayout()
directoryLabel = QLabel("Directory: ")
button = QPushButton("...")
button.clicked.connect(fileChoosing)
auxBox.addWidget(directoryLabel)
auxBox.addWidget(button)
auxWidget = QWidget()
auxWidget.setLayout(auxBox)
mainLayout.addWidget(auxWidget)
buttonOk = QPushButton("Create Project")
buttonOk.clicked.connect(okClicked)
mainLayout.addWidget(buttonOk)
dialog.setLayout(mainLayout)
dialog.show()