Skip to content

Commit

Permalink
Some static typing fixes in Player (not a bugfix)
Browse files Browse the repository at this point in the history
  • Loading branch information
felixchenier committed Mar 6, 2024
1 parent b4f775c commit fe2d4c9
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions kineticstoolkit/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ class Player:
_contents: TimeSeries
_oriented_points: TimeSeries
_oriented_frames: TimeSeries
_oriented_target: tuple[float, float, float]
_oriented_target: np.ndarray
_interconnections: dict[str, dict[str, Any]]
_extended_interconnections: dict[str, dict[str, Any]]
_colors: set[tuple[float, float, float]] # A list of all point colors
Expand Down Expand Up @@ -373,7 +373,7 @@ def __init__(
self._grid = np.array([])
self._oriented_points = TimeSeries(time=self._contents.time)
self._oriented_frames = TimeSeries(time=self._contents.time)
self._oriented_target = (0.0, 0.0, 0.0)
self._oriented_target = np.array([0.0, 0.0, 0.0])

self._interconnections = interconnections # Just to put stuff for now
self._extended_interconnections = interconnections # idem
Expand Down Expand Up @@ -1089,9 +1089,7 @@ def _orient_contents(self) -> None:
)

self._oriented_target = geometry.get_global_coordinates(
np.array(
[[self._target[0], self._target[1], self._target[2], 1.0]]
),
[[self._target[0], self._target[1], self._target[2], 1.0]],
rotation,
)[0, 0:3]

Expand Down Expand Up @@ -1527,7 +1525,7 @@ def _refresh(self):
self._mpl_objects["Axes"].set_xlim([-1.5, 1.5])
self._mpl_objects["Axes"].set_ylim([-1.0, 1.0])

def _set_new_target(self, target: ArrayLike) -> None:
def _set_new_target(self, target: tuple[float, float, float]) -> None:
"""Set new target and adapts pan and zoom consequently."""
# Save the current view
if np.sum(np.isnan(target)) > 0:
Expand Down Expand Up @@ -1564,7 +1562,7 @@ def error_function(input):
return error

# Set the new target
self._target = target
self._target = np.array(target)
self._orient_contents()

# Try to find a camera pan/zoom so that the view is similar
Expand Down

0 comments on commit fe2d4c9

Please sign in to comment.