You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.8 KiB
Python
57 lines
1.8 KiB
Python
4 years ago
|
from screens.base import BaseScreen
|
||
4 years ago
|
from kivymd.uix.boxlayout import MDBoxLayout
|
||
|
from kivymd.uix.textfield import MDTextField
|
||
|
from kivymd.uix.button import MDRectangleFlatButton
|
||
|
from kivymd.uix.label import MDLabel
|
||
|
|
||
|
class LoginBoxLayout(MDBoxLayout): pass
|
||
|
class LoginButtonLayout(MDBoxLayout): pass
|
||
|
class UsernameField(MDTextField): pass
|
||
|
class PasswordField(MDTextField): pass
|
||
|
class LoginButton(MDRectangleFlatButton): pass
|
||
|
class RegisterButton(MDRectangleFlatButton): pass
|
||
|
class LoginStatus(MDLabel): pass
|
||
4 years ago
|
|
||
|
class LoginScreen(BaseScreen):
|
||
|
#def on_pre_enter(self):
|
||
|
# global app
|
||
|
# if app.is_logged_in():
|
||
|
# app.root.change_screen('feed')
|
||
4 years ago
|
def on_pre_enter(self):
|
||
4 years ago
|
#log(self.ids)
|
||
|
#log('hello?')
|
||
4 years ago
|
self.layout = LoginBoxLayout()
|
||
|
|
||
|
self.username_field = UsernameField()
|
||
|
self.username_field.line_color_focus=(1,0,0,1)
|
||
|
self.layout.add_widget(self.username_field)
|
||
4 years ago
|
#log(self.username_field)
|
||
4 years ago
|
# self.username_field.text='hello????'
|
||
|
|
||
|
self.password_field = PasswordField()
|
||
|
self.password_field.line_color_focus=(1,0,0,1)
|
||
|
self.layout.add_widget(self.password_field)
|
||
|
|
||
|
self.layout_buttons = LoginButtonLayout()
|
||
|
self.layout.add_widget(self.layout_buttons)
|
||
|
|
||
|
self.login_button = LoginButton()
|
||
|
self.layout_buttons.add_widget(self.login_button)
|
||
|
|
||
|
self.register_button = RegisterButton()
|
||
|
# self.register_button =
|
||
|
self.layout_buttons.add_widget(self.register_button)
|
||
|
|
||
|
self.login_status = LoginStatus()
|
||
|
self.layout.add_widget(self.login_status)
|
||
|
|
||
|
|
||
|
## add all
|
||
|
self.add_widget(self.layout)
|
||
|
#pass
|
||
|
|
||
|
|
||
|
def on_enter(self):
|
||
|
un=self.app.get_username()
|
||
|
if un: self.username_field.text = un
|
||
|
|