/usr/lib/python2.7/dist-packages/ipywidgets/widgets/widget_selectioncontainer.py is in python-ipywidgets 5.2.2-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | """SelectionContainer class.
Represents a multipage container that can be used to group other widgets into
pages.
"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from .widget_box import Box, register
from traitlets import Unicode, Dict, CInt
class _SelectionContainer(Box):
"""Base class used to display multiple child widgets."""
_model_module = Unicode('jupyter-js-widgets').tag(sync=True)
_view_module = Unicode('jupyter-js-widgets').tag(sync=True)
_titles = Dict(help="Titles of the pages").tag(sync=True)
selected_index = CInt().tag(sync=True)
# Public methods
def set_title(self, index, title):
"""Sets the title of a container page.
Parameters
----------
index : int
Index of the container page
title : unicode
New title
"""
self._titles[index] = title
self.send_state('_titles')
def get_title(self, index):
"""Gets the title of a container pages.
Parameters
----------
index : int
Index of the container page
"""
if index in self._titles:
return self._titles[index]
else:
return None
@register('Jupyter.Accordion')
class Accordion(_SelectionContainer):
"""Displays children each on a separate accordion page."""
_view_name = Unicode('AccordionView').tag(sync=True)
_model_name = Unicode('AccordionModel').tag(sync=True)
@register('Jupyter.Tab')
class Tab(_SelectionContainer):
"""Displays children each on a separate accordion tab."""
_view_name = Unicode('TabView').tag(sync=True)
_model_name = Unicode('TabModel').tag(sync=True)
|