diff --git a/src/js/ui/keyboard_shortcuts.js b/src/js/ui/keyboard_shortcuts.js index 56d9d6a8f..a2046b316 100644 --- a/src/js/ui/keyboard_shortcuts.js +++ b/src/js/ui/keyboard_shortcuts.js @@ -96,6 +96,16 @@ function loadSolution () { }; file = fileInput.files[0]; + let worldToLoad = file.name.replace(/\.[^/.]+$/, ""); + let worldURL = RUR.world_selector.url_from_shortname(worldToLoad); + if (worldURL !== undefined) { + RUR.world_selector.set_url(worldURL); + } + //might be a good idea to provide a UI dialogue if the world can't auto-load? + // else { + // alert("Can't auto-load the correct world file... please select the correct world from the menu.")); + // } + RUR.reload(); reader.readAsText(file); }); } diff --git a/src/python/preprocess.py b/src/python/preprocess.py index fcff62deb..e0f954f89 100644 --- a/src/python/preprocess.py +++ b/src/python/preprocess.py @@ -23,7 +23,7 @@ def transform(text): stripped = stripped.replace(':', '') index = line.find(loop_keyword) try: - #n = int(stripped) + n = int(stripped) line = ' '*index + 'for ' + var_names.pop() + ' in range(%s):' % n except: # make sure we capture everything so as to avoid # exposing weird error messages to students.