# CPy - Form 1 for demo form switching. main = ex12_main_forms.py
# by Anthony Vogelaar, Perth Scotland
# rev 0.10  2024-04-15  Initial release

from    PySide6.QtCore      import  Qt
from    PySide6.QtWidgets   import  QWidget, QLabel, QPushButton

# ================================ Form 1 ========================================

# Test form #1 used in formswitching demo
class Form1(QWidget):

    def __init__(self, gui):
        super().__init__()
        self.gui = gui

        lb = QLabel('Form 1', self)
        lb.setAlignment(Qt.AlignCenter)
        lb.setStyleSheet("background-color: yellow")
        lb.resize(600, 400)

        btn = QPushButton(self)
        btn.setText('Menu')
        btn.move(500, 350)
        btn.clicked.connect(self.gui.onBtnClick)

# ================================= Test =====================================
    
if __name__ == '__main__':

    import  os, sys;            os.system('clear')
    from    PySide6.QtWidgets   import  QApplication

    class Controller:

        def __init__(self):
            app = QApplication()
            self.form = Form1(self)
            self.form.show()
            sys.exit(app.exec())


        def onBtnClick(self, flag):
            print('onBtnClick')


    Controller()

# ================================= End ======================================
