From 294bc6bb09640bd46b7aa58b26d64e4a9a35f822 Mon Sep 17 00:00:00 2001
From: destinyk <destiny.kuehn@student.nmt.edu>
Date: Fri, 8 Dec 2023 14:27:30 -0700
Subject: [PATCH] fix unique block jump

---
 mseedpeek/mseedpeek.py | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/mseedpeek/mseedpeek.py b/mseedpeek/mseedpeek.py
index 52f614e..7e7ddf7 100644
--- a/mseedpeek/mseedpeek.py
+++ b/mseedpeek/mseedpeek.py
@@ -689,7 +689,7 @@ class MainWindow(QWidget):
         self.slider_box.jump_menu.currentTextChanged.connect(
             lambda: self.update_slider("menu"))
         self.unique_box.unique_jump.currentIndexChanged.connect(
-            lambda: self.update_slider("unique"))
+            self.update_unique_block)
 
         # add everything to trace headers layout
         self.trace_headers_layout.addWidget(self.datadir_box)
@@ -703,6 +703,19 @@ 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
@@ -992,7 +1005,7 @@ class MainWindow(QWidget):
                     lastkey = key
                     if key not in self.unique_select_list:
                         self.unique_select_list.append(key)
-                    key = str(blk) + ":" + key
+                    key = str(n) + ":" + key
                     self.unique_list.append(key)
 
                 # build Blockette dictionary keyed to block number
-- 
GitLab