-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from HackXIt/develop
Merge latest develop (UI Frontend changed to KivyMD)
- Loading branch information
Showing
26 changed files
with
1,623 additions
and
472 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
import asynckivy | ||
from kivy.animation import Animation | ||
from kivy.lang import Builder | ||
from kivy.metrics import dp | ||
from kivy.uix.behaviors import ButtonBehavior | ||
|
||
from kivymd.app import MDApp | ||
from kivymd.uix.behaviors import RotateBehavior | ||
from kivymd.uix.expansionpanel import MDExpansionPanel | ||
from kivymd.uix.list import MDListItemTrailingIcon | ||
|
||
KV = ''' | ||
<ExpansionPanelItem> | ||
MDExpansionPanelHeader: | ||
MDListItem: | ||
theme_bg_color: "Custom" | ||
md_bg_color: self.theme_cls.surfaceContainerLowColor | ||
ripple_effect: False | ||
MDListItemSupportingText: | ||
text: "Supporting text" | ||
TrailingPressedIconButton: | ||
id: chevron | ||
icon: "chevron-right" | ||
on_release: app.tap_expansion_chevron(root, chevron) | ||
MDExpansionPanelContent: | ||
orientation: "vertical" | ||
padding: "12dp", 0, "12dp", "12dp" | ||
md_bg_color: self.theme_cls.surfaceContainerLowestColor | ||
MDLabel: | ||
text: "Channel information" | ||
adaptive_height: True | ||
padding_x: "16dp" | ||
padding_y: "12dp" | ||
MDListItem: | ||
theme_bg_color: "Custom" | ||
md_bg_color: self.theme_cls.surfaceContainerLowestColor | ||
MDListItemLeadingIcon: | ||
icon: "email" | ||
MDListItemHeadlineText: | ||
text: "Email" | ||
MDListItemSupportingText: | ||
text: "kivydevelopment@gmail.com" | ||
MDListItem: | ||
theme_bg_color: "Custom" | ||
md_bg_color: self.theme_cls.surfaceContainerLowestColor | ||
MDListItemLeadingIcon: | ||
icon: "instagram" | ||
MDListItemHeadlineText: | ||
text: "Instagram" | ||
MDListItemSupportingText: | ||
text: "Account" | ||
MDListItemTertiaryText: | ||
text: "www.instagram.com/KivyMD" | ||
MDScreen: | ||
md_bg_color: self.theme_cls.backgroundColor | ||
ScrollView: | ||
size_hint_x: .5 | ||
pos_hint: {"center_x": .5, "center_y": .5} | ||
MDList: | ||
id: container | ||
''' | ||
|
||
|
||
class ExpansionPanelItem(MDExpansionPanel): | ||
... | ||
|
||
|
||
class TrailingPressedIconButton( | ||
ButtonBehavior, RotateBehavior, MDListItemTrailingIcon | ||
): | ||
... | ||
|
||
|
||
class Example(MDApp): | ||
def on_start(self): | ||
async def set_panel_list(): | ||
for i in range(12): | ||
await asynckivy.sleep(0) | ||
self.root.ids.container.add_widget(ExpansionPanelItem()) | ||
|
||
super().on_start() | ||
asynckivy.start(set_panel_list()) | ||
|
||
def build(self): | ||
self.theme_cls.theme_style = "Dark" | ||
return Builder.load_string(KV) | ||
|
||
def tap_expansion_chevron( | ||
self, panel: MDExpansionPanel, chevron: TrailingPressedIconButton | ||
): | ||
Animation( | ||
padding=[0, dp(12), 0, dp(12)] | ||
if not panel.is_open | ||
else [0, 0, 0, 0], | ||
d=0.2, | ||
).start(panel) | ||
panel.open() if not panel.is_open else panel.close() | ||
panel.set_chevron_down( | ||
chevron | ||
) if not panel.is_open else panel.set_chevron_up(chevron) | ||
|
||
if __name__ == '__main__': | ||
Example().run() |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Oops, something went wrong.