Download path dialog

This commit is contained in:
zhbaor 2023-03-05 00:06:04 +08:00
parent a21d60c717
commit cfb0337c69
3 changed files with 38 additions and 10 deletions

View file

@ -1,11 +1,12 @@
from bottle import request, response, Bottle, static_file
from manager import Manager
from json import dumps
from pathlib import Path
from tkinter import filedialog as fd
from queue import SimpleQueue
manager = Manager()
app = Bottle()
action_queue = SimpleQueue()
path_queue = SimpleQueue()
@app.get("/")
@ -37,8 +38,9 @@ def download():
return "OK"
@app.get("/path")
@app.post("/path")
def get_path():
path = fd.askdirectory()
manager.path = path
return path
path = request.json["path"]
action_queue.put(path)
manager.path = path_queue.get()
return manager.path