mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 04:01:32 -06:00
Core: KivyMD and Launcher overhaul (#3934)
Shifts the contents of `kvui.py`, and thus all CommonClient-based clients as well as Launcher, to using KivyMD. KivyMD is an extension for Kivy that is almost fully compatible with pre-existing Kivy components, while providing Material Design support for theming and overall visual design as well as useful pre-existing built in components such as Snackbars, Tooltips, and a built-in File Manager (not currently being used). As a part of this shift, the launcher was completely overhauled, adding the ability to filter the list of components down to each type of component, the ability to define favorite components and filter to them, and add shortcuts for launcher components to the desktop. An optional description field was added to Component for display within the new launcher. The theme (Light/Dark) and primary palette have also been exposed to users via client/user.kv.
This commit is contained in:
@@ -14,23 +14,50 @@
|
||||
salmon: "FA8072" # typically trap item
|
||||
white: "FFFFFF" # not used, if you want to change the generic text color change color in Label
|
||||
orange: "FF7700" # Used for command echo
|
||||
<Label>:
|
||||
color: "FFFFFF"
|
||||
<TabbedPanel>:
|
||||
tab_width: root.width / app.tab_count
|
||||
# KivyMD theming parameters
|
||||
theme_style: "Dark" # Light/Dark
|
||||
primary_palette: "Green" # Many options
|
||||
dynamic_scheme_name: "TONAL_SPOT"
|
||||
<MDLabel>:
|
||||
color: self.theme_cls.primaryColor
|
||||
<TooltipLabel>:
|
||||
text_size: self.width, None
|
||||
size_hint_y: None
|
||||
height: self.texture_size[1]
|
||||
adaptive_height: True
|
||||
font_size: dp(20)
|
||||
markup: True
|
||||
halign: "left"
|
||||
<SelectableLabel>:
|
||||
size_hint: 1, None
|
||||
canvas.before:
|
||||
Color:
|
||||
rgba: (.0, 0.9, .1, .3) if self.selected else (0.2, 0.2, 0.2, 1)
|
||||
rgba: (.0, 0.9, .1, .3) if self.selected else self.theme_cls.surfaceContainerLowColor
|
||||
Rectangle:
|
||||
size: self.size
|
||||
pos: self.pos
|
||||
<MarkupDropdownItem>
|
||||
orientation: "vertical"
|
||||
|
||||
MDLabel:
|
||||
text: root.text
|
||||
valign: "center"
|
||||
padding_x: "12dp"
|
||||
shorten: True
|
||||
shorten_from: "right"
|
||||
theme_text_color: "Custom"
|
||||
markup: True
|
||||
text_color:
|
||||
app.theme_cls.onSurfaceVariantColor \
|
||||
if not root.text_color else \
|
||||
root.text_color
|
||||
|
||||
MDDivider:
|
||||
md_bg_color:
|
||||
( \
|
||||
app.theme_cls.outlineVariantColor \
|
||||
if not root.divider_color \
|
||||
else root.divider_color \
|
||||
) \
|
||||
if root.divider else \
|
||||
(0, 0, 0, 0)
|
||||
<UILog>:
|
||||
messages: 1000 # amount of messages stored in client logs.
|
||||
cols: 1
|
||||
@@ -49,7 +76,7 @@
|
||||
<HintLabel>:
|
||||
canvas.before:
|
||||
Color:
|
||||
rgba: (.0, 0.9, .1, .3) if self.selected else (0.2, 0.2, 0.2, 1) if self.striped else (0.18, 0.18, 0.18, 1)
|
||||
rgba: (.0, 0.9, .1, .3) if self.selected else self.theme_cls.surfaceContainerHighColor if self.striped else self.theme_cls.surfaceContainerLowColor
|
||||
Rectangle:
|
||||
size: self.size
|
||||
pos: self.pos
|
||||
@@ -152,3 +179,15 @@
|
||||
height: dp(30)
|
||||
multiline: False
|
||||
write_tab: False
|
||||
<ScrollBox>:
|
||||
layout: layout
|
||||
bar_width: "12dp"
|
||||
scroll_wheel_distance: 40
|
||||
do_scroll_x: False
|
||||
|
||||
MDBoxLayout:
|
||||
id: layout
|
||||
orientation: "vertical"
|
||||
spacing: 10
|
||||
size_hint_y: None
|
||||
height: self.minimum_height
|
||||
|
142
data/launcher.kv
Normal file
142
data/launcher.kv
Normal file
@@ -0,0 +1,142 @@
|
||||
<LauncherCard>:
|
||||
id: main
|
||||
style: "filled"
|
||||
padding: "4dp"
|
||||
size_hint: 1, None
|
||||
height: "75dp"
|
||||
context_button: context
|
||||
|
||||
MDRelativeLayout:
|
||||
ApAsyncImage:
|
||||
source: main.image
|
||||
size: (40, 40)
|
||||
size_hint_y: None
|
||||
pos_hint: {"center_x": 0.1, "center_y": 0.5}
|
||||
|
||||
MDLabel:
|
||||
text: main.component.display_name
|
||||
pos_hint:{"center_x": 0.5, "center_y": 0.85 if main.component.description else 0.65}
|
||||
halign: "center"
|
||||
font_style: "Title"
|
||||
role: "medium"
|
||||
theme_text_color: "Custom"
|
||||
text_color: app.theme_cls.primaryColor
|
||||
|
||||
MDLabel:
|
||||
text: main.component.description
|
||||
pos_hint: {"center_x": 0.5, "center_y": 0.35}
|
||||
halign: "center"
|
||||
role: "small"
|
||||
theme_text_color: "Custom"
|
||||
text_color: app.theme_cls.primaryColor
|
||||
|
||||
MDIconButton:
|
||||
component: main.component
|
||||
icon: "star" if self.component.display_name in app.favorites else "star-outline"
|
||||
style: "standard"
|
||||
pos_hint:{"center_x": 0.85, "center_y": 0.8}
|
||||
theme_text_color: "Custom"
|
||||
text_color: app.theme_cls.primaryColor
|
||||
on_release: app.set_favorite(self)
|
||||
|
||||
MDIconButton:
|
||||
id: context
|
||||
icon: "menu"
|
||||
style: "standard"
|
||||
pos_hint:{"center_x": 0.95, "center_y": 0.8}
|
||||
theme_text_color: "Custom"
|
||||
text_color: app.theme_cls.primaryColor
|
||||
|
||||
MDButton:
|
||||
pos_hint:{"center_x": 0.9, "center_y": 0.25}
|
||||
size_hint_y: None
|
||||
height: "25dp"
|
||||
component: main.component
|
||||
on_release: app.component_action(self)
|
||||
|
||||
MDButtonText:
|
||||
text: "Open"
|
||||
|
||||
|
||||
#:import Type worlds.LauncherComponents.Type
|
||||
MDFloatLayout:
|
||||
id: top_screen
|
||||
|
||||
MDGridLayout:
|
||||
id: grid
|
||||
cols: 2
|
||||
spacing: "5dp"
|
||||
padding: "10dp"
|
||||
|
||||
MDGridLayout:
|
||||
id: navigation
|
||||
cols: 1
|
||||
size_hint_x: 0.25
|
||||
|
||||
MDButton:
|
||||
id: all
|
||||
style: "text"
|
||||
type: (Type.CLIENT, Type.TOOL, Type.ADJUSTER, Type.MISC)
|
||||
on_release: app.filter_clients(self)
|
||||
|
||||
MDButtonIcon:
|
||||
icon: "asterisk"
|
||||
MDButtonText:
|
||||
text: "All"
|
||||
MDButton:
|
||||
id: client
|
||||
style: "text"
|
||||
type: (Type.CLIENT, )
|
||||
on_release: app.filter_clients(self)
|
||||
|
||||
MDButtonIcon:
|
||||
icon: "controller"
|
||||
MDButtonText:
|
||||
text: "Client"
|
||||
MDButton:
|
||||
id: Tool
|
||||
style: "text"
|
||||
type: (Type.TOOL, )
|
||||
on_release: app.filter_clients(self)
|
||||
|
||||
MDButtonIcon:
|
||||
icon: "desktop-classic"
|
||||
MDButtonText:
|
||||
text: "Tool"
|
||||
MDButton:
|
||||
id: adjuster
|
||||
style: "text"
|
||||
type: (Type.ADJUSTER, )
|
||||
on_release: app.filter_clients(self)
|
||||
|
||||
MDButtonIcon:
|
||||
icon: "wrench"
|
||||
MDButtonText:
|
||||
text: "Adjuster"
|
||||
MDButton:
|
||||
id: misc
|
||||
style: "text"
|
||||
type: (Type.MISC, )
|
||||
on_release: app.filter_clients(self)
|
||||
|
||||
MDButtonIcon:
|
||||
icon: "dots-horizontal-circle-outline"
|
||||
MDButtonText:
|
||||
text: "Misc"
|
||||
|
||||
MDButton:
|
||||
id: favorites
|
||||
style: "text"
|
||||
type: ("favorites", )
|
||||
on_release: app.filter_clients(self)
|
||||
|
||||
MDButtonIcon:
|
||||
icon: "star"
|
||||
MDButtonText:
|
||||
text: "Favorites"
|
||||
|
||||
MDNavigationDrawerDivider:
|
||||
|
||||
|
||||
ScrollBox:
|
||||
id: button_layout
|
Reference in New Issue
Block a user