WhakerKit 2.0

https://sourceforge.net/projects/whakerkit/

Module whakerkit.nodes

Class WhakerKitDocAsideNode

Description

The node of the aside element.

The aside content is used to display all the information on a document.

Constructor

Create the node.

Parameters
  • parent: (str) The parent node identifier
View Source
def __init__(self, parent: str):
    """Create the node.

    :param parent: (str) The parent node identifier

    """
    super(WhakerKitDocAsideNode, self).__init__(parent, 'doc_aside', 'aside', attributes={'id': 'doc_aside', 'class': 'doc-aside', 'tabindex': '0'})
    self.reset()

Public functions

reset

Reset the aside node to its default values.

View Source
def reset(self):
    """Reset the aside node to its default values."""
    h2 = HTMLNode(self.identifier, 'h2', 'h2')
    h2.set_value(get_msg(MSG_DETAILS))
    self.append_child(h2)
    self.__append_p('doc_filename', value=get_msg(MSG_DOC_FILENAME))
    self.__append_p('doc_author', value=get_msg(MSG_DOC_AUTHOR))
    self.__append_p('doc_filetype', value=get_msg(MSG_DOC_FILETYPE))
    self.__append_p('doc_date', value=get_msg(MSG_DOC_DATE))
    self.__append_p('doc_description', value=get_msg(MSG_DOC_DESCRIPTION))
    self.__append_p('doc_downloads', value=get_msg(MSG_DOC_DOWNLOADS), span_value=get_msg(MSG_DOC_DOWNLOADS_VALUE))
    button = HTMLNode(self.identifier, 'button', 'button', attributes={'id': 'close_aside_button', 'onclick': 'asideManager.closeDetails()', 'class': 'apply-button'})
    button.set_value(get_msg(MSG_CLOSE))
    self.append_child(button)

Protected functions

__append_p

Append a paragraph with given identifier name.

Parameters
  • name: (str) Identifier for the paragraph.
View Source
def __append_p(self, name: str, value='', span_value='--'):
    """Append a paragraph with given identifier name.

        :param name: (str) Identifier for the paragraph.

        """
    p = HTMLNode(self.identifier, name + '_p', 'p', value='<b>' + value + '</b>')
    self.append_child(p)
    name = name + '_span'
    span = HTMLNode(p.identifier, 'span', 'span', attributes={'id': name}, value=span_value)
    p.append_child(span)