Skip to content

Commit 017c18f

Browse files
committed
BF: useVersion was not being used for the JS code, only the HTML
This was resulting in a mismatch meaning that the PsychoJS was not loading
1 parent db663e1 commit 017c18f

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

psychopy/experiment/components/settings/JS_htmlHeader.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<title>{name} [PsychoPy]</title>
77
<!-- styles -->
88
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery-ui-dist@1.12.1/jquery-ui.min.css">
9-
<link rel="stylesheet" href="./lib/psychojs{version}.css">
9+
<link rel="stylesheet" href="./lib/psychojs-{version}.css">
1010
</head>
1111
<body>
1212
<div id="root"></div>
@@ -17,7 +17,7 @@
1717
<!-- experiment -->
1818
<script src="./{name}.js" type="module"></script>
1919
<!-- legacy browsers -->
20-
<script src="./lib/psychojs{version}.iife.js" nomodule></script>
20+
<script src="./lib/psychojs-{version}.iife.js" nomodule></script>
2121
<script src="./{name}-legacy-browsers.js" nomodule></script>
2222
</body>
2323
</html>

psychopy/experiment/components/settings/__init__.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ def writeInitCodeJS(self, buff, version, localDateTime, modular=True):
753753
elif useVer == 'latest':
754754
useVer = versions.latestVersion()
755755
else:
756-
version = versions.fullVersion(useVer)
756+
useVer = versions.fullVersion(useVer)
757757

758758
# do we shorten minor versions ('3.4.2' to '3.4')?
759759
# only from 3.2 onwards
@@ -765,14 +765,11 @@ def writeInitCodeJS(self, buff, version, localDateTime, modular=True):
765765
# e.g. 2021.1.0 not 2021.1.0.dev3
766766
useVer = '.'.join(useVer.split('.')[:3])
767767

768-
# prepend the hyphen
769-
versionStr = '-{}'.format(useVer)
770-
771768
# html header
772769
template = readTextFile("JS_htmlHeader.tmpl")
773770
header = template.format(
774771
name=jsFilename,
775-
version=versionStr,
772+
version=useVer,
776773
params=self.params)
777774
jsFile = self.exp.expPath
778775
folder = os.path.dirname(jsFile)
@@ -792,14 +789,14 @@ def writeInitCodeJS(self, buff, version, localDateTime, modular=True):
792789
# Write imports if modular
793790
if modular:
794791
code = (
795-
"import {{ core, data, sound, util, visual }} from './lib/psychojs-2021.2.0.js';\n"
792+
"import {{ core, data, sound, util, visual }} from './lib/psychojs-{version}.js';\n"
796793
"const {{ PsychoJS }} = core;\n"
797794
"const {{ TrialHandler }} = data;\n"
798795
"const {{ Scheduler }} = util;\n"
799796
"//some handy aliases as in the psychopy scripts;\n"
800797
"const {{ abs, sin, cos, PI: pi, sqrt }} = Math;\n"
801798
"const {{ round }} = util;\n"
802-
"\n").format(version=versionStr)
799+
"\n").format(version=useVer)
803800
buff.writeIndentedLines(code)
804801

805802
code = ("\n// store info about the experiment session:\n"

0 commit comments

Comments
 (0)