mirror of
https://github.com/nqrduck/nqrduck-pulseprogrammer.git
synced 2024-11-09 11:20:01 +00:00
Merge pull request #8 from kumitterer/main
Add back simple check_input method
This commit is contained in:
commit
4771d3508b
1 changed files with 13 additions and 0 deletions
|
@ -787,11 +787,24 @@ class AddEventDialog(QDialog):
|
||||||
Decimal: The duration value provided by the user, or 20"""
|
Decimal: The duration value provided by the user, or 20"""
|
||||||
return Decimal(self.duration_lineedit.text() or 20)
|
return Decimal(self.duration_lineedit.text() or 20)
|
||||||
|
|
||||||
|
def check_input(self) -> None:
|
||||||
|
"""Checks if the name and duration entered by the user is valid. If it is, the dialog is accepted. If not, the user is informed of the error."""
|
||||||
|
if (
|
||||||
|
self.duration_lineedit.validator.validate(self.duration_lineedit.text(), 0)[
|
||||||
|
0
|
||||||
|
]
|
||||||
|
== QValidator.State.Acceptable
|
||||||
|
and self.name_input.validator.validate(self.name_input.text(), 0)[0]
|
||||||
|
== QValidator.State.Acceptable
|
||||||
|
):
|
||||||
|
self.accept()
|
||||||
|
|
||||||
class NameInputValidator(QValidator):
|
class NameInputValidator(QValidator):
|
||||||
"""A validator for the name input field.
|
"""A validator for the name input field.
|
||||||
|
|
||||||
This is used to validate the input of the QLineEdit widget.
|
This is used to validate the input of the QLineEdit widget.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def validate(self, value, position):
|
def validate(self, value, position):
|
||||||
"""Validates the input value.
|
"""Validates the input value.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue