Skip to content

Commit d48a45a

Browse files
authored
[cuegui] Enable some separator characters on service name (#1492)
The following separators can now be used to name services: | / - _ --------- Signed-off-by: Diego Tavares <dtavares@imageworks.com>
1 parent 45e2175 commit d48a45a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

‎cuegui/cuegui/ServiceDialog.py‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,18 @@ def save(self):
159159
Create and emit a ServiceData object based
160160
on the contents of the form.
161161
"""
162-
if len(str(self.name.text())) < 3:
162+
service_name = str(self.name.text())
163+
if len(service_name) < 3:
163164
QtWidgets.QMessageBox.critical(self, "Error",
164165
"The service name must be at least 3 characters.")
165166
return
166167

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

@@ -176,7 +182,7 @@ def save(self):
176182
service = opencue.wrappers.service.Service()
177183
if self.__service:
178184
service.data.id = self.__service.data.id
179-
service.setName(str(self.name.text()))
185+
service.setName(service_name)
180186
service.setThreadable(self.threadable.isChecked())
181187
service.setMinCores(self.min_cores.value())
182188
service.setMaxCores(self.max_cores.value())

0 commit comments

Comments
 (0)