#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

from hspylib.core.enums.charset import Charset
from hspylib.modules.cli.application.version import Version
from hspylib.modules.qt.qt_application import QtApplication

from %APP_NAME%.__classpath__ import _Classpath
from %APP_NAME%.view.main_qt_view import MainQtView


class Main(QtApplication):
    """TODO"""

    # The welcome message
    DESCRIPTION = _Classpath.get_source("welcome.txt").read_text(encoding=Charset.UTF_8.value)

    # Location of the .version file
    VERSION_DIR = _Classpath.source_root()

    # Location of the resources dir
    RESOURCE_DIR = str(_Classpath.resource_dir())

    def __init__(self, app_name: str):
        version = Version.load(load_dir=self.VERSION_DIR)
        description = self.DESCRIPTION.format(version)
        super().__init__(MainQtView, app_name, version, description, resource_dir=self.RESOURCE_DIR)


if __name__ == "__main__":
    # Application entry point
    Main('Application name').INSTANCE.run(sys.argv[1:])
