From 1ad4e447bc13f50399329df3102db1b4bac8671c Mon Sep 17 00:00:00 2001 From: destinyk <destiny.kuehn@student.nmt.edu> Date: Mon, 4 Dec 2023 15:11:18 -0700 Subject: [PATCH] fix unique not showing multiplex files --- mseedpeek/mseedpeek.py | 49 ++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/mseedpeek/mseedpeek.py b/mseedpeek/mseedpeek.py index b6ab593..e035ef8 100644 --- a/mseedpeek/mseedpeek.py +++ b/mseedpeek/mseedpeek.py @@ -145,7 +145,8 @@ from PySide2.QtWidgets import (QApplication, QWidget, QTabWidget, QComboBox, QPushButton, QSizePolicy, QFormLayout, QRadioButton, QSlider, QSpacerItem, QStackedWidget, QFileDialog, - QMessageBox, QProgressDialog) + QMessageBox, QProgressDialog, QTreeWidget, + QTreeWidgetItem) from PySide2.QtCore import (Qt, QObject, Signal, QThread, QTimer, QEventLoop) from PySide2.QtGui import QColor @@ -794,7 +795,7 @@ class MainWindow(QWidget): self.blktype_box.show() self.blkinfo_box.show() self.blk_vars_box.show() - + def launch_find_trace(self): """ Separated out to run build trace list @@ -1286,18 +1287,26 @@ class MainWindow(QWidget): i += 1 self.unique_box.unique_jump.blockSignals(False) - # fill text box - text = "Block\tStat\tChan\tLoc\tNet\tRate" - self.unique_box.unique_infobox.setTextColor(Blue) - self.unique_box.unique_infobox.setText(text) - self.unique_box.unique_infobox.setTextColor(Black) - + # fill tree + self.unique_box.unique_info_tree.clear() + c = 0 for key in self.unique_list: - line = "" + unique_item = QTreeWidgetItem() + line = [] for var in key.split(":"): - line += (var + "\t") - self.unique_box.unique_infobox.append(line) - + line.append(var) + if c: + for i in range(len(line)): + unique_item.setText(i, line[i]) + unique_item.setBackgroundColor(i, Qt.cyan) + else: + for i in range(len(line)): + unique_item.setText(i, line[i]) + self.unique_box.unique_info_tree.addTopLevelItem(unique_item) + if c: + c = 0 + else: + c += 1 def wait(self, words, cnt): """ @@ -1397,7 +1406,7 @@ class MainWindow(QWidget): self.header_endianess_text.clear() self.hide_show("hide") QApplication.beep() - + def begin_thread(self, title, func, after_func=''): """ Create thread to run function @@ -1445,7 +1454,6 @@ class MainWindow(QWidget): self.thread.start() - def build_progress_window(self, title, text, max): """ Create progress window to update user @@ -1464,7 +1472,6 @@ class MainWindow(QWidget): self.progress_window.setCancelButton(cancel_b) self.progress_window.open() - def update_progress_window(self, val): """ Update progress window progress bar @@ -1472,7 +1479,6 @@ class MainWindow(QWidget): self.progress_window.setValue(val) - def stop_thread(self, title): """ Stop the currently running thread @@ -1690,15 +1696,20 @@ class UniqueBox(QGroupBox): jump_label = QLabel("Jump To Block #:") self.unique_jump = QComboBox() self.unique_jump.setEditable(True) - self.unique_infobox = QTextEdit() + self.unique_info_tree = QTreeWidget() + self.unique_info_tree.setRootIsDecorated(False) + self.unique_info_tree.setColumnCount(6) + self.unique_info_tree.setHeaderLabels( + ['Block', 'Stat', 'Chan', 'Loc', 'Net', 'Rate']) layout.addWidget(select_keys_label) layout.addWidget(self.keys_menu) layout.addWidget(jump_label) layout.addWidget(self.unique_jump) - layout.addWidget(self.unique_infobox) + layout.addWidget(self.unique_info_tree) layout.addStretch() + class Worker(QObject): update = Signal(int) finished = Signal() @@ -1706,7 +1717,7 @@ class Worker(QObject): def __init__(self, func): super().__init__() self.func = func - + def run(self): self.func() self.finished.emit() -- GitLab