Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
rows, disabled = [], []
for idx, s in enumerate(get_streams(fname)):
rows.append([s["stream_id"], s["name"], s["type"],
s["channel_count"], s["channel_format"],
s["nominal_srate"]])
is_marker = (s["nominal_srate"] == 0 or
s["channel_format"] == "string")
if is_marker: # disable marker streams
disabled.append(idx)
enabled = list(set(range(len(rows))) - set(disabled))
if enabled:
selected = enabled[0]
else:
selected = None
dialog = XDFStreamsDialog(self, rows, selected=selected,
disabled=disabled)
if dialog.exec_():
row = dialog.view.selectionModel().selectedRows()[0].row()
stream_id = dialog.model.data(dialog.model.index(row, 0))
self.model.load(fname, stream_id=stream_id)
else: # all other file formats
try:
self.model.load(fname)
except FileNotFoundError as e:
QMessageBox.critical(self, "File not found", str(e))
except ValueError as e:
QMessageBox.critical(self, "Unknown file type", str(e))