Skip to content

Commit bb8f14d

Browse files
committed
Allow to add singleton axes on export
1 parent 2ba0494 commit bb8f14d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

volumina/widgets/dataExportOptionsDlg.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,9 @@ def eventFilter(self, watched, event):
405405

406406
class _AxisOrderValidator(QValidator):
407407
def __init__(self, parent, inputSlot):
408-
super(DataExportOptionsDlg._AxisOrderValidator, self).__init__(parent)
408+
super().__init__(parent)
409409
self._inputSlot = inputSlot
410+
self._valid_axes = set("tzyxc")
410411

411412
def validate(self, userAxes, pos):
412413
taggedShape = self._inputSlot.meta.getTaggedShape()
@@ -415,17 +416,16 @@ def validate(self, userAxes, pos):
415416
userSet = set(str(userAxes))
416417

417418
# Ensure all user axes appear in the input
418-
if not (userSet <= inputSet):
419+
if not userSet.issubset(self._valid_axes):
419420
return (QValidator.Invalid, userAxes, pos)
420421

421422
# Ensure no repeats
422423
if len(userSet) != len(userAxes):
423424
return (QValidator.Invalid, userAxes, pos)
424425

425-
# If missing non-singleton axes, maybe intermediate entry
426-
# (It's okay to omit singleton axes)
427-
for key in inputSet - userSet:
428-
if taggedShape[key] != 1:
426+
# Ensure no non-singleton axis was omitted:
427+
for key in self._valid_axes - userSet:
428+
if taggedShape.get(key, 1) != 1:
429429
return (QValidator.Intermediate, userAxes, pos)
430430

431431
return (QValidator.Acceptable, userAxes, pos)

0 commit comments

Comments
 (0)