2020-08-10 16:37:42 +00:00
|
|
|
from kivymd.uix.screen import MDScreen
|
|
|
|
from kivy.properties import ObjectProperty
|
|
|
|
from kivymd.uix.boxlayout import MDBoxLayout
|
|
|
|
from kivymd.uix.label import MDLabel
|
|
|
|
from kivy.app import App
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Layout
|
|
|
|
|
|
|
|
### Base screens
|
|
|
|
class BaseScreen(MDScreen):
|
|
|
|
@property
|
|
|
|
def root(self):
|
|
|
|
return self.app.root
|
|
|
|
|
|
|
|
@property
|
|
|
|
def app(self):
|
|
|
|
return App.get_running_app()
|
|
|
|
|
2020-08-19 10:29:56 +00:00
|
|
|
def log(self,*x):
|
|
|
|
return self.app.log(*x)
|
|
|
|
|
2020-08-10 16:37:42 +00:00
|
|
|
class ProtectedScreen(BaseScreen):
|
|
|
|
def on_pre_enter(self):
|
|
|
|
if not self.app.is_logged_in():
|
|
|
|
self.root.change_screen('login')
|
|
|
|
|