Пример #1
0
def vuetify_layout_factory(viewer):

    def on_click(widget, event, data):
        drawer.v_model = not drawer.v_model

    sidebar_button = v.AppBarNavIcon()
    sidebar_button.on_event('click', on_click)

    options_panel = v.ExpansionPanels(
        v_model=[0, 1], multiple=True, accordion=True, style_='padding-left: 1px',
        children=[
            v.ExpansionPanel(children=[
                v.ExpansionPanelHeader(class_='font-weight-bold', children=['Viewer Options']),
                v.ExpansionPanelContent(children=[viewer.viewer_options])]),
            v.ExpansionPanel(children=[
                v.ExpansionPanelHeader(class_='font-weight-bold', children=['Layer Options']),
                v.ExpansionPanelContent(children=[viewer.layer_options])])])

    drawer = v.NavigationDrawer(v_model=False, absolute=True, right=True,
                                children=[sidebar_button,
                                          options_panel], width="min-content")

    toolbar_selection_tools = BasicJupyterToolbar(viewer)

    tool_ids, subtool_ids = get_viewer_tools(viewer.__class__)

    if subtool_ids:
        raise ValueError('subtools are not yet supported in Jupyter viewers')

    for tool_id in tool_ids:
        mode_cls = viewer_tool.members[tool_id]
        mode = mode_cls(viewer)
        toolbar_selection_tools.add_tool(mode)

    toolbar_active_subset = SubsetSelect(viewer)

    toolbar_selection_mode = SelectionModeMenu(viewer)

    toolbar = v.Toolbar(dense=True, class_='elevation-0',
                        children=[v.ToolbarItems(children=[toolbar_selection_tools,
                                                           toolbar_selection_mode,
                                                           toolbar_active_subset]),
                                  v.Spacer(),
                                  sidebar_button])

    layout = v.Html(tag='div', children=[
        toolbar,
        v.Row(no_gutters=True, children=[
            v.Col(cols=12, children=[viewer.figure_widget]),
            v.Col(cols=12, children=[viewer.output_widget])
        ]),
        drawer
    ])

    return layout
Пример #2
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.components = {
            'g-subset-select': SubsetSelect(session=self.session),
            'g-subset-mode': SelectionModeMenu(session=self.session)
        }

        self.hub.subscribe(self,
                           EditSubsetMessage,
                           handler=self.vue_subset_mode_changed)
Пример #3
0
    def __init__(self, data_collection=None, session=None):

        super(JupyterApplication, self).__init__(data_collection=data_collection, session=session)

        try:
            from glue.main import load_plugins
            load_plugins()
        except Exception:  # Compatibility with glue <0.16
            from glue.main import REQUIRED_PLUGINS
            REQUIRED_PLUGINS.clear()
            load_plugins()

        self.output = widgets.Output()
        self.widget_data_collection = widgets.SelectMultiple()
        self.widget_subset_select = SubsetSelect(session=self.session)
        self.widget_subset_mode = SelectionModeMenu(session=self.session)
        self.widget = widgets.VBox(children=[self.widget_subset_mode, self.output])