Ejemplo n.º 1
0
    def __init__(self, unique_str, content_element):
        """ Construct a content container, which is needed by iScroll for nice
        scrolling.

        Both the outer and inner container are required and they both must have
        unique ids for iScroll to work.

        Required:
        str     unique_str          the unique identifier of this content
        Element content_element     the element that should be scrollable

        """
        super(ContentWrapper, self).__init__()
        outer_container_id = "{}-{}".format(
                unique_str,
                self.OUTER_CONTAINER_CLASS)
        inner_container_id = "{}-{}".format(
                unique_str,
                self.INNER_CONTAINER_CLASS)

        self.set_id(outer_container_id)
        self.append_class(self.OUTER_CONTAINER_CLASS)

        inner_container = Div()
        inner_container.set_id(inner_container_id)
        inner_container.append_class(self.INNER_CONTAINER_CLASS)

        inner_container.append_child(content_element)
        self.append_child(inner_container)