From d5ca8036c517b55b03544949d3a6464667b7d841 Mon Sep 17 00:00:00 2001 From: destinyk <destiny.kuehn@student.nmt.edu> Date: Fri, 8 Dec 2023 16:30:17 -0700 Subject: [PATCH] fix unique select key filter --- mseedpeek/mseedpeek.py | 62 +++++++++++++++++++++++++++++------------- 1 file changed, 43 insertions(+), 19 deletions(-) diff --git a/mseedpeek/mseedpeek.py b/mseedpeek/mseedpeek.py index 8154474..fba6dad 100644 --- a/mseedpeek/mseedpeek.py +++ b/mseedpeek/mseedpeek.py @@ -689,7 +689,9 @@ class MainWindow(QWidget): self.slider_box.jump_menu.currentTextChanged.connect( lambda: self.update_slider("menu")) self.unique_box.unique_jump.currentIndexChanged.connect( - self.update_unique_block) + lambda: self.update_slider("unique")) + self.unique_box.keys_menu.currentIndexChanged.connect( + self.select_keys) # add everything to trace headers layout self.trace_headers_layout.addWidget(self.datadir_box) @@ -703,19 +705,6 @@ class MainWindow(QWidget): default_dir = os.getcwd() self.dd_text.setText(default_dir) - def update_unique_block(self): - """ - Update selected item in Unique's tree widget - """ - - row_num = int(self.unique_box.unique_jump.currentText()) - items = self.unique_box.unique_info_tree.findItems(str(row_num), Qt.MatchExactly, 0) - self.unique_box.unique_info_tree.clearSelection() - for i in items: - self.unique_box.unique_info_tree.setItemSelected(i, True) - self.unique_box.unique_info_tree.scrollToItem(i) - - def clicked_scan_type(self, index): """ Show data related to selected scan type @@ -1298,18 +1287,53 @@ class MainWindow(QWidget): except Exception: return + # def update_unique_block(self): + # """ + # Update selected item in Unique's tree widget + # """ + + # row_num = int(self.unique_box.unique_jump.currentText()) + # items = self.unique_box.unique_info_tree.findItems( + # str(row_num), Qt.MatchExactly, 0) + # self.unique_box.unique_info_tree.clearSelection() + # for i in items: + # self.unique_box.unique_info_tree.setItemSelected(i, True) + # self.unique_box.unique_info_tree.scrollToItem(i) + + def select_keys(self): + """ + """ + + selectkey = self.unique_box.keys_menu.currentText().split(":") + if selectkey == "*": + self.fill_unique() + return + unique_item = QTreeWidgetItem() + line = [] + self.unique_box.unique_info_tree.clear() + for key in self.unique_list: + if selectkey == key.split(":")[1:]: + for var in key.split(":"): + line.append(var) + for i in range(len(line)): + unique_item.setText(i, line[i]) + unique_item.setBackgroundColor(i, Qt.white) + self.unique_box.unique_info_tree.addTopLevelItem(unique_item) + return + + def fill_unique(self): """ Fills unique info on HdrDisplay """ - # text colors - Blue = QColor(0, 0, 153) - Black = QColor(0, 0, 0) # fill drop down menus + self.unique_box.keys_menu.blockSignals(True) self.unique_box.keys_menu.clear() self.unique_box.keys_menu.addItem("*") - self.unique_box.keys_menu.addItem(f'{self.unique_select_list[0]}') + for key in self.unique_select_list: + self.unique_box.keys_menu.addItem(key) + self.unique_box.keys_menu.blockSignals(False) self.unique_box.unique_jump.blockSignals(True) i = 0 @@ -1723,7 +1747,7 @@ class UniqueBox(QGroupBox): layout = QVBoxLayout(self) select_keys_label = QLabel("Select Keys:") self.keys_menu = QComboBox() - self.keys_menu.setEditable(True) + # self.keys_menu.setEditable(True) jump_label = QLabel("Jump To Block #:") self.unique_jump = QComboBox() self.unique_jump.setEditable(True) -- GitLab