mirror of
https://github.com/nqrduck/nqrduck-pulseprogrammer.git
synced 2024-12-22 15:47:47 +00:00
Implemented event name checks.
This commit is contained in:
parent
1b0e57d3cd
commit
1072f8c5b5
1 changed files with 11 additions and 3 deletions
|
@ -216,7 +216,7 @@ class AddEventDialog(QDialog):
|
|||
QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel,
|
||||
self,
|
||||
)
|
||||
self.buttons.accepted.connect(self.accept)
|
||||
self.buttons.accepted.connect(self.check_input)
|
||||
self.buttons.rejected.connect(self.reject)
|
||||
|
||||
self.layout.addWidget(self.label)
|
||||
|
@ -226,4 +226,12 @@ class AddEventDialog(QDialog):
|
|||
def get_name(self):
|
||||
return self.name_input.text()
|
||||
|
||||
def check_input(self):
|
||||
# Make sure that name is not empty and that event name doesn't already exist.
|
||||
if self.name_input.text() == "":
|
||||
self.label.setText("Please enter a name for the event.")
|
||||
elif self.name_input.text() in self.parent().module.model.pulse_sequence.events:
|
||||
self.label.setText("Event name already exists. Please enter a different name.")
|
||||
else:
|
||||
self.accept()
|
||||
|
Loading…
Reference in a new issue