mirror of
https://github.com/markqvist/Sideband.git
synced 2025-08-05 04:54:21 -04:00
Updated kivymd
This commit is contained in:
parent
c6df8b851b
commit
abcf173cc8
160 changed files with 11617 additions and 6545 deletions
|
@ -63,7 +63,7 @@ Base example
|
|||
x: 24
|
||||
|
||||
FitImage:
|
||||
source: "https://github.com/kivymd/internal/raw/main/logo/kivymd_logo_blue.png"
|
||||
source: "kivymd/images/logo/kivymd-icon-512.png"
|
||||
size_hint: None, None
|
||||
size: hero_from.size
|
||||
|
||||
|
@ -72,7 +72,7 @@ Base example
|
|||
pos_hint: {"center_x": .5}
|
||||
y: "36dp"
|
||||
on_release:
|
||||
root.current_hero = "hero"
|
||||
root.current_heroes = ["hero"]
|
||||
root.current = "screen B"
|
||||
|
||||
MDScreen:
|
||||
|
@ -82,6 +82,7 @@ Base example
|
|||
|
||||
MDHeroTo:
|
||||
id: hero_to
|
||||
tag: "hero"
|
||||
size_hint: None, None
|
||||
size: "220dp", "220dp"
|
||||
pos_hint: {"center_x": .5, "center_y": .5}
|
||||
|
@ -91,7 +92,7 @@ Base example
|
|||
pos_hint: {"center_x": .5}
|
||||
y: "36dp"
|
||||
on_release:
|
||||
root.current_hero = "hero"
|
||||
root.current_heroes = ["hero"]
|
||||
root.current = "screen A"
|
||||
'''
|
||||
|
||||
|
@ -113,6 +114,7 @@ Note that the child of the :class:`~MDHeroFrom` widget must have the size of the
|
|||
|
||||
MDHeroFrom:
|
||||
id: hero_from
|
||||
tag: "hero"
|
||||
|
||||
FitImage:
|
||||
size_hint: None, None
|
||||
|
@ -127,7 +129,7 @@ container in which the hero is located:
|
|||
MDRaisedButton:
|
||||
text: "Move Hero To Screen B"
|
||||
on_release:
|
||||
root.current_hero = "hero"
|
||||
root.current_heroes = ["hero"]
|
||||
root.current = "screen 2"
|
||||
|
||||
If you need to switch to a screen that does not contain heroes, set the
|
||||
|
@ -138,7 +140,7 @@ If you need to switch to a screen that does not contain heroes, set the
|
|||
MDRaisedButton:
|
||||
text: "Go To Another Screen"
|
||||
on_release:
|
||||
root.current_hero = ""
|
||||
root.current_heroes = []
|
||||
root.current = "another screen"
|
||||
|
||||
Example
|
||||
|
@ -166,7 +168,7 @@ Example
|
|||
x: 24
|
||||
|
||||
FitImage:
|
||||
source: "https://github.com/kivymd/internal/raw/main/logo/kivymd_logo_blue.png"
|
||||
source: "kivymd/images/logo/kivymd-icon-512.png"
|
||||
size_hint: None, None
|
||||
size: hero_from.size
|
||||
|
||||
|
@ -175,7 +177,7 @@ Example
|
|||
pos_hint: {"center_x": .5}
|
||||
y: "36dp"
|
||||
on_release:
|
||||
root.current_hero = "hero"
|
||||
root.current_heroes = ["hero"]
|
||||
root.current = "screen B"
|
||||
|
||||
MDScreen:
|
||||
|
@ -185,6 +187,7 @@ Example
|
|||
|
||||
MDHeroTo:
|
||||
id: hero_to
|
||||
tag: "hero"
|
||||
size_hint: None, None
|
||||
size: "220dp", "220dp"
|
||||
pos_hint: {"center_x": .5, "center_y": .5}
|
||||
|
@ -194,7 +197,7 @@ Example
|
|||
pos_hint: {"center_x": .5}
|
||||
y: "52dp"
|
||||
on_release:
|
||||
root.current_hero = ""
|
||||
root.current_heroes = []
|
||||
root.current = "screen C"
|
||||
|
||||
MDRaisedButton:
|
||||
|
@ -202,7 +205,7 @@ Example
|
|||
pos_hint: {"center_x": .5}
|
||||
y: "8dp"
|
||||
on_release:
|
||||
root.current_hero = "hero"
|
||||
root.current_heroes = ["hero"]
|
||||
root.current = "screen A"
|
||||
|
||||
MDScreen:
|
||||
|
@ -283,7 +286,7 @@ background color of the hero during the flight between the screens:
|
|||
pos_hint: {"center_x": .5}
|
||||
y: "36dp"
|
||||
on_release:
|
||||
root.current_hero = "hero"
|
||||
root.current_heroes = ["hero"]
|
||||
root.current = "screen B"
|
||||
|
||||
MDScreen:
|
||||
|
@ -293,6 +296,7 @@ background color of the hero during the flight between the screens:
|
|||
|
||||
MDHeroTo:
|
||||
id: hero_to
|
||||
tag: "hero"
|
||||
size_hint: None, None
|
||||
size: "220dp", "220dp"
|
||||
pos_hint: {"center_x": .5, "center_y": .5}
|
||||
|
@ -302,7 +306,7 @@ background color of the hero during the flight between the screens:
|
|||
pos_hint: {"center_x": .5}
|
||||
y: "36dp"
|
||||
on_release:
|
||||
root.current_hero = "hero"
|
||||
root.current_heroes = ["hero"]
|
||||
root.current = "screen A"
|
||||
'''
|
||||
|
||||
|
@ -370,7 +374,7 @@ Usage with ScrollView
|
|||
radius: 24
|
||||
box_radius: 0, 0, 24, 24
|
||||
box_color: 0, 0, 0, .5
|
||||
source: "image.jpg"
|
||||
source: "kivymd/images/logo/kivymd-icon-512.png"
|
||||
size_hint: None, None
|
||||
size: root.size
|
||||
mipmap: True
|
||||
|
@ -399,7 +403,7 @@ Usage with ScrollView
|
|||
|
||||
MDScreen:
|
||||
name: "screen B"
|
||||
hero_to: hero_to
|
||||
heroes_to: [hero_to]
|
||||
|
||||
MDHeroTo:
|
||||
id: hero_to
|
||||
|
@ -412,7 +416,7 @@ Usage with ScrollView
|
|||
pos_hint: {"center_x": .5}
|
||||
y: "36dp"
|
||||
on_release:
|
||||
root.current_hero = "hero"
|
||||
root.current_heroes = [hero_to.tag]
|
||||
root.current = "screen A"
|
||||
'''
|
||||
|
||||
|
@ -441,7 +445,8 @@ Usage with ScrollView
|
|||
|
||||
def on_release(self):
|
||||
def switch_screen(*args):
|
||||
self.manager.current_hero = self.tag
|
||||
self.manager.current_heroes = [self.tag]
|
||||
self.manager.ids.hero_to.tag = self.tag
|
||||
self.manager.current = "screen B"
|
||||
|
||||
Clock.schedule_once(switch_screen, 0.2)
|
||||
|
@ -465,6 +470,93 @@ Usage with ScrollView
|
|||
|
||||
.. image:: https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/hero-usage-with-scrollview.gif
|
||||
:align: center
|
||||
|
||||
Using multiple heroes at the same time
|
||||
--------------------------------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from kivy.lang import Builder
|
||||
|
||||
from kivymd.app import MDApp
|
||||
|
||||
KV = '''
|
||||
MDScreenManager:
|
||||
|
||||
MDScreen:
|
||||
name: "screen A"
|
||||
md_bg_color: "lightblue"
|
||||
|
||||
MDHeroFrom:
|
||||
id: hero_kivymd
|
||||
tag: "kivymd"
|
||||
size_hint: None, None
|
||||
size: "200dp", "200dp"
|
||||
pos_hint: {"top": .98}
|
||||
x: 24
|
||||
|
||||
FitImage:
|
||||
source: "kivymd/images/logo/kivymd-icon-512.png"
|
||||
size_hint: None, None
|
||||
size: hero_kivymd.size
|
||||
|
||||
MDHeroFrom:
|
||||
id: hero_kivy
|
||||
tag: "kivy"
|
||||
size_hint: None, None
|
||||
size: "200dp", "200dp"
|
||||
pos_hint: {"top": .98}
|
||||
x: 324
|
||||
|
||||
FitImage:
|
||||
source: "data/logo/kivy-icon-512.png"
|
||||
size_hint: None, None
|
||||
size: hero_kivy.size
|
||||
|
||||
MDRaisedButton:
|
||||
text: "Move Hero To Screen B"
|
||||
pos_hint: {"center_x": .5}
|
||||
y: "36dp"
|
||||
on_release:
|
||||
root.current_heroes = ["kivymd", "kivy"]
|
||||
root.current = "screen B"
|
||||
|
||||
MDScreen:
|
||||
name: "screen B"
|
||||
heroes_to: hero_to_kivymd, hero_to_kivy
|
||||
md_bg_color: "cadetblue"
|
||||
|
||||
MDHeroTo:
|
||||
id: hero_to_kivy
|
||||
tag: "kivy"
|
||||
size_hint: None, None
|
||||
pos_hint: {"center_x": .5, "center_y": .5}
|
||||
|
||||
MDHeroTo:
|
||||
id: hero_to_kivymd
|
||||
tag: "kivymd"
|
||||
size_hint: None, None
|
||||
pos_hint: {"right": 1, "top": 1}
|
||||
|
||||
MDRaisedButton:
|
||||
text: "Move Hero To Screen A"
|
||||
pos_hint: {"center_x": .5}
|
||||
y: "36dp"
|
||||
on_release:
|
||||
root.current_heroes = ["kivy", "kivymd"]
|
||||
root.current = "screen A"
|
||||
'''
|
||||
|
||||
|
||||
class Test(MDApp):
|
||||
def build(self):
|
||||
return Builder.load_string(KV)
|
||||
|
||||
|
||||
Test().run()
|
||||
|
||||
.. image:: https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/hero-multiple-heroes.gif
|
||||
:align: center
|
||||
"""
|
||||
|
||||
from kivy.properties import StringProperty
|
||||
|
@ -476,6 +568,9 @@ class MDHeroFrom(MDBoxLayout):
|
|||
"""
|
||||
The container from which the hero begins his flight.
|
||||
|
||||
For more information, see in the
|
||||
:class:`~kivymd.uix.boxlayout.MDBoxLayout` class documentation.
|
||||
|
||||
:Events:
|
||||
`on_transform_in`
|
||||
when the hero flies from screen **A** to screen **B**.
|
||||
|
@ -487,7 +582,7 @@ class MDHeroFrom(MDBoxLayout):
|
|||
"""
|
||||
Tag ID for heroes.
|
||||
|
||||
:attr:`shift_right` is an :class:`~kivy.properties.StringProperty`
|
||||
:attr:`tag` is an :class:`~kivy.properties.StringProperty`
|
||||
and defaults to `''`.
|
||||
"""
|
||||
|
||||
|
@ -504,4 +599,17 @@ class MDHeroFrom(MDBoxLayout):
|
|||
|
||||
|
||||
class MDHeroTo(MDBoxLayout):
|
||||
"""The container in which the hero comes."""
|
||||
"""
|
||||
The container in which the hero comes.
|
||||
|
||||
For more information, see in the
|
||||
:class:`~kivymd.uix.boxlayout.MDBoxLayout` class documentation.
|
||||
"""
|
||||
|
||||
tag = StringProperty(allownone=True)
|
||||
"""
|
||||
Tag ID for heroes.
|
||||
|
||||
:attr:`tag` is an :class:`~kivy.properties.StringProperty`
|
||||
and defaults to `''`.
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue