How to use the awe.view.Panel function in awe

To help you get started, we’ve selected a few awe examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dankilman / awe / tests / test_element.py View on Github external
def test_register_validation():
    page = Page()
    with pytest.raises(AssertionError):
        page.register(view.Panel)
    with pytest.raises(AssertionError):
        page.register({})
github dankilman / awe / awe / view.py View on Github external
def new_panel(self, header=None, active=False, **kwargs):
        """
        Add a panel child.

        :param header: If supplied, should be the text to display as the panel header.
                       Otherwise, the returned panel element will expose a ``header`` field.
                       This field should be used to create an element hierarchy (similar to ``Page``) that will be
                       passed as a ``ReactNode`` to the underlying ant design react ``Panel`` component.
        :param active: Should this panel be collapsed or expanded by default. (default: False)
        :return: The created panel element.
        """

        result = self._new_child(Panel, header=header, **kwargs)
        if active:
            self.props['defaultActiveKey'].append(result.id)
            self.update_props(self.props)
        return result
github dankilman / awe / awe / view.py View on Github external
def _new_child(self, cls, **kwargs):
        assert issubclass(cls, Panel)
        return super(Collapse, self)._new_child(cls, **kwargs)