Skip to content

Commit

Permalink
Allow using non-SVG images in toolbar.
Browse files Browse the repository at this point in the history
  • Loading branch information
Carifio24 committed Aug 15, 2024
1 parent 8434cb4 commit 55f2b35
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions glue_jupyter/common/toolbar_vuetify.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,17 @@ def _on_change_active_tool(self, change):
def add_tool(self, tool):
self.tools[tool.tool_id] = tool
# TODO: we should ideally just incorporate this check into icon_path directly.
ext = os.path.splitext(tool.icon)[1][1:] or "svg"
if os.path.exists(tool.icon):
path = tool.icon
else:
path = icon_path(tool.icon, icon_format='svg')
path = icon_path(tool.icon, icon_format=ext)

format = "svg+xml" if ext == "svg" else ext
self.tools_data = {
**self.tools_data,
tool.tool_id: {
'tooltip': tool.tool_tip,
'img': read_icon(path, 'svg+xml')
'img': read_icon(path, format)
}
}

0 comments on commit 55f2b35

Please # to comment.