Skip to content

Commit

Permalink
Merge pull request #191 from mwcraig/remove-python-2-stuff
Browse files Browse the repository at this point in the history
Remove references to _ispython3
  • Loading branch information
mwcraig committed Jan 19, 2022
2 parents 48cee12 + fddaafc commit 14928df
Showing 1 changed file with 19 additions and 24 deletions.
43 changes: 19 additions & 24 deletions vpython/vpython.py
Expand Up @@ -383,15 +383,14 @@ def handle_msg(self, msg):
elif evt['widget'] == 'winput':
obj._text = evt['text']
obj._number = evt['value']

# inspect the bound function and see what it's expecting
if _ispython3: # Python 3
a = signature(obj._bind)
if str(a) != '()': obj._bind( obj )
else: obj._bind()
else: # Python 2
a = getargspec(obj._bind)
if len(a.args) > 0: obj._bind( obj )
else: obj._bind()
a = signature(obj._bind)
if str(a) != '()':
obj._bind( obj )
else:
obj._bind()

else: ## a canvas event
if 'trigger' not in evt:
cvs = baseObj.object_registry[evt['canvas']]
Expand Down Expand Up @@ -3232,14 +3231,12 @@ def handle_event(self, evt): ## events and scene info updates
del evt['height']
for fct in self._binds['resize']:
# inspect the bound function and see what it's expecting
if _ispython3: # Python 3
a = signature(fct)
if str(a) != '()': fct( evt )
else: fct()
else: # Python 2
a = getargspec(fct)
if len(a.args) > 0: fct( evt )
else: fct()
a = signature(fct)
if str(a) != '()':
fct(evt)
else:
fct()

else: # pause/waitfor, update_canvas
if 'pos' in evt:
pos = evt['pos']
Expand All @@ -3259,14 +3256,12 @@ def handle_event(self, evt): ## events and scene info updates
evt1 = event_return(evt) ## turn it into an object
for fct in self._binds[ev]:
# inspect the bound function and see what it's expecting
if _ispython3: # Python 3
a = signature(fct)
if str(a) != '()': fct( evt1 )
else: fct()
else: # Python 2
a = getargspec(fct)
if len(a.args) > 0: fct( evt1 )
else: fct()
a = signature(fct)
if str(a) != '()':
fct( evt1 )
else:
fct()

self._waitfor = evt1 # what pause and waitfor are looking for
else: ## user can change forward (spin), range/autoscale (zoom), up (touch), center (pan)
if 'forward' in evt and self.userspin and not self._set_forward:
Expand Down

0 comments on commit 14928df

Please sign in to comment.