diff --git a/glue_wwt/viewer/jupyter_viewer.py b/glue_wwt/viewer/jupyter_viewer.py index bd4562cf..37432396 100644 --- a/glue_wwt/viewer/jupyter_viewer.py +++ b/glue_wwt/viewer/jupyter_viewer.py @@ -204,6 +204,8 @@ class WWTJupyterViewer(WWTDataViewerBase, IPyWidgetView): WWTTableLayerArtist: JupyterTableLayerOptions, } + tools = ["wwt:refresh_cache"] + def __init__(self, session, state=None): IPyWidgetView.__init__(self, session, state=state) WWTDataViewerBase.__init__(self) diff --git a/glue_wwt/viewer/qt_data_viewer.py b/glue_wwt/viewer/qt_data_viewer.py index 1a535bb9..0e3583ec 100644 --- a/glue_wwt/viewer/qt_data_viewer.py +++ b/glue_wwt/viewer/qt_data_viewer.py @@ -10,7 +10,7 @@ from .table_style_editor import WWTTableStyleEditor # We import the following to register the save tool -from . import tools # noqa +from . import tools as wwt_tools # noqa __all__ = ['WWTQtViewer'] @@ -24,6 +24,7 @@ class WWTQtViewer(WWTDataViewerBase, DataViewer): } subtools = {'save': ['wwt:save', 'wwt:savetour']} + tools = ["save", "wwt:refresh_cache"] def __init__(self, session, parent=None, state=None): DataViewer.__init__(self, session, parent=None, state=state) diff --git a/glue_wwt/viewer/refresh_cache.png b/glue_wwt/viewer/refresh_cache.png new file mode 100644 index 00000000..7a085181 Binary files /dev/null and b/glue_wwt/viewer/refresh_cache.png differ diff --git a/glue_wwt/viewer/tools.py b/glue_wwt/viewer/tools.py index 8293e2f0..22b9e07e 100644 --- a/glue_wwt/viewer/tools.py +++ b/glue_wwt/viewer/tools.py @@ -2,6 +2,7 @@ import io import time +from os.path import abspath, dirname, join from qtpy import compat from glue.viewers.common.tool import Tool @@ -112,3 +113,15 @@ def activate(self): with io.open(filename, 'w', newline='') as f: f.write(tourxml) + + +@viewer_tool +class RefreshTileCacheTool(Tool): + + icon = abspath(join(dirname(__file__), 'refresh_cache')) + tool_id = 'wwt:refresh_cache' + action_text = 'Refresh the WWT tile cache' + tool_tip = 'Refresh the WWT tile cache' + + def activate(self): + self.viewer._wwt.refresh_tile_cache() diff --git a/pyproject.toml b/pyproject.toml index 00ddb97e..e6543947 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ dependencies = [ "glue-core>=1.13.1", "echo", "astropy", - "pywwt>=0.21.0", + "pywwt>=0.24.1", "packaging", ] dynamic = ["version"]