# CPy - Menu Form 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 menu =======================================

# Test form Menu is form selector
class FormMenu(QWidget):

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

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

        btn = QPushButton(self)
        btn.setText('Form 1')
        btn.move(50, 50)
        btn.setObjectName('f1')
        btn.clicked.connect(self.gui.onBtnClick)

        btn = QPushButton(self)
        btn.setText('Form 2')
        btn.move(50, 100)
        btn.setObjectName('f2')
        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 = FormMenu(self)
            self.form.show()
            sys.exit(app.exec())


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


    Controller()

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