basic material design
This commit is contained in:
parent
2e6a0e0e60
commit
7c77a927b5
Binary file not shown.
@ -96,6 +96,7 @@ fullscreen = 0
|
||||
# (list) Permissions
|
||||
# (See https://python-for-android.readthedocs.io/en/latest/buildoptions/#build-options-1 for all the supported syntaxes and properties)
|
||||
#android.permissions = android.permission.INTERNET, (name=android.permission.WRITE_EXTERNAL_STORAGE;maxSdkVersion=18)
|
||||
android.permissions = android.permission.INTERNET
|
||||
|
||||
# (list) features (adds uses-feature -tags to manifest)
|
||||
#android.features = android.hardware.usb.host
|
||||
|
32
main.py
32
main.py
@ -1,21 +1,21 @@
|
||||
from kivy.lang import Builder
|
||||
from kivy.properties import ObjectProperty
|
||||
|
||||
from kivy.app import App
|
||||
from kivy.uix.button import Button
|
||||
from kivy.uix.gridlayout import GridLayout
|
||||
from kivy.core.window import Window
|
||||
# from kivy.app import App
|
||||
# from kivy.uix.button import Button
|
||||
# from kivy.uix.gridlayout import GridLayout
|
||||
# from kivy.core.window import Window
|
||||
|
||||
import requests
|
||||
# from kivymd.app import MDApp
|
||||
# from kivymd.theming import ThemeManager
|
||||
# from kivymd.uix.gridlayout import MDGridLayout
|
||||
|
||||
from kivymd.app import MDApp
|
||||
from kivymd.theming import ThemeManager
|
||||
from kivymd.uix.gridlayout import MDGridLayout
|
||||
from kivymd.uix.button import MDButton, MDButtonText
|
||||
|
||||
|
||||
# from kivymd.uix.label import MDLabel
|
||||
# from kivymd.uix.anchorlayout import MDAnchorLayout
|
||||
# from kivymd.uix.boxlayout import MDBoxLayout
|
||||
from kivymd.uix.boxlayout import MDBoxLayout
|
||||
# from kivymd.icon_definitions import md_icons
|
||||
# from kivymd.uix.screen import MDScreen
|
||||
|
||||
@ -30,17 +30,17 @@ def isAvailable(ip):
|
||||
try:
|
||||
response = requests.get("http://" + ip, timeout=5)
|
||||
# print("Yes")
|
||||
return "Yes"
|
||||
return "Works"
|
||||
except requests.ConnectionError:
|
||||
# return False
|
||||
# print("No")
|
||||
return "NO"
|
||||
return "No"
|
||||
except requests.exceptions.InvalidURL:
|
||||
return "?"
|
||||
|
||||
|
||||
|
||||
class Container(GridLayout):
|
||||
class Container(MDGridLayout):
|
||||
|
||||
def checkAvailability(self):
|
||||
openwrt = "10.1.0.1"
|
||||
@ -56,13 +56,13 @@ class Container(GridLayout):
|
||||
self.text_input_check.text = isAvailable(str(self.text_input.text))
|
||||
|
||||
|
||||
class MyApp(App):
|
||||
# theme_cls = ThemeManager()
|
||||
class MyApp(MDApp):
|
||||
theme_cls = ThemeManager()
|
||||
Title = 'Uptime Check'
|
||||
|
||||
def build(self):
|
||||
# self.theme_cls.theme_style = "Dark"
|
||||
# self.theme_cls.primary_palette = "Olive" # "Purple", "Red"
|
||||
self.theme_cls.theme_style = "Light"
|
||||
self.theme_cls.primary_palette = "Green" # "Purple", "Red"
|
||||
return Container()
|
||||
|
||||
MyApp().run()
|
53
my.kv
53
my.kv
@ -1,11 +1,12 @@
|
||||
|
||||
<ItemLabel@Label>:
|
||||
<ItemLabel@MDLabel>:
|
||||
font_size: '25sp'
|
||||
halign: 'left'
|
||||
valign: 'middle'
|
||||
text_size: self.size
|
||||
|
||||
<Container>:
|
||||
|
||||
rows:3
|
||||
|
||||
text_input: text_input
|
||||
@ -17,19 +18,30 @@
|
||||
udongein_xyz: udongein_xyz
|
||||
|
||||
|
||||
AnchorLayout:
|
||||
size_hint: 1, 0.15
|
||||
MDAnchorLayout:
|
||||
size_hint: 1, 0.25
|
||||
md_bg_color: app.theme_cls.backgroundColor
|
||||
padding: [20, 0, 20, 0]
|
||||
|
||||
TextInput:
|
||||
MDTextField:
|
||||
|
||||
mode: "filled"
|
||||
id: text_input
|
||||
font_size: '45sp'
|
||||
font_size: '40sp'
|
||||
multiline: False
|
||||
input_type: 'number'
|
||||
#input_type: 'number'
|
||||
MDTextFieldLeadingIcon:
|
||||
icon: "web"
|
||||
|
||||
MDTextFieldHelperText:
|
||||
text: "Enter ip or domain name"
|
||||
|
||||
GridLayout:
|
||||
MDGridLayout:
|
||||
#adaptive_height: True
|
||||
md_bg_color: app.theme_cls.backgroundColor
|
||||
cols: 2
|
||||
|
||||
BoxLayout:
|
||||
MDBoxLayout:
|
||||
orientation: 'vertical'
|
||||
padding: [30, 0, 0, 0]
|
||||
|
||||
@ -51,7 +63,7 @@
|
||||
|
||||
|
||||
|
||||
BoxLayout:
|
||||
MDBoxLayout:
|
||||
orientation: 'vertical'
|
||||
size_hint: 0.5, 1
|
||||
|
||||
@ -81,15 +93,24 @@
|
||||
markup: True
|
||||
|
||||
|
||||
BoxLayout:
|
||||
size_hint: 0.9, 0.15
|
||||
MDBoxLayout:
|
||||
orientation: "horizontal"
|
||||
size_hint_y: 0.20
|
||||
padding: [30, 0, 30, 20]
|
||||
Button:
|
||||
text: 'Check connection'
|
||||
font_size: 40
|
||||
md_bg_color: app.theme_cls.backgroundColor
|
||||
|
||||
MDButton:
|
||||
style: "tonal"
|
||||
on_press:on_press: root.checkAvailability()
|
||||
pos_hint_x: 60
|
||||
MDButtonIcon:
|
||||
|
||||
icon: "check"
|
||||
MDButtonText:
|
||||
text: 'Check connection'
|
||||
font_size: 40
|
||||
|
||||
|
||||
on_release:
|
||||
root.checkAvailability()
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user