AcrylicMaterialWidget Example

import sys

from DevMachines import __pyside2__, __pyside6__
from DevMachines import QtitanBase
from DevMachines.QtitanBase import MaterialWidget
from DevMachines.QtitanNavigationDesignUI import NavigationMainWindow

if __pyside2__:
    from PySide2 import QtCore
    from PySide2.QtCore import Qt
    from PySide2.QtGui import QPainter, QPixmap
    from PySide2.QtWidgets import QWidget, QApplication, QFrame, QLCDNumber, QCheckBox, QVBoxLayout, QGridLayout, QMessageBox

if __pyside6__:
    from PySide6 import QtCore
    from PySide6.QtCore import Qt
    from PySide6.QtGui import QPainter, QPixmap
    from PySide6.QtWidgets import QWidget, QApplication, QFrame, QLCDNumber, QCheckBox, QVBoxLayout, QGridLayout, QMessageBox

import AcrylicMaterialWidget_rc

class Window(NavigationMainWindow):
    def __init__(self):
        NavigationMainWindow.__init__(self)
        self.setWindowTitle("FluentUI  Acrylic Clock App")
        self.setGeometry(100, 100, 1200, 600)
        #self.setMaximumSize(QtCore.QSize(1600, 1000))

        self.titleBar().setBlurBehindWindowEnabled(True)
        self.titleBar().setSysButtonKind(QtitanBase.WindowTitleBar.BackButton)
        self.titleBar().show()
        self.connect(self.titleBar(), QtCore.SIGNAL("backRequested()"), self.showMessage)

        self.materialWidget = MaterialWidget(self)
        self.materialWidget.setBlendType(MaterialWidget.BackgroundBlend)
        self.setCentralWidget(self.materialWidget)

        self.background = QPixmap(":res/natural-image.jpg")

        self.createContent()

        self.timer = QtCore.QTimer(self)
        self.connect(self.timer, QtCore.SIGNAL("timeout()"), self.showTime)
        self.timer.start(1000)
        self.showTime()

    def createSettingsWidget(self):
        widget = QWidget()
        layout = QVBoxLayout(widget)

        self.blendBox = QCheckBox(self)
        self.blendBox.setText("In-App material brush blending")
        self.connect(self.blendBox, QtCore.SIGNAL("toggled(bool)"), self, QtCore.SLOT("blendChecked(bool)"))
        layout.addWidget(self.blendBox)

        self.extendViewBox = QCheckBox(self)
        self.extendViewBox.setText("Extend view into Title Bar (new)")
        self.connect(self.extendViewBox, QtCore.SIGNAL("toggled(bool)"), self, QtCore.SLOT("extendViewChecked(bool)"))
        self.extendViewBox.toggle()
        layout.addWidget(self.extendViewBox)
        return widget

    def paintEvent(self, event):
        painter = QPainter(self)
        painter.setClipRegion(event.region())
        painter.drawPixmap(0, 0, self.background)

    def createContent(self):
        self.clockWidget = QLCDNumber(self)
        self.clockWidget.setFrameShape(QFrame.NoFrame)
        self.clockWidget.setSegmentStyle(QLCDNumber.Filled)

        layout = QGridLayout()
        self.clockWidget.setFixedHeight(100)
        layout.addWidget(self.clockWidget, 0, 0, Qt.AlignBottom)
        layout.addWidget(self.createSettingsWidget(), 1, 0, Qt.AlignCenter)
        self.centralWidget().setLayout(layout)

    @QtCore.Slot()
    def showTime(self):
        time = QtCore.QTime.currentTime()
        text = time.toString("hh:mm")
        if time.second() % 2 == 0:
            text = text[:2] + ' ' + text[3:]
        self.clockWidget.display(text)

    @QtCore.Slot(bool)
    def blendChecked(self, checked):
        if checked:
            self.materialWidget.setBlendType(MaterialWidget.InAppBlend)
        else:
            self.materialWidget.setBlendType(MaterialWidget.BackgroundBlend)

    @QtCore.Slot(bool)
    def extendViewChecked(self, checked):
        self.titleBar().setExtendViewIntoTitleBar(checked)

    @QtCore.Slot()
    def showMessage(self):
        QMessageBox.information(self, "Message",
                                "WindowTitleBar back button is pressed",
                                QMessageBox.Ok)

if __name__ == "__main__":
    app = QApplication(sys.argv)
    w = Window()
    w.show()
    sys.exit(app.exec_())