from .dialog_sources.Ui_about import Ui_about
from PyQt6 import QtWidgets
from PyQt6.QtCore import PYQT_VERSION_STR
from src import Icon, __version__, __author__


class About(QtWidgets.QDialog, Ui_about):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.setupUi(self)
        self.setWindowIcon(Icon("info").icon)
        self.setWindowTitle("About")
        self.setInfo()

    def test(self):
        pass

    def setInfo(self):
        # add left most column to columnview
        data = {
            "Version": __version__,
            "Author": __author__,
            "PyQt6 Version": PYQT_VERSION_STR,
            "License": "MIT License",
            "Icons": """Google Material Design Icons (https://fonts.google.com/icons)
StableDiffusion (logo)
svgrepo (https://www.svgrepo.com)""",
        }
        description = ""
        for key, value in data.items():
            description += f"{key}: {value}\n"
        self.description.setText(description)

        pass


def launch_about():
    app = QtWidgets.QApplication([])
    window = About()
    window.show()
    app.exec()


if __name__ == "__main__":
    pass
