Replace some QTimers by named Timers.

This commit is contained in:
Florian Bruhin 2015-02-05 07:17:58 +01:00
parent 370c182f48
commit 5ed592a447
2 changed files with 6 additions and 6 deletions

View File

@ -170,7 +170,7 @@ class DownloadItem(QObject):
_redirects: How many time we were redirected already.
_buffer: A BytesIO object to buffer incoming data until we know the
target file.
_read_timer: A QTimer which reads the QNetworkReply into self._buffer
_read_timer: A Timer which reads the QNetworkReply into self._buffer
periodically.
_win_id: The window ID the DownloadItem runs in.
@ -209,7 +209,7 @@ class DownloadItem(QObject):
self.autoclose = True
self.reply = None
self._buffer = io.BytesIO()
self._read_timer = QTimer()
self._read_timer = usertypes.Timer(self, name='download-read-timer')
self._read_timer.setInterval(500)
self._read_timer.timeout.connect(self.on_read_timer_timeout)
self._redirects = 0

View File

@ -22,11 +22,11 @@
import os.path
import collections
from PyQt5.QtCore import pyqtSlot, QObject, QTimer
from PyQt5.QtCore import pyqtSlot, QObject
from qutebrowser.config import config
from qutebrowser.commands import cmdutils
from qutebrowser.utils import utils, log, message, objreg
from qutebrowser.utils import utils, log, message, objreg, usertypes
class Saveable:
@ -105,13 +105,13 @@ class SaveManager(QObject):
Attributes:
saveables: A dict mapping names to Saveable instances.
_save_timer: The QTimer used to periodically auto-save things.
_save_timer: The Timer used to periodically auto-save things.
"""
def __init__(self, parent=None):
super().__init__(parent)
self.saveables = collections.OrderedDict()
self._save_timer = QTimer(self)
self._save_timer = usertypes.Timer(self, name='save-timer')
self._save_timer.timeout.connect(self.autosave)
def __repr__(self):