|
@@ -2,39 +2,23 @@ import traceback
|
|
import justpy as jp
|
|
import justpy as jp
|
|
from icecream import ic
|
|
from icecream import ic
|
|
|
|
|
|
-pages = []
|
|
|
|
|
|
|
|
-
|
|
|
|
-def app():
|
|
|
|
-
|
|
|
|
- pages.append(jp.WebPage(delete_flag=False))
|
|
|
|
-
|
|
|
|
- def build():
|
|
|
|
- return pages[0]
|
|
|
|
-
|
|
|
|
- jp.justpy(build, start_server=False)
|
|
|
|
- return jp.app
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-class Widget:
|
|
|
|
|
|
+class NiceGui():
|
|
|
|
|
|
def __init__(self):
|
|
def __init__(self):
|
|
- pass
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-class Label(Widget):
|
|
|
|
-
|
|
|
|
- def __init__(self, text):
|
|
|
|
|
|
+ self.index = jp.WebPage(delete_flag=False)
|
|
|
|
|
|
- super().__init__()
|
|
|
|
- p = jp.P(text=text, a=pages[0], classes='w-48 text-xl p-1 m-2')
|
|
|
|
|
|
+ def build():
|
|
|
|
+ return self.index
|
|
|
|
|
|
|
|
+ jp.justpy(build, start_server=False)
|
|
|
|
+ self.app = jp.app
|
|
|
|
|
|
-class Button(Widget):
|
|
|
|
|
|
+ def label(self, text):
|
|
|
|
|
|
- def __init__(self, text, on_click=None):
|
|
|
|
|
|
+ p = jp.P(text=text, a=self.index, classes='w-48 text-xl p-1 m-2')
|
|
|
|
|
|
- super().__init__()
|
|
|
|
|
|
+ def button(self, text, on_click=None):
|
|
|
|
|
|
def click(self, _):
|
|
def click(self, _):
|
|
try:
|
|
try:
|
|
@@ -42,5 +26,5 @@ class Button(Widget):
|
|
except:
|
|
except:
|
|
traceback.print_exc()
|
|
traceback.print_exc()
|
|
|
|
|
|
- d = jp.Div(text=text, a=pages[0], classes='w-48 text-xl m-2 p-1 bg-blue-700 text-white text-center')
|
|
|
|
|
|
+ d = jp.Div(text=text, a=self.index, classes='w-48 text-xl m-2 p-1 bg-blue-700 text-white text-center')
|
|
d.on('click', click)
|
|
d.on('click', click)
|