import os
from PyQt6 import QtWidgets
from LowLevelWidgetsPackage import defaultConfigForWidgets 
from LowLevelWidgetsPackage.SerialMonitorPackage.SerialMonitorGUI import Ui_SerialMonitor as GUI_Form
log = defaultConfigForWidgets.LOGGER("ALL") #just default values Will be overwritten by main program Relay8Class is called
signal = defaultConfigForWidgets.SIGNALS() #just default values Will be overwritten by main program when Relay8Class is called

class SerialMonitorClass(QtWidgets.QWidget):
    def __init__(self,signals:defaultConfigForWidgets.SIGNALS = signal,log:defaultConfigForWidgets.LOGGER = log,*args, **kwargs):#args = multiple input variables, **kvargs multiple keyword variables (dictionaries, touples etc.)
    ################ INIT Function ##################
        super().__init__(*args, **kwargs)#super inherits all methods and properties from its parent  (QWIDGET classes)
        #Load UI forms creaated in QTdDesigner
        self.log = log
        self.log.log("STARTING SERIAL MONITOR CLASS","INFO")
        self.ui = GUI_Form() #UI form generated by UI designe
        self.ui.setupUi(self)
        self.signals = signals

if __name__ == "__main__":
    if os.path.exists("SerialMonitorGUI.py"):
        os.remove("SerialMonitorGUI.py")
    bashCommand = "pyuic6 -o SerialMonitorGUI.py SerialMonitor.ui"
    os.system(bashCommand)

    app = QtWidgets.QApplication([])
    window = SerialMonitorClass(QtWidgets.QWidget)
    window.show()
    app.exec()