Skip to content

Commit d9f6d6f

Browse files
Merge pull request #145 from BruceSherwood/Finish_graph_scroll
Finish graph scroll
2 parents 0309c4b + 0a84fd0 commit d9f6d6f

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

labextension/vpython/src/glowcommlab.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ var attrsb = {'a':'userzoom', 'b':'userspin', 'c':'range', 'd':'autoscale', 'e':
446446
'p':'left', 'q':'right', 'r':'top', 's':'bottom', 't':'_cloneid',
447447
'u':'logx', 'v':'logy', 'w':'dot', 'x':'dot_radius',
448448
'y':'markers', 'z':'legend', 'A':'label','B':'delta', 'C':'marker_color',
449-
'D':'size_units', 'E':'userpan'}
449+
'D':'size_units', 'E':'userpan', 'F':'scroll'}
450450

451451
// methods are X in {'m': '23X....'}
452452
var methods = {'a':'select', 'b':'pos', 'c':'start', 'd':'stop', 'f':'clear', // unused eghijklmnopvxyzCDFAB

vpython/vpython.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
'right':'q', 'top':'r', 'bottom':'s', '_cloneid':'t',
9898
'logx':'u', 'logy':'v', 'dot':'w', 'dot_radius':'x',
9999
'markers':'y', 'legend':'z', 'label':'A', 'delta':'B', 'marker_color':'C',
100-
'size_units':'D', 'userpan':'E'}
100+
'size_units':'D', 'userpan':'E', 'scroll':'F'}
101101

102102
# methods are X in {'m': '23X....'}
103103
# pos is normally updated as an attribute, but for interval-based trails, it is updated (multiply) as a method
@@ -2282,6 +2282,7 @@ def __init__(self, **args):
22822282
self._title = ""
22832283
self._xtitle = ""
22842284
self._ytitle = ""
2285+
self._scroll = False
22852286
argsToSend = []
22862287

22872288
## override default vector attributes
@@ -2296,7 +2297,7 @@ def __init__(self, **args):
22962297

22972298
## override default scalar attributes
22982299
scalarAttributes = ['width', 'height', 'title', 'xtitle', 'ytitle','align',
2299-
'xmin', 'xmax', 'ymin', 'ymax', 'logx', 'logy', 'fast']
2300+
'xmin', 'xmax', 'ymin', 'ymax', 'logx', 'logy', 'fast', 'scroll']
23002301
for a in scalarAttributes:
23012302
if a in args:
23022303
argsToSend.append(a)
@@ -2309,6 +2310,12 @@ def __init__(self, **args):
23092310

23102311
cmd = {"cmd": objName, "idx": self.idx}
23112312

2313+
if self._scroll:
2314+
if not ('xmin' in argsToSend and 'xmax' in argsToSend):
2315+
raise AttributeError("For a scrolling graph, both xmin and xmax must be specified.")
2316+
if self._xmax <= self._xmin:
2317+
raise AttributeError("For a scrolling graph, xmax must be greater than xmin.")
2318+
23122319
## send only args specified in constructor
23132320
for a in argsToSend:
23142321
aval = getattr(self,a)
@@ -2322,11 +2329,16 @@ def __init__(self, **args):
23222329
def fast(self): return self._fast
23232330
@fast.setter
23242331
def fast(self,val):
2325-
# if _isnotebook and not val:
2326-
# raise AttributeError('"fast = False" is currently not available in a Jupyter notebook.')
23272332
self._fast = val
23282333
self.addattr('fast')
23292334

2335+
@property
2336+
def scroll(self): return self._scroll
2337+
@scroll.setter
2338+
def scroll(self,val):
2339+
self._scroll = val
2340+
self.addattr('scroll')
2341+
23302342
@property
23312343
def width(self): return self._width
23322344
@width.setter

vpython/vpython_libraries/glowcomm.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@
393393
'p':'left', 'q':'right', 'r':'top', 's':'bottom', 't':'_cloneid',
394394
'u':'logx', 'v':'logy', 'w':'dot', 'x':'dot_radius',
395395
'y':'markers', 'z':'legend', 'A':'label','B':'delta', 'C':'marker_color',
396-
'D':'size_units', 'E':'userpan'}
396+
'D':'size_units', 'E':'userpan', 'F':'scroll'}
397397

398398
// methods are X in {'m': '23X....'}
399399
var methods = {'a':'select', 'b':'pos', 'c':'start', 'd':'stop', 'f':'clear', // unused eghijklmnopvxyzCDFAB

vpython/vpython_libraries/glowcomm.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ var attrsb = {'a':'userzoom', 'b':'userspin', 'c':'range', 'd':'autoscale', 'e':
423423
'p':'left', 'q':'right', 'r':'top', 's':'bottom', 't':'_cloneid',
424424
'u':'logx', 'v':'logy', 'w':'dot', 'x':'dot_radius',
425425
'y':'markers', 'z':'legend', 'A':'label','B':'delta', 'C':'marker_color',
426-
'D':'size_units', 'E':'userpan'}
426+
'D':'size_units', 'E':'userpan', 'F':'scroll'}
427427

428428
// methods are X in {'m': '23X....'}
429429
var methods = {'a':'select', 'b':'pos', 'c':'start', 'd':'stop', 'f':'clear', // unused eghijklmnopvxyzCDFAB

0 commit comments

Comments
 (0)