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

Public edit streams #105

Merged
merged 6 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
11 changes: 9 additions & 2 deletions holonote/annotate/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,15 @@ def _update_data(self):
def element(self):
return self.overlay()

@property
def edit_streams(self) -> dict[str, hv.streams.Stream]:
edit_streams = {}
if self.region_format in ("range", "range-range"):
edit_streams["box_select"] = self._edit_streams[0]
elif self.region_format in ("point", "point-point"):
edit_streams["tap"] = self._edit_streams[1]
return edit_streams

@property
def edit_tools(self) -> list[Tool]:
tools = []
Expand Down Expand Up @@ -336,8 +345,6 @@ def editable_enabled(self) -> bool:
@editable_enabled.setter
def editable_enabled(self, enabled: bool) -> None:
self._editable_enabled = enabled
if not enabled:
self.clear_indicated_region()
hoxbro marked this conversation as resolved.
Show resolved Hide resolved

def _filter_stream_values(self, bounds, x, y, geometry):
if not self._editable_enabled:
Expand Down
9 changes: 9 additions & 0 deletions holonote/tests/test_annotators_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@
assert output2 == expected2


def test_edit_streams(annotator_range1d) -> None:
annotator = annotator_range1d
edit_streams = annotator.get_display("TIME").edit_streams
assert len(edit_streams) == 3

Check failure on line 53 in holonote/tests/test_annotators_element.py

View workflow job for this annotation

GitHub Actions / Unit tests on ubuntu-latest with Python 3.9

test_edit_streams AssertionError: assert 1 == 3 + where 1 = len({'box_select': BoundsXY(bounds=None)})

Check failure on line 53 in holonote/tests/test_annotators_element.py

View workflow job for this annotation

GitHub Actions / Unit tests on ubuntu-latest with Python 3.10

test_edit_streams AssertionError: assert 1 == 3 + where 1 = len({'box_select': BoundsXY(bounds=None)})

Check failure on line 53 in holonote/tests/test_annotators_element.py

View workflow job for this annotation

GitHub Actions / Unit tests on ubuntu-latest with Python 3.11

test_edit_streams AssertionError: assert 1 == 3 + where 1 = len({'box_select': BoundsXY(bounds=None)})

Check failure on line 53 in holonote/tests/test_annotators_element.py

View workflow job for this annotation

GitHub Actions / Unit tests on ubuntu-latest with Python 3.12

test_edit_streams AssertionError: assert 1 == 3 + where 1 = len({'box_select': BoundsXY(bounds=None)})

Check failure on line 53 in holonote/tests/test_annotators_element.py

View workflow job for this annotation

GitHub Actions / Unit tests on macos-latest with Python 3.9

test_edit_streams AssertionError: assert 1 == 3 + where 1 = len({'box_select': BoundsXY(bounds=None)})

Check failure on line 53 in holonote/tests/test_annotators_element.py

View workflow job for this annotation

GitHub Actions / Unit tests on macos-latest with Python 3.10

test_edit_streams AssertionError: assert 1 == 3 + where 1 = len({'box_select': BoundsXY(bounds=None)})

Check failure on line 53 in holonote/tests/test_annotators_element.py

View workflow job for this annotation

GitHub Actions / Unit tests on macos-latest with Python 3.11

test_edit_streams AssertionError: assert 1 == 3 + where 1 = len({'box_select': BoundsXY(bounds=None)})

Check failure on line 53 in holonote/tests/test_annotators_element.py

View workflow job for this annotation

GitHub Actions / Unit tests on macos-latest with Python 3.12

test_edit_streams AssertionError: assert 1 == 3 + where 1 = len({'box_select': BoundsXY(bounds=None)})
ahuang11 marked this conversation as resolved.
Show resolved Hide resolved
assert "box_select" in edit_streams
assert "tap" not in edit_streams
assert "lasso_select" not in edit_streams


def test_set_regions_range2d(annotator_range2d) -> None:
annotator = annotator_range2d
annotator.get_display("x", "y")
Expand Down
Loading