Open DragaDoncila opened 3 weeks ago
Attention: Patch coverage is 97.52747%
with 18 lines
in your changes are missing coverage. Please review.
Project coverage is 92.44%. Comparing base (
5527240
) to head (551c7c0
). Report is 3 commits behind head on main.
Files | Patch % | Lines |
---|---|---|
napari/layers/points/_base.py | 97.47% | 18 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Please do not forget to include similar test for a new class.
References and relevant issues
This PR is a precursor to implementing the
GraphLayer
- see #5861 for a WIP on the graph layer itself.Description
In discussions during the Graph Layer working group we found that getting the PR close to review was very challenging due to frequent merge conflicts with the
Points
layer, which were not trivial to resolve because that PR currently makes the split you see in this PR. We therefore decided to bring this change into its own PR.This PR therefore splits the current
Points
layer functionality into a_BasePoints
andPoints
layer. This allows theGraphLayer
to reuse this code to represent its nodes.Summary of Key Changes:
data
and_points_data
Previously, the list of point coordinates lived at
Points.data
andself.data
was used throughoutPoints
as needed. In this PR,_BasePoints
uses a new property,_points_data
for all implemented methods.Points
overrides this property to returnself.data
. This means everything that's in the base class works via_points_data
, and can be reused byGraph
, butPoints
still keeps its public API and data setters mostly the same._BasePoints.data
getter,_BasePoints._points_data
and_BasePoints._set_data
are all abstract. The_BasePoints.data
setter is fully implemented i.e. copied fromPoints
, andPoints
uses it explicitly via_BasePoints.data.fset(self, data)
.Other abstract methods on
_BasePoints
_get_ndim
: inPoints
it's remained the same_make_slice_request_internal
: inPoints
it's remained the sameadd
: inPoints
, it's remained the same. InGraph
, it would still be used to addnodes
but it also takes anindices
argument for the nodes - so it's actually not overriding the_BasePoints
add... Should we just removeadd
from_BasePoints
entirely?remove_selected
: unchanged inPoints
, but I actually think we could extract some of the property updating stuff to_BasePoints
maybe?_move_points
:_move
(which calls_move points
once it's worked out which points need moving and to where) is implemented in_BasePoints
and thenPoints._move_points
simply does the shift on the data using the given indices.Extracted from
Points
to_BasePoints
_on_selection
features
stuffborder_color
,face_color
,text
,symbol
,size
, etc.)get_state
/get_value
/get_status
selected_data
stuff - butself._selected_data
is updated directly in points_paste_data
thumbnail
stuff_make_slice_request_internal
Remains in
Points
only...