forked from frans-fuerst/track
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_timegraph.py
executable file
·50 lines (37 loc) · 1.12 KB
/
test_timegraph.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import timegraph
import signal
import sys
from PyQt4 import QtGui, QtCore, Qt, uic
class test_ui(QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
tg = timegraph.timegraph(self)
self.show()
q = QtCore.QTimer()
q.singleShot(1000, self.quit)
def quit(self):
print("quit()")
QtCore.QCoreApplication.instance().quit()
def closeEvent(self, event):
self.cleanup()
def cleanup(self):
print("cleanup")
def sigint_handler(signal, window):
print("caught SIGINT - shutdown mainwindow")
window.cleanup()
QtGui.QApplication.quit()
def test_timegraph():
app = QtGui.QApplication(sys.argv)
mainwindow = test_ui()
signal.signal(signal.SIGINT, lambda signal,
frame: sigint_handler(signal, mainwindow))
# catch the interpreter every now and then to be able to catch
# signals
timer = QtCore.QTimer()
timer.start(200)
timer.timeout.connect(lambda: None)
app.exec_()
if __name__ == '__main__':
test_timegraph()