40 lines
1.1 KiB
Python
40 lines
1.1 KiB
Python
import toga
|
|||
|
|
from toga.style.pack import COLUMN, ROW, CENTER, START, END
|
||
|
|
from toga.style import Pack
|
||
|
|
import requests
|
||
|
|
from justgetit.constants import *
|
||
|
|
from justgetit.login import Login
|
||
|
|
from justgetit.register import Register
|
||
|
|
|
||
|
|
|
||
|
|
class JustEatIt(toga.App):
|
||
|
|
login_screen = toga.Box()
|
||
|
|
register_screen = toga.Box()
|
||
|
|
|
||
|
|
|
||
|
|
def goto_next_page(self, widget):
|
||
|
|
"""
|
||
|
|
ask app to activate a next page, id of the page is in the id of the widget
|
||
|
|
|
||
|
|
:param widget: the widget that called this function
|
||
|
|
"""
|
||
|
|
print(f"action 6 {widget.id}")
|
||
|
|
if widget.id == 'register':
|
||
|
|
self.main_window.content = self.register_screen
|
||
|
|
elif widget.id =='login':
|
||
|
|
self.main_window.content = self.login_screen
|
||
|
|
|
||
|
|
|
||
|
|
def startup(self):
|
||
|
|
self.login_screen = Login(navigate_to=self.goto_next_page)
|
||
|
|
self.register_screen = Register(navigate_to=self.goto_next_page)
|
||
|
|
|
||
|
|
self.main_window = toga.MainWindow(title=self.formal_name, size=(SCREENWIDTH, SCREENHEIGHT))
|
||
|
|
self.main_window.content = self.register_screen
|
||
|
|
self.main_window.show()
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
def main():
|
||
|
|
return JustEatIt()
|