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
|
2020-08-22 13:06:50 +00:00
|
|
|
import asyncio
|
2020-08-10 16:37:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Layout
|
|
|
|
|
|
|
|
### Base screens
|
|
|
|
class BaseScreen(MDScreen):
|
2020-09-20 19:34:45 +00:00
|
|
|
|
2020-08-10 16:37:42 +00:00
|
|
|
@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-21 17:52:21 +00:00
|
|
|
@property
|
|
|
|
def channel(self):
|
|
|
|
return self.app.channel
|
|
|
|
|
2020-08-22 19:39:56 +00:00
|
|
|
|
|
|
|
|
2020-09-22 09:08:20 +00:00
|
|
|
# class CardScreen(BaseScreen):
|
|
|
|
# @property
|
|
|
|
# def cards(self):
|
|
|
|
# if not hasattr(self,'_cards'): self._cards=[]
|
|
|
|
# return self._cards
|
|
|
|
|
|
|
|
# def clear_deck(self):
|
|
|
|
# for card in self.cards:
|
|
|
|
# self.ids.post_carousel.remove_widget(card)
|
|
|
|
|
|
|
|
# def add_card(self,data):
|
|
|
|
# card = PostCard(data)
|
|
|
|
# if not hasattr(self,'_cards'): self._cards=[]
|
|
|
|
# self._cards.append(card)
|
|
|
|
|
|
|
|
# self.app.log('card!',data)
|
|
|
|
# self.app.log('ids:',self.ids.keys(), type(self))
|
|
|
|
# self.app.log('card obj?',card)
|
|
|
|
# # self.ids.post_carousel.add_widget(card)
|
|
|
|
# stop
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-20 19:34:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-22 14:45:48 +00:00
|
|
|
class ProtectedScreen(BaseScreen): pass
|
|
|
|
# def on_pre_enter(self):
|
|
|
|
# if not self.channel in self.app.api.keys:
|
|
|
|
# self.root.change_screen('login')
|
|
|
|
# return
|
|
|
|
|