本文整理匯總了Python中PyQt5.QtWidgets.QLineEdit.setMinimumHeight方法的典型用法代碼示例。如果您正苦於以下問題:Python QLineEdit.setMinimumHeight方法的具體用法?Python QLineEdit.setMinimumHeight怎麽用?Python QLineEdit.setMinimumHeight使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt5.QtWidgets.QLineEdit
的用法示例。
在下文中一共展示了QLineEdit.setMinimumHeight方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: ImportPage
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setMinimumHeight [as 別名]
class ImportPage(QtWidgets.QWizardPage):
def __init__(self, Wizard, parent=None):
super(ImportPage, self).__init__(parent)
self.base = Wizard.base
self.setTitle(self.tr("Beginning"))
self.setSubTitle(self.tr("Choose distribution and import " +
"tarball or folder with source code"))
self.textLabel = QLabel()
self.textLabel.setText(
"<html><head/><body><p><span style=\"font-size:12pt;\">" +
"RPG - RPM Package Generator is tool, that guides you through" +
" the creation of a RPM package.<br>" +
"Please fill following details about your package.<br>For " +
"more information use tool tips (move the cursor on the label)." +
"<br><strong>Note:</strong> You can change target distribution" +
" and architecture later or you can build more packages." +
"</p></body></html>")
self.importLabel = QLabel("Source<font color=\'red\'>*</font>")
self.importEdit = QLineEdit()
self.importEdit.setMinimumHeight(30)
self.importLabel.setBuddy(self.importEdit)
self.importLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
self.importLabel.setToolTip(
"Pristine source package (e.g. tarballs) and patches")
self.importEdit.textChanged.connect(self.checkPath)
self.importEdit.setMinimumHeight(34)
self.importButton = QPushButton("Import")
self.importButton.setMinimumHeight(45)
self.importButton.setMinimumWidth(115)
self.importButton.clicked.connect(self.importPath)
self.ArchLabel = QLabel("Architecture<font color=\'red\'>*</font>")
self.ArchEdit = QComboBox()
self.ArchEdit.setMinimumHeight(30)
arch = platform.architecture()[0]
if arch == "32bit":
self.ArchEdit.addItem("i386")
self.ArchEdit.addItem("x86_64")
else:
self.ArchEdit.addItem("x86_64")
self.ArchEdit.addItem("i386")
self.ArchLabel.setBuddy(self.ArchEdit)
self.ArchLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
self.ArchLabel.setToolTip(
"Choose target architecture (32 bit - i386 or 64 bit - x68_64)")
self.DistroLabel = QLabel("Distribution<font color=\'red\'>*</font>")
self.DistroEdit = QComboBox()
self.DistroEdit.setMinimumHeight(30)
self.DistroEdit.addItem("fedora-22")
self.DistroEdit.addItem("fedora-21")
self.DistroEdit.addItem("fedora-20")
self.DistroEdit.addItem("fedora-19")
self.DistroEdit.addItem("fedora-rawhide")
self.DistroEdit.addItem("epel-7")
self.DistroEdit.addItem("epel-6")
self.DistroEdit.addItem("epel-5")
self.DistroLabel.setBuddy(self.DistroEdit)
self.DistroLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
self.DistroLabel.setToolTip("Choose target distribution")
self.registerField("Source*", self.importEdit)
mainLayout = QVBoxLayout()
grid = QGridLayout()
grid.addWidget(self.textLabel, 0, 0, 1, 6)
grid.setVerticalSpacing(15)
grid.addWidget(self.importLabel, 1, 0, 1, 1)
grid.addWidget(self.importEdit, 1, 1, 1, 6)
grid.addWidget(self.importButton, 1, 7, 1, 1)
grid.addWidget(self.DistroLabel, 2, 0, 1, 0)
grid.addWidget(self.DistroEdit, 2, 1, 1, 2)
grid.addWidget(self.ArchLabel, 3, 0, 1, 0)
grid.addWidget(self.ArchEdit, 3, 1, 1, 2)
mainLayout.addSpacing(25)
mainLayout.addLayout(grid)
self.setLayout(mainLayout)
def checkPath(self):
''' Checks, if path to import is correct while typing'''
path = Path(self.importEdit.text())
if(path.exists()):
self.importEdit.setStyleSheet("")
else:
self.importEdit.setStyleSheet("QLineEdit { border-style: solid;" +
"border-width: 1px;" +
"border-color: red;" +
"border-radius: 3px;" +
"background-color:" +
"rgb(233,233,233);}")
def importPath(self):
''' Returns path selected file or archive'''
self.import_dialog = DialogImport()
self.import_dialog.exec_()
#.........這裏部分代碼省略.........
示例2: CoprLoginPage
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setMinimumHeight [as 別名]
class CoprLoginPage(QtWidgets.QWizardPage):
def __init__(self, Wizard, parent=None):
super(CoprLoginPage, self).__init__(parent)
self.base = Wizard.base
self.setTitle(self.tr("Copr page"))
self.setSubTitle(self.tr("Copr mandatory information"))
self.textLoginLabel = QLabel()
self.textLoginLabel.setText(
"<html><head/><body><p align=\"left\"><span" +
"style=\" font-size:24pt;\">For upload and " +
"build package in Copr you need an account " +
"on <a href=\"https://copr.fedoraproject.org/api\">" +
"Copr API</a>.<br>Please log in and copy your information." +
" It will be saved on config file, but nowhere else.<br>" +
" You also need upload your package " +
"on some public web site." +
"</span></p></body></html>")
self.usernameLabel = QLabel("Username<font color=\'red\'>*</font>")
self.usernameEdit = QLineEdit()
self.usernameEdit.setMinimumHeight(30)
self.usernameLabel.setBuddy(self.usernameEdit)
self.usernameLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
self.usernameLabel.setToolTip("Your username from Copr API")
self.loginLabel = QLabel("Login<font color=\'red\'>*</font>")
self.loginEdit = QLineEdit()
self.loginEdit.setMinimumHeight(30)
self.loginLabel.setBuddy(self.loginEdit)
self.loginLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
self.loginLabel.setToolTip("Your login (not username!) from Copr API")
self.tokenLabel = QLabel("Token<font color=\'red\'>*</font>")
self.tokenEdit = QLineEdit()
self.tokenEdit.setMinimumHeight(30)
self.tokenLabel.setBuddy(self.tokenEdit)
self.tokenLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
self.tokenLabel.setToolTip("Your token from Copr API")
self.packageNameLabel = QLabel("Name<font color=\'red\'>*</font>")
self.packageNameEdit = QLineEdit()
self.packageNameEdit.setMinimumHeight(30)
self.packageNameLabel.setBuddy(self.packageNameEdit)
self.packageNameLabel.setCursor(
QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
self.packageNameLabel.setToolTip(
"Name of your package. It MUST be unique!")
self.packageUrlLabel = QLabel("Url<font color=\'red\'>*</font>")
self.packageUrlEdit = QLineEdit()
self.packageUrlEdit.setMinimumHeight(30)
self.packageUrlLabel.setBuddy(self.packageUrlEdit)
self.packageUrlLabel.setCursor(
QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
self.packageUrlLabel.setToolTip(
"An url of your package. It must be some public web site")
self.Fedora22_i386_CheckBox = QCheckBox("fedora-22-i386")
self.Fedora22_x64_CheckBox = QCheckBox("fedora-22-x86_64")
self.Fedora21_i386_CheckBox = QCheckBox("fedora-21-i386")
self.Fedora21_x64_CheckBox = QCheckBox("fedora-21-x86_64")
self.Fedora20_i386_CheckBox = QCheckBox("fedora-20-i386")
self.Fedora20_x64_CheckBox = QCheckBox("fedora-20-x86_64")
self.Fedoraraw_i386_CheckBox = QCheckBox("fedora-rawhide-i386")
self.Fedoraraw_x64_CheckBox = QCheckBox("fedora-rawhide-x86_64")
self.EPEL7_x64_CheckBox = QCheckBox("epel-7-x86_64")
self.EPEL6_x64_CheckBox = QCheckBox("epel-6-x86_64")
self.EPEL6_i386_CheckBox = QCheckBox("epel-6-i386")
self.EPEL5_x64_CheckBox = QCheckBox("epel-5-x86_64")
self.EPEL5_i386_CheckBox = QCheckBox("epel-5-i386")
# Making mandatory fields:
self.registerField("Username*", self.usernameEdit)
self.registerField("Login*", self.loginEdit)
self.registerField("Token*", self.tokenEdit)
self.registerField("PName*", self.packageNameEdit)
self.registerField("Url*", self.packageUrlEdit)
releaseBox = QGroupBox()
layoutReleaseBox = QGridLayout()
releaseBox.setTitle("Choose distribution*")
layoutReleaseBox.setColumnStretch(0, 1)
layoutReleaseBox.setColumnStretch(1, 1)
layoutReleaseBox.setColumnStretch(2, 1)
layoutReleaseBox.setColumnStretch(3, 1)
layoutReleaseBox.addWidget(self.EPEL7_x64_CheckBox, 0, 1)
layoutReleaseBox.addWidget(self.EPEL6_i386_CheckBox, 1, 1)
layoutReleaseBox.addWidget(self.EPEL6_x64_CheckBox, 2, 1)
layoutReleaseBox.addWidget(self.EPEL5_i386_CheckBox, 3, 1)
layoutReleaseBox.addWidget(self.EPEL5_x64_CheckBox, 4, 1)
layoutReleaseBox.addWidget(self.Fedora22_i386_CheckBox, 0, 2)
layoutReleaseBox.addWidget(self.Fedora22_x64_CheckBox, 1, 2)
layoutReleaseBox.addWidget(self.Fedora21_i386_CheckBox, 2, 2)
layoutReleaseBox.addWidget(self.Fedora21_x64_CheckBox, 3, 2)
layoutReleaseBox.addWidget(self.Fedora20_i386_CheckBox, 4, 2)
#.........這裏部分代碼省略.........
示例3: MandatoryPage
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setMinimumHeight [as 別名]
class MandatoryPage(QtWidgets.QWizardPage):
def __init__(self, Wizard, parent=None):
super(MandatoryPage, self).__init__(parent)
self.base = Wizard.base
self.setTitle(self.tr("Mandatory fields"))
self.setSubTitle(self.tr("Basic required information"))
''' Creating widgets and setting them to layout'''
self.nameLabel = QLabel("Name<font color=\'red\'>*</font>")
self.nameEdit = QLineEdit()
self.nameEdit.setMinimumHeight(30)
self.nameLabel.setBuddy(self.nameEdit)
self.nameLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
self.nameLabel.setToolTip(
"The (base) name of the package, " +
"which should match the SPEC file name")
self.versionLabel = QLabel("Version<font color=\'red\'>*</font>")
self.versionEdit = QLineEdit()
self.versionEdit.setMinimumHeight(30)
self.versionLabel.setBuddy(self.versionEdit)
self.versionLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
self.versionLabel.setToolTip(
"The upstream version number, " +
"usually numbers separated by dots (e.g. 1.7.4)")
self.releaseLabel = QLabel("Release<font color=\'red\'>*</font>")
self.releaseEdit = QLineEdit()
self.releaseEdit.setMinimumHeight(30)
self.releaseLabel.setBuddy(self.releaseEdit)
self.releaseLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
self.releaseLabel.setToolTip(
"The initial value should normally be 1%{?dist}. " +
"Increment the number every time you release a new package")
self.licenseLabel = QLabel("License<font color=\'red\'>*</font>")
self.licenseEdit = QLineEdit()
self.licenseEdit.setMinimumHeight(30)
self.licenseLabel.setBuddy(self.licenseEdit)
self.licenseLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
self.licenseLabel.setToolTip(
"The license, which must be an open source software license")
self.summaryLabel = QLabel("Summary<font color=\'red\'>*</font>")
self.summaryEdit = QLineEdit()
self.summaryEdit.setMinimumHeight(30)
self.summaryLabel.setBuddy(self.summaryEdit)
self.summaryLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
self.summaryLabel.setToolTip(
"A brief, one-line summary of the package. Use American English")
self.descriptionLabel = QLabel(
"Description<font color=\'red\'>*</font> ")
self.descriptionEdit = QLineEdit()
self.descriptionEdit.setMinimumHeight(30)
self.descriptionLabel.setBuddy(self.descriptionEdit)
self.descriptionLabel.setCursor(QtGui.
QCursor(QtCore.Qt.WhatsThisCursor))
self.descriptionLabel.setToolTip(
"A longer, multi-line description of the program")
self.URLLabel = QLabel("URL: ")
self.URLEdit = QLineEdit()
self.URLEdit.setMinimumHeight(30)
self.URLLabel.setBuddy(self.URLEdit)
self.URLLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
self.URLLabel.setToolTip(
"The full URL for more information about the " +
"program (e.g. the project website)")
# Making mandatory fields:
self.registerField("Name*", self.nameEdit)
self.registerField("Summary*", self.summaryEdit)
self.registerField("Version*", self.versionEdit)
self.registerField("Release*", self.releaseEdit)
self.registerField("License*", self.licenseEdit)
self.registerField("Description*", self.descriptionEdit)
mainLayout = QVBoxLayout()
grid = QGridLayout()
grid.setVerticalSpacing(15)
grid.addWidget(self.nameLabel, 0, 0)
grid.addWidget(self.nameEdit, 0, 1)
grid.addWidget(self.versionLabel, 1, 0)
grid.addWidget(self.versionEdit, 1, 1)
grid.addWidget(self.releaseLabel, 2, 0)
grid.addWidget(self.releaseEdit, 2, 1)
grid.addWidget(self.licenseLabel, 3, 0)
grid.addWidget(self.licenseEdit, 3, 1)
grid.addWidget(self.summaryLabel, 4, 0)
grid.addWidget(self.summaryEdit, 4, 1)
grid.addWidget(self.descriptionLabel, 5, 0)
grid.addWidget(self.descriptionEdit, 5, 1)
grid.addWidget(self.URLLabel, 6, 0)
grid.addWidget(self.URLEdit, 6, 1)
mainLayout.addSpacing(25)
mainLayout.addLayout(grid)
#.........這裏部分代碼省略.........
示例4: TubeDialog
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setMinimumHeight [as 別名]
class TubeDialog(QDialog):
def __init__(self, parent=None):
super().__init__()
self.parent = parent
self.resize(400, 75)
self.setWindowFlags(Qt.Tool)
self.move(settings().value("Youtube/position") or QPoint(250, 250))
self.setWindowIcon(QIcon.fromTheme("pisiplayer"))
self.setWindowTitle(self.tr("Youtube'dan Oynat"))
self.setStyleSheet("QDialog {background-color: rgba(255, 255, 255, 200); border-color: rgba(255, 255, 255, 200); border-width: 1px; border-style outset;}")
self.setVisible(False)
vlayout = QVBoxLayout()
self.setLayout(vlayout)
hlayout = QHBoxLayout()
vlayout.addLayout(hlayout)
self.tube_line = QLineEdit(self)
self.tube_line.setMinimumHeight(30)
self.tube_line.setStyleSheet("QLineEdit {background-color: white; color: black; border-radius: 3px;\
border-color: lightgray; border-style: solid; border-width:2px;}")
self.tube_line.setPlaceholderText("https://www.youtube.com/watch?v=mY--4-vzY6E")
hlayout.addWidget(self.tube_line)
self.tube_button = QPushButton(self)
self.tube_button.setMinimumHeight(30)
self.tube_button.setStyleSheet("QPushButton {background-color: #55aaff; color: white; border-width:1px; font-weight: bold; \
border-color: #55aaff; border-style: solid; padding-left: 3px; padding-right: 3px; border-radius: 3px;}")
self.tube_button.setText(self.tr("Video Oynat"))
hlayout.addWidget(self.tube_button)
self.tube_warning = QLabel(self)
self.tube_warning.setVisible(False)
self.tube_warning.setStyleSheet("QLabel {color: rgb(255, 0, 0); font-weight: bold; background-color: white;}")
self.tube_warning.setText(self.tr("Verilen bağlantı geçersiz!"))
vlayout.addWidget(self.tube_warning)
self.tube_line.returnPressed.connect(self.tube_button.animateClick)
self.tube_button.clicked.connect(self.videoParse)
def videoParse(self):
self.tube_warning.setVisible(False)
try:
youtube = Youtube(self.tube_line.text())
#youtube.video_title()
self.parent.player.addYoutubeVideo(youtube.get_video(settings().value("Youtube/quality") or "medium",
settings().value("Youtube/format") or "mp4"))
self.close()
# Başlık ------------ En kaliteli video url
except:
self.tube_warning.setVisible(True)
def closeEvent(self, event):
settings().setValue("Youtube/position", self.pos())
settings().sync()
event.accept()
示例5: CoprPage
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setMinimumHeight [as 別名]
class CoprPage(QtWidgets.QWizardPage):
def __init__(self, Wizard, parent=None):
super(CoprPage, self).__init__(parent)
self.base = Wizard.base
self.setTitle(self.tr("Copr page"))
self.setSubTitle(self.tr("COPR repository setting and uploading"))
COPRLabel = QLabel("<html><head/><body><p align=\"center\">You are" +
" going to upload your package to COPR." +
"</p><p align=\"center\">Copr is designed to be" +
" a lightweight buildsystem that allows " +
"</p><p align=\"center\">contributors to create" +
" packages, put them in repositories, </p>" +
"<p align=\"center\">and make it easy for" +
" users toinstall the packages </p>" +
"<p align=\"center\">onto their system." +
" Within the Fedora Project it </p>" +
"<p align=\"center\">is used toallow" +
"packagers to create third party repositories." +
"</p><p align=\"center\"><br/>For more " +
"information,please visit <a href=\"" +
"https://copr.fedoraproject.org/\"><span style=\"" +
" text-decoration: underline;color:#0000ff;\">" +
"https://copr.fedoraproject.org/</span></a></p>" +
"</body></html>")
self.createCOPRButton = QPushButton("Create COPR repository")
self.chooseCONFButton = QPushButton("Choose .conf file")
self.chooseCONFButton.clicked.connect(self.openChooseCONFFileDialog)
releaserLabel = QLabel("Releaser: ")
self.releaserEdit = QLineEdit()
projectNameLabel = QLabel("Project name: ")
self.projectNameEdit = QLineEdit()
uploadCommandLabel = QLabel("Upload command: ")
self.uploadCommandEdit = QLineEdit()
remoteLocationLabel = QLabel("Remote location: ")
self.remoteLocationEdit = QLineEdit()
self.releaserEdit.setMinimumHeight(30)
releaserLabel.setBuddy(self.releaserEdit)
self.projectNameEdit.setMinimumHeight(30)
projectNameLabel.setBuddy(self.projectNameEdit)
self.uploadCommandEdit.setMinimumHeight(30)
uploadCommandLabel.setBuddy(self.uploadCommandEdit)
self.remoteLocationEdit.setMinimumHeight(30)
remoteLocationLabel.setBuddy(self.remoteLocationEdit)
mainLayout = QVBoxLayout()
upperLayout = QHBoxLayout()
midleLayout = QHBoxLayout()
lowerLayout = QGridLayout()
upperLayout.addWidget(COPRLabel)
midleLayout.addSpacing(170)
midleLayout.addWidget(self.createCOPRButton)
midleLayout.addSpacing(50)
midleLayout.addWidget(self.chooseCONFButton)
midleLayout.addSpacing(170)
lowerLayout.addWidget(releaserLabel, 0, 0)
lowerLayout.addWidget(self.releaserEdit, 0, 1)
lowerLayout.addWidget(projectNameLabel)
lowerLayout.addWidget(self.projectNameEdit)
lowerLayout.addWidget(uploadCommandLabel)
lowerLayout.addWidget(self.uploadCommandEdit)
lowerLayout.addWidget(remoteLocationLabel)
lowerLayout.addWidget(self.remoteLocationEdit)
mainLayout.addLayout(upperLayout)
mainLayout.addSpacing(30)
mainLayout.addLayout(midleLayout)
mainLayout.addSpacing(30)
mainLayout.addLayout(lowerLayout)
self.setLayout(mainLayout)
def openChooseCONFFileDialog(self):
brows = QFileDialog()
brows.getOpenFileName(self, "/home")
def nextId(self):
return Wizard.PageFinal
示例6: ImportPage
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setMinimumHeight [as 別名]
class ImportPage(QtWidgets.QWizardPage):
def __init__(self, Wizard, parent=None):
super(ImportPage, self).__init__(parent)
self.base = Wizard.base
self.setTitle(self.tr("Beginning"))
self.setSubTitle(self.tr("Fill in fields and import " +
"your SRPM or source folder"))
''' Creating widgets and setting them to layout'''
self.nameLabel = QLabel("Name<font color=\'red\'>*</font>")
self.nameEdit = QLineEdit()
self.nameEdit.setMinimumHeight(30)
self.nameLabel.setBuddy(self.nameEdit)
self.nameLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
self.nameLabel.setToolTip("Text for name label")
self.versionLabel = QLabel("Version<font color=\'red\'>*</font>")
self.versionEdit = QLineEdit()
self.versionEdit.setMinimumHeight(30)
self.versionLabel.setBuddy(self.versionEdit)
self.versionLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
self.versionLabel.setToolTip("Text for verion label")
self.releaseLabel = QLabel("Release<font color=\'red\'>*</font>")
self.releaseEdit = QLineEdit()
self.releaseEdit.setMinimumHeight(30)
self.releaseLabel.setBuddy(self.releaseEdit)
self.releaseLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
self.releaseLabel.setToolTip("Text for release label")
self.licenseLabel = QLabel("License<font color=\'red\'>*</font>")
self.licenseEdit = QLineEdit()
self.licenseEdit.setMinimumHeight(30)
self.licenseLabel.setBuddy(self.licenseEdit)
self.licenseLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
self.licenseLabel.setToolTip("Text for license label")
self.summaryLabel = QLabel("Summary<font color=\'red\'>*</font>")
self.summaryEdit = QLineEdit()
self.summaryEdit.setMinimumHeight(30)
self.summaryLabel.setBuddy(self.summaryEdit)
self.summaryLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
self.summaryLabel.setToolTip("Text for summary label")
self.URLLabel = QLabel("URL: ")
self.URLEdit = QLineEdit()
self.URLEdit.setMinimumHeight(30)
self.URLLabel.setBuddy(self.URLEdit)
self.URLLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
self.URLLabel.setToolTip("Text for URL label")
self.descriptionLabel = QLabel("Description: ")
self.descriptionEdit = QLineEdit()
self.descriptionEdit.setMinimumHeight(30)
self.descriptionLabel.setBuddy(self.descriptionEdit)
self.descriptionLabel.setCursor(QtGui.
QCursor(QtCore.Qt.WhatsThisCursor))
self.descriptionLabel.setToolTip("Text for description label")
self.vendorLabel = QLabel("Vendor: ")
self.vendorEdit = QLineEdit()
self.vendorEdit.setMinimumHeight(30)
self.vendorLabel.setBuddy(self.vendorEdit)
self.vendorLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
self.vendorLabel.setToolTip("Text for vendor label")
self.packagerLabel = QLabel("Packager: ")
self.packagerEdit = QLineEdit()
self.packagerEdit.setMinimumHeight(30)
self.packagerLabel.setBuddy(self.packagerEdit)
self.packagerLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
self.packagerLabel.setToolTip("Text for packager label")
self.importLabel = QLabel("Source<font color=\'red\'>*</font>")
self.importEdit = QLineEdit()
self.importEdit.setMinimumHeight(30)
self.importLabel.setBuddy(self.importEdit)
self.importLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
self.importLabel.setToolTip("Text for import label")
self.importEdit.textChanged.connect(self.checkPath)
self.importEdit.setMinimumHeight(34)
self.importButton = QPushButton("Import")
self.importButton.setMinimumHeight(45)
self.importButton.setMinimumWidth(115)
self.importButton.clicked.connect(self.importPath)
# Making mandatory fields:
self.registerField("Name*", self.nameEdit)
self.registerField("Summary*", self.summaryEdit)
self.registerField("Version*", self.versionEdit)
self.registerField("Release*", self.releaseEdit)
self.registerField("License*", self.licenseEdit)
self.registerField("Source*", self.importEdit)
mainLayout = QVBoxLayout()
grid = QGridLayout()
grid.addWidget(self.importLabel, 0, 0, 1, 1)
grid.addWidget(self.importEdit, 0, 1, 1, 1)
#.........這裏部分代碼省略.........
示例7: CoprPage
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setMinimumHeight [as 別名]
class CoprPage(QtWidgets.QWizardPage):
def __init__(self, Wizard, parent=None):
super(CoprPage, self).__init__(parent)
self.base = Wizard.base
self.setTitle(self.tr("Copr page"))
self.setSubTitle(self.tr("COPR repository setting and uploading"))
self.x86_CheckBox = QCheckBox("x86")
self.x64_CheckBox = QCheckBox("x64")
self.Fedora20_CheckBox = QCheckBox("Fedora 20")
self.Fedora19_CheckBox = QCheckBox("Fedora 19")
self.Fedora18_CheckBox = QCheckBox("Fedora 18")
self.Fedora17_CheckBox = QCheckBox("Fedora 17")
self.Fedora16_CheckBox = QCheckBox("Fedora 16")
self.RHEL3_CheckBox = QCheckBox("RHEL 3")
self.RHEL4_CheckBox = QCheckBox("RHEL 4")
self.RHEL5_CheckBox = QCheckBox("RHEL 5")
self.RHEL6_CheckBox = QCheckBox("RHEL 6")
self.RHEL7_CheckBox = QCheckBox("RHEL 7")
self.createCOPRButton = QPushButton("Create COPR repository")
self.chooseCONFButton = QPushButton("Choose .conf file")
self.chooseCONFButton.clicked.connect(self.openChooseCONFFileDialog)
releaserLabel = QLabel("Releaser: ")
self.releaserEdit = QLineEdit()
projectNameLabel = QLabel("Project name: ")
self.projectNameEdit = QLineEdit()
self.releaserEdit.setMinimumHeight(30)
releaserLabel.setBuddy(self.releaserEdit)
self.projectNameEdit.setMinimumHeight(30)
projectNameLabel.setBuddy(self.projectNameEdit)
releaseBox = QGroupBox()
archBox = QGroupBox()
layoutReleaseBox = QGridLayout()
layoutArchBox = QGridLayout()
releaseBox.setTitle('Choose distribution')
layoutReleaseBox.setColumnStretch(0, 1)
layoutReleaseBox.setColumnStretch(1, 1)
layoutReleaseBox.setColumnStretch(2, 1)
layoutReleaseBox.setColumnStretch(3, 1)
layoutReleaseBox.setColumnStretch(4, 1)
layoutReleaseBox.addWidget(self.Fedora20_CheckBox, 0, 1)
layoutReleaseBox.addWidget(self.Fedora19_CheckBox, 1, 1)
layoutReleaseBox.addWidget(self.Fedora18_CheckBox, 2, 1)
layoutReleaseBox.addWidget(self.Fedora17_CheckBox, 3, 1)
layoutReleaseBox.addWidget(self.Fedora16_CheckBox, 4, 1)
layoutReleaseBox.addWidget(self.RHEL7_CheckBox, 0, 3)
layoutReleaseBox.addWidget(self.RHEL6_CheckBox, 1, 3)
layoutReleaseBox.addWidget(self.RHEL5_CheckBox, 2, 3)
layoutReleaseBox.addWidget(self.RHEL4_CheckBox, 3, 3)
layoutReleaseBox.addWidget(self.RHEL3_CheckBox, 4, 3)
releaseBox.setLayout(layoutReleaseBox)
archBox.setTitle('Choose architecture')
layoutArchBox.setColumnStretch(0, 1)
layoutArchBox.setColumnStretch(1, 1)
layoutArchBox.setColumnStretch(2, 1)
layoutArchBox.setColumnStretch(3, 1)
layoutArchBox.setColumnStretch(4, 1)
layoutArchBox.addWidget(self.x64_CheckBox, 0, 1)
layoutArchBox.addWidget(self.x86_CheckBox, 0, 3)
archBox.setLayout(layoutArchBox)
mainLayout = QVBoxLayout()
upperLayout = QHBoxLayout()
upper2Layout = QHBoxLayout()
midleLayout = QHBoxLayout()
lowerLayout = QGridLayout()
upperLayout.addWidget(releaseBox)
upper2Layout.addWidget(archBox)
midleLayout.addSpacing(170)
midleLayout.addWidget(self.createCOPRButton)
midleLayout.addSpacing(50)
midleLayout.addWidget(self.chooseCONFButton)
midleLayout.addSpacing(170)
lowerLayout.addWidget(releaserLabel, 0, 0)
lowerLayout.addWidget(self.releaserEdit, 0, 1)
lowerLayout.addWidget(projectNameLabel)
lowerLayout.addWidget(self.projectNameEdit)
mainLayout.addSpacing(30)
mainLayout.addLayout(upperLayout)
mainLayout.addSpacing(40)
mainLayout.addLayout(upper2Layout)
mainLayout.addLayout(midleLayout)
mainLayout.addSpacing(30)
mainLayout.addLayout(lowerLayout)
self.setLayout(mainLayout)
def openChooseCONFFileDialog(self):
brows = QFileDialog()
brows.getOpenFileName(self, "/home")
def nextId(self):
return Wizard.PageFinal