#!/usr/bin/python3

# TODO: Implement gloabl button actions, ie
#       --load template
#       --save template
# TODO: Implement button actions in TRACE HEADERS
#       --build trace db : brings up data fields but does nothing with them
#       --list traces 
#       --modify headers 
#       --clear current
#       --clear update dictionary
# TODO: Implement button actions in GLOBAL MODIFY
#       --build trace db : brings up data fields but does nothing with them
#       --global set
#       --clear current
#       --clear update dictionary
# TODO: Implement button actions in TIME SHIFT
# TODO: Implement button actions in ENDIANESS
# TODO: Implement button actions in LOG
# TODO: Improve indentation of text in HELP

# What works:
#             Exit button
#             PopUp help checkbox
#             Find directories button in TRACE HEADERS
#             Clear directories button in TRACE HEADERS
#             Clear stations button in TRACE HEADERS
#             Find directories button in TRACE HEADERS
#             Template Format button in HELP


from PySide6 import QtCore, QtGui, QtWidgets
import os
import sys
import time


# Global variables
VERSION = "2022.1.0.0"     # version of fixhdr
DIRECTORY = os.getcwd()    # current working directory initially listed in Data Directories


class Ui_Window(object):

    def setupUi(self, Window):
        Window.setObjectName("Window")
        Window.setFixedSize(730, 530) # static window size


#############################################################################################################
        
        # GLOBAL WINDOW ASSETS

        # Bottom Frame around Load/Save/Exit
        self.bottom_frame = QtWidgets.QFrame(Window)
        self.bottom_frame.setGeometry(QtCore.QRect(0, 450, 721, 41))
        self.bottom_frame.setFrameShape(QtWidgets.QFrame.Shape.StyledPanel)
        self.bottom_frame.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
        self.bottom_frame.setObjectName("bottom_frame")



        # Load Template Button
        self.load_template_btn = QtWidgets.QPushButton(Window)
        self.load_template_btn.setGeometry(QtCore.QRect(360, 458, 121, 25))
        self.load_template_btn.setObjectName("load_template_btn")
        self.load_template_btn.setStyleSheet("QPushButton::hover"
                                            "{"
                                            "background-color:green;"
                                            "}")



        # Save Template Button
        self.save_template_btn = QtWidgets.QPushButton(Window)
        self.save_template_btn.setGeometry(QtCore.QRect(480, 458, 121, 25))
        self.save_template_btn.setObjectName("save_template_btn")
        self.save_template_btn.setStyleSheet("QPushButton::hover"
                                            "{"
                                            "background-color:green;"
                                            "}")



        # Exit button
        self.exit_btn = QtWidgets.QPushButton(Window)
        self.exit_btn.setGeometry(QtCore.QRect(600, 458, 121, 25))
        self.exit_btn.setObjectName("exit_btn")
        #self.exit_btn.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.CrossCursor))
        self.exit_btn.setStyleSheet("QPushButton::hover"
                                    "{"
                                    "background-color:rgb(165, 29, 45);"
                                    "}")
        self.exit_btn.clicked.connect(self.click_quit)

        # MSEED files found banner 
        self.files_alert_textBrowser = QtWidgets.QTextBrowser(Window)
        self.files_alert_textBrowser.setGeometry(QtCore.QRect(0, 500, 730, 30))
        font = QtGui.QFont()
        font.setFamily("DejaVu Sans")
        self.files_alert_textBrowser.setFont(font)
        self.files_alert_textBrowser.setObjectName("files_alert_textBrowser")
        self.files_alert_textBrowser.setStyleSheet("background-color:yellow")




#############################################################################################################



        # TRACE HEADERS

        # Tab Setup
        self.tabWidget = QtWidgets.QTabWidget(Window)
        self.tabWidget.setGeometry(QtCore.QRect(0, 10, 721, 431))
        self.tabWidget.setObjectName("tabWidget")
        
        # Trace Headers Tab
        self.TraceHeaders = QtWidgets.QWidget()
        self.TraceHeaders.setObjectName("TraceHeaders")


        # Trace Headers Tab -- Data Directories Frame
        self.TH_dd_frame = QtWidgets.QFrame(self.TraceHeaders)
        self.TH_dd_frame.setGeometry(QtCore.QRect(-2, 5, 721, 41))
        self.TH_dd_frame.setFrameShape(QtWidgets.QFrame.Shape.StyledPanel)
        self.TH_dd_frame.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
        self.TH_dd_frame.setObjectName("TH_dd_frame")

        # Trace Headers Tab -- Data Directories Label
        self.TH_data_directories_label = QtWidgets.QLabel(self.TraceHeaders)
        self.TH_data_directories_label.setGeometry(QtCore.QRect(8, 17, 151, 17))
        self.TH_data_directories_label.setObjectName("TH_display_messages_for_label")

        # Trace Headers Tab -- File Directory textEdit
        self.textEdit = QtWidgets.QTextEdit(self.TraceHeaders)
        self.textEdit.setGeometry(QtCore.QRect(130, 13, 350, 25))
        self.textEdit.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.textEdit.setAcceptRichText(False)
        self.textEdit.setObjectName("textEdit")

        # Trace Headers Tab -- hidden frame + labels + textEdits 
        # revealed by clicking the Build Trace button

        self.frame = QtWidgets.QFrame(self.TraceHeaders)
        self.frame.setGeometry(QtCore.QRect(-2, 100, 730, 259))
        self.frame.setFrameShape(QtWidgets.QFrame.Shape.StyledPanel)
        self.frame.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
        self.frame.setObjectName("frame")
        self.frame.hide()

        self.stat_chan = QtWidgets.QLabel(self.TraceHeaders)
        self.stat_chan.setGeometry(QtCore.QRect(8, 100, 150, 40))
        self.stat_chan.setObjectName("stat_chan")
        self.stat_chan.hide()
        self.stat_name = QtWidgets.QLabel(self.TraceHeaders)
        self.stat_name.setGeometry(QtCore.QRect(8, 125, 150, 40))
        self.stat_name.setObjectName("stat_name")
        self.stat_name.hide()
        self.channel = QtWidgets.QLabel(self.TraceHeaders)
        self.channel.setGeometry(QtCore.QRect(8, 150, 150, 40))
        self.channel.setObjectName("channel")
        self.channel.hide()
        self.loc_code = QtWidgets.QLabel(self.TraceHeaders)
        self.loc_code.setGeometry(QtCore.QRect(8, 175, 150, 40))
        self.loc_code.setObjectName("loc_code")
        self.loc_code.hide()
        self.net_code = QtWidgets.QLabel(self.TraceHeaders)
        self.net_code.setGeometry(QtCore.QRect(8, 200, 150, 40))
        self.net_code.setObjectName("net_code")
        self.net_code.hide()
        self.smpl_rt = QtWidgets.QLabel(self.TraceHeaders)
        self.smpl_rt.setGeometry(QtCore.QRect(8, 225, 150, 40))
        self.smpl_rt.setObjectName("smpl_rt")
        self.smpl_rt.hide()
        self.textEdit1 = QtWidgets.QTextEdit(self.TraceHeaders)
        self.textEdit1.setGeometry(QtCore.QRect(180, 112, 150, 20))
        self.textEdit1.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.textEdit1.setAcceptRichText(False)
        self.textEdit1.hide()
        self.textEdit2 = QtWidgets.QTextEdit(self.TraceHeaders)
        self.textEdit2.setGeometry(QtCore.QRect(180, 137, 150, 20))
        self.textEdit2.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.textEdit2.setAcceptRichText(False)
        self.textEdit2.hide()
        self.textEdit3 = QtWidgets.QTextEdit(self.TraceHeaders)
        self.textEdit3.setGeometry(QtCore.QRect(180, 162, 150, 20))
        self.textEdit3.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.textEdit3.setAcceptRichText(False)
        self.textEdit3.hide()
        self.textEdit4 = QtWidgets.QTextEdit(self.TraceHeaders)
        self.textEdit4.setGeometry(QtCore.QRect(180, 187, 150, 20))
        self.textEdit4.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.textEdit4.setAcceptRichText(False)
        self.textEdit4.hide()
        self.textEdit5 = QtWidgets.QTextEdit(self.TraceHeaders)
        self.textEdit5.setGeometry(QtCore.QRect(180, 212, 150, 20))
        self.textEdit5.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.textEdit5.setAcceptRichText(False)
        self.textEdit5.hide()
        self.textEdit6 = QtWidgets.QTextEdit(self.TraceHeaders)
        self.textEdit6.setGeometry(QtCore.QRect(180, 237, 150, 20))
        self.textEdit6.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.textEdit6.setAcceptRichText(False)
        self.textEdit6.hide()

        self.new_val = QtWidgets.QLabel(self.TraceHeaders)
        self.new_val.setGeometry(QtCore.QRect(350, 102, 150, 40))
        self.new_val.setObjectName("new_val")
        self.new_val.hide()
        self.nv_textEdit1 = QtWidgets.QTextEdit(self.TraceHeaders)
        self.nv_textEdit1.setGeometry(QtCore.QRect(349, 137, 150, 20))
        self.nv_textEdit1.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.nv_textEdit1.setAcceptRichText(False)
        self.nv_textEdit1.hide()
        self.nv_textEdit2 = QtWidgets.QTextEdit(self.TraceHeaders)
        self.nv_textEdit2.setGeometry(QtCore.QRect(349, 162, 150, 20))
        self.nv_textEdit2.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.nv_textEdit2.setAcceptRichText(False)
        self.nv_textEdit2.hide()
        self.nv_textEdit3 = QtWidgets.QTextEdit(self.TraceHeaders)
        self.nv_textEdit3.setGeometry(QtCore.QRect(349, 187, 150, 20))
        self.nv_textEdit3.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.nv_textEdit3.setAcceptRichText(False)
        self.nv_textEdit3.hide()
        self.nv_textEdit4 = QtWidgets.QTextEdit(self.TraceHeaders)
        self.nv_textEdit4.setGeometry(QtCore.QRect(349, 212, 150, 20))
        self.nv_textEdit4.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.nv_textEdit4.setAcceptRichText(False)
        self.nv_textEdit4.hide()

        self.applied = QtWidgets.QLabel(self.TraceHeaders)
        self.applied.setGeometry(QtCore.QRect(520, 102, 150, 40))
        self.applied.setObjectName("applied")
        self.applied.hide()

        # Trace Headers Tab -- Build Trace button
        self.TH_build_trace_btn = QtWidgets.QPushButton(self.TraceHeaders)
        self.TH_build_trace_btn.setGeometry(QtCore.QRect(494, 13, 110, 25))
        self.TH_build_trace_btn.setObjectName("TH_build_traces_btn")
        self.TH_build_trace_btn.setStyleSheet("""
                                                QPushButton{
                                                        background-color:rgb(98, 160, 234);;
                                                }
                                                QPushButton::hover{
                                                        background-color:green;
                                                }
                                                """)
        self.TH_build_trace_btn.clicked.connect(self.click_build_trace)

        # Trace Headers Tab -- Find button
        self.TH_find_btn = QtWidgets.QPushButton(self.TraceHeaders)
        self.TH_find_btn.setGeometry(QtCore.QRect(603, 13, 50, 25))
        self.TH_find_btn.setObjectName("TH_find_btn")
        self.TH_find_btn.setStyleSheet("QPushButton::hover"
                                            "{"
                                            "background-color:green;"
                                            "}")
        self.TH_find_btn.clicked.connect(self.file_dialogue)

        # Trace Headers Tab -- Clear button
        self.TH_clear_btn = QtWidgets.QPushButton(self.TraceHeaders)
        self.TH_clear_btn.setGeometry(QtCore.QRect(652, 13, 50, 25))
        self.TH_clear_btn.setObjectName("TH_clear_btn")
        self.TH_clear_btn.setStyleSheet("QPushButton::hover"
                                            "{"
                                            "background-color:orange;"
                                            "}")
        self.TH_clear_btn.clicked.connect(self.click_TH_clear)

        # Trace Headers Tab -- Find Only Stations Frame
        self.TH_fos_frame = QtWidgets.QFrame(self.TraceHeaders)
        self.TH_fos_frame.setGeometry(QtCore.QRect(-2, 53, 721, 41))
        self.TH_fos_frame.setFrameShape(QtWidgets.QFrame.Shape.StyledPanel)
        self.TH_fos_frame.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
        self.TH_fos_frame.setObjectName("TH_fos_frame")

        # Trace Headers Tab -- Find Only Stations Label
        self.TH_fos_label = QtWidgets.QLabel(self.TraceHeaders)
        self.TH_fos_label.setGeometry(QtCore.QRect(8, 65, 280, 17))
        self.TH_fos_label.setObjectName("TH_display_messages_for_label")

        # Trace Headers Tab -- 2nd Clear button
        self.TH_clear_2_btn = QtWidgets.QPushButton(self.TraceHeaders)
        self.TH_clear_2_btn.setGeometry(QtCore.QRect(652, 61, 50, 25))
        self.TH_clear_2_btn.setObjectName("TH_clear_2_btn")
        self.TH_clear_2_btn.setStyleSheet("QPushButton::hover"
                                            "{"
                                            "background-color:orange;"
                                            "}")
        self.TH_clear_2_btn.clicked.connect(self.click_TH_clear_2)

        # Trace Headers Tab -- Find Only Stations Directory text
        self.fos_textEdit = QtWidgets.QTextEdit(self.TraceHeaders)
        self.fos_textEdit.setGeometry(QtCore.QRect(280, 61, 358, 25))
        self.fos_textEdit.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.fos_textEdit.setAcceptRichText(False)
        self.fos_textEdit.setObjectName("fos_textEdit")


        # Trace Headers Tab -- List Traces button
        self.TH_popup = QtWidgets.QMainWindow()
        self.TH_popup.setWindowTitle("Traces Listing")
        self.TH_popup.resize(750, 480)
        self.TH_popup.setObjectName("TH_popup")
        self.TH_popup_textBrowser = QtWidgets.QTextBrowser(self.TH_popup)
        self.TH_popup_textBrowser.setGeometry(QtCore.QRect(26, 25, 700, 400))
        self.TH_popup_textBrowser.setObjectName("TH_textBrowser")
        self.TH_popup.hide()
        self.TH_dismiss_btn = QtWidgets.QPushButton(self.TH_popup)
        self.TH_dismiss_btn.setGeometry(QtCore.QRect(340, 440, 83, 25))
        self.TH_dismiss_btn.setObjectName("TH_dismiss_btn")
        self.TH_dismiss_btn.setStyleSheet("""
                                                QPushButton{
                                                        background-color:rgb(98, 160, 234);
                                                }
                                                QPushButton::hover{
                                                        background-color:rgb(165, 29, 45);
                                                }
                                                """)
        self.TH_dismiss_btn.clicked.connect(self.TH_popup.close)
        self.TH_list_traces_btn = QtWidgets.QPushButton(self.TraceHeaders)
        self.TH_list_traces_btn.setGeometry(QtCore.QRect(6, 368, 85, 25))
        self.TH_list_traces_btn.setObjectName("TH_list_traces_btn")
        self.TH_list_traces_btn.setStyleSheet("QPushButton::hover"
                                                "{"
                                                "background-color:green;"
                                                "}")
        self.TH_list_traces_btn.clicked.connect(self.click_list_traces)

        # Trace Headers Tab -- Clear Update Dictionary button
        self.TH_clear_update_dictionary_btn = QtWidgets.QPushButton(self.TraceHeaders)
        self.TH_clear_update_dictionary_btn.setGeometry(QtCore.QRect(540, 368, 171, 25))
        self.TH_clear_update_dictionary_btn.setObjectName("TH_clear_update_dictionary_btn")
        self.TH_clear_update_dictionary_btn.setStyleSheet("QPushButton::hover"
                                                "{"
                                                "background-color:orange;"
                                                "}")

        # Trace Headers Tab -- Clear Current button
        self.TH_clear_current_btn = QtWidgets.QPushButton(self.TraceHeaders)
        self.TH_clear_current_btn.setGeometry(QtCore.QRect(420, 368, 121, 25))
        self.TH_clear_current_btn.setObjectName("TH_clear_current_btn")
        self.TH_clear_current_btn.setStyleSheet("QPushButton::hover"
                                                "{"
                                                "background-color:orange;"
                                                "}")

        # Trace Headers Tab -- Modify Headers button
        self.TH_modify_headers_btn = QtWidgets.QPushButton(self.TraceHeaders)
        self.TH_modify_headers_btn.setGeometry(QtCore.QRect(300, 368, 121, 25))
        self.TH_modify_headers_btn.setObjectName("TH_modify_headers_btn")
        self.TH_modify_headers_btn.setStyleSheet("QPushButton::hover"
                                                "{"
                                                "background-color:green;"
                                                "}")

        self.tabWidget.addTab(self.TraceHeaders, "")


#############################################################################################################

        # GLOBAL MODIFY

        # Global Modify Tab
        self.GlobalModify = QtWidgets.QWidget()
        self.GlobalModify.setObjectName("GlobalModify")

        # Global Modify Tab -- Current Data Directories Frame
        self.GM_cdd_frame = QtWidgets.QFrame(self.GlobalModify)
        self.GM_cdd_frame.setGeometry(QtCore.QRect(-2, 5, 721, 41))
        self.GM_cdd_frame.setFrameShape(QtWidgets.QFrame.Shape.StyledPanel)
        self.GM_cdd_frame.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
        self.GM_cdd_frame.setObjectName("TH_cdd_frame")

        # Global Modify Tab -- Current Data Directories Label
        self.GM_cdd_label = QtWidgets.QLabel(self.GlobalModify)
        self.GM_cdd_label.setGeometry(QtCore.QRect(8, 17, 170, 17))
        self.GM_cdd_label.setObjectName("TH_cdd_label")

        # Global Modify Tab -- File Directory text
        self.GM_cdd_textEdit = QtWidgets.QTextEdit(self.GlobalModify)
        self.GM_cdd_textEdit.setGeometry(QtCore.QRect(183, 13, 522, 25))
        self.GM_cdd_textEdit.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.GM_cdd_textEdit.setAcceptRichText(False)
        self.GM_cdd_textEdit.setObjectName("GM_cdd_textEdit")

        # Global Tab -- hidden frame + labels + textEdits

        self.GM_h_frame = QtWidgets.QFrame(self.GlobalModify)
        self.GM_h_frame.setGeometry(QtCore.QRect(-2, 53, 730, 306))
        self.GM_h_frame.setFrameShape(QtWidgets.QFrame.Shape.StyledPanel)
        self.GM_h_frame.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
        self.GM_h_frame.setObjectName("frame")
        self.GM_h_frame.hide()

        self.GM_for_headers_matching = QtWidgets.QLabel(self.GlobalModify)
        self.GM_for_headers_matching.setGeometry(QtCore.QRect(120, 53, 150, 40))
        self.GM_for_headers_matching.setObjectName("GM_for_headers_matching")
        self.GM_for_headers_matching.hide()
        self.GM_sub_values = QtWidgets.QLabel(self.GlobalModify)
        self.GM_sub_values.setGeometry(QtCore.QRect(300, 53, 150, 40))
        self.GM_sub_values.setObjectName("GM_for_headers_matching")
        self.GM_sub_values.hide()
        self.GM_stat_name = QtWidgets.QLabel(self.GlobalModify)
        self.GM_stat_name.setGeometry(QtCore.QRect(8, 75, 150, 40))
        self.GM_stat_name.setObjectName("GM_stat_name")
        self.GM_stat_name.hide()
        self.GM_channel = QtWidgets.QLabel(self.GlobalModify)
        self.GM_channel.setGeometry(QtCore.QRect(8, 100, 150, 40))
        self.GM_channel.setObjectName("GM_channel")
        self.GM_channel.hide()
        self.GM_loc_code = QtWidgets.QLabel(self.GlobalModify)
        self.GM_loc_code.setGeometry(QtCore.QRect(8, 125, 150, 40))
        self.GM_loc_code.setObjectName("GM_loc_code")
        self.GM_loc_code.hide()
        self.GM_net_code = QtWidgets.QLabel(self.GlobalModify)
        self.GM_net_code.setGeometry(QtCore.QRect(8, 150, 150, 40))
        self.GM_net_code.setObjectName("GM_net_code")
        self.GM_net_code.hide()
        self.GM_smpl_rt = QtWidgets.QLabel(self.GlobalModify)
        self.GM_smpl_rt.setGeometry(QtCore.QRect(8, 175, 150, 40))
        self.GM_smpl_rt.setObjectName("GM_smpl_rt")
        self.GM_smpl_rt.hide()

        self.GM_textEdit1 = QtWidgets.QTextEdit(self.GlobalModify)
        self.GM_textEdit1.setGeometry(QtCore.QRect(119, 88, 150, 20))
        self.GM_textEdit1.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.GM_textEdit1.setAcceptRichText(False)
        self.GM_textEdit1.hide()
        self.GM_textEdit2 = QtWidgets.QTextEdit(self.GlobalModify)
        self.GM_textEdit2.setGeometry(QtCore.QRect(119, 113, 150, 20))
        self.GM_textEdit2.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.GM_textEdit2.setAcceptRichText(False)
        self.GM_textEdit2.hide()
        self.GM_textEdit3 = QtWidgets.QTextEdit(self.GlobalModify)
        self.GM_textEdit3.setGeometry(QtCore.QRect(119, 138, 150, 20))
        self.GM_textEdit3.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.GM_textEdit3.setAcceptRichText(False)
        self.GM_textEdit3.hide()
        self.GM_textEdit4 = QtWidgets.QTextEdit(self.GlobalModify)
        self.GM_textEdit4.setGeometry(QtCore.QRect(119, 163, 150, 20))
        self.GM_textEdit4.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.GM_textEdit4.setAcceptRichText(False)
        self.GM_textEdit4.hide()
        self.GM_textEdit5 = QtWidgets.QTextEdit(self.GlobalModify)
        self.GM_textEdit5.setGeometry(QtCore.QRect(119, 188, 150, 20))
        self.GM_textEdit5.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.GM_textEdit5.setAcceptRichText(False)
        self.GM_textEdit5.hide()
        
        self.GM_textEdit6 = QtWidgets.QTextEdit(self.GlobalModify)
        self.GM_textEdit6.setGeometry(QtCore.QRect(299, 88, 150, 20))
        self.GM_textEdit6.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.GM_textEdit6.setAcceptRichText(False)
        self.GM_textEdit6.hide()
        self.GM_textEdit7 = QtWidgets.QTextEdit(self.GlobalModify)
        self.GM_textEdit7.setGeometry(QtCore.QRect(299, 113, 150, 20))
        self.GM_textEdit7.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.GM_textEdit7.setAcceptRichText(False)
        self.GM_textEdit7.hide()
        self.GM_textEdit8 = QtWidgets.QTextEdit(self.GlobalModify)
        self.GM_textEdit8.setGeometry(QtCore.QRect(299, 138, 150, 20))
        self.GM_textEdit8.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.GM_textEdit8.setAcceptRichText(False)
        self.GM_textEdit8.hide()
        self.GM_textEdit9 = QtWidgets.QTextEdit(self.GlobalModify)
        self.GM_textEdit9.setGeometry(QtCore.QRect(299, 163, 150, 20))
        self.GM_textEdit9.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.GM_textEdit9.setAcceptRichText(False)
        self.GM_textEdit9.hide()

        self.GM_sub_val = QtWidgets.QLabel(self.GlobalModify)
        self.GM_sub_val.setGeometry(QtCore.QRect(350, 102, 150, 40))
        self.GM_sub_val.setObjectName("GM_sub_val")
        self.GM_sub_val.hide()
        self.GM_sv_textEdit1 = QtWidgets.QTextEdit(self.GlobalModify)
        self.GM_sv_textEdit1.setGeometry(QtCore.QRect(349, 137, 150, 20))
        self.GM_sv_textEdit1.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.GM_sv_textEdit1.setAcceptRichText(False)
        self.GM_sv_textEdit1.hide()
        self.GM_sv_textEdit2 = QtWidgets.QTextEdit(self.GlobalModify)
        self.GM_sv_textEdit2.setGeometry(QtCore.QRect(349, 162, 150, 20))
        self.GM_sv_textEdit2.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.GM_sv_textEdit2.setAcceptRichText(False)
        self.GM_sv_textEdit2.hide()
        self.GM_sv_textEdit3 = QtWidgets.QTextEdit(self.GlobalModify)
        self.GM_sv_textEdit3.setGeometry(QtCore.QRect(349, 187, 150, 20))
        self.GM_sv_textEdit3.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.GM_sv_textEdit3.setAcceptRichText(False)
        self.GM_sv_textEdit3.hide()
        self.GM_sv_textEdit4 = QtWidgets.QTextEdit(self.GlobalModify)
        self.GM_sv_textEdit4.setGeometry(QtCore.QRect(349, 212, 150, 20))
        self.GM_sv_textEdit4.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.GM_sv_textEdit4.setAcceptRichText(False)
        self.GM_sv_textEdit4.hide()

        # Global Modify Tab -- Global Set button
        self.GM_global_set_btn = QtWidgets.QPushButton(self.GlobalModify)
        self.GM_global_set_btn.setGeometry(QtCore.QRect(300, 368, 121, 25))
        self.GM_global_set_btn.setObjectName("GM_global_set_btn")
        self.GM_global_set_btn.setStyleSheet("""
                                                QPushButton{
                                                        background-color:rgb(98, 160, 234);;
                                                }
                                                QPushButton::hover{
                                                        background-color:green;
                                                }
                                                """)

        # Global Modify Tab -- Clear Current button
        self.GM_clear_current_btn = QtWidgets.QPushButton(self.GlobalModify)
        self.GM_clear_current_btn.setGeometry(QtCore.QRect(420, 368, 121, 25))
        self.GM_clear_current_btn.setObjectName("GM_clear_current_btn")
        self.GM_clear_current_btn.setStyleSheet("QPushButton::hover"
                                                "{"
                                                "background-color:orange;"
                                                "}")

        # Global Modify Tab -- Clear Update Dictionary button
        self.GM_clear_update_dictionary_btn = QtWidgets.QPushButton(self.GlobalModify)
        self.GM_clear_update_dictionary_btn.setGeometry(QtCore.QRect(540, 368, 171, 25))
        self.GM_clear_update_dictionary_btn.setObjectName("GM_clear_update_dictionary_btn")
        self.GM_clear_update_dictionary_btn.setStyleSheet("QPushButton::hover"
                                                        "{"
                                                        "background-color:orange;"
                                                        "}")

        self.tabWidget.addTab(self.GlobalModify, "")


#############################################################################################################
        
        # TIME SHIFT

        # Time Shift Tab
        self.TimeShift = QtWidgets.QWidget()
        self.TimeShift.setObjectName("TimeShift")

        # Time Shift Tab -- Current Data Directories Frame
        self.TS_dd_frame = QtWidgets.QFrame(self.TimeShift)
        self.TS_dd_frame.setGeometry(QtCore.QRect(-2, 5, 721, 41))
        self.TS_dd_frame.setFrameShape(QtWidgets.QFrame.Shape.StyledPanel)
        self.TS_dd_frame.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
        self.TS_dd_frame.setObjectName("TS_dd_frame")

        # Time Shift Tab -- Data Directories Label
        self.TS_cdd_label = QtWidgets.QLabel(self.TimeShift)
        self.TS_cdd_label.setGeometry(QtCore.QRect(8, 17, 165, 17))
        self.TS_cdd_label.setObjectName("TS_cdd_label")

        # Time Shift Tab -- File Directory text
        self.TS_textEdit = QtWidgets.QTextEdit(self.TimeShift)
        self.TS_textEdit.setGeometry(QtCore.QRect(183, 13, 522, 25))
        self.TS_textEdit.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.TS_textEdit.setAcceptRichText(False)
        self.TS_textEdit.setObjectName("TS_textEdit")

        # Time Shift Tab -- How To Treat Existing Corrections Frame
        self.TS_ec_frame = QtWidgets.QFrame(self.TimeShift)
        self.TS_ec_frame.setGeometry(QtCore.QRect(-2, 53, 721, 41))
        self.TS_ec_frame.setFrameShape(QtWidgets.QFrame.Shape.StyledPanel)
        self.TS_ec_frame.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
        self.TS_ec_frame.setObjectName("TS_fos_frame")

        # Time Shift Tab -- How To Treat Existing Corrections Label
        self.TS_ec_label = QtWidgets.QLabel(self.TimeShift)
        self.TS_ec_label.setGeometry(QtCore.QRect(8, 65, 280, 17))
        self.TS_ec_label.setObjectName("TS_existing_corrections_label")

        # Time Shift Tab -- Add To radio button
        self.TS_add_to_rbtn = QtWidgets.QRadioButton(self.TimeShift)
        self.TS_add_to_rbtn.setGeometry(QtCore.QRect(240, 63, 70, 23))
        self.TS_add_to_rbtn.setObjectName("TS_add_to_rbtn")
        self.TS_add_to_rbtn.setChecked(True)

        # Time Shift Tab -- Replace radio button
        self.TS__replace_rbtn = QtWidgets.QRadioButton(self.TimeShift)
        self.TS__replace_rbtn.setGeometry(QtCore.QRect(320, 63, 71, 23))
        self.TS__replace_rbtn.setObjectName("TS__replace_rbtn")

        # Time Shift Tab -- Undo Time Corrections button
        self.TS_undo_tc_btn = QtWidgets.QPushButton(self.TimeShift)
        self.TS_undo_tc_btn.setGeometry(QtCore.QRect(540, 61, 165, 25))
        self.TS_undo_tc_btn.setObjectName("TS_undo_tc_btn")
        self.TS_undo_tc_btn.setStyleSheet("""
                                                QPushButton{
                                                        background-color:rgb(98, 160, 234);
                                                }
                                                QPushButton::hover{
                                                        background-color:green;
                                                }
                                                """)

        # Time Shift Tab -- hidden

        self.TS_frame = QtWidgets.QFrame(self.TimeShift)
        self.TS_frame.setGeometry(QtCore.QRect(-2, 100, 730, 200))
        self.TS_frame.setFrameShape(QtWidgets.QFrame.Shape.StyledPanel)
        self.TS_frame.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
        self.TS_frame.setObjectName("TS_frame")
        self.TS_frame.hide()

        self.TS_for_traces_matching = QtWidgets.QLabel(self.TimeShift)
        self.TS_for_traces_matching.setGeometry(QtCore.QRect(101, 100, 150, 40))
        self.TS_for_traces_matching.setObjectName("TS_for_traces_matching")
        self.TS_for_traces_matching.hide()

        self.TS_stat_loc_net = QtWidgets.QLabel(self.TimeShift)
        self.TS_stat_loc_net.setGeometry(QtCore.QRect(8, 125, 150, 40))
        self.TS_stat_loc_net.setObjectName("TS_stat_loc_net")
        self.TS_stat_loc_net.hide()

        self.TS_textEdit1 = QtWidgets.QTextEdit(self.TimeShift)
        self.TS_textEdit1.setGeometry(QtCore.QRect(100, 135, 150, 20))
        self.TS_textEdit1.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.TS_textEdit1.setAcceptRichText(False)
        self.TS_textEdit1.hide()

        self.TS_checkBox = QtWidgets.QCheckBox(self.TimeShift)
        self.TS_checkBox.setGeometry(QtCore.QRect(101, 160, 180, 23))
        self.TS_checkBox.setObjectName("TS_checkBox")
        self.TS_checkBox.setChecked(False)
        self.TS_checkBox.hide()

        self.TS_time_shift = QtWidgets.QLabel(self.TimeShift)
        self.TS_time_shift.setGeometry(QtCore.QRect(431, 100, 150, 40))
        self.TS_time_shift.setObjectName("TS_time_shift")
        self.TS_time_shift.hide()

        self.TS_applied = QtWidgets.QLabel(self.TimeShift)
        self.TS_applied.setGeometry(QtCore.QRect(600, 100, 150, 40))
        self.TS_applied.setObjectName("TS_applied")
        self.TS_applied.hide()

        self.TS_start_time = QtWidgets.QLabel(self.TimeShift)
        self.TS_start_time.setGeometry(QtCore.QRect(351, 125, 150, 40))
        self.TS_start_time.setObjectName("TS_start_time")
        self.TS_start_time.hide()

        self.TS_textEdit2 = QtWidgets.QTextEdit(self.TimeShift)
        self.TS_textEdit2.setGeometry(QtCore.QRect(430, 135, 150, 20))
        self.TS_textEdit2.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.TS_textEdit2.setAcceptRichText(False)
        self.TS_textEdit2.hide()

        self.TS_end_time = QtWidgets.QLabel(self.TimeShift)
        self.TS_end_time.setGeometry(QtCore.QRect(358, 150, 150, 40))
        self.TS_end_time.setObjectName("TS_end_time")
        self.TS_end_time.hide()

        self.TS_textEdit3 = QtWidgets.QTextEdit(self.TimeShift)
        self.TS_textEdit3.setGeometry(QtCore.QRect(430, 160, 150, 20))
        self.TS_textEdit3.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.TS_textEdit3.setAcceptRichText(False)
        self.TS_textEdit3.hide()

        self.TS_time_shift_sec = QtWidgets.QLabel(self.TimeShift)
        self.TS_time_shift_sec.setGeometry(QtCore.QRect(324, 175, 150, 40))
        self.TS_time_shift_sec.setObjectName("TS_time_shift_sec")
        self.TS_time_shift_sec.hide()

        self.TS_textEdit4 = QtWidgets.QTextEdit(self.TimeShift)
        self.TS_textEdit4.setGeometry(QtCore.QRect(430, 185, 150, 20))
        self.TS_textEdit4.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.TS_textEdit4.setAcceptRichText(False)
        self.TS_textEdit4.hide()

        self.TS_tt_questionable = QtWidgets.QLabel(self.TimeShift)
        self.TS_tt_questionable.setGeometry(QtCore.QRect(257, 200, 165, 40))
        self.TS_tt_questionable.setObjectName("TS_tt_questionable")
        self.TS_tt_questionable.hide()

        self.TS_textEdit5 = QtWidgets.QTextEdit(self.TimeShift)
        self.TS_textEdit5.setGeometry(QtCore.QRect(430, 210, 150, 20))
        self.TS_textEdit5.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.TS_textEdit5.setAcceptRichText(False)
        self.TS_textEdit5.hide()

        # Time Shift Tab - List Time Corrections button
        self.TS_list_time_corrections_btn = QtWidgets.QPushButton(self.TimeShift)
        self.TS_list_time_corrections_btn.setGeometry(QtCore.QRect(50, 368, 161, 25))
        self.TS_list_time_corrections_btn.setObjectName("TS_list_time_corrections_btn")
        self.TS_list_time_corrections_btn.setStyleSheet("QPushButton::hover"
                                                        "{"
                                                        "background-color:green;"
                                                        "}")

        # Time Shift Tab - Apply Time Corrections button
        self.TS_apply_time_correction_btn = QtWidgets.QPushButton(self.TimeShift)
        self.TS_apply_time_correction_btn.setGeometry(QtCore.QRect(210, 368, 161, 25))
        self.TS_apply_time_correction_btn.setObjectName("TS_apply_time_correction_btn")
        self.TS_apply_time_correction_btn.setStyleSheet("""
                                                QPushButton{
                                                        background-color:rgb(98, 160, 234);;
                                                }
                                                QPushButton::hover{
                                                        background-color:green;
                                                }
                                                """)

        # Time Shift Tab - Time Set button
        self.TS_time_set_btn = QtWidgets.QPushButton(self.TimeShift)
        self.TS_time_set_btn.setGeometry(QtCore.QRect(370, 368, 83, 25))
        self.TS_time_set_btn.setObjectName("TS_time_set_btn")
        self.TS_time_set_btn.setStyleSheet("""
                                                QPushButton{
                                                        background-color:rgb(98, 160, 234);;
                                                }
                                                QPushButton::hover{
                                                        background-color:green;
                                                }
                                                """)

        # Time Shift Tab - Recalc Start/End button
        self.TS_recalc_start_end_btn = QtWidgets.QPushButton(self.TimeShift)
        self.TS_recalc_start_end_btn.setGeometry(QtCore.QRect(450, 368, 131, 25))
        self.TS_recalc_start_end_btn.setObjectName("TS_recalc_start_end_btn")
        self.TS_recalc_start_end_btn.setStyleSheet("""
                                                QPushButton{
                                                        background-color:rgb(98, 160, 234);;
                                                }
                                                QPushButton::hover{
                                                        background-color:green;
                                                }
                                                """)

        # Time Shift Tab - Clear All button
        self.TS_clear_all_btn = QtWidgets.QPushButton(self.TimeShift)
        self.TS_clear_all_btn.setGeometry(QtCore.QRect(580, 368, 83, 25))
        self.TS_clear_all_btn.setObjectName("TS_clear_all_btn")
        self.TS_clear_all_btn.setStyleSheet("QPushButton::hover"
                                            "{"
                                            "background-color:orange;"
                                            "}")

        self.tabWidget.addTab(self.TimeShift, "")


#############################################################################################################

        # ENDIANESS

        # Endianess Tab
        self.Endianess = QtWidgets.QWidget()
        self.Endianess.setObjectName("Endianess")

        # Endianess Tab -- Current Data Directories Frame
        self.E_cdd_frame = QtWidgets.QFrame(self.Endianess)
        self.E_cdd_frame.setGeometry(QtCore.QRect(-2, 5, 721, 41))
        self.E_cdd_frame.setFrameShape(QtWidgets.QFrame.Shape.StyledPanel)
        self.E_cdd_frame.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
        self.E_cdd_frame.setObjectName("E_cdd_frame")

        # Endianess Tab -- Current Data Directories Label
        self.E_cdd_label = QtWidgets.QLabel(self.Endianess)
        self.E_cdd_label.setGeometry(QtCore.QRect(8, 17, 170, 17))
        self.E_cdd_label.setObjectName("E_cdd_label")

        # Endianess Tab -- File Directory text
        self.E_cdd_textEdit = QtWidgets.QTextEdit(self.Endianess)
        self.E_cdd_textEdit.setGeometry(QtCore.QRect(183, 13, 522, 25))
        self.E_cdd_textEdit.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.E_cdd_textEdit.setAcceptRichText(False)
        self.E_cdd_textEdit.setObjectName("E_cdd_textEdit")

        # Endianess Tab -- Endian Files Found Frame
        self.E_files_frame = QtWidgets.QFrame(self.Endianess)
        self.E_files_frame.setGeometry(QtCore.QRect(-2, 53, 721, 73))
        self.E_files_frame.setFrameShape(QtWidgets.QFrame.Shape.StyledPanel)
        self.E_files_frame.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
        self.E_files_frame.setObjectName("E_files_frame")

        # Endianess Tab -- Little Endian Files Found Label
        self.E_little_label = QtWidgets.QLabel(self.Endianess)
        self.E_little_label.setGeometry(QtCore.QRect(8, 65, 170, 17))
        self.E_cdd_label.setObjectName("E_little_label")

        # Endianess Tab -- Little Endian Files Found text
        self.E_little_textEdit = QtWidgets.QTextEdit(self.Endianess)
        self.E_little_textEdit.setGeometry(QtCore.QRect(180, 65, 70, 17))
        self.E_little_textEdit.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.E_little_textEdit.setAcceptRichText(False)
        self.E_little_textEdit.setObjectName("E_little_textEdit")

        # Endianess Tab -- Convert to Big button
        self.E_ctb_btn = QtWidgets.QPushButton(self.Endianess)
        self.E_ctb_btn.setGeometry(QtCore.QRect(261, 61, 120, 25))
        self.E_ctb_btn.setObjectName("E_ctb_btn")
        self.E_ctb_btn.setStyleSheet("""
                                                QPushButton{
                                                        background-color:rgb(98, 160, 234);;
                                                }
                                                QPushButton::hover{
                                                        background-color:green;
                                                }
                                                """)

        # Endianess Tab -- Big Endian Files Found Label
        self.E_big_label = QtWidgets.QLabel(self.Endianess)
        self.E_big_label.setGeometry(QtCore.QRect(8, 95, 170, 17))
        self.E_big_label.setObjectName("E_big_label")

        # Endianess Tab -- Big Endian Files Found text
        self.E_big_textEdit = QtWidgets.QTextEdit(self.Endianess)
        self.E_big_textEdit.setGeometry(QtCore.QRect(180, 96, 70, 17))
        self.E_big_textEdit.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.E_big_textEdit.setAcceptRichText(False)
        self.E_big_textEdit.setObjectName("E_big_textEdit")

        # Endianess Tab -- Convert to Little button
        self.E_ctl_btn = QtWidgets.QPushButton(self.Endianess)
        self.E_ctl_btn.setGeometry(QtCore.QRect(261, 93, 120, 25))
        self.E_ctl_btn.setObjectName("E_ctl_btn")
        self.E_ctl_btn.setStyleSheet("""
                                                QPushButton{
                                                        background-color:rgb(98, 160, 234);;
                                                }
                                                QPushButton::hover{
                                                        background-color:green;
                                                }
                                                """)

        self.tabWidget.addTab(self.Endianess, "")


#############################################################################################################
        
        # LOG

        # Log Tab
        self.Log = QtWidgets.QWidget()
        self.Log.setObjectName("Log")

        # # Log Tab -- top buttons frame
        self.L_top_btns_frame = QtWidgets.QFrame(self.Log)
        self.L_top_btns_frame.setGeometry(QtCore.QRect(-2, 5, 721, 41))
        self.L_top_btns_frame.setFrameShape(QtWidgets.QFrame.Shape.StyledPanel)
        self.L_top_btns_frame.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
        self.L_top_btns_frame.setObjectName("top_btns_frame")

        # # Log Tab -- Display Messages frame
        self.L_display_frame = QtWidgets.QFrame(self.Log)
        self.L_display_frame.setGeometry(QtCore.QRect(-2, 53, 721, 41))
        self.L_display_frame.setFrameShape(QtWidgets.QFrame.Shape.StyledPanel)
        self.L_display_frame.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
        self.L_display_frame.setObjectName("L_display_frame")

        # Log Tab -- Print Update Dict button
        self.L_print_update_dict_btn = QtWidgets.QPushButton(self.Log)
        self.L_print_update_dict_btn.setGeometry(QtCore.QRect(350, 13, 141, 25))
        self.L_print_update_dict_btn.setObjectName("L_print_update_dict_btn")
        self.L_print_update_dict_btn.setStyleSheet("""
                                                QPushButton{
                                                        background-color:rgb(98, 160, 234);;
                                                }
                                                QPushButton::hover{
                                                        background-color:green;
                                                }
                                                """)

        # Log Tab -- Save Log File button
        self.L_save_log_file_btn = QtWidgets.QPushButton(self.Log)
        self.L_save_log_file_btn.setGeometry(QtCore.QRect(490, 13, 111, 25))
        self.L_save_log_file_btn.setObjectName("L_save_log_file_btn")
        self.L_save_log_file_btn.setStyleSheet("QPushButton::hover"
                                                "{"
                                                "background-color:green;"
                                                "}")

        # Log Tab -- Clear Logs button
        self.L_clear_logs_btn = QtWidgets.QPushButton(self.Log)
        self.L_clear_logs_btn.setGeometry(QtCore.QRect(600, 13, 101, 25))
        self.L_clear_logs_btn.setObjectName("L_clear_logs_btn")
        self.L_clear_logs_btn.setStyleSheet("QPushButton::hover"
                                            "{"
                                            "background-color:rgb(165, 29, 45);"
                                            "}")

        # Log Tab -- Display Messages label
        self.L_display_messages_for_label = QtWidgets.QLabel(self.Log)
        self.L_display_messages_for_label.setGeometry(QtCore.QRect(8, 65, 151, 17))
        self.L_display_messages_for_label.setObjectName("L_display_messages_for_label")

        # Log Tab -- All radio button
        self.L_all_rbtn = QtWidgets.QRadioButton(self.Log)
        self.L_all_rbtn.setGeometry(QtCore.QRect(170, 64, 41, 23))
        self.L_all_rbtn.setObjectName("L_all_rbtn")
        self.L_all_rbtn.setChecked(True)

        # Log Tab -- Header radio button
        self.L_header_rbtn = QtWidgets.QRadioButton(self.Log)
        self.L_header_rbtn.setGeometry(QtCore.QRect(220, 64, 71, 23))
        self.L_header_rbtn.setObjectName("L_header_rbtn")

        # Log Tab -- Timing radio button
        self.L_timing_rbtn = QtWidgets.QRadioButton(self.Log)
        self.L_timing_rbtn.setGeometry(QtCore.QRect(300, 64, 71, 23))
        self.L_timing_rbtn.setObjectName("L_timing_rbtn")
        
        # Log Tab -- Endian radio button
        self.L_endian_rbtn = QtWidgets.QRadioButton(self.Log)
        self.L_endian_rbtn.setGeometry(QtCore.QRect(380, 64, 71, 23))
        self.L_endian_rbtn.setObjectName("L_endian_rbtn")

        # Log Tab -- Log Message Window
        self.L_textBrowser = QtWidgets.QTextBrowser(self.Log)
        self.L_textBrowser.setGeometry(QtCore.QRect(30, 100, 661, 296))
        font = QtGui.QFont()
        font.setFamily("DejaVu Sans")
        self.L_textBrowser.setFont(font)
        self.L_textBrowser.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.L_textBrowser.setObjectName("L_textBrowser")

        
        self.tabWidget.addTab(self.Log, "")


#############################################################################################################

        # HELP

        # Help Tab
        self.Help = QtWidgets.QWidget()
        self.Help.setObjectName("Help")

        # Template Format popup window
        self.popup = QtWidgets.QMainWindow()
        self.popup.setWindowTitle("Template Format")
        self.popup.resize(750, 480)
        self.popup.setObjectName("popup")
        self.popup_textBrowser = QtWidgets.QTextBrowser(self.popup)
        self.popup_textBrowser.setGeometry(QtCore.QRect(26, 25, 700, 400))
        self.popup_textBrowser.setObjectName("textBrowser")
        self.done_btn = QtWidgets.QPushButton(self.popup)
        self.done_btn.setGeometry(QtCore.QRect(340, 440, 83, 25))
        self.done_btn.setObjectName("done_btn")
        self.done_btn.setStyleSheet("""
                                                QPushButton{
                                                        background-color:rgb(98, 160, 234);
                                                }
                                                QPushButton::hover{
                                                        background-color:rgb(165, 29, 45);
                                                }
                                                """)
        self.done_btn.clicked.connect(self.popup.close)
        self.popup.hide()

        # Help Tab - Template Format button
        self.H_template_format_btn = QtWidgets.QPushButton(self.Help)
        self.H_template_format_btn.setGeometry(QtCore.QRect(570, 10, 131, 25))
        self.H_template_format_btn.setObjectName("H_template_format_btn")
        self.H_template_format_btn.setStyleSheet("""
                                                QPushButton{
                                                        background-color:rgb(98, 160, 234);
                                                }
                                                QPushButton::hover{
                                                        background-color:green;
                                                }
                                                """)
        self.H_template_format_btn.clicked.connect(self.template_format_window)

        self.H_textBrowser = QtWidgets.QTextBrowser(self.Help)
        self.H_textBrowser.setGeometry(QtCore.QRect(30, 46, 661, 325))
        font = QtGui.QFont()
        font.setFamily("DejaVu Sans")
        self.H_textBrowser.setFont(font)
        self.H_textBrowser.setAcceptRichText(True)
        self.H_textBrowser.viewport().setProperty("cursor", QtGui.QCursor(QtCore.Qt.CursorShape.SizeVerCursor))
        self.H_textBrowser.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.H_textBrowser.setObjectName("H_textBrowser")

        self.tabWidget.addTab(self.Help, "")


#############################################################################################################

        # MSEED format

        # MSEED format Tab
        self.MSEEDformat = QtWidgets.QWidget()
        self.MSEEDformat.setObjectName("MSEEDformat")
        self.M_textBrowser = QtWidgets.QTextBrowser(self.MSEEDformat)
        self.M_textBrowser.setGeometry(QtCore.QRect(30, 30, 661, 341))
        font = QtGui.QFont()
        font.setFamily("DejaVu Sans")
        self.M_textBrowser.setFont(font)
        self.M_textBrowser.viewport().setProperty("cursor", QtGui.QCursor(QtCore.Qt.CursorShape.SizeVerCursor))
        self.M_textBrowser.setObjectName("M_textBrowser")
        self.tabWidget.addTab(self.MSEEDformat, "")
      


#############################################################################################################   



        # PopUp Help Check box
        self.checkBox = QtWidgets.QCheckBox(Window)
        self.checkBox.setGeometry(QtCore.QRect(10, 459, 101, 23))
        self.checkBox.setObjectName("checkBox")
        self.checkBox.setToolTip("Toggles 'PopUp Help' on and off")
        #self.checkBox.setChecked(True)
        self.checkBox.clicked.connect(self.click_help_popup)
        

#############################################################################################################   



        # calls retranslateUi

        self.retranslateUi(Window)
        self.tabWidget.setCurrentIndex(0)
        QtCore.QMetaObject.connectSlotsByName(Window)



#############################################################################################################


    def retranslateUi(self, Window):
        _translate = QtCore.QCoreApplication.translate
        Window.setWindowTitle(_translate("Window", "fixhdr " + VERSION))

        self.load_template_btn.setText(_translate("Window", "Load Template"))
        self.save_template_btn.setText(_translate("Window", "Save Template"))
        self.exit_btn.setText(_translate("Window", "Exit"))

        # Trace Headers Tab

        self.stat_chan.setText(_translate("Window", "Stat:Chan:Loc:Net:Sps:"))
        self.stat_name.setText(_translate("Window", "Station_name"))
        self.channel.setText(_translate("Window", "Channel"))
        self.loc_code.setText(_translate("Window", "Location_Code"))
        self.net_code.setText(_translate("Window", "Network_Code"))
        self.smpl_rt.setText(_translate("Window", "Sample_Rate"))
        self.new_val.setText(_translate("Window", "New Values"))
        self.applied.setText(_translate("Window", "Applied"))
        self.TH_list_traces_btn.setText(_translate("Window", "List Traces"))
        self.TH_dismiss_btn.setText(_translate("TH_popup", "Dismiss"))
        self.TH_clear_update_dictionary_btn.setText(_translate("Window", "Clear Update Dictionary"))
        self.TH_clear_current_btn.setText(_translate("Window", "Clear Current"))
        self.TH_modify_headers_btn.setText(_translate("Window", "Modify Headers"))
        self.TH_data_directories_label.setText(_translate("Window", "Data Directories:"))
        self.textEdit.setText(_translate("Window", "" + DIRECTORY))
        self.TH_fos_label.setText(_translate("Window", "Find only stations (colon separated list):"))
        self.TH_build_trace_btn.setText(_translate("Window", "Build Trace db"))
        self.TH_find_btn.setText(_translate("Window", "Find"))
        self.TH_clear_btn.setText(_translate("Window", "Clear"))
        self.TH_clear_2_btn.setText(_translate("Window", "Clear"))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.TraceHeaders), _translate("Window", "Trace Headers"))

        # Global Modify Tab
        self.GM_cdd_label.setText(_translate("Window", "Current Data Directories:"))
        self.GM_cdd_textEdit.setText(_translate("Window", "" + DIRECTORY))
        self.GM_for_headers_matching.setText(_translate("Window", "For Headers Matching:"))
        self.GM_sub_values.setText(_translate("Window", "Substitute Values:"))
        self.GM_stat_name.setText(_translate("Window", "Station_Name"))
        self.GM_channel.setText(_translate("Window", "Channel"))
        self.GM_loc_code.setText(_translate("Window", "Location_Code"))
        self.GM_net_code.setText(_translate("Window", "Network_Code"))
        self.GM_smpl_rt.setText(_translate("Window", "Sample_Rate"))
        self.GM_global_set_btn.setText(_translate("Window", "Global Set"))
        self.GM_clear_current_btn.setText(_translate("Window", "Clear Current"))
        self.GM_clear_update_dictionary_btn.setText(_translate("Window", "Clear Update Dictionary"))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.GlobalModify), _translate("Window", "Global Modify"))

        # Time Shift Tab
        self.TS_cdd_label.setText(_translate("Window", "Current Data Directories:"))
        self.TS_textEdit.setText(_translate("Window", "" + DIRECTORY))
        self.TS_ec_label.setText(_translate("Window", "How to Treat Existing Corrections:"))
        self.TS_add_to_rbtn.setText(_translate("Window", "Add To"))
        self.TS__replace_rbtn.setText(_translate("Window", "Replace"))
        self.TS_undo_tc_btn.setText(_translate("Window", "Undo Time Corrections"))

        self.TS_stat_loc_net.setText(_translate("Window", "Stat:Loc:Net"))
        self.TS_for_traces_matching.setText(_translate("Window", "For Traces Matching:"))
        self.TS_checkBox.setText(_translate("Window", "Wildcard Location Code"))
        self.TS_time_shift.setText(_translate("Window", "Time Shift:"))
        self.TS_start_time.setText(_translate("Window", "Start_Time"))
        self.TS_end_time.setText(_translate("Window", "End_Time"))
        self.TS_time_shift_sec.setText(_translate("Window", "Time_Shift_sec"))
        self.TS_tt_questionable.setText(_translate("Window", "Time Tag is questionable:"))
        self.TS_applied.setText(_translate("Window", "Applied"))

        self.TS_list_time_corrections_btn.setText(_translate("Window", "List Time Corrections"))
        self.TS_apply_time_correction_btn.setText(_translate("Window", "Apply Time Correction"))
        self.TS_time_set_btn.setText(_translate("Window", "Time Set"))
        self.TS_recalc_start_end_btn.setText(_translate("Window", "Recalc Start/End"))
        self.TS_clear_all_btn.setText(_translate("Window", "Clear All"))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.TimeShift), _translate("Window", "Time Shift"))

        # Endianess Tab
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.Endianess), _translate("Window", "Endianess"))
        self.E_cdd_textEdit.setText(_translate("Window", "" + DIRECTORY))
        self.E_cdd_label.setText(_translate("Window", "Current Data Directories:"))
        self.E_little_label.setText(_translate("Window", "Little Endian Files Found:"))
        self.E_big_label.setText(_translate("Window", "Big Endian Files Found:"))
        self.E_little_textEdit.setText(_translate("Window", "0"))
        self.E_big_textEdit.setText(_translate("Window", "0"))
        self.E_ctb_btn.setText(_translate("Window", "Convert to Big"))
        self.E_ctl_btn.setText(_translate("Window", "Convert to Little"))

        # Log Tab
        self.L_print_update_dict_btn.setText(_translate("Window", "Print Update Dict"))
        self.L_save_log_file_btn.setText(_translate("Window", "Save Log File"))
        self.L_clear_logs_btn.setText(_translate("Window", "Clear Logs"))
        self.L_display_messages_for_label.setText(_translate("Window", "Display messages for:"))
        self.L_all_rbtn.setText(_translate("Window", "All"))
        self.L_header_rbtn.setText(_translate("Window", "Header"))
        self.L_timing_rbtn.setText(_translate("Window", "Timing"))
        self.L_endian_rbtn.setText(_translate("Window", "Endian"))
        self.L_textBrowser.setText(_translate("Window", ""))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.Log), _translate("Window", "Log"))

        # Help Tab
        self.H_template_format_btn.setText(_translate("Window", "Template Format"))
        self.done_btn.setText(_translate("popup", "Done"))

        self.popup_textBrowser.setHtml(_translate("popup", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'Fira Sans Semi-Light\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">The Template file consists of two lists: <span style=\" color:#a51d2d;\">hdrlist</span> and <span style=\" color:#a51d2d;\">timelist</span>. </p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">These lists are delimmited by \'{}\'. Comments are allowed in the template file and are denoted by a \'#\' in the first column.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">For the <span style=\" color:#a51d2d;\">hdrlist</span> the columns are:</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">stat:chan:loc:net:sps    stat:chan:loc:net</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">For the <span style=\" color:#a51d2d;\">timelist</span> the columns are:</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">sta:loc:net    Start_time                  End_Time                    Shift(s)    Time_Tag          Corr_type</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">sta:loc:net    yyyy:ddd:hh:mm:ss    yyyy:ddd:hh:mm:ss    float/NA   set/unset/Na    add/replace/NA</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">EXAMPLE:</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#1a5fb4;\"> # Header Changes</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#1a5fb4;\"> # stat:chan:loc:net:sps     stat:chan:loc:net</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#1a5fb4;\"> hdrlist{</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#1a5fb4;\"> 01053:1C4::XX:40.0          SITE:BHZ::PI</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#1a5fb4;\"> 01053:1C5::XX:40.0          SITE:BHN::PI</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#1a5fb4;\"> 01053:1C6::XX:40.0          SITE:BHE::PI</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#1a5fb4;\"> }</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#1a5fb4;\">       </span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#1a5fb4;\"> # Timing Corrections</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#1a5fb4;\"> # sta:loc:net    Start_Time                  End_Time                   Shifts(s)    Time_Tag          Corr_Type               </span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#1a5fb4;\"> # sta:loc:net    yyyy:ddd:hh:mm:ss    yyyy:ddd:hh:mm:ss    float/NA    set/unset/NA    add/replace/Na</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#1a5fb4;\"> timelist{</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#1a5fb4;\">     9294::SS      2005:304:00:00:00    2005:305:22:15:10     0.56          set                    add</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#1a5fb4;\"> }</span></p></body></html>"))


        self.H_textBrowser.setHtml(_translate("Window", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'DejaVu Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#1c71d8;\">NAME</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">fixhdr - a GUI to modify mseed header fields (\'Station Name\',  \'Channel\', \'Location Code\', and \'Network Code\'), to apply time shifts and to convert header endianess.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#1c71d8;\">VERSION</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">2022.1.0.0</span></p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; color:#1c71d8;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#1c71d8;\">SYNOPSIS</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">fixhdr</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">fixhdr -#</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">fixhdr -h</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">fixhdr [-d DataDirs] [-m batch_file] [-t batch_file] [-e endianess]</span></p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; color:#1c71d8;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#1c71d8;\">OPTIONS</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">-# returns version number</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">-h returns usage</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">-d DataDirs colon separated list of data directories [default: cwd]</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">-m batch_file correct mseed headers in batch mode using batch_file</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">-t batch_file correct trace timing in batch mode using batch_file</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">-e endianess convert trace headers to endianess [big or little]</span></p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; color:#000000;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">NOTE: -m, -t, &amp; -e are mutually exclusive. If you wish to do both timing and headers, run time corrections fist.</span></p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; color:#1c71d8;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#1c71d8;\">DESCRIPTION</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">fixhdr has seven notebooks: </span><span style=\" color:#26a269;\">[Trace Headers]</span><span style=\" color:#000000;\">, </span><span style=\" color:#26a269;\">[Global Modify]</span><span style=\" color:#000000;\">, </span><span style=\" color:#26a269;\">[Time Shift]</span><span style=\" color:#000000;\">, </span><span style=\" color:#26a269;\">[Endianess]</span><span style=\" color:#000000;\">, </span><span style=\" color:#26a269;\">[Log]</span><span style=\" color:#000000;\">, </span><span style=\" color:#26a269;\">[Help]</span><span style=\" color:#000000;\">, and </span><span style=\" color:#26a269;\">[MSEED format]</span><span style=\" color:#000000;\">. </span><span style=\" color:#26a269;\">[Trace Headers]</span><span style=\" color:#000000;\"> and </span><span style=\" color:#26a269;\">[Global Modify]</span><span style=\" color:#000000;\"> provide a means to read and modify mseed header fields (station, channel, location code, and network code) for files found beneath a specified directory list. </span><span style=\" color:#26a269;\">[Time Shift]</span><span style=\" color:#000000;\"> allows the user to apply a bulk time shift to traces that fall between a start and end time and to set a header flag indicating that the time tag is questionable. </span><span style=\" color:#26a269;\">[Endianess] </span><span style=\" color:#000000;\">converts traces between little and big, or big and little endian headers. The </span><span style=\" color:#26a269;\">[Log]</span><span style=\" color:#000000;\"> notebook maintains records of key events.</span></p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; color:#000000;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#26a269;\">[Root window]</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">Buttons:</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#a51d2d;\">&lt;Load Template&gt;</span><span style=\" color:#000000;\">: loads a previously saved or user created mapping of header and timing modification that then can be applied.</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#a51d2d;\">&lt;Save Template&gt;</span><span style=\" color:#000000;\">: saves a map of all header and timing modifications.</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#a51d2d;\">&lt;Exit&gt;</span><span style=\" color:#000000;\">: Exits fixhdr and will query if not all mappings in Update_Dictionary have been applied.</span></p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; color:#000000;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#26a269;\">[Trace Headers]</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">General:</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">&gt;&gt; specify/load directories for header investigation/modifications</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">&gt;&gt; manipulate/edit individual &lt;sta&gt;&lt;chn&gt;&lt;loc&gt;&lt;net&gt; entries for loaded headers</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">&gt;&gt; modify trace headers as specified in the &quot;New Value&quot; column for _ALL_ loaded headers</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">&gt;&gt; store and recall header modification templates</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">Buttons:</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#a51d2d;\">&lt;Build Trace db&gt;</span><span style=\" color:#000000;\">: Searches the directories listed in the &quot;Data-Directories&quot; entry box (a colon separated list) and builds a list of mseed files found indexing them on unique values of &lt;sta&gt;&lt;chn&gt;&lt;loc&gt;&lt;net&gt;&lt;sps&gt;. You can narrow your search by entering stations in the &quot;Find Only Stations&quot; entry box (a colon separated file).</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#a51d2d;\">&lt;Find&gt;</span><span style=\" color:#000000;\">: Launches a file browser allowing the user to add directories to the &quot;Data Directories&quot; entry box. Double clicking selects the new directory.</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#a51d2d;\">&lt;Clear&gt;</span><span style=\" color:#000000;\">: Clears the &quot;Data Directories&quot; entry box.</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#a51d2d;\">&lt;List Traces&gt;</span><span style=\" color:#000000;\">: Lists all traces for the selected Sta:Chan:Loc:Net:Sps.</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#a51d2d;\">&lt;Modify Headers&gt;</span><span style=\" color:#000000;\">: Applies all current values in the Update_Dictionary (that can be viewed in the [Log] notebook) to the current trace list that was built using </span><span style=\" color:#a51d2d;\">&lt;Clear Current&gt;</span><span style=\" color:#000000;\">: clears all entries in the Update_Dictionary and display for the currently selected sta:chan:loc:net:sps that have not been applied.</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#a51d2d;\">&lt;Clear All&gt;</span><span style=\" color:#000000;\">: clears all entries in the Update_Dictionary that have not been applied.</span></p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; color:#000000;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#26a269;\">[Global Modify]</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">General:</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">&gt;&gt; specify header values in &quot;For Headers Matching:&quot; column, using drop-down menus. Wildcards are allowed and are the default.</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">&gt;&gt; enter new header values in &quot;Substitute Values:&quot;</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">Buttons:</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#a51d2d;\">&lt;Global Set&gt;</span><span style=\" color:#000000;\">: inserts the values in &quot;Substitute Values&quot; into the &quot;Update_Dictionary using For Headers Matching&quot; entries to determine which &lt;sta&gt;&lt;chn&gt;&lt;loc&gt;&lt;net&gt;&lt;sps&gt; to modify. This only creates entries in the dictionary and does NOT apply them to the mseed headers. You must use </span><span style=\" color:#26a269;\">[Trace Headers]</span><span style=\" color:#000000;\">-&gt;</span><span style=\" color:#a51d2d;\">&lt;Modify Headers&gt;</span><span style=\" color:#000000;\"> to apply these updates. </span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#a51d2d;\">&lt;Clear All&gt;</span><span style=\" color:#000000;\">: clears all current entries. This does not affect the Update_Dictionary.</span></p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; color:#000000;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#26a269;\">[Time Shift]</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">General:</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">&gt;&gt; specify header values in &quot;For Traces Matching:&quot; column, using drop-down menus. Once selected first and last sample times will be displayed. The start and end time can be changed.</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">&gt;&gt; enter time in seconds to be added to the blockette start times in then &quot;Time_Shift_sec&quot; window.</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">&gt;&gt;&quot;Time Tag is questionable&quot; allows you to flip a bit in the Data Quality flags in the mseed file\'s Fixed Section of Data Header</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">&gt;&gt; &quot;Applied&quot; indicators notify a user when corrections have been applied in this instance of fixhdr. </span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">Buttons:</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#a51d2d;\">&lt;How to Treat Existing Correction&gt;</span><span style=\" color:#000000;\">: you can choose to either add to any correction listed in the Fixed Header or Replace any existing correction with the one entered.</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#a51d2d;\">&lt;Undo Time Corrections&gt;</span><span style=\" color:#000000;\">: Allows user to un-apply previously applied timing corrections. Note: Use with caution. This will only remove single and cumulative corrections. Review \'List Time Corrections\' to better understand corrections already applied to trace headers.</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#a51d2d;\">&lt;List Time Corrections&gt;</span><span style=\" color:#000000;\">: Displays time corrections doe traces matching the selected Stat:Loc:Net key.</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#a51d2d;\">&lt;Apply Time Correction&gt;</span><span style=\" color:#000000;\">: Applies updates from &lt;List Time Corrections&gt;.</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#a51d2d;\">&lt;Time Set&gt;</span><span style=\" color:#000000;\">: Allows user to build a dictionary of timing corrections to be applied with the &quot;Apply Time Corrections&quot; button. ie. timing corrections for multiple Stat:Loc:Net selections can be set prior to applying in a single instance.</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#a51d2d;\">&lt;Recalc Start/End&gt;</span><span style=\" color:#000000;\">: resets the start and end times from the trace headers. The first time a trace is read in the start and end times are cached for future use. If you change these times, this button is used to update the cache and display.</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#a51d2d;\">&lt;Clear All&gt;</span><span style=\" color:#000000;\">: clears all current entries.</span></p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; color:#000000;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#26a269;\">[Endianess]</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">General:</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">&gt;&gt; displays the number of big and little endian files found. Allows user to convert between big and little endian headers.</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">Buttons:</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#a51d2d;\">&lt;Convert to Big&gt;</span><span style=\" color:#000000;\">: Converts header from little to big endian</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#a51d2d;\">&lt;Convert to Little&gt;</span><span style=\" color:#000000;\">: Converts headers from big to little endian</span></p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; color:#000000;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#26a269;\">[Log]</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">General:<br />&gt;&gt; displays key events (e.g. &quot;Build Trace db&quot;, &quot;Modify Headers&quot;, etc). Radio buttons allow you to select all log messages or window only those messages related to Header events, Time events, or changes in endianess.</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">Buttons:</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#a51d2d;\">&lt;Dump UpdateHdrDict&gt;</span><span style=\" color:#000000;\">: Dumps the current values in the Update_Dictionary and indicates whether or not they have been applied (i.e. &lt;Modify Headers&gt; has been run).</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#a51d2d;\">&lt;Save Log File&gt;</span><span style=\" color:#000000;\">: Saves text window to an output file.</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#a51d2d;\">&lt;Clear Log File&gt;</span><span style=\" color:#000000;\">: Clears text window and flushes buffer.</span></p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; color:#1c71d8;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#1c71d8;\">KEYWORDS</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">mseed; header information; header modification</span></p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; color:#1c71d8;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#1c71d8;\">SEE ALSO</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">mseedhdr &amp; SEED manual</span></p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; color:#1c71d8;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#1c71d8;\">AUTHOR</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#000000;\">Bruce Beaudoin &lt;bruce@passcal.nmt.edu&gt;</span></p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p></body></html>"))
        self.H_textBrowser.setPlaceholderText(_translate("Window", "Testing"))
        
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.Help), _translate("Window", "Help"))

        # MSEED format Tab
        self.M_textBrowser.setText(_translate("Window", """
        Appendix A From "SEED Reference Manual, v2.3, Feb. 1993:
        Channel Naming
        Contributed by Scott Halbert


        Seismologists have used many conventions for naming channels.
        Usually, these conventions are designed to meet the particular
        needs of one network. But general recording systems - such as the
        various Global Seismographic Network (GSN) systems that can
        record many channels at high sample rates - create a need for a
        standard to handle the variety of instruments that can be
        recorded. Modern instrumentation and the need for conformity
        among cooperating networks have greatly complicated the problem.
        Sensors are available in narrow band and broadband configurations
        with pass bands in very different parts of the spectrum of
        interest. Each sensor may have several different outputs with
        different spectral shaping. In addition, station processors often
        derive several data streams from one sensor channel by digital
        filtering. These possibilities require a comprehensive
        convention. The desire to combine data from cooperating networks
        and to search for like channels automatically requires
        standardization. The SEED format uses three letters to name
        seismic channels, and three letters to name weather or
        environmental channels. In the following convention, each letter
        describes one aspect of the instrumentation and its digitization.
        SEED does not require this convention, but we recommend it as a
        usage standard for Federation members to facilitate data
        exchange.

        Band Code
        The first letter specifies the general sampling rate and the
        response band of the instrument. (The "A" code is reserved for
        administrative functions such as miscellaneous state of health.)
                Band code   Band type                Sample rate (Hz)   Corner period (sec)
                E           Extremely Short Period   >= 80              < 10 sec
                S           Short Period             >= 10 to < 80      < 10 sec
                H           High Broad Band          >= 80              >= 10 sec
                B           Broad Band               >= 10 to < 80      >= 10 sec
                M           Mid Period               > 1 to < 10
                L           Long Period              ~ 1
                V           Very Long Period         ~ 0.1
                U           Ultra Long Period        ~ 0.01
                R           Extremely Long Period    ~ 0.001
                A           Administrative
                W           Weather/Environmental
                X           Experimental


        Instrument Code and Orientation Code
        The second letter specifies the family to which the sensor
        belongs. The third letter specifies the physical configuration of
        the members of a multiple axis instrument package or other
        parameters as specified for each instrument.

        Seismometer: Measures displacement/velocity/acceleration along a
        line defined by the dip and azimuth.
                Instrument Code
                H                 High Gain Seismometer
                L                 Low Gain Seismometer
                G                 Gravimeter
                M                 Mass Position Seismometer
                N*                 Accelerometer
                *historically some channels from accelerometers have used
                instrumentation codes of L and G. The use of N is the FDSN
                convention as defined in August 2000.
                Orientation Code
                Z N E              Traditional (Vertical, North-South, East-West)
                A B C              Triaxial (Along the edges of a cube turned up on a corner)
                T R                For formed beams (Transverse, Radial)
                1 2 3              Orthogonal components but non traditional orientations
                U V W              Optional components
                Dip/Azimuth:       Ground motion vector (reverse dip/azimuth
                        if signal polarity incorrect)
                Signal Units:      M, M/S, M/S**2, (for G & M) M/S**2 (usually)
                Channel Flags:     G

        Tilt Meter: Measures tilt from the horizontal plane. Azimuth is
        typically N/S or E/W.
                Instrument Code
                A
                Orientation Code
                N E                Traditional
                Dip/Azimuth:       Ground motion vector (reverse dip/azimuth
                        if signal polarity incorrect)
                Signal Units:      Radians
                Channel Flags:     G

        Creep Meter: Measures the absolute movement between two sides of
        a fault by means of fixing a metal beam on one side of the fault
        and measuring its position on the other side. This is also done
        with light beams.
        The orientation and therefore the dip and azimuth would be
        perpendicular to the measuring beam (light or metal), which would
        be along the average travel vector for the fault.
        Positive/Negative travel would be arbitrary, but would be noted
        in the dip/azimuth. Another type of Creep Meter involves using a
        wire that is stretched across the fault. Changes in wire length
        are triangulated to form movement vector.
                Instrument Code
                B
                Orientation Code
                Unknown
                Dip/Azimuth:       Along the fault or wire vector
                Signal Units:      M
                Channel Flags:     G

        Calibration Input: Usually only used for seismometers or other
        magnetic coil instruments. This signal monitors the input signal
        to the coil to be used in response evaluation. Usually tied to a
        specific instrument. Sometimes all instruments are calibrated
        together, sometimes horizontals are done separately from
        verticals.
                Instrument Code
                C
                Orientation Code
                A B C D... for when there are only a few cal sources for many devices.
                Blank if there is only one calibrator at a time or, Match
                Calibrated Channel (i.s. Z, N or E)

        Pressure: A barometer, or microbarometer measures pressure. Used
        to measure the weather pressure or sometimes for state of health
        monitoring down hole. This includes infrasonic and hydrophone
        measurements.
                Instrument Code
                D
                Orientation Code
                O                  Outside
                I                  Inside
                D                  Down Hole
                F                  Infrasound
                H                  Hydrophone
                U                  Underground
                Dip/Azimuth:       Not applicable - Should be zero.
                Signal Units:      Pa (Pascals)
                Channel Flags:     W or H

        Electronic Test Point: Used to monitor circuitry inside recording
        system, local power or seismometer. Usually for power supply
        voltages, or line voltages.
                Instrument Code
                E
                Orientation code
                Designate as desired, make mnemonic as possible, use numbers
                        for test points, etc.
                Dip/Azimuth:       Not applicableSignal Units: V, A, Hz, Etc.
                Channel Flags:     H

        Magnetometer: Measures the magnetic field where the instrument is
        sitting. They measure the part of the field vector which is
        aligned with the measurement coil. Many magnetometers are three
        axis. The instrument will typically be oriented to local magnetic
        north. The dip and azimuth should describe this in terms of the
        geographic north. Example: Local magnetic north is 13 degrees
        east of north in Albuquerque. So if the magnetometer is pointed
        to magnetic north, the azimuth would be + 103 for the E channel.
        Some magnetometers do not record any vector quantity associated
        with the signal, but record the total intensity. So, these would
        not have any dip/azimuth.
                Instrument Code
                F
                Orientation Code
                Z N E              Magnetic
                Signal Units:      T - Teslas
                Channel Flags:     G

        Humidity: Absolute/Relative measurements of the humidity.
        Temperature recordings may also be essential for meaningful
        results.
                Instrument Code
                I
                Orientation Code
                O                  Outside Environment
                I                  Inside Building
                D                  Down Hole
                1 2 3 4            Cabinet Sources
                All other letters available for mnemonic source types.
                Dip/Azimuth:       Not applicable - Should be zero.
                Signal Units:      %
                Channel Flags:     W

        Temperature: Measurement of the temperature at some location.
        Typically used for measuring:
        1. Weather - Outside Temperature
        2. State of Health - Inside recording building
        - Down hole
        - Inside electronics
                Instrument Code
                K
                Orientation Code
                O                  Outside Environment
                I                  Inside Building
                D                  Down Hole
                1 2 3 4            Cabinet sources
                All other letters available for mnemonic types.
                Dip Azimuth:       Not applicable - Should be zero.
                Signal Units:      deg C or deg K
                Channel Flags:     W or H

        Water Current: This measurement measures the velocity of water in
        a given direction. The measurement may be at depth, within a
        borehole, or a variety of other locations.
                Instrument Code
                O
                Orientation Code
                Unknown
                Dip/Azimuth:       Along current direction
                Signal Units:      M/S
                Channel Flags:     G

        Geophone: Very short period seismometer, with natural frequency 5
        - 10 Hz or higher.
                Instrument Code
                P
                Orientation Code
                Z N E              Traditional
                Dip/Azimuth:       Ground Motion Vector (Reverse dip/azimuth
                        if signal polarity incorrect)
                Signal Units:      M, M/S, M/S
                Channel Flags:     G

        Electric Potential: Measures the Electric Potential between two
        points. This is normally done using a high impedance voltmeter
        connected to two electrodes driven into the ground. In the case
        of magnetotelleuric work, this is one parameter that must be
        measured.
                Instrument Code
                Q
                Orientation Code
                Unknown
                Signal Units:      V - Volts
                Channel Flags:     G

        Rainfall: Measures total rainfall, or an amount per sampling
        interval.
                Instrument Code
                R
                Orientation Code
                Unknown
                Dip/Azimuth:       Not applicable - Should be zero.
                Signal Units:      M, M/S
                Channel Flags:     W

        Linear Strain: One typical application is to build a very
        sensitive displacement measuring device, typically a long quartz
        rod. One end is affixed to a wall. On the free end, a pylon from
        the floor reaches up to the rod where something measures the
        position of the pylon on the rod (like a large LVDT). There are
        also some interferometry projects which measure distance with
        lasers. Dip/Azimuth are the line of the movement being measured.
        Positive values are obtained when stress/distance increases,
        negative, when they decrease.
                Instrument Code
                S
                Orientation Code
                Z N E Vertical,    North-South, East-West
                Dip/Azimuth:       Along axis of instrument
                Signal Units:      M/M
                Channel Flags:     G

        Tide : Not to be confused with lunar tidal filters or gravimeter
        output. Tide instruments measure the depth of the water at the
        monitoring site.
                Instrument Code
                T
                Orientation Code
                Z                  Always vertical
                Dip/Azimuth:       Always vertical
                Signal Units:      M - Relative to sea level or local ocean depth
                Channel Flags:     G

        Bolometer: Infrared instrument used to evaluate average cloud
        cover. Used in astronomy to determine observability of sky.
                Instrument Code
                U
                Orientation Code
                Unknown
                Dip/Azimuth:       Not applicable - Should be zero.
                . Signal Units:    Unknown
                Channel Flags:     W

        Volumetric Strain: Unknown
                Instrument Code
                V
                Orientation Code
                Unknown
                Dip/Azimuth:       Not Applicable - Should be zero.
                Signal Units:      M**3/M**3
                Channel Flags:     G

        Wind: Measures the wind vector or velocity. Normal notion of dip
        and azimuth does not apply.
                Instrument Code
                W
                Orientation Code
                S                  Wind speed
                D                  Wind Direction Vector - Relative to geographic North
                Dip/Azimuth:       Not Applicable - Should be zero.
                Channel Flags:     W

        Synthesized Beams: This is used when forming beams from
        individual elements of an array. Refer to blockettes 35, 400, &
        405.
                Instrument Code
                Z
                Orientation Code
                I                  Incoherent Beam
                C                  Coherent Beam
                F                  FK Beam
                O                  Origin Beam
                Dip/Azimuth:       Ground motion vector (reverse dip/azimuth
                        if signal polarity incorrect)
                Signal Units:      M, M/S, M/S**2, (for G & M) M/S**2 (usually)
                Channel Flags:     G


        Channel Code
        We suggest that two sequences be reserved for special channels
        the "LOG" channel for the console log, and the "SOH" channel for
        the main state of health channel. Subsidiary logs and state of
        health channels should begin with the "A" code; the source and
        orientation fields can then be used in any way.

        Here are some typical channel arrangements used by a GSN system:
                Channel       Description
                EHZ/EHN/EHE   Short Period 100 sps
                BHZ/BHN/BHE   Broad Band 20 sps
                LHZ/LHN/LHE   Long Period 1 sps
                VHZ/VHN/VHE   Very Long Period 0.1 sps
                BCI           Broad Band Calibration Signal
                ECI           Short Period Cal
                LOG           Console Log

        NOTE: Log Records: Log records has a channel identifier code of
        "LOG" and a sample rate of zero. The number of samples field is
        the number of characters in the record (including the carriage
        return and line feed that terminates each line). Log messages are
        packed into records until a message falls into a new minute. Log
        records have no blockettes, so the strings start at offset
        48.
        """))

        self.tabWidget.setTabText(self.tabWidget.indexOf(self.MSEEDformat), _translate("Window", "MSEED format"))
        
        # PopUp Help Checkbox 
        self.checkBox.setText(_translate("Window", "PopUp Help"))


#############################################################################################################

    # function for quit button
    def click_quit(self):
            quit() 



    # function for what happens when PopUp Help is checked/unchecked
    def click_help_popup(self):
            toggle = self.checkBox.isChecked()
            
            # if checked, tool tips are visible
            if toggle == True:

                self.load_template_btn.setToolTip("Import saved header &\n"
                                                "timing corrections file")
                self.save_template_btn.setToolTip("Export saved header & timing corrections to file")
                self.exit_btn.setToolTip("Exit program")
                self.TH_data_directories_label.setToolTip("Search path(s) for finding mseed files.\n"
                                                        "Colon separate multiple entries.")
                self.TH_build_trace_btn.setToolTip("Build a trace db using\n"
                                                "'Data Directories' as\n"
                                                "top level directories")
                self.TH_find_btn.setToolTip("Dialogue window to\n"
                                                "select Data Directories")
                self.TH_clear_btn.setToolTip("Clears 'Data Directories' entry")
                self.TH_clear_2_btn.setToolTip("Clear station filter")
                self.fos_textEdit.setToolTip("Filter trace search\n"
                                                "for these stations")
                self.TH_list_traces_btn.setToolTip("List traces for selected Stat:Chan:Loc:Net:Sps")
                self.TH_clear_update_dictionary_btn.setToolTip("Clear all updates in 'Update Dictionary'")
                self.TH_clear_current_btn.setToolTip("Clears entries in 'Update Dictionary' for selected Stat:Chan:Loc:Net:Sps")
                self.TH_modify_headers_btn.setToolTip("Modifies headers using current entries and all entries in 'Update Dictionary'")
                self.GM_cdd_label.setToolTip("Traces located beneath these directories")
                self.GM_global_set_btn.setToolTip("Add current entries to 'Update Dictionary'")
                self.GM_clear_current_btn.setToolTip("Clears all current entries")
                self.GM_clear_update_dictionary_btn.setToolTip("Clear all entries in 'Update Dictionary'")
                self.TS_cdd_label.setToolTip("Traces located beneath these\n"
                                                "directories")
                self.TS_ec_label.setToolTip("When applying time corrections:\n"
                                                "Add to existing or\n"
                                                "Zero and replace existing")
                self.TS_undo_tc_btn.setToolTip("Reverse applied time corrections")
                self.TS_list_time_corrections_btn.setToolTip("List time corrections currently in trace headers for for select Stat:Loc:Net")
                self.TS_apply_time_correction_btn.setToolTip("Modifies trace times using using current entries and all entries in 'Update Dictionary'")
                self.TS_time_set_btn.setToolTip("Add current entries to 'Update Dictionary'")
                self.TS_recalc_start_end_btn.setToolTip("Recalculate start and end times for selected traces")
                self.TS_clear_all_btn.setToolTip("Clears all current entries")
                self.E_cdd_label.setToolTip("Traces located beneath these directories")
                self.E_ctb_btn.setToolTip("Convert all little endian files\n"
                                                "to big endian")
                self.E_ctl_btn.setToolTip("Convert all big endian files\n"
                                        "to little endian")
                self.L_print_update_dict_btn.setToolTip("Print 'Update Dictionary' to log message window")
                self.L_save_log_file_btn.setToolTip("Save log messages to file")
                self.L_clear_logs_btn.setToolTip("Delete all log messages")
                self.L_display_messages_for_label.setToolTip("Filter log messages")
                self.H_template_format_btn.setToolTip("Display example format for 'Template' file")
                self.checkBox.setToolTip("Toggles 'PopUp Help' on and off")

            # if unchecked, tool tips are invisible
            if toggle == False:

                self.load_template_btn.setToolTip("")
                self.save_template_btn.setToolTip("")
                self.exit_btn.setToolTip("")
                self.TH_data_directories_label.setToolTip("")
                self.TH_build_trace_btn.setToolTip("")
                self.TH_find_btn.setToolTip("")
                self.TH_clear_btn.setToolTip("")
                self.TH_clear_2_btn.setToolTip("")
                self.fos_textEdit.setToolTip("")
                self.TH_list_traces_btn.setToolTip("")
                self.TH_clear_update_dictionary_btn.setToolTip("")
                self.TH_clear_current_btn.setToolTip("")
                self.TH_modify_headers_btn.setToolTip("")
                self.GM_cdd_label.setToolTip("")
                self.GM_global_set_btn.setToolTip("")
                self.GM_clear_current_btn.setToolTip("")
                self.GM_clear_update_dictionary_btn.setToolTip("")
                self.TS_cdd_label.setToolTip("")
                self.TS_ec_label.setToolTip("")
                self.TS_undo_tc_btn.setToolTip("")
                self.TS_list_time_corrections_btn.setToolTip("")
                self.TS_apply_time_correction_btn.setToolTip("")
                self.TS_time_set_btn.setToolTip("")
                self.TS_recalc_start_end_btn.setToolTip("")
                self.TS_clear_all_btn.setToolTip("")
                self.E_cdd_label.setToolTip("")
                self.E_ctb_btn.setToolTip("")
                self.E_ctl_btn.setToolTip("")
                self.L_print_update_dict_btn.setToolTip("")
                self.L_save_log_file_btn.setToolTip("")
                self.L_clear_logs_btn.setToolTip("")
                self.L_display_messages_for_label.setToolTip("")
                self.H_template_format_btn.setToolTip("")
                self.checkBox.setToolTip("")



    # function for clear button in TRACE HEADERS
    def click_TH_clear(self):
            _translate = QtCore.QCoreApplication.translate
            # clears all directory textEdits in TRACE HEADERS,
            # GLOBAL MODIFY, TIME SHIFT, and ENDIANESS
            self.textEdit.setText(_translate("Window", ""))
            self.GM_cdd_textEdit.setText(_translate("Window", ""))
            self.TS_textEdit.setText(_translate("Window", ""))
            self.E_cdd_textEdit.setText(_translate("Window", ""))



    # function for 2nd clear button in TRACE HEADERS
    def click_TH_clear_2(self):
            _translate = QtCore.QCoreApplication.translate
            # clears stations
            self.fos_textEdit.setText(_translate("Window", ""))



    # function for pop up Template Format window in HELP
    def template_format_window(self):
            self.popup.show()



    # function for file dialogue/choosing directory to search for mseed files
    def file_dialogue(self):

            # set timezone to UTC
            os.environ['TZ'] = 'GMT'
            time.tzname = ('GMT', 'GMT')
            time.timezone = 0

            # TODO: MAKE IT LIST MULTIPLE DIRECTORIES
            self.search = QtWidgets.QFileDialog.getExistingDirectory()

            # if the user doesn't cancel the file directory popup:
            # updates directory in Trace Headers, Global Modify, Time Shift,
            # and Endianess
            if (self.search != ""):
                _translate = QtCore.QCoreApplication.translate

                # adds newly selected directory to Trace Headers
                self.textEdit.setText(_translate("Window", "" + self.search))
                # updates the other textEdits in Global Modify, Time Shift, and Endianess
                self.GM_cdd_textEdit.setText(_translate("Window", "" + self.search))
                self.TS_textEdit.setText(_translate("Window", "" + self.search))
                self.E_cdd_textEdit.setText(_translate("Window", "" + self.search))

                # scans chosen directory for mseed files
                # NOTE: it's set to identify an mseed file if it ends in '.312'
                #       I'm not sure if this is true -- fix if false
                dir = os.scandir(self.search)
                for entry in dir:
                        if entry.is_file():
                                if entry.name.endswith('.312'):
                                        print(entry.name)
                                        
                                        



    # function for what happens when the button List Traces
    # is clicked in TRACE HEADERS
    def click_list_traces(self):
            self.TH_popup.show()



    # function for what happens when the button Build Traces
    # is clicked in TRACE HEADERS
    def click_build_trace(self):
            self.frame.show()
            self.stat_chan.show()
            self.stat_name.show()
            self.channel.show()
            self.loc_code.show()
            self.net_code.show()
            self.smpl_rt.show()
            self.new_val.show()
            self.textEdit1.show()
            self.textEdit2.show()
            self.textEdit3.show()
            self.textEdit4.show()
            self.textEdit5.show()
            self.textEdit6.show()
            self.new_val.show()
            self.nv_textEdit1.show()
            self.nv_textEdit2.show()
            self.nv_textEdit3.show()
            self.nv_textEdit4.show()
            self.applied.show()
            self.GM_h_frame.show()
            self.GM_for_headers_matching.show()
            self.GM_sub_values.show()
            self.GM_stat_name.show()
            self.GM_channel.show()
            self.GM_loc_code.show()
            self.GM_net_code.show()
            self.GM_smpl_rt.show()
            self.GM_textEdit1.show()
            self.GM_textEdit2.show()
            self.GM_textEdit3.show()
            self.GM_textEdit4.show()
            self.GM_textEdit5.show()
            self.GM_textEdit6.show()
            self.GM_textEdit7.show()
            self.GM_textEdit8.show()
            self.GM_textEdit9.show()
            self.TS_frame.show()
            self.TS_stat_loc_net.show()
            self.TS_for_traces_matching.show()
            self.TS_textEdit1.show()
            self.TS_checkBox.show()
            self.TS_time_shift.show()
            self.TS_start_time.show()
            self.TS_end_time.show()
            self.TS_time_shift_sec.show()
            self.TS_tt_questionable.show()
            self.TS_textEdit2.show()
            self.TS_textEdit3.show()
            self.TS_textEdit4.show()
            self.TS_textEdit5.show()
            self.TS_applied.show()



#############################################################################################################



if __name__ == "__main__":
    app = QtWidgets.QApplication(sys.argv)
    Window = QtWidgets.QWidget()
    ui = Ui_Window()
    ui.setupUi(Window)
    Window.show()
    sys.exit(app.exec())