Skip to content

Commit

Permalink
Merge pull request #113 from Carifio24/tile-refresh-tool
Browse files Browse the repository at this point in the history
Add tool for refreshing tile cache
  • Loading branch information
Carifio24 authored Sep 10, 2024
2 parents 0321d4a + d5de837 commit e03e9a0
Show file tree
Hide file tree
Showing 5 changed files with 18 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"]

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.
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()
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 e03e9a0

Please sign in to comment.