# Created by BaiJiFeiLong@gmail.com at 2022/1/21 17:13

import typing

from IceSpringRealOptional.typingUtils import gg
from PySide2 import QtWidgets, QtCore

from IceSpringMusicPlayer import tt
from IceSpringMusicPlayer.common.pluginMixin import PluginMixin
from IceSpringMusicPlayer.common.pluginWidgetMixin import PluginWidgetMixin
from IceSpringMusicPlayer.tt import Text


class HelloWorldPlugin(QtWidgets.QWidget, PluginMixin, PluginWidgetMixin):
    @classmethod
    def getPluginName(cls) -> Text:
        return tt.HelloWorldPlugin_Name

    @classmethod
    def getPluginReplacers(cls) -> typing.Dict[Text, typing.Callable[[], PluginWidgetMixin]]:
        return {tt.HelloWorldWidget_Name: lambda: cls()}

    def __init__(self):
        super().__init__()
        label = QtWidgets.QLabel("Hello World")
        label.setAlignment(gg(QtCore.Qt.AlignmentFlag.AlignCenter))
        self.setLayout(QtWidgets.QGridLayout())
        self.layout().addWidget(label)

[((25, 16, 25, 47), 'PySide2.QtWidgets.QLabel', 'QtWidgets.QLabel', ({(25, 33, 25, 46): '"""Hello World"""'}, {}), "('Hello World')", False, 'from PySide2 import QtWidgets, QtCore\n'), ((26, 27, 26, 66), 'IceSpringRealOptional.typingUtils.gg', 'gg', ({(26, 30, 26, 65): 'QtCore.Qt.AlignmentFlag.AlignCenter'}, {}), '(QtCore.Qt.AlignmentFlag.AlignCenter)', False, 'from IceSpringRealOptional.typingUtils import gg\n'), ((27, 23, 27, 46), 'PySide2.QtWidgets.QGridLayout', 'QtWidgets.QGridLayout', ({}, {}), '()', False, 'from PySide2 import QtWidgets, QtCore\n')]