@@ 125-146 (lines=22) @@ | ||
122 | ||
123 | class DataChangeUI(object): |
|
124 | ||
125 | def __init__(self, window, uaclient): |
|
126 | self.window = window |
|
127 | self.uaclient = uaclient |
|
128 | self._subhandler = DataChangeHandler() |
|
129 | self._subscribed_nodes = [] |
|
130 | self.model = QStandardItemModel() |
|
131 | self.window.ui.subView.setModel(self.model) |
|
132 | self.window.ui.subView.horizontalHeader().setSectionResizeMode(1) |
|
133 | ||
134 | self.window.ui.actionSubscribeDataChange.triggered.connect(self._subscribe) |
|
135 | self.window.ui.actionUnsubscribeDataChange.triggered.connect(self._unsubscribe) |
|
136 | ||
137 | # populate contextual menu |
|
138 | self.window.addAction(self.window.ui.actionSubscribeDataChange) |
|
139 | self.window.addAction(self.window.ui.actionUnsubscribeDataChange) |
|
140 | ||
141 | # handle subscriptions |
|
142 | self._subhandler.data_change_fired.connect(self._update_subscription_model, type=Qt.QueuedConnection) |
|
143 | ||
144 | # accept drops |
|
145 | self.model.canDropMimeData = self.canDropMimeData |
|
146 | self.model.dropMimeData = self.dropMimeData |
|
147 | ||
148 | def canDropMimeData(self, mdata, action, row, column, parent): |
|
149 | return True |
|
@@ 56-73 (lines=18) @@ | ||
53 | ||
54 | class EventUI(object): |
|
55 | ||
56 | def __init__(self, window, uaclient): |
|
57 | self.window = window |
|
58 | self.uaclient = uaclient |
|
59 | self._handler = EventHandler() |
|
60 | self._subscribed_nodes = [] # FIXME: not really needed |
|
61 | self.model = QStandardItemModel() |
|
62 | self.window.ui.evView.setModel(self.model) |
|
63 | self.window.ui.actionSubscribeEvent.triggered.connect(self._subscribe) |
|
64 | self.window.ui.actionUnsubscribeEvents.triggered.connect(self._unsubscribe) |
|
65 | # context menu |
|
66 | self.window.addAction(self.window.ui.actionSubscribeEvent) |
|
67 | self.window.addAction(self.window.ui.actionUnsubscribeEvents) |
|
68 | self.window.addAction(self.window.ui.actionAddToGraph) |
|
69 | self._handler.event_fired.connect(self._update_event_model, type=Qt.QueuedConnection) |
|
70 | ||
71 | # accept drops |
|
72 | self.model.canDropMimeData = self.canDropMimeData |
|
73 | self.model.dropMimeData = self.dropMimeData |
|
74 | ||
75 | def canDropMimeData(self, mdata, action, row, column, parent): |
|
76 | return True |