Skip to content

Commit

Permalink
Add tool for refreshing tile cache.
Browse files Browse the repository at this point in the history
  • Loading branch information
Carifio24 committed May 28, 2024
1 parent 0321d4a commit 8406201
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 2 deletions.
2 changes: 2 additions & 0 deletions glue_wwt/viewer/jupyter_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ class WWTJupyterViewer(WWTDataViewerBase, IPyWidgetView):
WWTTableLayerArtist: JupyterTableLayerOptions,
}

tools = ["wwt:refresh_cache"]

Check warning on line 207 in glue_wwt/viewer/jupyter_viewer.py

View check run for this annotation

Codecov / codecov/patch

glue_wwt/viewer/jupyter_viewer.py#L207

Added line #L207 was not covered by tests

def __init__(self, session, state=None):
IPyWidgetView.__init__(self, session, state=state)
WWTDataViewerBase.__init__(self)
Expand Down
3 changes: 2 additions & 1 deletion glue_wwt/viewer/qt_data_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']

Expand All @@ -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)
Expand Down
Binary file added glue_wwt/viewer/refresh_cache.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions glue_wwt/viewer/refresh_cache.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions glue_wwt/viewer/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()

Check warning on line 127 in glue_wwt/viewer/tools.py

View check run for this annotation

Codecov / codecov/patch

glue_wwt/viewer/tools.py#L127

Added line #L127 was not covered by tests
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies = [
"glue-core>=1.13.1",
"echo",
"astropy",
"pywwt>=0.21.0",
"pywwt>=0.24.1",
"packaging",
]
dynamic = ["version"]
Expand Down

0 comments on commit 8406201

Please sign in to comment.