forked from M-Labs/artiq
waveform: remove localmodelmanager
This commit is contained in:
parent
6763cb586f
commit
513c9188c4
@ -46,12 +46,14 @@ class _AddChannelDialog(QtWidgets.QDialog):
|
||||
grid = QtWidgets.QGridLayout()
|
||||
self.setLayout(grid)
|
||||
|
||||
self._channels_mgr = channels_mgr
|
||||
self._channels_widget = QtWidgets.QTreeView()
|
||||
self._channels_widget.setHeaderHidden(True)
|
||||
self._channels_widget.setSelectionBehavior(
|
||||
QtWidgets.QAbstractItemView.SelectItems)
|
||||
self._channels_widget.setSelectionMode(
|
||||
QtWidgets.QAbstractItemView.ExtendedSelection)
|
||||
self._channels_widget.setModel(self._channels_mgr)
|
||||
grid.addWidget(self._channels_widget, 0, 0, 1, 2)
|
||||
cancel_btn = QtWidgets.QPushButton("Cancel")
|
||||
cancel_btn.clicked.connect(self.close)
|
||||
@ -66,20 +68,13 @@ class _AddChannelDialog(QtWidgets.QDialog):
|
||||
QtWidgets.QStyle.SP_DialogApplyButton))
|
||||
grid.addWidget(confirm_btn, 1, 1)
|
||||
|
||||
self._model = Model(dict())
|
||||
channels_mgr.add_setmodel_callback(self.set_model)
|
||||
|
||||
def set_model(self, model):
|
||||
self._model = model
|
||||
self._channels_widget.setModel(model)
|
||||
|
||||
def add_channels(self):
|
||||
selection = self._channels_widget.selectedIndexes()
|
||||
channels = []
|
||||
for select in selection:
|
||||
key = self._model.index_to_key(select)
|
||||
key = self._channels_mgr.index_to_key(select)
|
||||
if key is not None:
|
||||
width = self._model[key].ref
|
||||
width = self._channels_mgr[key].ref
|
||||
channels.append((key, width))
|
||||
self.accepted.emit(channels)
|
||||
self.close()
|
||||
@ -668,8 +663,7 @@ class WaveformDock(QtWidgets.QDockWidget):
|
||||
self.setFeatures(
|
||||
QtWidgets.QDockWidget.DockWidgetMovable | QtWidgets.QDockWidget.DockWidgetFloatable)
|
||||
|
||||
self._channels_mgr = LocalModelManager(Model)
|
||||
self._channels_mgr.init({})
|
||||
self._channels_mgr = Model({})
|
||||
|
||||
self._devices = None
|
||||
self._dump = None
|
||||
@ -745,12 +739,7 @@ class WaveformDock(QtWidgets.QDockWidget):
|
||||
|
||||
def _update_log_channels(self):
|
||||
for log in self._state['logs']:
|
||||
self._channels_mgr.update({
|
||||
"action": "setitem",
|
||||
"path": "",
|
||||
"key": log,
|
||||
"value": (0, "log")
|
||||
})
|
||||
self._channels_mgr[log] = (0, "log")
|
||||
|
||||
def on_dump_receive(self, data):
|
||||
decoded_dump = comm_analyzer.decode_dump(data)
|
||||
@ -853,7 +842,9 @@ class WaveformDock(QtWidgets.QDockWidget):
|
||||
def init_ddb(self, ddb):
|
||||
self._ddb = ddb
|
||||
addr = None
|
||||
self._channels_mgr.init(comm_analyzer.get_channel_list(ddb))
|
||||
channel_list = comm_analyzer.get_channel_list(ddb)
|
||||
for k, v in channel_list.items():
|
||||
self._channels_mgr[k] = v
|
||||
for name, desc in ddb.items():
|
||||
if isinstance(desc, dict):
|
||||
if desc["type"] == "controller" and name == "core_analyzer":
|
||||
|
Loading…
Reference in New Issue
Block a user