-
Notifications
You must be signed in to change notification settings - Fork 0
/
backend.py
53 lines (41 loc) · 1.4 KB
/
backend.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# ======================================
# IMPORTS
# ======================================
from nicegui import app, ui
from fastapi import FastAPI
# SciCalcs Internal Modules
from settings.mainpages import home_layout, eletrica_layout, estatistica_layout, not_found_404
from settings.eletrica_sub_pages import ganho_amplificador
from settings.estatistica_sub_pages import incertezas, graph_generation
from settings.defining_functions import clear_text
# ======================================
# ROUTES HANDLING
# ======================================
fast = FastAPI()
app.add_static_files('/img', 'img')
@ui.page('/')
async def home_page():
home_layout()
@ui.page('/{category}')
async def category_selector(category):
if category == 'eletrica':
eletrica_layout()
elif category == 'estatistica':
estatistica_layout()
else:
not_found_404()
@ui.page('/{category}/{subcategory}')
async def subcatery_calculator(category, subcategory):
if category == 'eletrica':
if subcategory == clear_text('Ganho de amplificador'):
ganho_amplificador()
else:
not_found_404()
if category == 'estatistica':
if subcategory == clear_text('Incertezas'):
incertezas()
elif subcategory == clear_text('Geração de Gráfico'):
graph_generation()
else:
not_found_404()
ui.run_with(app=fast)