|
@@ 105-126 (lines=22) @@
|
| 102 |
|
|
| 103 |
|
class DataChangeUI(object): |
| 104 |
|
|
| 105 |
|
def __init__(self, window, uaclient): |
| 106 |
|
self.window = window |
| 107 |
|
self.uaclient = uaclient |
| 108 |
|
self._subhandler = DataChangeHandler() |
| 109 |
|
self._subscribed_nodes = [] |
| 110 |
|
self.model = QStandardItemModel() |
| 111 |
|
self.window.ui.subView.setModel(self.model) |
| 112 |
|
self.window.ui.subView.horizontalHeader().setSectionResizeMode(1) |
| 113 |
|
|
| 114 |
|
self.window.ui.actionSubscribeDataChange.triggered.connect(self._subscribe) |
| 115 |
|
self.window.ui.actionUnsubscribeDataChange.triggered.connect(self._unsubscribe) |
| 116 |
|
|
| 117 |
|
# populate contextual menu |
| 118 |
|
self.window.ui.treeView.addAction(self.window.ui.actionSubscribeDataChange) |
| 119 |
|
self.window.ui.treeView.addAction(self.window.ui.actionUnsubscribeDataChange) |
| 120 |
|
|
| 121 |
|
# handle subscriptions |
| 122 |
|
self._subhandler.data_change_fired.connect(self._update_subscription_model, type=Qt.QueuedConnection) |
| 123 |
|
|
| 124 |
|
# accept drops |
| 125 |
|
self.model.canDropMimeData = self.canDropMimeData |
| 126 |
|
self.model.dropMimeData = self.dropMimeData |
| 127 |
|
|
| 128 |
|
def canDropMimeData(self, mdata, action, row, column, parent): |
| 129 |
|
return True |
|
@@ 41-57 (lines=17) @@
|
| 38 |
|
|
| 39 |
|
class EventUI(object): |
| 40 |
|
|
| 41 |
|
def __init__(self, window, uaclient): |
| 42 |
|
self.window = window |
| 43 |
|
self.uaclient = uaclient |
| 44 |
|
self._handler = EventHandler() |
| 45 |
|
self._subscribed_nodes = [] # FIXME: not really needed |
| 46 |
|
self.model = QStandardItemModel() |
| 47 |
|
self.window.ui.evView.setModel(self.model) |
| 48 |
|
self.window.ui.actionSubscribeEvent.triggered.connect(self._subscribe) |
| 49 |
|
self.window.ui.actionUnsubscribeEvents.triggered.connect(self._unsubscribe) |
| 50 |
|
# context menu |
| 51 |
|
self.window.ui.treeView.addAction(self.window.ui.actionSubscribeEvent) |
| 52 |
|
self.window.ui.treeView.addAction(self.window.ui.actionUnsubscribeEvents) |
| 53 |
|
self._handler.event_fired.connect(self._update_event_model, type=Qt.QueuedConnection) |
| 54 |
|
|
| 55 |
|
# accept drops |
| 56 |
|
self.model.canDropMimeData = self.canDropMimeData |
| 57 |
|
self.model.dropMimeData = self.dropMimeData |
| 58 |
|
|
| 59 |
|
def canDropMimeData(self, mdata, action, row, column, parent): |
| 60 |
|
return True |