From 4b2fd9faf616b72c0cbafad9e459b8e1346367d4 Mon Sep 17 00:00:00 2001
From: destinyk <destiny.kuehn@student.nmt.edu>
Date: Mon, 4 Dec 2023 16:15:02 -0700
Subject: [PATCH] fix blockettes not being displayed

---
 mseedpeek/mseedpeek.py | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/mseedpeek/mseedpeek.py b/mseedpeek/mseedpeek.py
index e035ef8..b8470ea 100644
--- a/mseedpeek/mseedpeek.py
+++ b/mseedpeek/mseedpeek.py
@@ -504,6 +504,10 @@ class MainWindow(QWidget):
         # widgets
         blk_label = QLabel("Blockette:")
         blk_menu = QComboBox()
+        blk_menu.currentIndexChanged.connect(
+            lambda: self.fill_blockettes_tab(
+                0,
+                blk_menu.currentText()))
         blk_menu.setObjectName("type_menu")
 
         self.blkinfo_btn = QPushButton("Blockette Info")
@@ -1086,6 +1090,7 @@ class MainWindow(QWidget):
         for blk in self.blockettes_dict[key]:
             self.blockettes_list.append(blk[0])
         self.blockettes_list.sort()
+        print(self.blockettes_list)
 
         # fill blockette info for first blockette found
         self.fill_blockettes_tab(key, self.blockettes_list[0])
@@ -1094,17 +1099,24 @@ class MainWindow(QWidget):
         """
         clears/initializes entry fields in Blockettes tab
         """
+
         for block in self.blockettes_dict[key]:
-            if block[0] == blktype:
+            if int(block[0]) == int(blktype):
                 blocktuple = block
         for key, values in BlkVars.items():
-            if blktype == key:
+            print(key)
+            if int(blktype) == int(key):
+                print("matchnig?")
                 boxes = self.blockettes_tab.findChildren(QGroupBox)
                 for box in boxes:
                     if box.objectName() == "Box1":
                         menu = box.findChild(QComboBox, "type_menu")
+                        menu.blockSignals(True)
                         menu.clear()
-                        menu.insertItem(0, str(blktype))
+                        for blk in self.blockettes_list:
+                            menu.addItem(str(blk))
+                        menu.setCurrentText(str(blktype))
+                        menu.blockSignals(False)
                     elif box.objectName() == "Box2":
                         layout = box.layout()
                         # delete previous labels if they exist
@@ -1344,7 +1356,7 @@ class MainWindow(QWidget):
         """
         self.infobar.setText(text)
         self.infobar.setStyleSheet("background-color:" + color)
-        if color != "yellow" and color != "green":
+        if color != "yellow":
             QApplication.beep()
 
     def update_slider(self, widget):
-- 
GitLab