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