Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion labextension/vpython/src/glowcommlab.js
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,13 @@ function decode(data) {
}
} else if (textattrs.indexOf(attr) > -1) {
if (attr == 'choices') { // menu choices to be wrapped in a list
val = m[3].split(' ')
val = m[3].slice(2,-2)
val = val.replace(/'/g, '') // remove quotes
val = val.replace(/,/g, '') // remove commas
let s = val.split(' ')
val = []
let a
for (a of s) {val.push(a)}
} else {
// '\n' doesn't survive JSON transmission, so in vpython.py we replace '\n' with '<br>'
val = m[3].replace(/<br>/g, "\n")
Expand Down
1 change: 1 addition & 0 deletions vpython/vpython.py
Original file line number Diff line number Diff line change
Expand Up @@ -3339,6 +3339,7 @@ class controls(baseObj):
def setup(self, args):
super(controls, self).__init__() ## get idx, attrsupdt from baseObj
## default values of common attributes
self._disabled = False
self._constructing = True
argsToSend = []
objName = args['_objName']
Expand Down
9 changes: 8 additions & 1 deletion vpython/vpython_libraries/glowcomm.html
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,13 @@
}
} else if (textattrs.indexOf(attr) > -1) {
if (attr == 'choices') { // menu choices to be wrapped in a list
val = m[3].split(' ')
val = m[3].slice(2,-2)
val = val.replace(/'/g, '') // remove quotes
val = val.replace(/,/g, '') // remove commas
let s = val.split(' ')
val = []
let a
for (a of s) {val.push(a)}
} else {
// '\n' doesn't survive JSON transmission, so in vpython.py we replace '\n' with '<br>'
val = m[3].replace(/<br>/g, "\n")
Expand Down Expand Up @@ -792,6 +798,7 @@
cfg.objName = obj
cfg.bind = control_handler
cfg = fix_location(cfg)
console.log(cfg.choices)
glowObjs[idx] = menu(cfg)
if (cfg['selected'] === 'None') {
cfg['selected'] = null
Expand Down
8 changes: 7 additions & 1 deletion vpython/vpython_libraries/glowcomm.js
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,13 @@ function decode(data) {
}
} else if (textattrs.indexOf(attr) > -1) {
if (attr == 'choices') { // menu choices to be wrapped in a list
val = m[3].split(' ')
val = m[3].slice(2,-2)
val = val.replace(/'/g, '') // remove quotes
val = val.replace(/,/g, '') // remove commas
let s = val.split(' ')
val = []
let a
for (a of s) {val.push(a)}
} else {
// '\n' doesn't survive JSON transmission, so in vpython.py we replace '\n' with '<br>'
val = m[3].replace(/<br>/g, "\n")
Expand Down