Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove old async octree #28

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
2eb5008
connect new async method to existing async ui, disable octree setting
kcpevey Mar 7, 2023
19b5b27
remove octree
kcpevey Mar 23, 2023
dde37cf
more code cleanup of old unused code path
kcpevey Mar 29, 2023
f31d27e
add deleted files back
kcpevey Mar 30, 2023
8a0c133
cleanup
kcpevey Mar 30, 2023
1916b6f
missed an octree usage
kcpevey Mar 30, 2023
d134a09
Add some old async definitions back (#29)
andy-sweet Apr 6, 2023
db6e954
Update _experimental.py
kcpevey Apr 6, 2023
ee819dd
Bugfix: Convert Viewer Delete button to QtViewerPushButton with actio…
psobolewskiPhD Mar 21, 2023
af3c04a
Change dim `axis_label` resize logic to set width using only displaye…
dalthviz Mar 22, 2023
3ef3966
MAINT: Do not use mutable default for dataclass. (#5647)
Carreau Mar 23, 2023
b2d70f5
Fix features issues with init param and property setter (#5646)
andy-sweet Mar 29, 2023
89ebcb2
Skip pyside6 version 6.4.3 for tests (#5683)
andy-sweet Mar 29, 2023
c9424b8
Bugfix: Don't double toggle visibility for linked layers (#5656)
psobolewskiPhD Mar 30, 2023
13666b1
Bugfix: IndexError slicing Surface with higher-dimensional vertex_val…
aganders3 Apr 3, 2023
2c9d5fe
Enable `ruff` rules part 4. (#5590)
Czaki Apr 4, 2023
a221f60
FIX: fix translation checking script. (#5626)
Carreau Apr 4, 2023
9d7684c
Maint: ImportError -> ModuleNotFoundError. (#5628)
Carreau Apr 4, 2023
5794177
Bugfix: ensure pan/zoom buttons work, along with spacebar keybinding …
psobolewskiPhD Apr 4, 2023
6d5374e
Bugfix: Add Tracks to qt_keyboard_settings (#5678)
psobolewskiPhD Apr 4, 2023
95a3532
Fix automatic naming and GUI exposure of multiple unnamed colormaps (…
brisvag Apr 4, 2023
e30e3d0
Update PR template to front-load issue references (#5659)
jni Apr 4, 2023
0c0e5dd
Unvendor lazy_loader (#5681)
stefanv Apr 5, 2023
f74ee07
Feature: Add action to set current label to background (with keybindi…
psobolewskiPhD Apr 5, 2023
72d4f63
resolve conflicts with main
kcpevey Apr 6, 2023
696fb33
merge conflicts with deleted/modified files mid rebase, just adding e…
kcpevey Apr 6, 2023
1e7fc0e
rebase onto main, conflict resolution
kcpevey Mar 30, 2023
1c552c0
Add some old async definitions back (#29)
andy-sweet Apr 6, 2023
92a5954
Merge branch 'main' into remove_old_async_octree
kcpevey Apr 6, 2023
cc1e065
chunk_receiver cannot be property without adding a setter
kcpevey Apr 10, 2023
79baa61
ignore deprecation warnings for layer.loaded
kcpevey Apr 10, 2023
031e38c
remove deprecation warning filter, remove todos
kcpevey Apr 11, 2023
f30a625
Merge branch 'main' into remove_old_async_octree
kcpevey Apr 11, 2023
22e790a
add more explanation on deprecations
kcpevey Apr 11, 2023
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
4 changes: 0 additions & 4 deletions .github/workflows/test_comprehensive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ jobs:
platform: ubuntu-20.04
backend: pyqt5
MIN_REQ: 1
# test with --async_only
- python: 3.8
platform: ubuntu-20.04
toxenv: async-py38-linux-pyqt5
# test without any Qt backends
- python: 3.8
platform: ubuntu-20.04
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/test_pull_requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ jobs:
platform: ubuntu-20.04
backend: pyqt5
MIN_REQ: 1
# test with --async_only
- python: 3.8
platform: ubuntu-20.04
toxenv: async-pyqt5-py38-linux
# test without any Qt backends
- python: 3.8
platform: ubuntu-20.04
Expand Down
18 changes: 0 additions & 18 deletions napari/_qt/_qapp_model/qactions/_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

from napari._app_model.constants import CommandId, MenuGroup, MenuId
from napari._qt.qt_main_window import Window
from napari._qt.qt_viewer import QtViewer
from napari.settings import get_settings
from napari.utils.translations import trans


Expand Down Expand Up @@ -79,22 +77,6 @@ def _get_current_activity_dock(window: Window):
callback=Window._toggle_play,
keybindings=[{'primary': KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KeyP}],
),
Action(
id=CommandId.TOGGLE_OCTREE_CHUNK_OUTLINES,
title=CommandId.TOGGLE_OCTREE_CHUNK_OUTLINES.title,
menus=[
{
'id': MenuId.MENUBAR_VIEW,
'group': MenuGroup.RENDER,
'order': 1,
'when': get_settings().experimental.octree,
}
],
callback=QtViewer._toggle_chunk_outlines,
enablement=get_settings().experimental.octree,
# this used to have a keybinding of Ctrl+Alt+O, but that conflicts with
# Open files as stack
),
Action(
id=CommandId.TOGGLE_ACTIVITY_DOCK,
title=CommandId.TOGGLE_ACTIVITY_DOCK.title,
Expand Down
7 changes: 0 additions & 7 deletions napari/_qt/_tests/test_async_slicing.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,13 @@

# The tests in this module for the new style of async slicing in napari:
# https://napari.org/dev/naps/4-async-slicing.html
# They are marked with sync_only because that denotes that the old experimental
# async should not run as we don't explicitly wait for its threads to finish.


@pytest.fixture()
def rng() -> np.random.Generator:
return np.random.default_rng(0)


@pytest.mark.sync_only
def test_async_slice_image_on_current_step_change(
make_napari_viewer, qtbot, rng
):
Expand All @@ -33,7 +30,6 @@ def test_async_slice_image_on_current_step_change(
wait_until_vispy_image_data_equal(qtbot, vispy_image, data[2, :, :])


@pytest.mark.sync_only
def test_async_slice_image_on_order_change(make_napari_viewer, qtbot, rng):
viewer = make_napari_viewer()
data = rng.random((3, 4, 5))
Expand All @@ -45,7 +41,6 @@ def test_async_slice_image_on_order_change(make_napari_viewer, qtbot, rng):
wait_until_vispy_image_data_equal(qtbot, vispy_image, data[:, 2, :])


@pytest.mark.sync_only
def test_async_slice_image_on_ndisplay_change(make_napari_viewer, qtbot, rng):
viewer = make_napari_viewer()
data = rng.random((3, 4, 5))
Expand All @@ -57,7 +52,6 @@ def test_async_slice_image_on_ndisplay_change(make_napari_viewer, qtbot, rng):
wait_until_vispy_image_data_equal(qtbot, vispy_image, data)


@pytest.mark.sync_only
def test_async_slice_multiscale_image_on_pan(make_napari_viewer, qtbot, rng):
viewer = make_napari_viewer()
data = [rng.random((4, 8, 10)), rng.random((2, 4, 5))]
Expand All @@ -79,7 +73,6 @@ def test_async_slice_multiscale_image_on_pan(make_napari_viewer, qtbot, rng):
wait_until_vispy_image_data_equal(qtbot, vispy_image, data[1][1, 0:4, 0:3])


@pytest.mark.sync_only
def test_async_slice_multiscale_image_on_zoom(qtbot, make_napari_viewer, rng):
viewer = make_napari_viewer()
data = [rng.random((4, 8, 10)), rng.random((2, 4, 5))]
Expand Down
1 change: 0 additions & 1 deletion napari/_qt/_tests/test_qt_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ def test_notification_error(count_show, monkeypatch):


@skip_on_win_ci
@pytest.mark.sync_only
def test_notifications_error_with_threading(
make_napari_viewer, clean_current, monkeypatch
):
Expand Down
19 changes: 0 additions & 19 deletions napari/_qt/dialogs/preferences_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,25 +127,6 @@ def _add_page(self, field: 'ModelField'):
lambda d: getattr(self._settings, name.lower()).update(d)
)

# need to disable async if octree is enabled.
# TODO: this shouldn't live here... if there is a coupling/dependency
# between these settings, it should be declared in the settings schema
if (
name.lower() == 'experimental'
and values['octree']
and self._settings.env_settings()
.get('experimental', {})
.get('async_')
not in (None, '0')
):
form_layout = form.widget.layout()
for i in range(form_layout.count()):
wdg = form_layout.itemAt(i, form_layout.FieldRole).widget()
if wdg._name == 'async_':
wdg.opacity.setOpacity(0.3)
wdg.setDisabled(True)
break

self._list.addItem(field.field_info.title or field.name)
self._stack.addWidget(form)

Expand Down
8 changes: 0 additions & 8 deletions napari/_qt/layer_controls/qt_layer_controls_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
Tracks,
Vectors,
)
from napari.utils import config
from napari.utils.translations import trans

layer_to_controls = {
Expand All @@ -29,13 +28,6 @@
Tracks: QtTracksControls,
}

if config.async_loading:
from napari.layers.image.experimental.octree_image import _OctreeImageBase

# The user visible layer controls for OctreeImage layers are identical
# to the regular image layer controls, for now.
layer_to_controls[_OctreeImageBase] = QtImageControls


def create_qt_layer_controls(layer):
"""
Expand Down
6 changes: 0 additions & 6 deletions napari/_qt/qt_event_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,6 @@ def quit_app():

monitor.stop()

if config.async_loading:
# Shutdown the chunkloader
from napari.components.experimental.chunk import chunk_loader

chunk_loader.shutdown()


@contextmanager
def gui_qt(*, startup_logo=False, gui_exceptions=False, force=False):
Expand Down
39 changes: 19 additions & 20 deletions napari/_qt/qt_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,18 +278,7 @@ def __init__(
self.viewer.layers, self._qt_poll
)

# moved from the old layerlist... still feels misplaced.
# can you help me move this elsewhere?
if config.async_loading:
from napari._qt.experimental.qt_chunk_receiver import (
QtChunkReceiver,
)

# The QtChunkReceiver object allows the ChunkLoader to pass newly
# loaded chunks to the layers that requested them.
self.chunk_receiver = QtChunkReceiver(self.layers)
else:
self.chunk_receiver = None
self.chunk_receiver = None
kcpevey marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it stands, this overwrites the defined function that returns None with None itself.


# bind shortcuts stored in settings last.
self._bind_shortcuts()
Expand All @@ -306,6 +295,16 @@ def __init__(
for overlay in self.viewer._overlays.values():
self._add_overlay(overlay)

def chunk_receiver(self) -> None:
warnings.warn(
trans._(
'QtViewer.chunk_receiver is deprecated from napari version 0.5 and will be removed in a later version.'
),
DeprecationWarning,
stacklevel=1,
)
return

@staticmethod
def _update_dask_cache_settings(
dask_setting: Union[DaskSettings, Event] = None
Expand Down Expand Up @@ -527,13 +526,17 @@ def console(self, console):

@ensure_main_thread
def _on_slice_ready(self, event):
"""Callback connected to `viewer._layer_slicer.events.ready`. Provides
updates after slicing using the slice response data.
This only gets triggered on async path."""
responses = event.value
for layer, response in responses.items():
# Update the layer slice state to temporarily support behavior
# that depends on it.
layer._update_slice_response(response)
# The rest of `Layer.refresh` after `set_view_slice`, where `set_data`
# notifies the corresponding vispy layer of the new slice.
# The rest of `Layer.refresh` after `set_view_slice`, where
# `set_data` notifies the corresponding vispy layer of the new
# slice.
layer.events.set_data()
layer._update_thumbnail()
layer._set_highlight(force=True)
Expand Down Expand Up @@ -1269,11 +1272,7 @@ def closeEvent(self, event):
def _create_qt_poll(parent: QObject, camera: Camera) -> Optional[QtPoll]:
"""Create and return a QtPoll instance, if needed.

Create a QtPoll instance for octree or monitor.

Octree needs QtPoll so VispyTiledImageLayer can finish in-progress
loads even if the camera is not moving. Once loading is finish it will
tell QtPoll it no longer needs to be polled.
Create a QtPoll instance for monitor.

Monitor needs QtPoll to poll for incoming messages. This might be
temporary until we can process incoming messages with a dedicated
Expand All @@ -1291,7 +1290,7 @@ def _create_qt_poll(parent: QObject, camera: Camera) -> Optional[QtPoll]:
Optional[QtPoll]
The new QtPoll instance, if we need one.
"""
if not config.async_octree and not config.monitor:
if not config.monitor:
return None

from napari._qt.experimental.qt_poll import QtPoll
Expand Down
1 change: 0 additions & 1 deletion napari/_tests/test_magicgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ def _assert_stuff():
_assert_stuff()


@pytest.mark.sync_only
def test_magicgui_add_threadworker(qtbot, make_napari_viewer):
"""Test that annotating with FunctionWorker works."""
from napari.qt.threading import FunctionWorker, thread_worker
Expand Down
3 changes: 0 additions & 3 deletions napari/_tests/test_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,6 @@ def test_changing_theme(make_napari_viewer):
viewer.theme = 'nonexistent_theme'


# TODO: revisit the need for sync_only here.
# An async failure was observed here on CI, but was not reproduced locally
@pytest.mark.sync_only
@pytest.mark.parametrize('layer_class, data, ndim', layer_test_data)
def test_roll_transpose_update(make_napari_viewer, layer_class, data, ndim):
"""Check that transpose and roll preserve correct transform sequence."""
Expand Down
Loading