2022-07-07 14:16:10 -06:00
|
|
|
"""
|
|
|
|
Components/Screen
|
|
|
|
=================
|
|
|
|
|
|
|
|
:class:`~kivy.uix.screenmanager.Screen` class equivalent. Simplifies working
|
|
|
|
with some widget properties. For example:
|
|
|
|
|
|
|
|
Screen
|
|
|
|
------
|
|
|
|
|
2022-10-02 09:16:59 -06:00
|
|
|
.. code-block:: kv
|
2022-07-07 14:16:10 -06:00
|
|
|
|
|
|
|
Screen:
|
|
|
|
canvas:
|
|
|
|
Color:
|
|
|
|
rgba: app.theme_cls.primary_color
|
|
|
|
RoundedRectangle:
|
|
|
|
pos: self.pos
|
|
|
|
size: self.size
|
|
|
|
radius: [25, 0, 0, 0]
|
|
|
|
|
|
|
|
MDScreen
|
|
|
|
--------
|
|
|
|
|
2022-10-02 09:16:59 -06:00
|
|
|
.. code-block:: kv
|
2022-07-07 14:16:10 -06:00
|
|
|
|
|
|
|
MDScreen:
|
|
|
|
radius: [25, 0, 0, 0]
|
|
|
|
md_bg_color: app.theme_cls.primary_color
|
|
|
|
"""
|
|
|
|
|
2022-10-08 09:17:59 -06:00
|
|
|
from kivy.properties import ListProperty, ObjectProperty
|
2022-07-07 14:16:10 -06:00
|
|
|
from kivy.uix.screenmanager import Screen
|
|
|
|
|
2023-07-09 18:49:58 -06:00
|
|
|
from kivymd.theming import ThemableBehavior
|
2022-07-07 14:16:10 -06:00
|
|
|
from kivymd.uix import MDAdaptiveWidget
|
2022-10-02 09:16:59 -06:00
|
|
|
from kivymd.uix.behaviors import DeclarativeBehavior
|
2022-07-07 14:16:10 -06:00
|
|
|
from kivymd.uix.hero import MDHeroTo
|
|
|
|
|
|
|
|
|
2023-07-09 18:49:58 -06:00
|
|
|
class MDScreen(DeclarativeBehavior, ThemableBehavior, Screen, MDAdaptiveWidget):
|
2022-07-07 14:16:10 -06:00
|
|
|
"""
|
2022-10-02 09:16:59 -06:00
|
|
|
Screen is an element intended to be used with a
|
|
|
|
:class:`~kivymd.uix.screenmanager.MDScreenManager`. For more information,
|
|
|
|
see in the :class:`~kivy.uix.screenmanager.Screen` class documentation.
|
|
|
|
"""
|
|
|
|
|
2022-10-08 09:17:59 -06:00
|
|
|
hero_to = ObjectProperty(deprecated=True)
|
2022-10-02 09:16:59 -06:00
|
|
|
"""
|
2022-10-08 09:17:59 -06:00
|
|
|
Must be a :class:`~kivymd.uix.hero.MDHeroTo` class.
|
|
|
|
|
2022-07-07 14:16:10 -06:00
|
|
|
See the documentation of the
|
|
|
|
`MDHeroTo <https://kivymd.readthedocs.io/en/latest/components/hero/>`_
|
|
|
|
widget for more detailed information.
|
|
|
|
|
2022-10-08 09:17:59 -06:00
|
|
|
.. deprecated:: 1.0.0
|
|
|
|
Use attr:`heroes_to` attribute instead.
|
2022-07-07 14:16:10 -06:00
|
|
|
|
|
|
|
:attr:`hero_to` is an :class:`~kivy.properties.ObjectProperty`
|
|
|
|
and defaults to `None`.
|
|
|
|
"""
|
|
|
|
|
2022-10-08 09:17:59 -06:00
|
|
|
heroes_to = ListProperty()
|
|
|
|
"""
|
|
|
|
Must be a list of :class:`~kivymd.uix.hero.MDHeroTo` class.
|
|
|
|
|
|
|
|
.. versionadded:: 1.0.0
|
|
|
|
|
|
|
|
:attr:`heroes_to` is an :class:`~kivy.properties.LiatProperty`
|
|
|
|
and defaults to `[]`.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def on_hero_to(self, screen, widget: MDHeroTo) -> None:
|
|
|
|
"""Called when the value of the :attr:`hero_to` attribute changes."""
|
|
|
|
|
2022-07-07 14:16:10 -06:00
|
|
|
if not isinstance(widget, MDHeroTo) or not issubclass(
|
|
|
|
widget.__class__, MDHeroTo
|
|
|
|
):
|
|
|
|
raise TypeError(
|
|
|
|
f"The `{widget}` widget must be an `kivymd.uix.hero.MDHeroTo` "
|
|
|
|
f"class or inherited from this class"
|
|
|
|
)
|
2022-10-08 09:17:59 -06:00
|
|
|
self.heroes_to = [widget]
|