Skip to content

Commit

Permalink
Fixing various type errors
Browse files Browse the repository at this point in the history
Error count: 97 -> 90
  • Loading branch information
henrikmidtiby committed Oct 26, 2024
1 parent 1195d0d commit 6c137ee
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 7 deletions.
6 changes: 4 additions & 2 deletions manim/camera/multi_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
__all__ = ["MultiCamera"]


from manim.mobject.types.image_mobject import ImageMobject
from manim.mobject.types.image_mobject import ImageMobject, ImageMobjectFromCamera

from ..camera.moving_camera import MovingCamera
from ..utils.iterables import list_difference_update
Expand Down Expand Up @@ -38,7 +38,9 @@ def __init__(
)
super().__init__(**kwargs)

def add_image_mobject_from_camera(self, image_mobject_from_camera: ImageMobject):
def add_image_mobject_from_camera(
self, image_mobject_from_camera: ImageMobjectFromCamera
):
"""Adds an ImageMobject that's been obtained from the camera
into the list ``self.image_mobject_from_cameras``
Expand Down
2 changes: 1 addition & 1 deletion manim/scene/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -1814,7 +1814,7 @@ def mouse_drag_orbit_controls(
)
self.camera_target += total_shift_vector

def set_key_function(self, char: int, func: Callable[[None], Any]) -> None:
def set_key_function(self, char: str, func: Callable[[None], Any]) -> None:
self.key_to_function_map[char] = func

def on_mouse_press(
Expand Down
2 changes: 1 addition & 1 deletion manim/scene/scene_file_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import av
import numpy as np
import srt
import srt # type: ignore[import-untyped]
from PIL import Image
from pydub import AudioSegment

Expand Down
5 changes: 3 additions & 2 deletions manim/scene/three_d_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
if TYPE_CHECKING:
from typing_extensions import Any

from ..renderer.opengl_renderer import OpenGLCamera


class ThreeDScene(Scene):
"""
Expand Down Expand Up @@ -133,7 +135,7 @@ def begin_ambient_camera_rotation(
x.add_updater(lambda m, dt: x.increment_value(rate * dt))
self.add(x)
elif config.renderer == RendererType.OPENGL:
cam: ThreeDCamera = self.camera
cam: OpenGLCamera = self.camera
methods = {
"theta": cam.increment_theta,
"phi": cam.increment_phi,
Expand Down Expand Up @@ -263,7 +265,6 @@ def move_camera(
anims = []

if config.renderer == RendererType.CAIRO:
self.camera: ThreeDCamera
value_tracker_pairs = [
(phi, self.camera.phi_tracker),
(theta, self.camera.theta_tracker),
Expand Down
3 changes: 2 additions & 1 deletion manim/scene/vector_space_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,8 @@ def add_background_mobject(self, *mobjects: Mobject) -> None:
"""
self.add_special_mobjects(self.background_mobjects, *mobjects)

# TODO, this conflicts with Scene.add_fore
# TODO, this conflicts with Scene.add_foreground_mobject
# Please be aware that there is also the method Scene.add_foreground_mobjects.
def add_foreground_mobject(self, *mobjects: Mobject) -> None:
"""
Adds the mobjects to the special list
Expand Down
1 change: 1 addition & 0 deletions manim/scene/zoomed_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ def activate_zooming(self, animate: bool = False) -> None:
of the zoomed camera.
"""
self.zoom_activated = True
assert isinstance(self.renderer.camera, MultiCamera)
self.renderer.camera.add_image_mobject_from_camera(self.zoomed_display)
if animate:
self.play(self.get_zoom_in_animation())
Expand Down

0 comments on commit 6c137ee

Please sign in to comment.