Added development testing application
This commit is contained in:
parent
06a3583887
commit
ea9cb71e49
88
src/demo_testing_navigaition_drawer/main.kv
Normal file
88
src/demo_testing_navigaition_drawer/main.kv
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
#:import OneLineListItem kivymd.list.OneLineListItem
|
||||||
|
#:import MDTextField kivymd.textfields.MDTextField
|
||||||
|
#:import get_color_from_hex kivy.utils.get_color_from_hex
|
||||||
|
#:import colors kivymd.color_definitions.colors
|
||||||
|
#:import MDTabbedPanel kivymd.tabs.MDTabbedPanel
|
||||||
|
#:import MDTab kivymd.tabs.MDTab
|
||||||
|
#:import MDFloatingActionButton kivymd.button.MDFloatingActionButton
|
||||||
|
#:import Factory kivy.factory.Factory
|
||||||
|
#:import MDScrollViewRefreshLayout kivymd.refreshlayout.MDScrollViewRefreshLayout
|
||||||
|
#:import MDSpinner kivymd.spinner.MDSpinner
|
||||||
|
#:import NoTransition kivy.uix.screenmanager.NoTransition
|
||||||
|
#:import MDSeparator kivymd.card.MDSeparator
|
||||||
|
|
||||||
|
#:set color_button (0.784, 0.443, 0.216, 1) # brown
|
||||||
|
#:set color_button_pressed (0.659, 0.522, 0.431, 1) # darker brown
|
||||||
|
#:set color_font (0.957, 0.890, 0.843, 1) # off white
|
||||||
|
|
||||||
|
<MyNavigationDrawerIconButton@NavigationDrawerIconButton>:
|
||||||
|
icon: 'checkbox-blank-circle'
|
||||||
|
|
||||||
|
<ContentNavigationDrawer@Navigatorss>:
|
||||||
|
drawer_logo: './images/drawer_logo1.png'
|
||||||
|
NavigationDrawerDivider:
|
||||||
|
NavigationDrawerSubheader:
|
||||||
|
text: "Accounts"
|
||||||
|
NavigationDrawerIconButton:
|
||||||
|
text: "new address"
|
||||||
|
icon:'account-plus'
|
||||||
|
on_release: app.root.ids.scr_mngr.current = 'test1'
|
||||||
|
NavigationDrawerIconButton:
|
||||||
|
text: "Network Status"
|
||||||
|
icon:'server-network'
|
||||||
|
on_release: app.root.ids.scr_mngr.current = 'test2'
|
||||||
|
NavigationDrawerIconButton:
|
||||||
|
text: "My Addresses"
|
||||||
|
icon:'account-multiple'
|
||||||
|
on_release: app.root.ids.scr_mngr.current = 'test3'
|
||||||
|
|
||||||
|
NavigationLayout:
|
||||||
|
id: nav_layout
|
||||||
|
|
||||||
|
ContentNavigationDrawer:
|
||||||
|
id: nav_drawer
|
||||||
|
|
||||||
|
FloatLayout:
|
||||||
|
id: float_box
|
||||||
|
BoxLayout:
|
||||||
|
id: box_layout
|
||||||
|
orientation: 'vertical'
|
||||||
|
Toolbar:
|
||||||
|
id: toolbar
|
||||||
|
# title: 'TTTTTTTT'
|
||||||
|
opacity: 1
|
||||||
|
disabled: False
|
||||||
|
md_bg_color: app.theme_cls.primary_color
|
||||||
|
background_palette: 'Primary'
|
||||||
|
background_hue: '500'
|
||||||
|
left_action_items: [['menu', lambda x: app.root.toggle_nav_drawer()]]
|
||||||
|
right_action_items: [['account-plus', lambda x: None]]
|
||||||
|
|
||||||
|
ScreenManager:
|
||||||
|
id: scr_mngr
|
||||||
|
Test1:
|
||||||
|
id:sc1
|
||||||
|
Test2:
|
||||||
|
id:sc2
|
||||||
|
Test3:
|
||||||
|
id:sc3
|
||||||
|
|
||||||
|
|
||||||
|
<Test1>:
|
||||||
|
name: 'test1'
|
||||||
|
Label:
|
||||||
|
text:"I am in Test1"
|
||||||
|
color: 0,0,0,1
|
||||||
|
|
||||||
|
<Test2>:
|
||||||
|
name: 'test2'
|
||||||
|
Label:
|
||||||
|
text:"I am in Test2"
|
||||||
|
color: 0,0,0,1
|
||||||
|
|
||||||
|
<Test3>:
|
||||||
|
name: 'test3'
|
||||||
|
Label:
|
||||||
|
text:"I am in Test3"
|
||||||
|
color: 0,0,0,1
|
||||||
|
|
74
src/demo_testing_navigaition_drawer/main.py
Normal file
74
src/demo_testing_navigaition_drawer/main.py
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
import os
|
||||||
|
from kivy.uix.boxlayout import BoxLayout
|
||||||
|
|
||||||
|
# from kivymd.app import MDApp
|
||||||
|
from kivy.app import App
|
||||||
|
from kivy.lang import Builder
|
||||||
|
from kivy.properties import StringProperty
|
||||||
|
|
||||||
|
from kivymd.list import OneLineAvatarListItem, IRightBody
|
||||||
|
from kivy.uix.screenmanager import Screen
|
||||||
|
from kivymd.label import MDLabel
|
||||||
|
from kivymd.navigationdrawer import (
|
||||||
|
MDNavigationDrawer,
|
||||||
|
NavigationDrawerHeaderBase
|
||||||
|
)
|
||||||
|
from kivymd.theming import ThemeManager
|
||||||
|
|
||||||
|
class NavigationItem(OneLineAvatarListItem):
|
||||||
|
icon = StringProperty()
|
||||||
|
|
||||||
|
class CommonHead(Screen):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class Navigatorss(MDNavigationDrawer):
|
||||||
|
"""Navigator class (image, title and logo)"""
|
||||||
|
image_source = StringProperty('images/qidenticon_two.png')
|
||||||
|
title = StringProperty('Navigation')
|
||||||
|
drawer_logo = StringProperty()
|
||||||
|
|
||||||
|
|
||||||
|
class ContentNavigationDrawer(Navigatorss):
|
||||||
|
"""Navigate Content Drawer"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class Test1(Screen):
|
||||||
|
|
||||||
|
def __init__(self, **kwargs):
|
||||||
|
"""Set screen of address detail page"""
|
||||||
|
print('call first.......................')
|
||||||
|
super(Test1, self).__init__(**kwargs)
|
||||||
|
|
||||||
|
def on_enter(self):
|
||||||
|
# import pdb;pdb.set_trace()
|
||||||
|
if self.ids:
|
||||||
|
from kivymd.textfield import MDTextField
|
||||||
|
|
||||||
|
field = MDTextField()
|
||||||
|
field.hint_text = "required = True"
|
||||||
|
field.required = True
|
||||||
|
field.helper_text_mode = "on_error"
|
||||||
|
self.ids.box.add_widget(field)
|
||||||
|
|
||||||
|
class Test2(Screen):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class Test3(Screen):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class TestNavigationDrawer(App):
|
||||||
|
|
||||||
|
theme_cls = ThemeManager()
|
||||||
|
def build(self):
|
||||||
|
self.nav_drawer = Navigatorss()
|
||||||
|
return Builder.load_file(
|
||||||
|
os.path.join(os.path.dirname(__file__), 'main.kv'))
|
||||||
|
|
||||||
|
def reset_field_required(self, scr_mngr, box):
|
||||||
|
# import pdb;pdb.set_trace()
|
||||||
|
if scr_mngr.current != "test1":
|
||||||
|
box.clear_widgets()
|
||||||
|
|
||||||
|
TestNavigationDrawer().run()
|
Reference in New Issue
Block a user