28
28
'standardAttributes' , 'text' , 'textures' , 'triangle' , 'vertex' ,
29
29
'wtext' , 'winput' , 'keysdown' ]
30
30
31
- __p = platform .python_version ()
32
- _ispython3 = (__p [0 ] == '3' )
33
-
34
- if _ispython3 :
35
- from inspect import signature # Python 3; needed to allow zero arguments in a bound function
36
- else :
37
- from inspect import getargspec # Python 2; needed to allow zero arguments in a bound function
31
+ from inspect import signature # needed to allow zero arguments in a bound function
38
32
39
33
# __version__ is the version number of the Jupyter VPython installer, generated in building the installer.
40
34
version = [__version__ , 'jupyter' ]
@@ -175,10 +169,6 @@ def _encode_attr(D, ismethods): # ismethods is True if a list of method operatio
175
169
out .append (s )
176
170
return out
177
171
178
- if sys .version > '3' :
179
- long = int
180
-
181
-
182
172
def list_to_vec (L ):
183
173
return vector (L [0 ], L [1 ], L [2 ])
184
174
@@ -385,14 +375,9 @@ def handle_msg(self, msg):
385
375
obj ._text = evt ['text' ]
386
376
obj ._number = evt ['value' ]
387
377
# inspect the bound function and see what it's expecting
388
- if _ispython3 : # Python 3
389
- a = signature (obj ._bind )
390
- if str (a ) != '()' : obj ._bind ( obj )
391
- else : obj ._bind ()
392
- else : # Python 2
393
- a = getargspec (obj ._bind )
394
- if len (a .args ) > 0 : obj ._bind ( obj )
395
- else : obj ._bind ()
378
+ a = signature (obj ._bind )
379
+ if str (a ) != '()' : obj ._bind ( obj )
380
+ else : obj ._bind ()
396
381
else : ## a canvas event
397
382
if 'trigger' not in evt :
398
383
cvs = baseObj .object_registry [evt ['canvas' ]]
@@ -1446,11 +1431,6 @@ def __init__(self, objList, **args):
1446
1431
savesize = args ['size' ]
1447
1432
del args ['size' ]
1448
1433
1449
- baseObj .sent = False
1450
- while not baseObj .sent : # wait for compounding objects to exist
1451
- if _isnotebook : rate (1000 )
1452
- else : time .sleep (0.001 )
1453
-
1454
1434
self .compound_idx += 1
1455
1435
args ['_objName' ] = 'compound' + str (self .compound_idx )
1456
1436
super (compound , self ).setup (args )
@@ -3117,14 +3097,9 @@ def handle_event(self, evt): ## events and scene info updates
3117
3097
del evt ['height' ]
3118
3098
for fct in self ._binds ['resize' ]:
3119
3099
# inspect the bound function and see what it's expecting
3120
- if _ispython3 : # Python 3
3121
- a = signature (fct )
3122
- if str (a ) != '()' : fct ( evt )
3123
- else : fct ()
3124
- else : # Python 2
3125
- a = getargspec (fct )
3126
- if len (a .args ) > 0 : fct ( evt )
3127
- else : fct ()
3100
+ a = signature (fct )
3101
+ if str (a ) != '()' : fct ( evt )
3102
+ else : fct ()
3128
3103
else : # pause/waitfor, update_canvas
3129
3104
if 'pos' in evt :
3130
3105
pos = evt ['pos' ]
@@ -3144,14 +3119,9 @@ def handle_event(self, evt): ## events and scene info updates
3144
3119
evt1 = event_return (evt ) ## turn it into an object
3145
3120
for fct in self ._binds [ev ]:
3146
3121
# inspect the bound function and see what it's expecting
3147
- if _ispython3 : # Python 3
3148
- a = signature (fct )
3149
- if str (a ) != '()' : fct ( evt1 )
3150
- else : fct ()
3151
- else : # Python 2
3152
- a = getargspec (fct )
3153
- if len (a .args ) > 0 : fct ( evt1 )
3154
- else : fct ()
3122
+ a = signature (fct )
3123
+ if str (a ) != '()' : fct ( evt1 )
3124
+ else : fct ()
3155
3125
self ._waitfor = evt1 # what pause and waitfor are looking for
3156
3126
else : ## user can change forward (spin), range/autoscale (zoom), up (touch), center (pan)
3157
3127
if 'forward' in evt and self .userspin and not self ._set_forward :
@@ -4111,4 +4081,4 @@ def set_browser(type='default'):
4111
4081
if type == 'pyqt' :
4112
4082
_browsertype = 'pyqt'
4113
4083
else :
4114
- _browsertype = 'default'
4084
+ _browsertype = 'default'
0 commit comments