Skip to content

Commit 786e1d3

Browse files
committed
BF: when Text or TextBox had default of "" the script contained "''"
This looks like it was a long-standing bug never notixed because in Text nobody ever creates blank text this way. This was copied across to TextBox where the issue became more obvious.
1 parent 3477e32 commit 786e1d3

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

psychopy/experiment/components/text/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def writeInitCodeJS(self, buff):
147147
if inits[param] in [None, 'None', '']:
148148
inits[param].val = 'undefined'
149149
if param == 'text':
150-
inits[param].val = "''"
150+
inits[param].val = ""
151151

152152
code = ("%(name)s = new visual.TextStim({\n"
153153
" win: psychoJS.window,\n"

psychopy/experiment/components/textbox/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def writeInitCodeJS(self, buff):
238238
if inits[param] in [None, 'None', '']:
239239
inits[param].val = 'undefined'
240240
if param == 'text':
241-
inits[param].val = "''"
241+
inits[param].val = ""
242242

243243
code = ("%(name)s = new visual.TextBox({\n"
244244
" win: psychoJS.window,\n"

psychopy/experiment/params.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def __str__(self):
152152
return "%i" % self.val # int and float -> str(int)
153153
except TypeError:
154154
return "{}".format(self.val) # try array of float instead?
155-
elif self.valType in ['extendedStr','str']:
155+
elif self.valType in ['extendedStr', 'str']:
156156
# at least 1 non-escaped '$' anywhere --> code wanted
157157
# return str if code wanted
158158
# return repr if str wanted; this neatly handles "it's" and 'He

0 commit comments

Comments
 (0)