From ff8f818fe9e75f02aca517cebba4b1041ff9c32f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=B2=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=AE=D1=80=D0=B8?= =?UTF-8?q?=D0=B9?= Date: Fri, 17 May 2024 16:38:11 +0300 Subject: [PATCH] Fix doc strings. --- kivymd/uix/transition/transition.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/kivymd/uix/transition/transition.py b/kivymd/uix/transition/transition.py index 78e062aaa..7e1d920ea 100644 --- a/kivymd/uix/transition/transition.py +++ b/kivymd/uix/transition/transition.py @@ -310,15 +310,18 @@ def on_progress(self, progression: float) -> None: class MDSharedAxisTransition(MDTransitionBase): - """Android default screen transition""" + """ + Android default screen transition. + + .. versionadded:: 2.0.0 + """ transition_axis = OptionProperty("x", options=["x", "y", "z"]) """ Axis of the transition. Available values "x", "y", and "z". - .. image:: https://github.com/kivymd/KivyMD/assets/68729523/063e478c-9e23-40d4-a8ce-4663b428b575 - :height: 350px - :align: left + .. image:: https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/transition_axis.gif + :align: center :attr:`transition_axis` is an :class:`~kivy.properties.OptionProperty` and defaults to `"x"`. @@ -388,7 +391,7 @@ def start(self, manager): if self.transition_axis == "z": if self.ih not in self._s_map.keys(): - # Save scale instructions + # Save scale instructions. with self.screen_in.canvas.before: PushMatrix() self._s_map[self.ih] = Scale() @@ -405,25 +408,25 @@ def start(self, manager): (manager.pos[1] + manager.height) / 2, ] self._s_map[self.ih].origin = self._s_map[self.oh].origin - # relative subtracted area + # Relative subtracted area. self._slide_diff = (manager.width - self.slide_distance) * ( manager.height - self.slide_distance ) / (manager.width * manager.height) - 1 elif self.transition_axis in ["x", "y"]: - # slide distance with opposite logic + # Slide distance with opposite logic. self._slide_diff = ( (1 if self.opposite else -1) * self.slide_distance * 2 ) super().start(manager) def on_progress(self, progress): - # This code could be simplyfied with setattr, but it's slow + # This code could be simplyfied with setattr, but it's slow. progress = AnimationTransition.out_cubic(progress) progress_i = progress - 1 progress_d = progress * 2 - # first half + # First half. if progress <= 0.5: - # Screen out animation + # Screen out animation. if self.transition_axis == "z": self._s_map[self.oh].xyz = ( *[1 + self._slide_diff * progress_d] * 2, @@ -441,7 +444,7 @@ def on_progress(self, progress): ] self.screen_out.opacity = 1 - progress_d self.screen_in.opacity = 0 - # second half + # Second half. else: if self.transition_axis == "z": self._s_map[self.ih].xyz = (