本文整理匯總了Python中PyQt5.QtWidgets.QLineEdit.setInputMask方法的典型用法代碼示例。如果您正苦於以下問題:Python QLineEdit.setInputMask方法的具體用法?Python QLineEdit.setInputMask怎麽用?Python QLineEdit.setInputMask使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt5.QtWidgets.QLineEdit
的用法示例。
在下文中一共展示了QLineEdit.setInputMask方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: OffsetRow
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setInputMask [as 別名]
class OffsetRow(QWidget):
def __init__(self):
super(OffsetRow, self).__init__()
self.layout = QHBoxLayout()
self.layout.setContentsMargins(0,0,0,0)
self.sign = QComboBox()
self.sign.addItems(['-', '+'])
self.amount = QLineEdit()
self.amount.setInputMask('99999999')
self.unit = QComboBox()
self.unit.addItems(['sec', 'min', 'hrs', 'day'])
self.layout.addWidget(self.sign)
self.layout.addWidget(self.amount, stretch = 1)
self.layout.addWidget(self.unit)
def show(self):
self.sign.show()
self.amount.show()
self.unit.show()
def hide(self):
self.sign.hide()
self.amount.hide()
self.unit.hide()
def set_values(self, sign, amount, unit):
self.sign.setCurrentText(sign)
self.amount.setText(str(amount))
self.unit.setCurrentText(unit)
示例2: __init__
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setInputMask [as 別名]
def __init__(self, parent=None):
super(lineEditDemo, self).__init__(parent)
e1 = QLineEdit()
e1.setValidator( QIntValidator() )
e1.setMaxLength(4)
e1.setAlignment( Qt.AlignRight )
e1.setFont( QFont("Arial",20))
e2 = QLineEdit()
e2.setValidator( QDoubleValidator(0.99,99.99,2))
flo = QFormLayout()
flo.addRow("integer validator", e1)
flo.addRow("Double validator",e2)
e3 = QLineEdit()
e3.setInputMask('+99_9999_999999')
flo.addRow("Input Mask",e3)
e4 = QLineEdit()
e4.textChanged.connect( self.textchanged )
flo.addRow("Text changed",e4)
e5 = QLineEdit()
e5.setEchoMode( QLineEdit.Password )
flo.addRow("Password",e5)
e6 = QLineEdit("Hello PyQt5")
e6.setReadOnly(True)
flo.addRow("Read Only",e6 )
e5.editingFinished.connect( self.enterPress )
self.setLayout(flo)
self.setWindowTitle("QLineEdit例子")
示例3: __init__
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setInputMask [as 別名]
def __init__(self, parent=None):
super(lineEditDemo, self).__init__(parent)
self.setWindowTitle("QLineEdit的輸入掩碼例子")
flo = QFormLayout()
pIPLineEdit = QLineEdit()
pMACLineEdit = QLineEdit()
pDateLineEdit = QLineEdit()
pLicenseLineEdit = QLineEdit()
pIPLineEdit.setInputMask("000.000.000.000;_")
pMACLineEdit.setInputMask("HH:HH:HH:HH:HH:HH;_")
pDateLineEdit.setInputMask("0000-00-00")
pLicenseLineEdit.setInputMask(">AAAAA-AAAAA-AAAAA-AAAAA-AAAAA;#")
flo.addRow("數字掩碼", pIPLineEdit)
flo.addRow("Mac掩碼", pMACLineEdit)
flo.addRow("日期掩碼", pDateLineEdit)
flo.addRow("許可證掩碼", pLicenseLineEdit)
#pIPLineEdit.setPlaceholderText("111")
#pMACLineEdit.setPlaceholderText("222")
#pLicenseLineEdit.setPlaceholderText("333")
#pLicenseLineEdit.setPlaceholderText("444")
self.setLayout(flo)
示例4: NumberFormatDlg
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setInputMask [as 別名]
class NumberFormatDlg(QDialog):
def __init__(self, format, callback, parent=None):
super(NumberFormatDlg, self).__init__(parent)
punctuationRe = QRegExp(r"[ ,;:.]")
thousandsLabel = QLabel("&Thousands separator")
self.thousandsEdit = QLineEdit(format["thousandsseparator"])
thousandsLabel.setBuddy(self.thousandsEdit)
self.thousandsEdit.setMaxLength(1)
self.thousandsEdit.setValidator(QRegExpValidator(
punctuationRe, self))
decimalMarkerLabel = QLabel("Decimal &marker")
self.decimalMarkerEdit = QLineEdit(format["decimalmarker"])
decimalMarkerLabel.setBuddy(self.decimalMarkerEdit)
self.decimalMarkerEdit.setMaxLength(1)
self.decimalMarkerEdit.setValidator(QRegExpValidator(
punctuationRe, self))
self.decimalMarkerEdit.setInputMask("X")
decimalPlacesLabel = QLabel("&Decimal places")
self.decimalPlacesSpinBox = QSpinBox()
decimalPlacesLabel.setBuddy(self.decimalPlacesSpinBox)
self.decimalPlacesSpinBox.setRange(0, 6)
self.decimalPlacesSpinBox.setValue(format["decimalplaces"])
self.redNegativesCheckBox = QCheckBox("&Red negative numbers")
self.redNegativesCheckBox.setChecked(format["rednegatives"])
self.format = format
self.callback = callback
grid = QGridLayout()
grid.addWidget(thousandsLabel, 0, 0)
grid.addWidget(self.thousandsEdit, 0, 1)
grid.addWidget(decimalMarkerLabel, 1, 0)
grid.addWidget(self.decimalMarkerEdit, 1, 1)
grid.addWidget(decimalPlacesLabel, 2, 0)
grid.addWidget(self.decimalPlacesSpinBox, 2, 1)
grid.addWidget(self.redNegativesCheckBox, 3, 0, 1, 2)
self.setLayout(grid)
self.thousandsEdit.textEdited.connect(self.checkAndFix)
self.decimalMarkerEdit.textEdited.connect(self.checkAndFix)
self.decimalPlacesSpinBox.valueChanged.connect(self.apply)
self.redNegativesCheckBox.toggled.connect(self.apply)
self.setWindowTitle("Set Number Format (`Live')")
def checkAndFix(self):
thousands = unicode(self.thousandsEdit.text())
decimal = unicode(self.decimalMarkerEdit.text())
if thousands == decimal:
self.thousandsEdit.clear()
self.thousandsEdit.setFocus()
if len(decimal) == 0:
self.decimalMarkerEdit.setText(".")
self.decimalMarkerEdit.selectAll()
self.decimalMarkerEdit.setFocus()
self.apply()
def apply(self):
self.format["thousandsseparator"] = (
unicode(self.thousandsEdit.text()))
self.format["decimalmarker"] = (
unicode(self.decimalMarkerEdit.text()))
self.format["decimalplaces"] = (
self.decimalPlacesSpinBox.value())
self.format["rednegatives"] = (
self.redNegativesCheckBox.isChecked())
self.callback()
示例5: Window
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setInputMask [as 別名]
#.........這裏部分代碼省略.........
accessGroup = QGroupBox("Access")
accessLabel = QLabel("Read-only:")
accessComboBox = QComboBox()
accessComboBox.addItem("False")
accessComboBox.addItem("True")
self.accessLineEdit = QLineEdit()
echoComboBox.activated.connect(self.echoChanged)
validatorComboBox.activated.connect(self.validatorChanged)
alignmentComboBox.activated.connect(self.alignmentChanged)
inputMaskComboBox.activated.connect(self.inputMaskChanged)
accessComboBox.activated.connect(self.accessChanged)
echoLayout = QGridLayout()
echoLayout.addWidget(echoLabel, 0, 0)
echoLayout.addWidget(echoComboBox, 0, 1)
echoLayout.addWidget(self.echoLineEdit, 1, 0, 1, 2)
echoGroup.setLayout(echoLayout)
validatorLayout = QGridLayout()
validatorLayout.addWidget(validatorLabel, 0, 0)
validatorLayout.addWidget(validatorComboBox, 0, 1)
validatorLayout.addWidget(self.validatorLineEdit, 1, 0, 1, 2)
validatorGroup.setLayout(validatorLayout)
alignmentLayout = QGridLayout()
alignmentLayout.addWidget(alignmentLabel, 0, 0)
alignmentLayout.addWidget(alignmentComboBox, 0, 1)
alignmentLayout.addWidget(self.alignmentLineEdit, 1, 0, 1, 2)
alignmentGroup. setLayout(alignmentLayout)
inputMaskLayout = QGridLayout()
inputMaskLayout.addWidget(inputMaskLabel, 0, 0)
inputMaskLayout.addWidget(inputMaskComboBox, 0, 1)
inputMaskLayout.addWidget(self.inputMaskLineEdit, 1, 0, 1, 2)
inputMaskGroup.setLayout(inputMaskLayout)
accessLayout = QGridLayout()
accessLayout.addWidget(accessLabel, 0, 0)
accessLayout.addWidget(accessComboBox, 0, 1)
accessLayout.addWidget(self.accessLineEdit, 1, 0, 1, 2)
accessGroup.setLayout(accessLayout)
layout = QGridLayout()
layout.addWidget(echoGroup, 0, 0)
layout.addWidget(validatorGroup, 1, 0)
layout.addWidget(alignmentGroup, 2, 0)
layout.addWidget(inputMaskGroup, 0, 1)
layout.addWidget(accessGroup, 1, 1)
self.setLayout(layout)
self.setWindowTitle("Line Edits")
def echoChanged(self, index):
if index == 0:
self.echoLineEdit.setEchoMode(QLineEdit.Normal)
elif index == 1:
self.echoLineEdit.setEchoMode(QLineEdit.Password)
elif index == 2:
self.echoLineEdit.setEchoMode(QLineEdit.PasswordEchoOnEdit)
elif index == 3:
self.echoLineEdit.setEchoMode(QLineEdit.NoEcho)
def validatorChanged(self, index):
if index == 0:
self.validatorLineEdit.setValidator(0)
elif index == 1:
self.validatorLineEdit.setValidator(QIntValidator(self.validatorLineEdit))
elif index == 2:
self.validatorLineEdit.setValidator(QDoubleValidator(-999.0, 999.0, 2, self.validatorLineEdit))
self.validatorLineEdit.clear()
def alignmentChanged(self, index):
if index == 0:
self.alignmentLineEdit.setAlignment(Qt.AlignLeft)
elif index == 1:
self.alignmentLineEdit.setAlignment(Qt.AlignCenter)
elif index == 2:
self.alignmentLineEdit.setAlignment(Qt.AlignRight)
def inputMaskChanged(self, index):
if index == 0:
self.inputMaskLineEdit.setInputMask('')
elif index == 1:
self.inputMaskLineEdit.setInputMask('+99 99 99 99 99;_')
elif index == 2:
self.inputMaskLineEdit.setInputMask('0000-00-00')
self.inputMaskLineEdit.setText('00000000')
self.inputMaskLineEdit.setCursorPosition(0)
elif index == 3:
self.inputMaskLineEdit.setInputMask('>AAAAA-AAAAA-AAAAA-AAAAA-AAAAA;#')
def accessChanged(self, index):
if index == 0:
self.accessLineEdit.setReadOnly(False)
elif index == 1:
self.accessLineEdit.setReadOnly(True)
示例6: NumberFormatDlg
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setInputMask [as 別名]
class NumberFormatDlg(QDialog):
changed = pyqtSignal()
def __init__(self, format, parent=None):
super(NumberFormatDlg, self).__init__(parent)
self.setAttribute(Qt.WA_DeleteOnClose)
punctuationRe = QRegExp(r"[ ,;:.]")
thousandsLabel = QLabel("&Thousands separator")
self.thousandsEdit = QLineEdit(format["thousandsseparator"])
thousandsLabel.setBuddy(self.thousandsEdit)
self.thousandsEdit.setMaxLength(1)
self.thousandsEdit.setValidator(
QRegExpValidator(punctuationRe, self))
decimalMarkerLabel = QLabel("Decimal &marker")
self.decimalMarkerEdit = QLineEdit(format["decimalmarker"])
decimalMarkerLabel.setBuddy(self.decimalMarkerEdit)
self.decimalMarkerEdit.setMaxLength(1)
self.decimalMarkerEdit.setValidator(
QRegExpValidator(punctuationRe, self))
self.decimalMarkerEdit.setInputMask("X")
decimalPlacesLabel = QLabel("&Decimal places")
self.decimalPlacesSpinBox = QSpinBox()
decimalPlacesLabel.setBuddy(self.decimalPlacesSpinBox)
self.decimalPlacesSpinBox.setRange(0, 6)
self.decimalPlacesSpinBox.setValue(format["decimalplaces"])
self.redNegativesCheckBox = QCheckBox("&Red negative numbers")
self.redNegativesCheckBox.setChecked(format["rednegatives"])
buttonBox = QDialogButtonBox(QDialogButtonBox.Apply|
QDialogButtonBox.Close)
self.format = format
grid = QGridLayout()
grid.addWidget(thousandsLabel, 0, 0)
grid.addWidget(self.thousandsEdit, 0, 1)
grid.addWidget(decimalMarkerLabel, 1, 0)
grid.addWidget(self.decimalMarkerEdit, 1, 1)
grid.addWidget(decimalPlacesLabel, 2, 0)
grid.addWidget(self.decimalPlacesSpinBox, 2, 1)
grid.addWidget(self.redNegativesCheckBox, 3, 0, 1, 2)
grid.addWidget(buttonBox, 4, 0, 1, 2)
self.setLayout(grid)
buttonBox.button(QDialogButtonBox.Apply).clicked.connect(self.apply)
buttonBox.rejected.connect(self.reject)
# self.connect(buttonBox.button(QDialogButtonBox.Apply),
# SIGNAL("clicked()"), self.apply)
# self.connect(buttonBox, SIGNAL("rejected()"),
# self, SLOT("reject()"))
self.setWindowTitle("Set Number Format (Modeless)")
def apply(self):
thousands = unicode(self.thousandsEdit.text())
decimal = unicode(self.decimalMarkerEdit.text())
if thousands == decimal:
QMessageBox.warning(self, "Format Error",
"The thousands separator and the decimal marker "
"must be different.")
self.thousandsEdit.selectAll()
self.thousandsEdit.setFocus()
return
if len(decimal) == 0:
QMessageBox.warning(self, "Format Error",
"The decimal marker may not be empty.")
self.decimalMarkerEdit.selectAll()
self.decimalMarkerEdit.setFocus()
return
self.format["thousandsseparator"] = thousands
self.format["decimalmarker"] = decimal
self.format["decimalplaces"] = (
self.decimalPlacesSpinBox.value())
self.format["rednegatives"] = (
self.redNegativesCheckBox.isChecked())
self.changed.emit()
示例7: EditView
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setInputMask [as 別名]
#.........這裏部分代碼省略.........
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(False)
self.Folio.setSizePolicy(sizePolicy)
self.Folio.setMinimumSize(QSize(30, 12))
self.Folio.setContextMenuPolicy(Qt.NoContextMenu)
self.Folio.setFrameShape(QFrame.StyledPanel)
self.Folio.setAlignment( Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter )
self.Folio.setObjectName("Folio display")
self.Folio.setToolTip(_TR("EditViewWidget", "Folio value for current page", "tooltip"))
self.Folio.setStatusTip(_TR("EditViewWidget", "Folio value for the page under the edit cursor", "statustip"))
self.Folio.setWhatsThis(_TR("EditViewWidget", "The Folio (page number) value for the page under the edit cursor. Use the Pages panel to adjust folios to agree with the printed book.","whats this"))
HBL.addWidget(self.Folio)
spacerItem = QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum)
HBL.addItem(spacerItem)
FolioLabel.setBuddy(self.Folio)
# Set up the image filename lineedit and its buddy label.
ImageFilenameLabel = QLabel(bot_frame)
ImageFilenameLabel.setAlignment( Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter )
ImageFilenameLabel.setText(_TR("EditViewWidget", "Image", "Image field label"))
HBL.addWidget(ImageFilenameLabel)
self.ImageFilename = QLineEdit(bot_frame)
sizePolicy = QSizePolicy( QSizePolicy.Expanding, QSizePolicy.Fixed )
sizePolicy.setHorizontalStretch(1)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(False)
self.ImageFilename.setSizePolicy(sizePolicy)
self.ImageFilename.setMinimumSize(QSize(30, 12))
self.ImageFilename.setMouseTracking(False)
self.ImageFilename.setFocusPolicy(Qt.ClickFocus)
self.ImageFilename.setContextMenuPolicy(Qt.NoContextMenu)
self.ImageFilename.setAcceptDrops(True)
self.ImageFilename.setInputMask("")
self.ImageFilename.setAlignment( Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter )
self.ImageFilename.setObjectName("ImageFilename")
self.ImageFilename.setToolTip(_TR("EditViewWidget", "Scan image filename", "Image tooltip"))
self.ImageFilename.setStatusTip(_TR("EditViewWidget", "Filename of the scan image under the edit cursor", "Image status tip"))
self.ImageFilename.setWhatsThis(_TR("EditViewWidget", "This is the name of the scanned image that produced the text under the edit cursor. This image file is displayed in the Image panel.","Image whats this"))
HBL.addWidget(self.ImageFilename)
spacerItem = QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum)
HBL.addItem(spacerItem)
ImageFilenameLabel.setBuddy(self.ImageFilename)
# Set up the line number lineedit and its buddy label.
LineNumberLabel = QLabel(bot_frame)
LineNumberLabel.setText(_TR("EditViewWidget", "Line#", "Line number label"))
LineNumberLabel.setAlignment( Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter )
HBL.addWidget(LineNumberLabel)
self.LineNumber = QLineEdit(bot_frame)
sizePolicy = QSizePolicy( QSizePolicy.Expanding, QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(1)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(False)
self.LineNumber.setSizePolicy(sizePolicy)
self.LineNumber.setMinimumSize(QSize(0, 12))
self.LineNumber.setMouseTracking(False)
self.LineNumber.setFocusPolicy(Qt.ClickFocus)
self.LineNumber.setContextMenuPolicy(Qt.NoContextMenu)
self.LineNumber.setAcceptDrops(True)
self.LineNumber.setLayoutDirection(Qt.LeftToRight)
self.LineNumber.setCursorPosition(0)
self.LineNumber.setAlignment( Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter )
self.LineNumber.setPlaceholderText("")
self.LineNumber.setCursorMoveStyle(Qt.LogicalMoveStyle)
self.LineNumber.setObjectName("LineNumber")
示例8: MultiPlayerMenu
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setInputMask [as 別名]
class MultiPlayerMenu(QWidget):
def __init__(self):
super(MultiPlayerMenu, self).__init__()
nameLayout = self.createNameField()
networkConfig = self.createIpAndPortFields()
networkButtons = self.createConnectAndHostButtons()
mainLayout = QVBoxLayout()
mainLayout.addWidget(self.createTitleLabel('Online'))
mainLayout.addLayout(nameLayout)
mainLayout.addLayout(networkConfig)
mainLayout.addLayout(networkButtons)
mainLayout.addWidget(self.createHorizontalLine())
mainLayout.addWidget(self.createTitleLabel('Hotseat on one PC'))
mainLayout.addWidget(self.createHotseatButton())
self.setLayout(mainLayout)
def createNameField(self):
self.nameLabel = QLabel('Your name: ')
self.nameField = QLineEdit()
self.nameField.setMaxLength(20)
self.nameField.textChanged.connect(self.nameChange)
layout = QHBoxLayout()
layout.addWidget(self.nameLabel)
layout.addWidget(self.nameField)
return layout
def createIpAndPortFields(self):
ipLabel = QLabel('Opponent IP:')
ipLabel.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
portLabel = QLabel('Game port:')
portLabel.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
self.ipField = QLineEdit()
self.ipField.setInputMask('000.000.000.000; ')
self.ipField.setFixedWidth(130)
self.ipField.textChanged.connect(self.ipChange)
self.portSpinBox = QSpinBox()
self.portSpinBox.setRange(1024, 8080)
self.portSpinBox.setFixedWidth(80)
layout = QGridLayout()
layout.addWidget(ipLabel, 0, 0)
layout.addWidget(self.ipField, 0, 1)
layout.addWidget(portLabel, 1, 0)
layout.addWidget(self.portSpinBox, 1, 1)
return layout
def createConnectAndHostButtons(self):
self.connectButton = QPushButton('Connect')
self.connectButton.setEnabled(False)
self.hostButton = QPushButton('Host game')
self.hostButton.setEnabled(False)
layout = QHBoxLayout()
layout.addWidget(self.connectButton)
layout.addWidget(self.hostButton)
return layout
def createTitleLabel(self, title):
titleLabel = QLabel(title)
titleLabel.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
return titleLabel
def createHotseatButton(self):
self.hotseatButton = QPushButton('Play')
return self.hotseatButton
def createHorizontalLine(self):
line = QLabel()
line.setFrameStyle(QFrame.HLine)
return line
def nameChange(self):
if self.nameIsValid():
self.hostButton.setEnabled(True)
if self.ipIsValid():
self.connectButton.setEnabled(True)
else:
self.hostButton.setEnabled(False)
self.connectButton.setEnabled(False)
def ipChange(self):
if self.ipIsValid():
if self.nameIsValid():
self.connectButton.setEnabled(True)
else:
self.connectButton.setEnabled(False)
def ipIsValid(self):
return QHostAddress().setAddress(self.ipField.text())
def nameIsValid(self):
if self.nameField.text():
return True
return False
示例9: EditView
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setInputMask [as 別名]
#.........這裏部分代碼省略.........
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(False)
self.Folio.setSizePolicy(sizePolicy)
self.Folio.setMinimumSize(QSize(30, 12))
self.Folio.setContextMenuPolicy(Qt.NoContextMenu)
self.Folio.setFrameShape(QFrame.StyledPanel)
self.Folio.setAlignment( Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter )
self.Folio.setObjectName("Folio display")
self.Folio.setToolTip(_TR("EditViewWidget", "Folio value for current page", "tooltip"))
self.Folio.setStatusTip(_TR("EditViewWidget", "Folio value for the page under the edit cursor", "statustip"))
self.Folio.setWhatsThis(_TR("EditViewWidget", "The Folio (page number) value for the page under the edit cursor. Use the Pages panel to adjust folios to agree with the printed book.","whats this"))
HBL.addWidget(self.Folio)
spacerItem = QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum)
HBL.addItem(spacerItem)
FolioLabel.setBuddy(self.Folio)
# Set up the image filename lineedit and its buddy label.
ImageFilenameLabel = QLabel(bot_frame)
ImageFilenameLabel.setAlignment( Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter )
ImageFilenameLabel.setText(_TR("EditViewWidget", "Image", "Image field label"))
HBL.addWidget(ImageFilenameLabel)
self.ImageFilename = QLineEdit(bot_frame)
sizePolicy = QSizePolicy( QSizePolicy.Expanding, QSizePolicy.Fixed )
sizePolicy.setHorizontalStretch(1)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(False)
self.ImageFilename.setSizePolicy(sizePolicy)
self.ImageFilename.setMinimumSize(QSize(30, 12))
self.ImageFilename.setMouseTracking(False)
self.ImageFilename.setFocusPolicy(Qt.ClickFocus)
self.ImageFilename.setContextMenuPolicy(Qt.NoContextMenu)
self.ImageFilename.setAcceptDrops(True)
self.ImageFilename.setInputMask("")
self.ImageFilename.setAlignment( Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter )
self.ImageFilename.setObjectName("ImageFilename")
self.ImageFilename.setToolTip(_TR("EditViewWidget", "Scan image filename", "Image tooltip"))
self.ImageFilename.setStatusTip(_TR("EditViewWidget", "Filename of the scan image under the edit cursor", "Image status tip"))
self.ImageFilename.setWhatsThis(_TR("EditViewWidget", "This is the name of the scanned image that produced the text under the edit cursor. This image file is displayed in the Image panel.","Image whats this"))
HBL.addWidget(self.ImageFilename)
spacerItem = QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum)
HBL.addItem(spacerItem)
ImageFilenameLabel.setBuddy(self.ImageFilename)
# Set up the line number lineedit and its buddy label.
LineNumberLabel = QLabel(bot_frame)
LineNumberLabel.setText(_TR("EditViewWidget", "Line#", "Line number label"))
LineNumberLabel.setAlignment( Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter )
HBL.addWidget(LineNumberLabel)
self.LineNumber = QLineEdit(bot_frame)
sizePolicy = QSizePolicy( QSizePolicy.Expanding, QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(1)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(False)
self.LineNumber.setSizePolicy(sizePolicy)
self.LineNumber.setMinimumSize(QSize(0, 12))
self.LineNumber.setMouseTracking(False)
self.LineNumber.setFocusPolicy(Qt.ClickFocus)
self.LineNumber.setContextMenuPolicy(Qt.NoContextMenu)
self.LineNumber.setAcceptDrops(True)
self.LineNumber.setLayoutDirection(Qt.LeftToRight)
self.LineNumber.setCursorPosition(0)
self.LineNumber.setAlignment( Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter )
self.LineNumber.setPlaceholderText("")
self.LineNumber.setCursorMoveStyle(Qt.LogicalMoveStyle)
self.LineNumber.setObjectName("LineNumber")
示例10: ModaliteEvaluation
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setInputMask [as 別名]
class ModaliteEvaluation(QWidget):
"""
classe qui servira a definir les periodes devaluations
le systeme de note etc
"""
def __init__(self,parent=None):
super(ModaliteEvaluation,self).__init__(parent)
##########################
#premiere ligne, le titre#
##########################
self.labelTitre = QLabel(self)
self.labelTitre.setText("Liste des periodes d'evaluation".upper())
#############################
#seconde ligne, les colonnes#
#############################
self.labelDebut = QLabel(self)
self.labelDebut.setText("Debut".upper())
self.labelFin = QLabel(self)
self.labelFin.setText("Fin".upper())
##########################
#3-n lignes, les periodes#
##########################
self.labelPeriode1 = QLabel(self)
self.labelPeriode1.setText("Periode 1")
self.leDate1Debut = QLineEdit(self)
self.leDate1Debut.setInputMask("99/99/99")
self.leDate1Debut.setMaxLength(8)
self.leDate1Fin = QLineEdit(self)
self.leDate1Fin.setInputMask("99/99/99")
self.leDate1Fin.setMaxLength(8)
self.labelPeriode2 = QLabel(self)
self.labelPeriode2.setText("Periode 2")
self.leDate2Debut = QLineEdit(self)
self.leDate2Debut.setInputMask("99/99/99")
self.leDate2Debut.setMaxLength(8)
self.leDate2Fin = QLineEdit(self)
self.leDate2Fin.setInputMask("99/99/99")
self.leDate2Fin.setMaxLength(8)
self.labelPeriode3 = QLabel(self)
self.labelPeriode3.setText("Periode 3")
self.leDate3Debut = QLineEdit(self)
self.leDate3Debut.setInputMask("99/99/99")
self.leDate3Debut.setMaxLength(8)
self.leDate3Fin = QLineEdit(self)
self.leDate3Fin.setInputMask("99/99/99")
self.leDate3Fin.setMaxLength(8)
######################
#bouton de sauvegarde#
######################
self.boutonValidateDate = QPushButton("save",self)
self.boutonValidateDate.clicked.connect(self.onValidation)
############
#label vide#
############
self.labelVide = QLabel(self)
self.labelVide.setText(" ")
layout = QGridLayout()
layout.addWidget(self.labelTitre,1,0,1,5)
layout.addWidget(self.labelDebut,2,2)
layout.addWidget(self.labelFin,2,4)
#1ere periode
layout.addWidget(self.labelPeriode1,3,0)
layout.addWidget(self.labelVide,3,1)
layout.addWidget(self.leDate1Debut,3,2)
layout.addWidget(self.labelVide,3,3)
layout.addWidget(self.leDate1Fin,3,4)
layout.addWidget(self.labelVide,3,5)
#2eme periode
layout.addWidget(self.labelPeriode2,4,0)
layout.addWidget(self.labelVide,4,1)
layout.addWidget(self.leDate2Debut,4,2)
layout.addWidget(self.labelVide,4,3)
layout.addWidget(self.leDate2Fin,4,4)
layout.addWidget(self.labelVide,4,5)
#3eme periode
layout.addWidget(self.labelPeriode3,5,0)
layout.addWidget(self.labelVide,5,1)
layout.addWidget(self.leDate3Debut,5,2)
layout.addWidget(self.labelVide,5,3)
layout.addWidget(self.leDate3Fin,5,4)
layout.addWidget(self.labelVide,5,5)
#button
layout.addWidget(self.boutonValidateDate,6,5)
layout2 = QVBoxLayout()
layout2.addLayout(layout)
layout2.addStretch()
self.setLayout(layout2)
def onValidation(self):
#.........這裏部分代碼省略.........