Skip to content

Commit

Permalink
[cuegui] Enable some separator characters on service name (#1492)
Browse files Browse the repository at this point in the history
The following separators can now be used to name services:
 | / - _

---------

Signed-off-by: Diego Tavares <[email protected]>
  • Loading branch information
DiegoTavares authored Aug 22, 2024
1 parent 45e2175 commit d48a45a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions cuegui/cuegui/ServiceDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,18 @@ def save(self):
Create and emit a ServiceData object based
on the contents of the form.
"""
if len(str(self.name.text())) < 3:
service_name = str(self.name.text())
if len(service_name) < 3:
QtWidgets.QMessageBox.critical(self, "Error",
"The service name must be at least 3 characters.")
return

if not str(self.name.text()).isalnum():
# Allow alphanumeric chars and | / - _
# chars like , and . can be used as separators in other parts of the API and behave
# inconsistently
if (not service_name.isalnum()) and \
[char for char in service_name
if not char.isalnum() and char not in "|/-_"]:
QtWidgets.QMessageBox.critical(self, "Error", "The service name must alphanumeric.")
return

Expand All @@ -176,7 +182,7 @@ def save(self):
service = opencue.wrappers.service.Service()
if self.__service:
service.data.id = self.__service.data.id
service.setName(str(self.name.text()))
service.setName(service_name)
service.setThreadable(self.threadable.isChecked())
service.setMinCores(self.min_cores.value())
service.setMaxCores(self.max_cores.value())
Expand Down

0 comments on commit d48a45a

Please sign in to comment.