working condition

This commit is contained in:
Yura 2024-09-15 20:57:02 +03:00
parent 417e54da96
commit 511e0b0379
517 changed files with 29187 additions and 32696 deletions

View file

@ -4,6 +4,9 @@ from .navigationdrawer import (
MDNavigationDrawerDivider,
MDNavigationDrawerHeader,
MDNavigationDrawerItem,
MDNavigationDrawerItemLeadingIcon,
MDNavigationDrawerItemText,
MDNavigationDrawerItemTrailingText,
MDNavigationDrawerLabel,
MDNavigationDrawerMenu,
MDNavigationLayout,

View file

@ -1,134 +1,83 @@
#:import Window kivy.core.window.Window
#:import m_res kivymd.material_resources
<MDNavigationDrawer>:
<MDNavigationDrawer>
type: "filled"
size_hint_x: None
width: Window.width - dp(56) if Window.width <= dp(376) else dp(320)
md_bg_color: self.theme_cls.bg_light
padding:
width: Window.width - dp(56) if Window.width <= dp(360) else dp(320)
theme_bg_color: "Custom"
shadow_radius: self.radius
md_bg_color:
self.theme_cls.surfaceContainerLowColor \
if not self.background_color else \
self.background_color
x:
(self.width * (self.open_progress - 1)) \
if self.anchor == "left" \
else (Window.width - self.width * self.open_progress)
canvas:
Clear
Color:
rgba: self.md_bg_color
RoundedRectangle:
size: self.size
pos: self.pos
source: root.background
radius: root.radius
<MDNavigationDrawerLabel>
adaptive_height: True
MDLabel:
text: root.text
adaptive_size: True
markup: True
<MDNavigationDrawerDivider>
adaptive_height: True
MDSeparator:
color: root.color if root.color else app.theme_cls.divider_color
<MDNavigationDrawerHeader>
adaptive_height: True
FitImage:
id: logo
source: root.source
size_hint: None, None
size: label_box.height, label_box.height
MDBoxLayout:
id: label_box
orientation: "vertical"
adaptive_height: True
MDLabel:
id: title
adaptive_height: True
halign: root.title_halign
text: root.title
font_style: root.title_font_style
font_size: root.title_font_size
color:
root.title_color \
if root.title_color else \
app.theme_cls.text_color
MDLabel:
id: text
adaptive_height: True
text: root.text
halign: root.text_halign
font_style: root.text_font_style
font_size: root.text_font_size
color:
root.text_color \
if root.text_color else \
app.theme_cls.text_color
padding: "20dp", "0dp", "16dp", "16dp"
text_color:
self.theme_cls.onSurfaceColor \
if self.theme_text_color == "Primary" else \
self.text_color
<MDNavigationDrawerItem>
radius: self.height / 2 if self.radius == [0, 0, 0, 0] else self.radius
divider: None
theme_text_color: "Custom"
text_color: self.text_color if not self.selected else self.selected_color
_txt_left_pad: "56dp"
on_size:
self.ids._left_container.x = "4dp"
self.ids._right_container.width = right_label.texture_size[0]
on_release:
if not self.selected: self._text_color = self.text_color
self._text_right_color = root.text_right_color if root.text_right_color else app.theme_cls.text_color
self._drawer_menu.reset_active_color(self)
radius: self.height / 2
ripple_color: self.theme_cls.onSecondaryContainerColor[:-1] + [0.12]
theme_bg_color: "Custom"
md_bg_color:
self.theme_cls.surfaceContainerLowColor \
if not self.inactive_indicator_color else \
self.inactive_indicator_color
IconLeftWidgetWithoutTouch:
icon: root.icon
theme_icon_color: "Custom"
icon_color:
( \
app.theme_cls.text_color \
if not root.icon_color else \
root.icon_color \
) \
if not root.selected else \
root.selected_color
MDLabel:
id: right_label
text: root.right_text
pos_hint: {"center_y": .5}
adaptive_size: True
markup: True
color:
( \
root.text_right_color \
if root.text_right_color else \
app.theme_cls.text_color \
) \
if not root.selected else \
root.selected_color
x:
root.x \
+ root.width \
- m_res.HORIZ_MARGINS \
- root.ids._right_container.width - dp(24) \
- self.texture_size[0] \
+ dp(24)
<MDNavigationDrawerItemTrailingText>
text_color:
self.theme_cls.onSurfaceVariantColor \
if self.theme_text_color == "Primary" else \
self.text_color
<MDNavigationDrawerItemText>
font_style: "Label"
role: "large"
text_color:
self.theme_cls.onSurfaceVariantColor \
if self.theme_text_color == "Primary" else \
self.text_color
<MDNavigationDrawerItemLeadingIcon>
icon_color:
self.theme_cls.onSurfaceVariantColor \
if self.theme_icon_color == "Primary" else \
self.icon_color
<MDNavigationDrawerHeader>
size_hint_y: None
height: self.minimum_height
<MDNavigationDrawerDivider>
padding: 0, "4dp", 0, "4dp"
size_hint_y: None
height: self.minimum_height
MDDivider:
<MDNavigationDrawerMenu>
MDList:
GridLayout:
id: menu
cols: 1
size_hint_y: None
height: self.minimum_height
spacing: root.spacing