Skip to content

Commit

Permalink
Fix use of Mobject's deprecated get_*() and set_*() methods in …
Browse files Browse the repository at this point in the history
…Cairo tests (#3549)

* Fix Deprecation warnings in cairo tests

* Fix animation/specialized.py
  • Loading branch information
JasonGrace2282 authored Dec 26, 2023
1 parent 9b18a86 commit 472eaae
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion manim/animation/specialized.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def __init__(

mob.move_to(self.focal_point)
mob.save_state()
mob.set_width(self.initial_width)
mob.set(width=self.initial_width)

if fill_o:
mob.set_opacity(self.initial_opacity)
Expand Down
2 changes: 1 addition & 1 deletion manim/animation/transform_matching_parts.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def get_mobject_parts(mobject: Mobject) -> list[Mobject]:
def get_mobject_key(mobject: Mobject) -> int:
mobject.save_state()
mobject.center()
mobject.set_height(1)
mobject.set(height=1)
result = hash(np.round(mobject.points, 3).tobytes())
mobject.restore()
return result
Expand Down
2 changes: 1 addition & 1 deletion manim/mobject/graphing/number_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ def get_number_mobject(
num_mob.next_to(self.number_to_point(x), direction=direction, buff=buff)
if x < 0 and self.label_direction[0] == 0:
# Align without the minus sign
num_mob.shift(num_mob[0].get_width() * LEFT / 2)
num_mob.shift(num_mob[0].width * LEFT / 2)
return num_mob

def get_number_mobjects(self, *numbers, **kwargs) -> VGroup:
Expand Down
4 changes: 2 additions & 2 deletions manim/mobject/svg/svg_mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,9 @@ def move_into_position(self) -> None:
if self.should_center:
self.center()
if self.svg_height is not None:
self.set_height(self.svg_height)
self.set(height=self.svg_height)
if self.svg_width is not None:
self.set_width(self.svg_width)
self.set(width=self.svg_width)


class VMobjectFromSVGPath(VMobject, metaclass=ConvertToOpenGL):
Expand Down
2 changes: 1 addition & 1 deletion manim/mobject/text/text_mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def construct(self):
)
text6.scale(1.3).shift(DOWN)
self.add(text1, text2, text3, text4, text5 , text6)
Group(*self.mobjects).arrange(DOWN, buff=.8).set_height(config.frame_height-LARGE_BUFF)
Group(*self.mobjects).arrange(DOWN, buff=.8).set(height=config.frame_height-LARGE_BUFF)
.. manim:: TextMoreCustomization
:save_last_frame:
Expand Down
4 changes: 2 additions & 2 deletions manim/mobject/value_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def construct(self):

def __init__(self, value=0, **kwargs):
super().__init__(**kwargs)
self.set_points(np.zeros((1, 3)))
self.set(points=np.zeros((1, 3)))
self.set_value(value)

def get_value(self) -> float:
Expand Down Expand Up @@ -132,7 +132,7 @@ def interpolate(self, mobject1, mobject2, alpha, path_func=straight_path()):
Turns self into an interpolation between mobject1
and mobject2.
"""
self.set_points(path_func(mobject1.points, mobject2.points, alpha))
self.set(points=path_func(mobject1.points, mobject2.points, alpha))
return self


Expand Down

0 comments on commit 472eaae

Please sign in to comment.