🧑‍💻 Get window in backend

This commit is contained in:
zhbaor 2023-03-05 00:17:20 +08:00
parent cfb0337c69
commit fe36735f37
3 changed files with 8 additions and 26 deletions

View file

@ -1,12 +1,10 @@
from bottle import request, response, Bottle, static_file
from manager import Manager
from json import dumps
from queue import SimpleQueue
import webview
manager = Manager()
app = Bottle()
action_queue = SimpleQueue()
path_queue = SimpleQueue()
@app.get("/")
@ -38,9 +36,9 @@ def download():
return "OK"
@app.post("/path")
@app.get("/path")
def get_path():
path = request.json["path"]
action_queue.put(path)
manager.path = path_queue.get()
result = webview.active_window().create_file_dialog(dialog_type=webview.FOLDER_DIALOG)
if result:
manager.path = result[0]
return manager.path