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
13 changes: 8 additions & 5 deletions labextension/vpython/src/glowcommlab.js
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,8 @@ var attrsb = {'a':'userzoom', 'b':'userspin', 'c':'range', 'd':'autoscale', 'e':
'p':'left', 'q':'right', 'r':'top', 's':'bottom', 't':'_cloneid',
'u':'logx', 'v':'logy', 'w':'dot', 'x':'dot_radius',
'y':'markers', 'z':'legend', 'A':'label','B':'delta', 'C':'marker_color',
'D':'size_units', 'E':'userpan', 'F':'scroll', 'G':'choices', 'H':'depth', 'I':'round'}
'D':'size_units', 'E':'userpan', 'F':'scroll', 'G':'choices', 'H':'depth',
'I':'round', 'J':'name'}

// methods are X in {'m': '23X....'} available: u
var methods = {'a':'select', 'b':'pos', 'c':'start', 'd':'stop', 'f':'clear', // unused eghijklmnopvxyzCDFAB
Expand All @@ -491,7 +492,7 @@ var vecattrs = ['pos', 'up', 'color', 'trail_color', 'axis', 'size', 'origin',
'foreground', 'background', 'ray', 'ambient', 'center', 'forward', 'normal',
'marker_color']

var textattrs = ['text', 'align', 'caption', 'title', 'title_align', 'xtitle', 'ytitle', 'selected', 'capture',
var textattrs = ['text', 'align', 'caption', 'title', 'title_align', 'xtitle', 'ytitle', 'selected', 'capture', 'name',
'label', 'append_to_caption', 'append_to_title', 'bind', 'unbind', 'pause', 'GSprint', 'choices']

// patt gets idx and attr code; vpatt gets x,y,z of a vector
Expand Down Expand Up @@ -613,7 +614,6 @@ function o2vec3(p) {
}

function handler(data) {
"use strict";
"use strict";

/*
Expand All @@ -622,8 +622,8 @@ function handler(data) {
for (var i in data[d]) console.log(i, JSON.stringify(data[d][i]))
}
*/



if (data.cmds !== undefined && data.cmds.length > 0) handle_cmds(data.cmds)
if (data.methods !== undefined && data.methods.length > 0) handle_methods(data.methods)
if (data.attrs !== undefined && data.attrs.length > 0) handle_attrs(data.attrs)
Expand Down Expand Up @@ -862,10 +862,13 @@ function handle_cmds(dcmds) {
break
}
case 'radio': {
cfg.canvas = canvas.get_selected()
cfg = fix_location(cfg)
delete cfg.canvas
cfg.objName = obj
cfg.bind = control_handler
cfg = fix_location(cfg)
glowObjs[idx] = radio(cfg)
// glowObjs[idx].canvas = canvas.get_selected()
break
}
case 'button': {
Expand Down
15 changes: 12 additions & 3 deletions vpython/vpython.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@
'right':'q', 'top':'r', 'bottom':'s', '_cloneid':'t',
'logx':'u', 'logy':'v', 'dot':'w', 'dot_radius':'x',
'markers':'y', 'legend':'z', 'label':'A', 'delta':'B', 'marker_color':'C',
'size_units':'D', 'userpan':'E', 'scroll':'F', 'choices':'G', 'depth':'H', 'round':'I'}
'size_units':'D', 'userpan':'E', 'scroll':'F', 'choices':'G', 'depth':'H',
'round':'I', 'name':'J'}

# methods are X in {'m': '23X....'}
# pos is normally updated as an attribute, but for interval-based trails, it is updated (multiply) as a method
Expand All @@ -112,7 +113,7 @@
'foreground', 'background', 'ray', 'ambient', 'center', 'forward', 'normal',
'marker_color']

__textattrs = ['text', 'align', 'caption', 'title', 'xtitle', 'ytitle', 'selected', 'label', 'capture',
__textattrs = ['text', 'align', 'caption', 'title', 'xtitle', 'ytitle', 'selected', 'label', 'capture', 'name',
'append_to_caption', 'append_to_title', 'bind', 'unbind', 'pause', 'GSprint', 'choices']

def _encode_attr2(sendval, val, ismethods):
Expand Down Expand Up @@ -3399,7 +3400,7 @@ def text(self, value):
class controls(baseObj):
attrlists = { 'button': ['text', 'color', 'textcolor', 'background', 'disabled'],
'checkbox':['checked', 'text', 'disabled'],
'radio':['checked', 'text', 'disabled'],
'radio':['checked', 'text', 'disabled', 'name'],
'menu':['selected', 'choices', 'index', 'disabled'],
'slider':['vertical', 'min', 'max', 'step', 'value', 'length',
'width', 'left', 'right', 'top', 'bottom', 'align', 'disabled'],
Expand Down Expand Up @@ -3586,6 +3587,14 @@ def checked(self, value):
if not self._constructing:
self.addattr('checked')

@property
def name(self):
return self._name
@name.setter
def name(self, value):
if not self._constructing:
raise AttributeError('Cannot change the name attribute of a radio widget.')

class winput(controls):
def __init__(self, **args):
args['_objName'] = 'winput'
Expand Down
2 changes: 1 addition & 1 deletion vpython/vpython_libraries/glow.min.js

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions vpython/vpython_libraries/glowcomm.html
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,8 @@
'p':'left', 'q':'right', 'r':'top', 's':'bottom', 't':'_cloneid',
'u':'logx', 'v':'logy', 'w':'dot', 'x':'dot_radius',
'y':'markers', 'z':'legend', 'A':'label','B':'delta', 'C':'marker_color',
'D':'size_units', 'E':'userpan', 'F':'scroll', 'G':'choices', 'H':'depth', 'I':'round'}
'D':'size_units', 'E':'userpan', 'F':'scroll', 'G':'choices', 'H':'depth',
'I':'round', 'J':'name'}

// methods are X in {'m': '23X....'} available: u
var methods = {'a':'select', 'b':'pos', 'c':'start', 'd':'stop', 'f':'clear', // unused eghijklmnopvxyzCDFAB
Expand All @@ -409,7 +410,7 @@
'foreground', 'background', 'ray', 'ambient', 'center', 'forward', 'normal',
'marker_color']

var textattrs = ['text', 'align', 'caption', 'title', 'title_align', 'xtitle', 'ytitle', 'selected', 'capture',
var textattrs = ['text', 'align', 'caption', 'title', 'title_align', 'xtitle', 'ytitle', 'selected', 'capture', 'name',
'label', 'append_to_caption', 'append_to_title', 'bind', 'unbind', 'pause', 'GSprint', 'choices']

// patt gets idx and attr code; vpatt gets x,y,z of a vector
Expand Down Expand Up @@ -539,8 +540,8 @@
for (var i in data[d]) console.log(i, JSON.stringify(data[d][i]))
}
*/



if (data.cmds !== undefined && data.cmds.length > 0) handle_cmds(data.cmds)
if (data.methods !== undefined && data.methods.length > 0) handle_methods(data.methods)
if (data.attrs !== undefined && data.attrs.length > 0) handle_attrs(data.attrs)
Expand Down Expand Up @@ -779,10 +780,13 @@
break
}
case 'radio': {
cfg.canvas = canvas.get_selected()
cfg = fix_location(cfg)
delete cfg.canvas
cfg.objName = obj
cfg.bind = control_handler
cfg = fix_location(cfg)
glowObjs[idx] = radio(cfg)
// glowObjs[idx].canvas = canvas.get_selected()
break
}
case 'button': {
Expand Down
13 changes: 9 additions & 4 deletions vpython/vpython_libraries/glowcomm.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ function send() { // periodically send events and update_canvas and request obje

// Should eventually have glowcomm.html, glowcom.js, and glowcommlab.js all import this common component.

window.__GSlang = "vpython"
window.__GSlang = "vpython"

function msclock() {
"use strict";
Expand Down Expand Up @@ -445,7 +445,8 @@ var attrsb = {'a':'userzoom', 'b':'userspin', 'c':'range', 'd':'autoscale', 'e':
'p':'left', 'q':'right', 'r':'top', 's':'bottom', 't':'_cloneid',
'u':'logx', 'v':'logy', 'w':'dot', 'x':'dot_radius',
'y':'markers', 'z':'legend', 'A':'label','B':'delta', 'C':'marker_color',
'D':'size_units', 'E':'userpan', 'F':'scroll', 'G':'choices', 'H':'depth', 'I':'round'}
'D':'size_units', 'E':'userpan', 'F':'scroll', 'G':'choices', 'H':'depth',
'I':'round', 'J':'name'}

// methods are X in {'m': '23X....'} available: u
var methods = {'a':'select', 'b':'pos', 'c':'start', 'd':'stop', 'f':'clear', // unused eghijklmnopvxyzCDFAB
Expand All @@ -459,7 +460,7 @@ var vecattrs = ['pos', 'up', 'color', 'trail_color', 'axis', 'size', 'origin',
'foreground', 'background', 'ray', 'ambient', 'center', 'forward', 'normal',
'marker_color']

var textattrs = ['text', 'align', 'caption', 'title', 'title_align', 'xtitle', 'ytitle', 'selected', 'capture',
var textattrs = ['text', 'align', 'caption', 'title', 'title_align', 'xtitle', 'ytitle', 'selected', 'capture', 'name',
'label', 'append_to_caption', 'append_to_title', 'bind', 'unbind', 'pause', 'GSprint', 'choices']

// patt gets idx and attr code; vpatt gets x,y,z of a vector
Expand Down Expand Up @@ -830,10 +831,14 @@ function handle_cmds(dcmds) {
break
}
case 'radio': {
cfg.canvas = canvas.get_selected()
cfg = fix_location(cfg)
delete cfg.canvas
cfg.objName = obj
cfg.bind = control_handler
cfg = fix_location(cfg)
glowObjs[idx] = radio(cfg)
// glowObjs[idx].canvas = canvas.get_selected()
break
}
case 'button': {
Expand Down