Skip to content

Commit e9db877

Browse files
committed
fixup! source axistags from input, allow for singleton axes when changing order
1 parent 3f703cd commit e9db877

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

volumina/widgets/dataExportOptionsDlg.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,9 @@ def _handleAxisOrderChecked(checked):
374374

375375
self.outputAxisOrderEdit.editingFinished.connect(_handleNewAxisOrder)
376376
self.outputAxisOrderEdit.textChanged.connect(partial(self._updateAxisOrderColor, True))
377-
self.outputAxisOrderEdit.setValidator(DataExportOptionsDlg._AxisOrderValidator(self, self._opDataExport.Input))
377+
self.outputAxisOrderEdit.setValidator(
378+
DataExportOptionsDlg._AxisOrderValidator(self, self._opDataExport.ConvertedImage)
379+
)
378380
self.outputAxisOrderEdit.installEventFilter(DataExportOptionsDlg._AxisOrderEventFilter(self))
379381
self.axisOrderCheckbox.toggled.connect(_handleAxisOrderChecked)
380382

@@ -403,18 +405,18 @@ def eventFilter(self, watched, event):
403405

404406
class _AxisOrderValidator(QValidator):
405407
def __init__(self, parent, inputSlot):
406-
super(DataExportOptionsDlg._AxisOrderValidator, self).__init__(parent)
408+
super().__init__(parent)
407409
self._inputSlot = inputSlot
410+
self._valid_axes = set("tzyxc")
408411

409412
def validate(self, userAxes, pos):
410413
taggedShape = self._inputSlot.meta.getTaggedShape()
411-
originalAxes = self._inputSlot.meta.getOriginalAxisKeys()
412-
inputAxes = list(originalAxes)
414+
inputAxes = list(taggedShape.keys())
413415
inputSet = set(inputAxes)
414416
userSet = set(str(userAxes))
415417

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

420422
# Ensure no repeats

0 commit comments

Comments
 (0)