Beispiel #1
0
    def _publish(self):
        """Publishes this tab bar in the given cell.

    Note: this function is idempotent.
    """
        if self._published:
            return
        content_height = 'initial',
        content_border = '0px',
        border_color = '#a7a7a7',
        self._content_div = self._id + '_content'
        super(TabBar, self)._publish()
        with self._output_in_widget():
            _publish.css(url=self.TAB_CSS)
            _publish.javascript(url=self.TABBAR_JS)
            _publish.html(self._html_repr())

            js.js_global.colab_lib.createTabBar({
                'location': self._location,
                'elementId': self._id,
                'tabNames': self.tab_names,
                'initialSelection': self._active,
                'contentBorder': content_border,
                'contentHeight': content_height,
                'borderColor': border_color,
            })
            # Note: publish() will only be called once, thus this will never change
            # already visible tab.
            js.js_global[self._id].setSelectedTabIndex(0)
Beispiel #2
0
    def _publish(self):
        """Publishes the grid.

    Grid will publish automatically on first call to output_to.
    """

        if self._published:
            return
        super(Grid, self)._publish()
        with self._output_in_widget():
            _publish.css("""
       table#%(id)s, #%(id)s > tbody > tr > th, #%(id)s > tbody > tr > td {
         border: 1px solid lightgray;
         border-collapse:collapse;
         %(userstyle)s
        }""" % {
                'id': self._id,
                'userstyle': self._style
            })

            _publish.html(self._html_repr())