"""
Page view class
"""


import os

from Server.Importer import ImportFromModule


class PageView(ImportFromModule("Server.PageViewBase", "PageViewBase")):
    """
    Page view class.
    """


    _PAGE_TITLE = "Python Web Framework"


    def __init__(self, htmlToLoad):
        """
        Constructor.
        - htmlToLoad : HTML to load
        """
        self.SetPageTitle(self._PAGE_TITLE)

        self.AddMetaData("charset=\"UTF-8\"")
        self.AddMetaData("name=\"viewport\" content=\"width=device-width, initial-scale=1\"")

        self.AddStyleSheet("/css/styles.css")

        self.AddJavaScript("/js/http.js")

        self.LoadHtml(os.path.join(os.path.dirname(__file__), "%s.html" % htmlToLoad))

        self.SetPageData({ "PageTitle" : self._PAGE_TITLE })
