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

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

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

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

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

        lb = QLabel('Form 2', self)
        lb.setAlignment(Qt.AlignCenter)
        lb.setStyleSheet("background-color: red")
        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 = Form2(self)
            self.form.show()
            sys.exit(app.exec())


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


    Controller()

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