Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Timers #1025

Merged
merged 3 commits into from

1 participant

@dopplershift
Collaborator

This fixes a lingering bug with the timer code as well as the TimerQT class.

dopplershift added some commits
@dopplershift dopplershift Fix TimerBase call to non-existent method. 28514ca
@dopplershift dopplershift Swallow RuntimeError in __del__.
This likely indicates that the underlying C++ object has been deleted and therefore the clean-up code is unnecessary.
5eb7b21
@dopplershift dopplershift Make sure to set the initial interval for the QTimer. 02a7573
@dopplershift dopplershift merged commit 9911308 into matplotlib:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 20, 2012
  1. @dopplershift
  2. @dopplershift

    Swallow RuntimeError in __del__.

    dopplershift authored
    This likely indicates that the underlying C++ object has been deleted and therefore the clean-up code is unnecessary.
  3. @dopplershift
This page is out of date. Refresh to see the latest.
View
2  lib/matplotlib/backend_bases.py
@@ -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):
View
11 lib/matplotlib/backends/backend_qt4.py
@@ -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)
Something went wrong with that request. Please try again.