# standard
from __future__ import annotations

from pathlib import Path
from typing import TYPE_CHECKING, Optional

# PyQGIS
from qgis.PyQt import uic
from qgis.PyQt.QtGui import QIcon

# Project
from oslandia.__about__ import DIR_PLUGIN_ROOT
from oslandia.gui.onboarding.wdg_base_page import WidgetPageBase


if TYPE_CHECKING:
    from qgis.PyQt.QtWidgets import QWidget


class WelcomePage(WidgetPageBase):
    def __init__(self, parent: Optional[QWidget] = None):
        """Home page content

        :param parent: parent widget, defaults to None
        :type parent: QObject, optional
        """
        # init module and ui
        super().__init__(parent)
        uic.loadUi(Path(__file__).parent / f"{Path(__file__).stem}.ui", self)

        self.btn_get_started.setIcon(
            QIcon(str(DIR_PLUGIN_ROOT / "resources/images/rocket.svg"))
        )
        self.btn_get_started.clicked.connect(lambda: self.next_page_signal.emit(0))
        self.btn_get_started.clicked.connect(lambda: self.start_signal.emit())
