Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update to ipyvuetify 1.0 (Vuetify 2.0) #132

Merged
merged 4 commits into from
Sep 26, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions glue_jupyter/common/toolbar_vuetify.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,14 @@ def _on_change_active_tool(self, change):
def add_tool(self, tool):
self.tools[tool.tool_id] = tool
icon = Image.from_file(icon_path(tool.icon, icon_format='svg'), width=ICON_WIDTH)
button = v.Btn(slot='activator', icon=True, children=[icon], value=tool.tool_id)
annotated = v.Tooltip(bottom=True, children=[button, tool.tool_tip])
button = v.Btn(v_on="tooltip.on", icon=True, children=[icon], value=tool.tool_id)
annotated = v.Tooltip(
bottom=True,
v_slots=[{
'name': 'activator',
'variable': 'tooltip',
'children': button}],
children=[tool.tool_tip])
self.children = list(self.children) + [annotated]


Expand Down
18 changes: 11 additions & 7 deletions glue_jupyter/vuetify_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,22 @@ def vuetify_layout_factory(viewer):
def on_click(widget, event, data):
drawer.v_model = not drawer.v_model

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

options_panel = v.ExpansionPanel(v_model=[True, True], expand=True,
children=[v.ExpansionPanelContent(children=[v.Html(tag='b', slot='header', children=['Viewer Options']),
v.Card(children=[viewer.viewer_options])]),
v.ExpansionPanelContent(children=[v.Html(tag='b', slot='header', children=['Layer Options']),
v.Card(children=[viewer.layer_options])])])
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=350)
options_panel], width=373)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this magic number? should we add a comment in the code?


toolbar_selection_tools = BasicJupyterToolbar(viewer)

Expand Down
16 changes: 11 additions & 5 deletions glue_jupyter/widgets/subset_mode_vuetify.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ def __init__(self, viewer):

items = []
for mode in self.modes:
item = v.ListTile(children=[v.ListTileAction(children=[mode[1]]),
v.ListTileTitle(children=[mode[0]])])
item = v.ListItem(children=[v.ListItemAction(children=[mode[1]]),
v.ListItemTitle(children=[mode[0]])])
items.append(item)

for item in items:
Expand All @@ -29,9 +29,15 @@ def __init__(self, viewer):
mylist = v.List(children=items)

self.main = v.Btn(icon=True,
children=[self.modes[0][1]], slot='activator')

super().__init__(children=[self.main, mylist])
children=[self.modes[0][1]], v_on="menu.on")

super().__init__(
v_slots=[{
'name': 'activator',
'variable': 'menu',
'children': self.main
}],
children=[mylist])

self.session.hub.subscribe(self, msg.EditSubsetMessage,
handler=self._on_edit_subset_msg)
Expand Down
17 changes: 11 additions & 6 deletions glue_jupyter/widgets/subset_select_vuetify.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ def __init__(self, viewer):
self.session = viewer.session
self.data_collection = viewer.session.data_collection

self.main = v.Btn(children=["No selection (create new)"], slot='activator', flat=True)
self.main = v.Btn(children=["No selection (create new)"], v_on="menu.on", text=True)

self.widget_menu_item_no_active = v.ListTile(children=[v.ListTileTitle(children=["No selection (create new)"])])
self.widget_menu_item_no_active = v.ListItem(children=[v.ListItemTitle(children=["No selection (create new)"])])
self.widget_menu_item_no_active.on_event('click', self._sync_state_from_ui)

self.subset_list = v.List(children=[self.widget_menu_item_no_active])
Expand All @@ -36,7 +36,12 @@ def __init__(self, viewer):
# manually trigger to set up the initial state
self._sync_ui_from_state(self.session.edit_subset_mode.edit_subset)

self.children = [self.main, self.subset_list]
self.v_slots = [{
'name': 'activator',
'variable': 'menu',
'children': self.main
}]
self.children = [self.subset_list]

def _on_edit_subset_msg(self, msg):
self._sync_ui_from_state(msg.subset)
Expand Down Expand Up @@ -68,9 +73,9 @@ def _sync_ui_from_state(self, subset_groups_selected):
for subset_group in self.data_collection.subset_groups:
# TODO: could avoid re-creating widgets as we do for the material UI version
# we're using a triangular icon here, since in the UI it's close to a round icon, which is confusing
item = v.ListTile(children=[
v.ListTileAvatar(children=[v.Icon(children=['signal_cellular_4_bar'], color=subset_group.style.color)]),
v.ListTileTitle(children=[subset_group.label])
item = v.ListItem(children=[
v.ListItemAvatar(children=[v.Icon(children=['signal_cellular_4_bar'], color=subset_group.style.color)]),
v.ListItemTitle(children=[subset_group.label])
])
item.on_event('click', self._sync_state_from_ui)
items.append(item)
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ install_requires =
ipyvolume
ipywidgets
ipymaterialui>=0.1.1
ipyvuetify
ipyvuetify>=1,<2
bqplot-image-gl
bqplot==0.12.0a2

Expand Down