2828 'standardAttributes' , 'text' , 'textures' , 'triangle' , 'vertex' ,
2929 'wtext' , 'winput' , 'keysdown' ]
3030
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
3832
3933# __version__ is the version number of the Jupyter VPython installer, generated in building the installer.
4034version = [__version__ , 'jupyter' ]
@@ -175,10 +169,6 @@ def _encode_attr(D, ismethods): # ismethods is True if a list of method operatio
175169 out .append (s )
176170 return out
177171
178- if sys .version > '3' :
179- long = int
180-
181-
182172def list_to_vec (L ):
183173 return vector (L [0 ], L [1 ], L [2 ])
184174
@@ -385,14 +375,9 @@ def handle_msg(self, msg):
385375 obj ._text = evt ['text' ]
386376 obj ._number = evt ['value' ]
387377 # 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 ()
396381 else : ## a canvas event
397382 if 'trigger' not in evt :
398383 cvs = baseObj .object_registry [evt ['canvas' ]]
@@ -1446,11 +1431,6 @@ def __init__(self, objList, **args):
14461431 savesize = args ['size' ]
14471432 del args ['size' ]
14481433
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-
14541434 self .compound_idx += 1
14551435 args ['_objName' ] = 'compound' + str (self .compound_idx )
14561436 super (compound , self ).setup (args )
@@ -3117,14 +3097,9 @@ def handle_event(self, evt): ## events and scene info updates
31173097 del evt ['height' ]
31183098 for fct in self ._binds ['resize' ]:
31193099 # 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 ()
31283103 else : # pause/waitfor, update_canvas
31293104 if 'pos' in evt :
31303105 pos = evt ['pos' ]
@@ -3144,14 +3119,9 @@ def handle_event(self, evt): ## events and scene info updates
31443119 evt1 = event_return (evt ) ## turn it into an object
31453120 for fct in self ._binds [ev ]:
31463121 # 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 ()
31553125 self ._waitfor = evt1 # what pause and waitfor are looking for
31563126 else : ## user can change forward (spin), range/autoscale (zoom), up (touch), center (pan)
31573127 if 'forward' in evt and self .userspin and not self ._set_forward :
@@ -4111,4 +4081,4 @@ def set_browser(type='default'):
41114081 if type == 'pyqt' :
41124082 _browsertype = 'pyqt'
41134083 else :
4114- _browsertype = 'default'
4084+ _browsertype = 'default'
0 commit comments