diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ac333b8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.sesskey +env/* +__pycache__/* \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..1c200c7 --- /dev/null +++ b/main.py @@ -0,0 +1,70 @@ +from fasthtml.common import * +import os + + +app= FastHTML() +def listUsers(): + with os.scandir("static") as files: + subdir = [file.name for file in files if file.is_dir()] + return subdir + +def menuusers(users): + T=[] + n=0 + for user in users: + T.append(Option(user, value=str(user)) ) + return Form( + Select(*T, + cls="selector", + _id="counter", + name="data", + **{'@click':"alert('Clicked');"},),Button("Submit"),action="/checkInfoSources", method="post") + +@app.post("/checkInfoSources") +def checkInfoSources(data:str): + print(data) + with os.scandir("static/"+data) as files: + subdir = [CheckboxX(label=file.name,value="static/"+data+"/"+file.name) for file in files if file.is_file()] + return Form( + Label(*subdir, + cls="selector", + _id="counter", + hx_target="files", + name="data", + **{'@click':"alert('Clicked');"},),Button("Submit"),action="/process", method="post") + + +@app.post("/process") +def processData(): + print() + pass + + + + + +@app.get("/") +def home(): + page = Html( + Head(Title('Super tutor')), + Body(Div('Este es el sistema de super tutor, ', + menuusers(listUsers()), + A('A link', href='https://example.com'), + Img(src="https://placehold.co/200"), + Form( + Select( + Option("user", value=str("user"))), + Button("Submit"), + action="/", method="post"), cls='myclass')), + Div(id="files")) + + + + return page + +app.mount("/static", StaticFiles(directory="static"), name="static") + + + + +serve() \ No newline at end of file