Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions volumina/widgets/dataExportOptionsDlg.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,9 @@ def eventFilter(self, watched, event):

class _AxisOrderValidator(QValidator):
def __init__(self, parent, inputSlot):
super(DataExportOptionsDlg._AxisOrderValidator, self).__init__(parent)
super().__init__(parent)
self._inputSlot = inputSlot
self._valid_axes = set("tzyxc")

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

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

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

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

return (QValidator.Acceptable, userAxes, pos)
Expand Down