def __init__(self, *args, **kwargs):
        self.app = QApplication(sys.argv)
        super().__init__(*args, **kwargs)

        # Some good colors:
        # #afbcc6, #b9afc6, #afb0c6
        self.title = "Equation Database"
        self.left = WINDOW_LEFT_START
        # self.left = 0
        self.top = WINDOW_TOP_START
        self.height = WINDOW_HEIGHT
        self.width = int(self.height * golden_ratio)

        # region ToolBar
        self.toolbar = self.addToolBar('Save')
        self.toolbar.setIconSize(QSize(128, 128))

        save_action = QAction(QIcon('Icons/save_button_256x256.png'), '&Save', self)
        save_action.setShortcut('Ctrl+S')
        save_action.setStatusTip('Save Equation Group')

        analyze_action = QAction(QIcon('Icons/analyze_cog_512x512.png'), '&Analyze', self)
        analyze_action.setShortcut('Alt+A')
        analyze_action.setStatusTip('Analyze Equation Group')

        new_eqn_action = QAction(QIcon('Icons/sigma_icon_256x256.png'), '&New Equation', self)
        new_eqn_action.setShortcut('Ctrl+N')
        new_eqn_action.setStatusTip('New Equation')

        new_eqn_group_action = QAction(QIcon('Icons/new_eq_group_1000x1000.png'), '&New Equation Group', self)
        new_eqn_group_action.setShortcut('Alt+N')
        new_eqn_group_action.setStatusTip('New Equation Group')
        new_eqn_group_action.triggered.connect(self.new_equation_group)

        eqn_group_info_action = QAction(QIcon('Icons/info_icon256x256.png'), '&Equation Group Information', self)
        eqn_group_info_action.setShortcut('Alt+I')
        eqn_group_info_action.setStatusTip('Equation Group Information')

        self.toolbar.addAction(save_action)
        self.toolbar.addAction(new_eqn_action)
        empty1 = QWidget(self.toolbar)
        ew: int = 50  # pylint: disable=invalid-name
        empty1.setFixedWidth(ew)
        empty2 = QWidget(self.toolbar)
        empty2.setFixedWidth(ew)
        self.toolbar.addWidget(empty1)
        self.toolbar.addSeparator()
        self.toolbar.addWidget(empty2)
        self.toolbar.addAction(new_eqn_group_action)
        self.toolbar.addAction(analyze_action)
        self.toolbar.addAction(eqn_group_info_action)

        # endregion
        t_log = TimeLogger()

        verbose = True
        my_conn = my_connect(t_log=t_log, verbose=verbose)
        self.my_conn = my_conn

        t_log.new_event("Start Gui Build: ")

        # region Equation Group - Left Frame
        # -----------------------------------------------------------------------------------------------------------
        self.eq_group_gbox = QGroupBox("Equation Group")
        self.eq_group_gbox.setMinimumWidth(200)
        self.eq_group_v_layout = QVBoxLayout(self.eq_group_gbox)
        self.eq_group_v_layout.setSpacing(5)

        self.eq_group_cbox = QComboBox(self.eq_group_gbox)
        self.eq_group_cbox.activated.connect(self.populate_equation_listbox)

        self.eq_group_v_layout.addWidget(self.eq_group_cbox)

        self.analyze_frame = QFrame(self.eq_group_gbox)
        self.analyze_h_layout = QHBoxLayout(self.analyze_frame)
        self.analyze_h_layout.setContentsMargins(10, 0, 10, 15)
        size_policy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)
        self.analyze_frame.setSizePolicy(size_policy)

        self.equation_filter_list = EDFilterListWidget(self.eq_group_gbox)
        self.equation_listbox = self.equation_filter_list.list
        # self.equation_listbox = QListWidget(self.eq_group_gbox)
        self.equation_listbox.setSelectionBehavior(QAbstractItemView.SelectItems)
        self.equation_listbox.setSelectionMode(QAbstractItemView.ExtendedSelection)
        self.equation_listbox.selectionModel().selectionChanged.connect(self.select_one_equation)
        self.equation_filter_list.add.connect(self.add_equation)
        self.equation_filter_list.remove.connect(self.remove_equation)

        self.eq_group_v_layout.addWidget(self.equation_filter_list)
        # endregion

        # region Equation Details - Right Frame
        # -----------------------------------------------------------------------------------------------------------
        self.eq_details_gbox = QGroupBox("Equation Details")  # Entire encapsulating Gbox
        self.eq_details_v_layout = QVBoxLayout(self.eq_details_gbox)

        # region Equation Header added to Equation Details
        # **********************************************************
        self.eq_header_frame = QFrame()
        size_policy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)
        self.eq_header_frame.setSizePolicy(size_policy)
        self.eq_header_g_layout = QGridLayout(self.eq_header_frame)
        self.eq_details_v_layout.addWidget(self.eq_header_frame)

        self.name_label = QLabel("Equation Name")
        self.name_l_edit = QLineEdit()
        self.eq_header_g_layout.addWidget(self.name_label, 0, 0)
        self.eq_header_g_layout.addWidget(self.name_l_edit, 0, 1)

        self.codefile_label = QLabel("Code File")
        self.codefile_l_edit = QLineEdit()
        self.eq_header_g_layout.addWidget(self.codefile_label, 1, 0)
        self.eq_header_g_layout.addWidget(self.codefile_l_edit, 1, 1)

        self.type_label = QLabel("Type")
        self.type_cbox = QComboBox()
        self.type_cbox.setMinimumWidth(700)
        self.eq_header_g_layout.addWidget(self.type_label, 0, 2)
        self.eq_header_g_layout.addWidget(self.type_cbox, 0, 3)

        self.associated_eq_groups_btn = EquationButton("Associated Eq Groups")
        self.eq_header_g_layout.addWidget(self.associated_eq_groups_btn, 1, 3)
        self.eq_header_g_layout.setAlignment(self.associated_eq_groups_btn, Qt.AlignLeft)
        self.details_btn = EquationButton("Other Details")
        self.eq_header_g_layout.addWidget(self.details_btn, 1, 3)
        self.eq_header_g_layout.setAlignment(self.details_btn, Qt.AlignRight)
        # endregion

        # region LaTeX added to Equation Details
        # **********************************************************

        self.latex_gbox = QGroupBox("LaTeX")
        size_policy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.latex_gbox.setSizePolicy(size_policy)
        self.latex_v_layout = QVBoxLayout(self.latex_gbox)

        # This would be great for when one wants to filter content based on what is being typed
        # self.latex_textbox.textChanged.connect(self.update_latex_image)

        self.latex_graphicbox = QGraphicsView(self.latex_gbox)
        self.scene = QGraphicsScene()
        self.latex_graphicbox.setScene(self.scene)
        # self.latex_graphicbox.setMinimumSize(QSize(907, 369))

        self.latex_textbox = LaTexTextEdit(my_conn=my_conn, parent=self.latex_gbox, t_log=t_log, scene=self.scene,
                                           graphics_view=self.latex_graphicbox, verbose=verbose)

        self.latex_splitter = Customsplitter(Qt.Vertical)  # Note Handle for a vert splitter is oriented Horizontally
        self.latex_splitter.addWidget(self.latex_textbox)
        self.latex_splitter.addWidget(self.latex_graphicbox)
        self.latex_v_layout.addWidget(self.latex_splitter)

        self.latex_btn_frame = QFrame()
        size_policy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)
        self.latex_btn_frame.setSizePolicy(size_policy)
        self.latex_btn_h_layout = QHBoxLayout(self.latex_btn_frame)
        self.latex_btn_h_layout.setContentsMargins(0, 0, 1, 10)
        self.latex_template_btn = EquationButton("Template")
        self.latex_update_btn = EquationButton("Update")
        h_spacer = QSpacerItem(20, 40, QSizePolicy.MinimumExpanding, QSizePolicy.Expanding)
        self.latex_btn_h_layout.addWidget(self.latex_template_btn)
        self.latex_btn_h_layout.addItem(h_spacer)
        self.latex_btn_h_layout.addWidget(self.latex_update_btn)
        self.latex_v_layout.addWidget(self.latex_btn_frame)

        # endregion

        # region Variables Notes
        self.var_notes_frame = QFrame(self.eq_details_gbox)
        self.var_notes_v_layout = QVBoxLayout(self.var_notes_frame)
        # self.var_notes_frame.setLayout(self.var_notes_v_layout)

        self.variables_gbox = QGroupBox("Variables")
        self.variables_v_layout = QVBoxLayout(self.variables_gbox)
        self.variables_v_layout.setSpacing(5)
        # self.variables_gbox.setLayout(self.var_notes_v_layout)
        self.variables_tbl = QTableWidget(self.variables_gbox)
        self.variables_v_layout.addWidget(self.variables_tbl)

        self.var_add_btn = QPushButton("+")
        self.var_add_btn.setObjectName("add_rm_btn")
        ar_w = 50
        self.var_add_btn.setFixedSize(QSize(ar_w, int(ar_w)))
        self.var_add_btn.clicked.connect(self.add_variable)

        self.var_rm_btn = QPushButton("-")
        self.var_rm_btn.setObjectName("add_rm_btn")
        self.var_rm_btn.clicked.connect(self.remove_variable)
        self.var_rm_btn.setFixedSize(QSize(ar_w, int(ar_w)))

        self.var_add_rm_frame = QFrame(self.variables_gbox)
        size_policy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)
        self.var_add_rm_frame.setSizePolicy(size_policy)
        self.var_add_rm_h_layout = QHBoxLayout(self.var_add_rm_frame)
        self.var_add_rm_h_layout.setSpacing(2)
        h_spacer = QSpacerItem(20, 40, QSizePolicy.MinimumExpanding, QSizePolicy.Expanding)
        self.var_add_rm_h_layout.addItem(h_spacer)
        self.var_add_rm_h_layout.addWidget(self.var_add_btn)
        self.var_add_rm_h_layout.addWidget(self.var_rm_btn)
        self.variables_v_layout.addWidget(self.var_add_rm_frame)

        self.notes_gbox = QGroupBox("Notes")
        self.notes_v_layout = QVBoxLayout(self.notes_gbox)
        # self.notes_gbox.setLayout(self.notes_v_layout)
        self.notes_textbox = QTextEdit(self.notes_gbox)
        self.notes_v_layout.addWidget(self.notes_textbox)

        self.notes_btn_frame = QFrame()
        size_policy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)
        self.notes_btn_frame.setSizePolicy(size_policy)
        self.notes_btn_h_layout = QHBoxLayout(self.notes_btn_frame)
        self.notes_btn_h_layout.setContentsMargins(0, 0, 1, 10)
        self.notes_update_btn = EquationButton("Update")
        h_spacer = QSpacerItem(20, 40, QSizePolicy.MinimumExpanding, QSizePolicy.Expanding)
        self.notes_btn_h_layout.addItem(h_spacer)
        self.notes_btn_h_layout.addWidget(self.notes_update_btn)
        self.notes_v_layout.addWidget(self.notes_btn_frame)

        self.var_notes_vsplt = Customsplitter(Qt.Vertical)
        self.var_notes_vsplt.addWidget(self.variables_gbox)
        self.var_notes_vsplt.addWidget(self.notes_gbox)
        self.var_notes_v_layout.addWidget(self.var_notes_vsplt)

        # endregion

        self.detail_v_splitter = Customsplitter()
        self.detail_v_splitter.addWidget(self.latex_gbox)
        self.detail_v_splitter.addWidget(self.var_notes_frame)
        self.detail_v_splitter.setSizes([int(self.width * 0.7 * 0.5), int(self.width * 0.7 * 0.5)])
        self.eq_details_v_layout.addWidget(self.detail_v_splitter)

        # endregion

        # region Main Splitter splits the equation groups list view from the details view
        # -----------------------------------------------------------------------------------------------------------
        self.main_splitter = Customsplitter()
        self.main_splitter.addWidget(self.eq_group_gbox)
        self.main_splitter.addWidget(self.eq_details_gbox)
        self.main_splitter.setSizes([int(self.width * 0.3), int(self.width * 0.7)])
        # endregion

        # region Main Window Creation
        self.main_frame = QFrame()
        self.main_layout = QVBoxLayout(self.main_frame)
        self.main_layout.addWidget(self.main_splitter)

        self.setCentralWidget(self.main_frame)

        self.setGeometry(self.left, self.top, self.width, self.height)

        self.setWindowTitle(self.title)
        app_icon = QIcon("Icons/sigma_icon.png")
        self.setWindowIcon(app_icon)
        self.app.setStyle('Oxygen')
        # endregion

        # region Data members

        t_log.new_event("End GUI Build")

        self.state_data = dict()
        # t_log.new_event("Equation Group Load")
        self.eqn_grp = EquationGroup(my_conn=my_conn, t_log=t_log, verbose=verbose)
        self.eq = GroupedEquations(my_conn=my_conn, t_log=t_log, verbose=verbose)
        self.var = GroupedVariables(my_conn=my_conn, t_log=t_log, verbose=verbose)
        self.unit = Unit(my_conn=my_conn, t_log=t_log, verbose=verbose)
        self.eq_type = TypeTable(name='equation_type', my_conn=my_conn, t_log=t_log, verbose=verbose)
        self.var_type = TypeTable(name='variable_type', my_conn=my_conn, t_log=t_log, verbose=verbose)
        self.unit_type = TypeTable(name='unit_type', my_conn=my_conn, t_log=t_log, verbose=verbose)

        t_log.new_event("Data Finished Loading")

        self.eq_grp_id: int = 1  # Can envision it pulling user specified state information someday
        self.eqn_records_for_eqn_group = None  # Gets Populated when equations are present
        self.eq_id: tuple = (1,)  # Same comment as eq_grp_id
        self.var_records_for_eqns = None  # Gets populated when eqn_group_gets selected
        self.selected_equation = None  # Stores the selected equation
        self.latex_textbox.db_ref = self.eq
        self.equation_taken: bool = False

        t_log.new_event("Populating Boxes")
        self.refresh_eqn_group_combo_box()
        self.populate_equation_listbox()
        t_log.new_event("Populating Boxes")
        self.app.setStyleSheet(open('equation_db.css').read())
        t_log.new_event("Finished Style Sheet")
        print()
        print('Total Time: ', t_log.total_time())
from equation_dialog import EquationDialog
from equations import GroupedEquations  # , EquationRecord
from variables import GroupedVariables, GroupedVariableRecord
from variable_dialog import VariableDialog
from CustomWidgets.filter_list_widget import EDFilterListWidget
from unit import Unit
from type_table import TypeTable
from time_logging import TimeLogger

WINDOW_LEFT_START = 300
WINDOW_TOP_START = 300
WINDOW_HEIGHT = 1500

if platform.system() == "Windows":
    outer_log = TimeLogger()
    outer_log.new_event('Starting Windows Stuff: ')

    displays = screeninfo.get_monitors()

    if len(displays) == 2:
        WINDOW_LEFT_START = 3200
        WINDOW_TOP_START = 25
        WINDOW_HEIGHT = 900
    elif len(displays) == 3:
        my_mon = displays[2]
        WINDOW_LEFT_START = my_mon.x + int(my_mon.width / 20)
        WINDOW_TOP_START = 300
        WINDOW_HEIGHT = 1500

    # for item in obj:
    #     if item.Name == 'Dell S2240T(HDMI)':