2523:139f182b72f6 | 2525:8b507a9a2d40 |
---|---|
4 # | 4 # |
5 | 5 |
6 """ | 6 """ |
7 Module implementing an auto saver class. | 7 Module implementing an auto saver class. |
8 """ | 8 """ |
9 | |
10 from __future__ import unicode_literals # __IGNORE_WARNING__ | |
9 | 11 |
10 from PyQt4.QtCore import QObject, QBasicTimer, QTime | 12 from PyQt4.QtCore import QObject, QBasicTimer, QTime |
11 | 13 |
12 | 14 |
13 class AutoSaver(QObject): | 15 class AutoSaver(QObject): |
22 Constructor | 24 Constructor |
23 | 25 |
24 @param parent reference to the parent object (QObject) | 26 @param parent reference to the parent object (QObject) |
25 @param save slot to be called to perform the save operation | 27 @param save slot to be called to perform the save operation |
26 """ | 28 """ |
27 super().__init__(parent) | 29 super(AutoSaver, self).__init__(parent) |
28 | 30 |
29 if parent is None: | 31 if parent is None: |
30 raise RuntimeError("AutoSaver: parent must not be None.") | 32 raise RuntimeError("AutoSaver: parent must not be None.") |
31 | 33 |
32 self.__save = save | 34 self.__save = save |
53 @param evt reference to the timer event (QTimerEvent) | 55 @param evt reference to the timer event (QTimerEvent) |
54 """ | 56 """ |
55 if evt.timerId() == self.__timer.timerId(): | 57 if evt.timerId() == self.__timer.timerId(): |
56 self.saveIfNeccessary() | 58 self.saveIfNeccessary() |
57 else: | 59 else: |
58 super().timerEvent(evt) | 60 super(AutoSaver, self).timerEvent(evt) |
59 | 61 |
60 def saveIfNeccessary(self): | 62 def saveIfNeccessary(self): |
61 """ | 63 """ |
62 Public method to activate the save operation. | 64 Public method to activate the save operation. |
63 """ | 65 """ |