Skip to content

Commit

Permalink
Merge pull request #1025 from dopplershift/timers
Browse files Browse the repository at this point in the history
  • Loading branch information
dopplershift committed Jul 20, 2012
2 parents b836275 + 02a7573 commit 9911308
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ def start(self, interval=None):
to reset the timer interval first if provided.
'''
if interval is not None:
self.set_interval(interval)
self._set_interval(interval)
self._timer_start()

def stop(self):
Expand Down
11 changes: 8 additions & 3 deletions lib/matplotlib/backends/backend_qt4.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,17 @@ def __init__(self, *args, **kwargs):
self._timer = QtCore.QTimer()
QtCore.QObject.connect(self._timer, QtCore.SIGNAL('timeout()'),
self._on_timer)
self._timer_set_interval()

def __del__(self):
# Probably not necessary in practice, but is good behavior to disconnect
TimerBase.__del__(self)
QtCore.QObject.disconnect(self._timer , QtCore.SIGNAL('timeout()'),
self._on_timer)
try:
TimerBase.__del__(self)
QtCore.QObject.disconnect(self._timer,
QtCore.SIGNAL('timeout()'), self._on_timer)
except RuntimeError:
# Timer C++ object already deleted
pass

def _timer_set_single_shot(self):
self._timer.setSingleShot(self._single)
Expand Down

0 comments on commit 9911308

Please sign in to comment.