Closed jni closed 3 years ago
@tlambert03 I got the dims sorter working :tada: but I have this weird behavior where if I change the values (dims.order
, dims.axis_labels
) programmatically, the list updates only on hover of the widget. How do I hook up those events to the widget refresh? I couldn't find where in the napari layer list to find that pattern...
If you install the plugin from this branch you can do napari path/to/image.tif --with zarpaint 'Dims Sorter'
to test. (Then setting the values in the console.)
I think you might be blocking the events that the Qt view is listening to in your move_indices
function:
def move_indices(axes_list, order):
with axes_list.events.blocker_all():
edit: for reference those events are hooked up here.
however, SelectableEventedList
already has move/move_multiple
methods that take care of this for you:
try this:
# instead of this
# dims.events.order.connect(
# lambda event, axes_list=root: move_indices(axes_list, event.value)
# )
# try this:
dims.events.order.connect(lambda event: root.move_multiple(event.value))
I should have been clearer: yes I block the events because you don't want to update the order when you're updating the list, but adding a axes_list.events.reordered()
at the end didn't help.
however, SelectableEventedList already has move/move_multiple methods that take care of this for you:
Of course it does. 😂 It didn't occur to me that moving all of them to 0 with order
would be the same thing as reordering them. 😂 You don't want to know how long I spent debugging this. 😂 😂 😂
Having said that, I'm not sure it does exactly what I need, because the order in the list is not range(ndim)
, which is what move_multiple(order)
assumes?
:tada:
status update: as of napari 0.4.8rc3, with this PR you can do
napari --with zarpaint -- path/to/file.tiff
and it works for (a) creating/reopening a zarr file and using it as labels, and (b) painting into that file. Chunks are specified as an int tuple that isast.literal_eval
d, e.g.(1, 1, 256, 256)
.I'll keep pushing a few widgets to this branch, and updating tests. :grimacing:
CC @GenevieveBuckley