-
Notifications
You must be signed in to change notification settings - Fork 6
/
GraphWindow.py
72 lines (64 loc) · 2.23 KB
/
GraphWindow.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
'''
Window for holding Graphs
'''
import sys
from PyQt4 import QtGui
import GUIConfig
from GraphWidgetPyQtGraph import Graph_PyQtGraph as Graph
from HistWidgetPyQtGraph import Hist_PyQtGraph as Hist
from ScrollingGraphWidgetPyQtGraph import ScrollingGraph_PyQtGraph as ScrollingGraph
from ImageWidget import imageWidget as ImageGraph
from GridGraphWindow import GridGraphWindow
class GraphWindow(QtGui.QTabWidget):
def __init__(self, reactor, cxn = None, parent=None):
super(GraphWindow, self).__init__(parent)
self.cxn = cxn
self.reactor = reactor
self.initUI()
self.show()
def initUI(self):
reactor = self.reactor
self.graphDict = {}
self.tabDict = {}
for gc in GUIConfig.tabs:
gcli = gc.config_list
gli = []
for config in gcli:
name = config.name
max_ds = config.max_datasets
if config.isScrolling:
g = ScrollingGraph(config, reactor, self.cxn)
elif config.isImages:
g = ImageGraph(config, reactor)
self.graphDict[name] = g
gli.append(g)
continue
elif config.isHist:
g = Hist(config, reactor, self.cxn)
self.graphDict[name] = g
gli.append(g)
continue
else:
g = Graph(config, reactor, self.cxn)
g.set_ylimits(config.ylim)
self.graphDict[name] = g
gli.append(g)
widget = GridGraphWindow(gli, gc.row_list, gc.column_list, reactor)
self.tabDict[name] = widget
self.addTab(widget, gc.tab)
self.setMovable(True)
def insert_tab(self, t):
g = Graph(t, reactor)
self.graphDict[t] = g
self.addTab(g, t)
def closeEvent(self, x):
self.reactor.stop()
if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
import qt4reactor
qt4reactor.install()
from twisted.internet import reactor
main = GraphWindow(reactor)
main.show()
#sys.exit(app.exec_())
reactor.run()