diff --git a/tests/sandbox/sandbox.html b/tests/sandbox/sandbox.html index a01e9bfb..56d2fa5a 100644 --- a/tests/sandbox/sandbox.html +++ b/tests/sandbox/sandbox.html @@ -283,7 +283,17 @@ setCode(content) document.getElementById("codeUri").value = f } - loadFile(pyodide.FS.currentPath+"/demo/demo.py") + + const queryString = window.location.search; + console.log(queryString); + const urlParams = new URLSearchParams(queryString); + fileUri = urlParams.get("fileUri") + if (fileUri != null){ + pyodide.FS.writeFile(pyodide.FS.currentPath+"/test_file.py", await (await fetch(fileUri)).text()); + loadFile(pyodide.FS.currentPath+"/test_file.py") + }else{ + loadFile(pyodide.FS.currentPath+"/demo/demo.py") + } //loadFile("/home/pyodide/tutorial/calculator/calculator.005.py") w2ui.sidebar.select(pyodide.FS.currentPath+"/demo/demo.py")