Permalink
Browse files

BF: Replace 'use prefs' default with 'height' for JS window units

'use preferences' for window units breaks JS code. This fix sets the default window units as 'height'. Fixes new issue in #2227.
  • Loading branch information...
dvbridges authored and peircej committed Jan 28, 2019
1 parent aa14f1b commit a686dbf525b9cd441f57448a660f1414f19d89e9
Showing with 18 additions and 10 deletions.
  1. +18 −10 psychopy/experiment/components/settings/__init__.py
@@ -723,17 +723,25 @@ def writeWindowCode(self, buff):
buff.writeIndentedLines(code)

def writeWindowCodeJS(self, buff):
"""Setup the JS window code.
"""
# Replace instances of 'use prefs'
units = self.params['Units'].val
if units == 'use prefs':
units = 'height'

code = ("// init psychoJS:\n"
"var psychoJS = new PsychoJS({{\n"
" debug: true\n"
"}});\n\n"
"// open window:\n"
"psychoJS.openWindow({{\n"
" fullscr: {fullScr},\n"
" color: new util.Color({params[color]}),\n"
" units: {params[Units]}\n"
"}});\n").format(fullScr=str(self.params['Full-screen window']).lower(),
params=self.params)
"var psychoJS = new PsychoJS({{\n"
" debug: true\n"
"}});\n\n"
"// open window:\n"
"psychoJS.openWindow({{\n"
" fullscr: {fullScr},\n"
" color: new util.Color({params[color]}),\n"
" units: '{units}'\n"
"}});\n").format(fullScr=str(self.params['Full-screen window']).lower(),
params=self.params,
units=units)
buff.writeIndentedLines(code)

def writeEndCode(self, buff):

0 comments on commit a686dbf

Please sign in to comment.