working condition
This commit is contained in:
parent
417e54da96
commit
511e0b0379
517 changed files with 29187 additions and 32696 deletions
Binary file not shown.
Binary file not shown.
|
@ -22,7 +22,6 @@
|
|||
MDLabel:
|
||||
text: root.text
|
||||
pos_hint: {"center_y": .5}
|
||||
theme_text_color: "Custom" if root.text_color else "Primary"
|
||||
shorten: True
|
||||
shorten_from: "right"
|
||||
size_hint_x: None
|
||||
|
@ -34,25 +33,26 @@
|
|||
+ container.padding[2] \
|
||||
+ container.spacing \
|
||||
)
|
||||
theme_text_color: "Custom"
|
||||
text_color:
|
||||
root.text_color \
|
||||
if root.text_color else \
|
||||
app.theme_cls.text_color
|
||||
app.theme_cls.onSurfaceVariantColor \
|
||||
if not root.text_color else \
|
||||
root.text_color
|
||||
|
||||
MDTrailingTextContainer:
|
||||
id: trailing_container
|
||||
text: root.trailing_text
|
||||
adaptive_width: True
|
||||
theme_text_color: "Custom" if root.trailing_text_color else "Primary"
|
||||
theme_text_color: "Custom"
|
||||
text_color:
|
||||
root.trailing_text_color \
|
||||
if root.trailing_text_color else \
|
||||
app.theme_cls.text_color
|
||||
app.theme_cls.onSurfaceVariantColor \
|
||||
if not root.trailing_text_color else \
|
||||
root.trailing_text_color
|
||||
|
||||
MDSeparator:
|
||||
MDDivider:
|
||||
md_bg_color:
|
||||
( \
|
||||
self.theme_cls.divider_color \
|
||||
app.theme_cls.outlineVariantColor \
|
||||
if not root.divider_color \
|
||||
else root.divider_color \
|
||||
) \
|
||||
|
@ -74,16 +74,15 @@
|
|||
size_hint: None, None
|
||||
size: "48dp", "48dp"
|
||||
pos_hint: {"center_y": .5}
|
||||
theme_text_color: "Custom" if root.leading_icon_color else "Primary"
|
||||
theme_text_color: "Custom"
|
||||
text_color:
|
||||
root.leading_icon_color \
|
||||
if root.leading_icon_color else \
|
||||
app.theme_cls.text_color
|
||||
app.theme_cls.onSurfaceVariantColor \
|
||||
if not root.leading_icon_color else \
|
||||
root.leading_icon_color
|
||||
|
||||
MDLabel:
|
||||
text: root.text
|
||||
pos_hint: {"center_y": .5}
|
||||
theme_text_color: "Custom" if root.text_color else "Primary"
|
||||
shorten: True
|
||||
shorten_from: "right"
|
||||
size_hint_x: None
|
||||
|
@ -97,10 +96,11 @@
|
|||
+ container.spacing \
|
||||
+ dp(18) \
|
||||
)
|
||||
theme_text_color: "Custom"
|
||||
text_color:
|
||||
root.text_color \
|
||||
if root.text_color else \
|
||||
app.theme_cls.text_color
|
||||
app.theme_cls.onSurfaceVariantColor \
|
||||
if not root.text_color else \
|
||||
root.text_color
|
||||
|
||||
Widget:
|
||||
|
||||
|
@ -108,16 +108,16 @@
|
|||
id: trailing_container
|
||||
text: root.trailing_text
|
||||
adaptive_width: True
|
||||
theme_text_color: "Custom" if root.trailing_text_color else "Primary"
|
||||
theme_text_color: "Custom"
|
||||
text_color:
|
||||
root.trailing_text_color \
|
||||
if root.trailing_text_color else \
|
||||
app.theme_cls.text_color
|
||||
app.theme_cls.onSurfaceVariantColor \
|
||||
if not root.trailing_text_color else \
|
||||
root.trailing_text_color
|
||||
|
||||
MDSeparator:
|
||||
MDDivider:
|
||||
md_bg_color:
|
||||
( \
|
||||
self.theme_cls.divider_color \
|
||||
app.theme_cls.outlineVariantColor \
|
||||
if not root.divider_color \
|
||||
else root.divider_color \
|
||||
) \
|
||||
|
@ -140,7 +140,6 @@
|
|||
size_hint_x: None
|
||||
shorten_from: "right"
|
||||
pos_hint: {"center_y": .5}
|
||||
theme_text_color: "Custom" if root.text_color else "Primary"
|
||||
shorten: True
|
||||
shorten_from: "right"
|
||||
width:
|
||||
|
@ -152,10 +151,11 @@
|
|||
+ container.spacing \
|
||||
+ dp(18) \
|
||||
)
|
||||
theme_text_color: "Custom"
|
||||
text_color:
|
||||
root.text_color \
|
||||
if root.text_color else \
|
||||
app.theme_cls.text_color
|
||||
app.theme_cls.onSurfaceVariantColor \
|
||||
if not root.text_color else \
|
||||
root.text_color
|
||||
|
||||
Widget:
|
||||
|
||||
|
@ -165,16 +165,16 @@
|
|||
size: "48dp", "48dp"
|
||||
pos_hint: {"center_y": .5}
|
||||
icon: root.trailing_icon
|
||||
theme_text_color: "Custom" if root.trailing_icon_color else "Primary"
|
||||
theme_text_color: "Custom"
|
||||
text_color:
|
||||
root.trailing_icon_color \
|
||||
if root.trailing_icon_color else \
|
||||
app.theme_cls.text_color
|
||||
app.theme_cls.onSurfaceVariantColor \
|
||||
if not root.trailing_icon_color else \
|
||||
root.trailing_icon_color
|
||||
|
||||
MDSeparator:
|
||||
MDDivider:
|
||||
md_bg_color:
|
||||
( \
|
||||
self.theme_cls.divider_color \
|
||||
app.theme_cls.outlineVariantColor \
|
||||
if not root.divider_color \
|
||||
else root.divider_color \
|
||||
) \
|
||||
|
@ -190,21 +190,21 @@
|
|||
size_hint: None, None
|
||||
size: "48dp", "48dp"
|
||||
pos_hint: {"center_y": .5}
|
||||
theme_text_color: "Custom" if root.trailing_icon_color else "Primary"
|
||||
theme_text_color: "Custom"
|
||||
text_color:
|
||||
root.trailing_icon_color \
|
||||
if root.trailing_icon_color else \
|
||||
app.theme_cls.text_color
|
||||
app.theme_cls.onSurfaceVariantColor \
|
||||
if not root.trailing_icon_color else \
|
||||
root.trailing_icon_color
|
||||
|
||||
MDLabel:
|
||||
text: root.trailing_text
|
||||
adaptive_size: True
|
||||
pos_hint: {"center_y": .5}
|
||||
theme_text_color: "Custom" if root.trailing_text_color else "Primary"
|
||||
theme_text_color: "Custom"
|
||||
text_color:
|
||||
root.trailing_text_color \
|
||||
if root.trailing_text_color else \
|
||||
app.theme_cls.text_color
|
||||
app.theme_cls.onSurfaceVariantColor \
|
||||
if not root.text_color else \
|
||||
root.text_color
|
||||
|
||||
|
||||
<MDDropdownTrailingIconTextItem>
|
||||
|
@ -222,7 +222,6 @@
|
|||
size_hint_x: None
|
||||
shorten_from: "right"
|
||||
pos_hint: {"center_y": .5}
|
||||
theme_text_color: "Custom" if root.text_color else "Primary"
|
||||
shorten: True
|
||||
shorten_from: "right"
|
||||
width:
|
||||
|
@ -233,10 +232,11 @@
|
|||
+ container.padding[2] \
|
||||
+ container.spacing \
|
||||
)
|
||||
theme_text_color: "Custom"
|
||||
text_color:
|
||||
root.text_color \
|
||||
if root.text_color else \
|
||||
app.theme_cls.text_color
|
||||
app.theme_cls.onSurfaceVariantColor \
|
||||
if not root.text_color else \
|
||||
root.text_color
|
||||
|
||||
MDTrailingIconTextContainer:
|
||||
id: trailing_container
|
||||
|
@ -245,10 +245,10 @@
|
|||
trailing_text_color: root.trailing_text_color
|
||||
trailing_icon_color: root.trailing_icon_color
|
||||
|
||||
MDSeparator:
|
||||
MDDivider:
|
||||
md_bg_color:
|
||||
( \
|
||||
self.theme_cls.divider_color \
|
||||
app.theme_cls.outlineVariantColor \
|
||||
if not root.divider_color \
|
||||
else root.divider_color \
|
||||
) \
|
||||
|
@ -263,18 +263,18 @@
|
|||
text: root.text
|
||||
valign: "center"
|
||||
padding_x: "12dp"
|
||||
theme_text_color: "Custom" if root.text_color else "Primary"
|
||||
shorten: True
|
||||
shorten_from: "right"
|
||||
theme_text_color: "Custom"
|
||||
text_color:
|
||||
root.text_color \
|
||||
if root.text_color else \
|
||||
app.theme_cls.text_color
|
||||
app.theme_cls.onSurfaceVariantColor \
|
||||
if not root.text_color else \
|
||||
root.text_color
|
||||
|
||||
MDSeparator:
|
||||
MDDivider:
|
||||
md_bg_color:
|
||||
( \
|
||||
self.theme_cls.divider_color \
|
||||
app.theme_cls.outlineVariantColor \
|
||||
if not root.divider_color \
|
||||
else root.divider_color \
|
||||
) \
|
||||
|
@ -296,16 +296,15 @@
|
|||
size_hint: None, None
|
||||
size: "48dp", "48dp"
|
||||
pos_hint: {"center_y": .5}
|
||||
theme_text_color: "Custom" if root.leading_icon_color else "Primary"
|
||||
theme_text_color: "Custom"
|
||||
text_color:
|
||||
root.leading_icon_color \
|
||||
if root.leading_icon_color else \
|
||||
app.theme_cls.text_color
|
||||
app.theme_cls.onSurfaceVariantColor \
|
||||
if not root.leading_icon_color else \
|
||||
root.leading_icon_color
|
||||
|
||||
MDLabel:
|
||||
text: root.text
|
||||
pos_hint: {"center_y": .5}
|
||||
theme_text_color: "Custom" if root.text_color else "Primary"
|
||||
shorten: True
|
||||
shorten_from: "right"
|
||||
size_hint_x: None
|
||||
|
@ -319,10 +318,11 @@
|
|||
+ container.spacing \
|
||||
+ dp(18) \
|
||||
)
|
||||
theme_text_color: "Custom"
|
||||
text_color:
|
||||
root.text_color \
|
||||
if root.text_color else \
|
||||
app.theme_cls.text_color
|
||||
app.theme_cls.onSurfaceVariantColor \
|
||||
if not root.text_color else \
|
||||
root.text_color
|
||||
|
||||
Widget:
|
||||
|
||||
|
@ -333,10 +333,10 @@
|
|||
trailing_icon_color: root.trailing_icon_color
|
||||
trailing_text_color: root.trailing_text_color
|
||||
|
||||
MDSeparator:
|
||||
MDDivider:
|
||||
md_bg_color:
|
||||
( \
|
||||
self.theme_cls.divider_color \
|
||||
app.theme_cls.outlineVariantColor \
|
||||
if not root.divider_color \
|
||||
else root.divider_color \
|
||||
) \
|
||||
|
@ -358,11 +358,11 @@
|
|||
size_hint: None, None
|
||||
size: "48dp", "48dp"
|
||||
pos_hint: {"center_y": .5}
|
||||
theme_text_color: "Custom" if root.leading_icon_color else "Primary"
|
||||
theme_text_color: "Custom"
|
||||
text_color:
|
||||
root.leading_icon_color \
|
||||
if root.leading_icon_color else \
|
||||
app.theme_cls.text_color
|
||||
app.theme_cls.onSurfaceVariantColor \
|
||||
if not root.leading_icon_color else \
|
||||
root.leading_icon_color
|
||||
|
||||
MDLabel:
|
||||
id: label
|
||||
|
@ -371,7 +371,6 @@
|
|||
size_hint_x: None
|
||||
shorten_from: "right"
|
||||
pos_hint: {"center_y": .5}
|
||||
theme_text_color: "Custom" if root.text_color else "Primary"
|
||||
shorten: True
|
||||
shorten_from: "right"
|
||||
width:
|
||||
|
@ -384,10 +383,11 @@
|
|||
+ container.spacing \
|
||||
+ dp(18) \
|
||||
)
|
||||
theme_text_color: "Custom"
|
||||
text_color:
|
||||
root.text_color \
|
||||
if root.text_color else \
|
||||
app.theme_cls.text_color
|
||||
app.theme_cls.onSurfaceVariantColor \
|
||||
if not root.text_color else \
|
||||
root.text_color
|
||||
|
||||
Widget:
|
||||
|
||||
|
@ -397,16 +397,16 @@
|
|||
size: "48dp", "48dp"
|
||||
pos_hint: {"center_y": .5}
|
||||
icon: root.trailing_icon
|
||||
theme_text_color: "Custom" if root.trailing_icon_color else "Primary"
|
||||
theme_text_color: "Custom"
|
||||
text_color:
|
||||
root.trailing_icon_color \
|
||||
if root.trailing_icon_color else \
|
||||
app.theme_cls.text_color
|
||||
app.theme_cls.onSurfaceVariantColor \
|
||||
if not root.trailing_icon_color else \
|
||||
root.trailing_icon_color
|
||||
|
||||
MDSeparator:
|
||||
MDDivider:
|
||||
md_bg_color:
|
||||
( \
|
||||
self.theme_cls.divider_color \
|
||||
app.theme_cls.outlineVariantColor \
|
||||
if not root.divider_color \
|
||||
else root.divider_color \
|
||||
) \
|
||||
|
@ -428,11 +428,11 @@
|
|||
size_hint: None, None
|
||||
size: "48dp", "48dp"
|
||||
pos_hint: {"center_y": .5}
|
||||
theme_text_color: "Custom" if root.leading_icon_color else "Primary"
|
||||
theme_text_color: "Custom"
|
||||
text_color:
|
||||
root.leading_icon_color \
|
||||
if root.leading_icon_color else \
|
||||
app.theme_cls.text_color
|
||||
app.theme_cls.onSurfaceVariantColor \
|
||||
if not root.leading_icon_color else \
|
||||
root.leading_icon_color
|
||||
|
||||
MDLabel:
|
||||
id: label
|
||||
|
@ -441,7 +441,6 @@
|
|||
size_hint_x: None
|
||||
shorten_from: "right"
|
||||
pos_hint: {"center_y": .5}
|
||||
theme_text_color: "Custom" if root.text_color else "Primary"
|
||||
shorten: True
|
||||
shorten_from: "right"
|
||||
width:
|
||||
|
@ -452,15 +451,16 @@
|
|||
+ container.padding[2] \
|
||||
+ container.spacing \
|
||||
)
|
||||
theme_text_color: "Custom"
|
||||
text_color:
|
||||
root.text_color \
|
||||
if root.text_color else \
|
||||
app.theme_cls.text_color
|
||||
app.theme_cls.onSurfaceVariantColor \
|
||||
if not root.text_color else \
|
||||
root.text_color
|
||||
|
||||
MDSeparator:
|
||||
MDDivider:
|
||||
md_bg_color:
|
||||
( \
|
||||
self.theme_cls.divider_color \
|
||||
app.theme_cls.outlineVariantColor \
|
||||
if not root.divider_color \
|
||||
else root.divider_color \
|
||||
) \
|
||||
|
@ -470,14 +470,18 @@
|
|||
|
||||
<MDDropdownMenu>
|
||||
orientation: "vertical"
|
||||
elevation: root.elevation
|
||||
shadow_radius: root.shadow_radius
|
||||
shadow_softness: root.shadow_softness
|
||||
shadow_offset: root.shadow_offset
|
||||
shadow_color: root.shadow_color
|
||||
shadow_color: root.shadow_color
|
||||
radius: root.radius
|
||||
size_hint: None, None
|
||||
focus_behavior: False
|
||||
style: "elevated"
|
||||
elevation_level: 2
|
||||
shadow_softness: 1.5
|
||||
shadow_radius: 4
|
||||
theme_bg_color: root.theme_bg_color
|
||||
# md_bg_color:
|
||||
# app.theme_cls.surfaceContainerColor \
|
||||
# if root.theme_bg_color == "Primary" else \
|
||||
# root.md_bg_color
|
||||
|
||||
|
||||
MDBoxLayout:
|
||||
id: content_header
|
||||
|
|
|
@ -205,6 +205,7 @@ You can use the following parameters to customize the menu items:
|
|||
:align: center
|
||||
|
||||
.. Header:
|
||||
|
||||
Header
|
||||
------
|
||||
|
||||
|
@ -338,6 +339,7 @@ for both the righthand and lefthand menus.
|
|||
:align: center
|
||||
|
||||
.. Position:
|
||||
|
||||
Position
|
||||
========
|
||||
|
||||
|
@ -405,50 +407,49 @@ Center position
|
|||
.. code-block:: python
|
||||
|
||||
from kivy.lang import Builder
|
||||
from kivy.metrics import dp
|
||||
|
||||
from kivymd.app import MDApp
|
||||
from kivymd.uix.menu import MDDropdownMenu
|
||||
from kivymd.app import MDApp
|
||||
|
||||
KV = '''
|
||||
MDScreen:
|
||||
MDScreen
|
||||
md_bg_color: self.theme_cls.backgroundColor
|
||||
|
||||
MDDropDownItem:
|
||||
id: drop_item
|
||||
pos_hint: {'center_x': .5, 'center_y': .5}
|
||||
text: 'Item 0'
|
||||
on_release: app.menu.open()
|
||||
pos_hint: {"center_x": .5, "center_y": .5}
|
||||
on_release: app.open_drop_item_menu(self)
|
||||
|
||||
MDDropDownItemText:
|
||||
id: drop_text
|
||||
text: "Item"
|
||||
'''
|
||||
|
||||
|
||||
class Test(MDApp):
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self.screen = Builder.load_string(KV)
|
||||
class Example(MDApp, CommonApp):
|
||||
drop_item_menu: MDDropdownMenu = None
|
||||
|
||||
def open_drop_item_menu(self, item):
|
||||
menu_items = [
|
||||
{
|
||||
"text": f"Item {i}",
|
||||
"on_release": lambda x=f"Item {i}": self.set_item(x),
|
||||
"text": f"{i}",
|
||||
"on_release": lambda x=f"Item {i}": self.menu_callback(x),
|
||||
} for i in range(5)
|
||||
]
|
||||
self.menu = MDDropdownMenu(
|
||||
caller=self.screen.ids.drop_item,
|
||||
items=menu_items,
|
||||
position="center",
|
||||
)
|
||||
self.menu.bind()
|
||||
if not self.drop_item_menu:
|
||||
self.drop_item_menu = MDDropdownMenu(
|
||||
caller=item, items=menu_items, position="center"
|
||||
)
|
||||
self.drop_item_menu.open()
|
||||
|
||||
def set_item(self, text_item):
|
||||
self.screen.ids.drop_item.set_item(text_item)
|
||||
self.menu.dismiss()
|
||||
def menu_callback(self, text_item):
|
||||
self.root.ids.drop_text.text = text_item
|
||||
self.drop_item_menu.dismiss()
|
||||
|
||||
def build(self):
|
||||
self.theme_cls.primary_palette = "Orange"
|
||||
self.theme_cls.theme_style = "Dark"
|
||||
return self.screen
|
||||
return Builder.load_string(KV)
|
||||
|
||||
|
||||
Test().run()
|
||||
Example().run()
|
||||
|
||||
.. image:: https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/menu-position-center.gif
|
||||
:align: center
|
||||
|
@ -636,14 +637,14 @@ from kivy.properties import (
|
|||
)
|
||||
from kivy.uix.recycleview import RecycleView
|
||||
|
||||
import kivymd.material_resources as m_res
|
||||
from kivymd import uix_path
|
||||
from kivymd.uix.behaviors import StencilBehavior, RectangularRippleBehavior
|
||||
from kivymd.uix.behaviors.motion_behavior import MotionDropDownMenuBehavior
|
||||
from kivymd.uix.boxlayout import MDBoxLayout
|
||||
from kivymd.uix.card import MDCard
|
||||
from kivymd.uix.label import MDLabel
|
||||
from kivymd.uix.list import IRightBody
|
||||
|
||||
# from kivymd.uix.list import IRightBody
|
||||
|
||||
with open(
|
||||
os.path.join(uix_path, "menu", "menu.kv"), encoding="utf-8"
|
||||
|
@ -672,7 +673,7 @@ class BaseDropdownItem(RectangularRippleBehavior, ButtonBehavior, MDBoxLayout):
|
|||
.. versionadded:: 1.2.0
|
||||
|
||||
For more information, see in the
|
||||
:class:`~kivymd.uix.behaviors.RectangularRippleBehavior` and
|
||||
:class:`~kivymd.uix.behaviors.ripple_behavior.RectangularRippleBehavior` and
|
||||
:class:`~kivymd.uix.boxlayout.MDBoxLayout` classes.
|
||||
"""
|
||||
|
||||
|
@ -762,7 +763,7 @@ class BaseDropdownItem(RectangularRippleBehavior, ButtonBehavior, MDBoxLayout):
|
|||
"""
|
||||
|
||||
|
||||
class MDTrailingTextContainer(BaseDropdownItem, IRightBody, MDLabel):
|
||||
class MDTrailingTextContainer(BaseDropdownItem, MDLabel):
|
||||
"""
|
||||
Implements a container for trailing text.
|
||||
|
||||
|
@ -775,7 +776,7 @@ class MDTrailingTextContainer(BaseDropdownItem, IRightBody, MDLabel):
|
|||
"""
|
||||
|
||||
|
||||
class MDTrailingIconTextContainer(BaseDropdownItem, IRightBody, MDBoxLayout):
|
||||
class MDTrailingIconTextContainer(BaseDropdownItem, MDBoxLayout):
|
||||
"""
|
||||
Implements a container for trailing icons and trailing text.
|
||||
|
||||
|
@ -877,9 +878,9 @@ class MDDropdownMenu(MotionDropDownMenuBehavior, StencilBehavior, MDCard):
|
|||
Dropdown menu class.
|
||||
|
||||
For more information, see in the
|
||||
:class:`~kivymd.uix.behaviors.MotionDropDownMenuBehavior` and
|
||||
:class:`~kivymd.uix.behaviors.StencilBehavior` and
|
||||
:class:`~kivymd.uix.card.MDCard`
|
||||
:class:`~kivymd.uix.behaviors.motion_behavior.MotionDropDownMenuBehavior` and
|
||||
:class:`~kivymd.uix.behaviors.stencil_behavior.StencilBehavior` and
|
||||
:class:`~kivymd.uix.card.card.MDCard`
|
||||
classes documentation.
|
||||
|
||||
:Events:
|
||||
|
@ -1058,42 +1059,6 @@ class MDDropdownMenu(MotionDropDownMenuBehavior, StencilBehavior, MDCard):
|
|||
and defaults to `'[dp(7)]'`.
|
||||
"""
|
||||
|
||||
elevation = NumericProperty(m_res.DROP_DOWN_MENU_ELEVATION)
|
||||
"""
|
||||
See :attr:`kivymd.uix.behaviors.elevation.CommonElevationBehavior.elevation`
|
||||
attribute.
|
||||
|
||||
:attr:`elevation` is an :class:`~kivy.properties.NumericProperty`
|
||||
and defaults to `2`.
|
||||
"""
|
||||
|
||||
shadow_radius = VariableListProperty([6], length=4)
|
||||
"""
|
||||
See :attr:`kivymd.uix.behaviors.elevation.CommonElevationBehavior.shadow_radius`
|
||||
attribute.
|
||||
|
||||
:attr:`shadow_radius` is an :class:`~kivy.properties.VariableListProperty`
|
||||
and defaults to `[6]`.
|
||||
"""
|
||||
|
||||
shadow_softness = NumericProperty(m_res.DROP_DOWN_MENU_SOFTNESS)
|
||||
"""
|
||||
See :attr:`kivymd.uix.behaviors.elevation.CommonElevationBehavior.shadow_softness`
|
||||
attribute.
|
||||
|
||||
:attr:`shadow_softness` is an :class:`~kivy.properties.NumericProperty`
|
||||
and defaults to `6`.
|
||||
"""
|
||||
|
||||
shadow_offset = ListProperty(m_res.DROP_DOWN_MENU_OFFSET)
|
||||
"""
|
||||
See :attr:`kivymd.uix.behaviors.elevation.CommonElevationBehavior.shadow_offset`
|
||||
attribute.
|
||||
|
||||
:attr:`shadow_offset` is an :class:`~kivy.properties.ListProperty`
|
||||
and defaults to `(0, -2)`.
|
||||
"""
|
||||
|
||||
_items = []
|
||||
_start_coords = []
|
||||
_tar_x = 0
|
||||
|
@ -1381,6 +1346,9 @@ class MDDropdownMenu(MotionDropDownMenuBehavior, StencilBehavior, MDCard):
|
|||
items.append(data)
|
||||
|
||||
self._items = items
|
||||
# Update items in view
|
||||
if hasattr(self, "menu"):
|
||||
self.menu.data = self._items
|
||||
|
||||
def on_header_cls(
|
||||
self, instance_dropdown_menu, instance_user_menu_header
|
||||
|
@ -1424,13 +1392,13 @@ if __name__ == "__main__":
|
|||
from kivy.metrics import dp
|
||||
|
||||
from kivymd.app import MDApp
|
||||
from kivymd.uix.button import MDRaisedButton
|
||||
from kivymd.uix.button import MDButton, MDButtonText
|
||||
from kivymd.uix.screen import MDScreen
|
||||
|
||||
class Test(MDApp):
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self.screen = MDScreen()
|
||||
self.screen = MDScreen(md_bg_color=self.theme_cls.backgroundColor)
|
||||
menu_items = [{"text": f"Item {i}"} for i in range(55)]
|
||||
self.menu = MDDropdownMenu(items=menu_items, width_mult=4)
|
||||
|
||||
|
@ -1452,7 +1420,13 @@ if __name__ == "__main__":
|
|||
]
|
||||
for pos_hint in pos_hints:
|
||||
self.screen.add_widget(
|
||||
MDRaisedButton(pos_hint=pos_hint, on_release=self.open_menu)
|
||||
MDButton(
|
||||
MDButtonText(
|
||||
text="Press me",
|
||||
),
|
||||
pos_hint=pos_hint,
|
||||
on_release=self.open_menu,
|
||||
)
|
||||
)
|
||||
|
||||
def build(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue