Skip to content

Commit b599299

Browse files
committed
fix(state): add bg, interval and center to state
1 parent ab43db9 commit b599299

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

‎src/e3sm_quickview/app.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,10 @@ def download_state(self):
340340
"tools": self.state.active_tools,
341341
"help": not self.state.compact_drawer,
342342
"camera": self.view_manager.get_camera_state(),
343+
"grid-interval": self.state.grid_interval,
344+
"bg-color": self.view_manager._bg_color,
345+
"map-center-lon": self.state.spherical_center_lon,
346+
"map-center-lat": self.state.spherical_center_lat,
343347
}
344348
data_selection = {
345349
k: self.state[k]
@@ -474,6 +478,14 @@ async def _import_state(self, state_content):
474478
if "camera" in state_content["layout"]:
475479
self.view_manager.set_camera_state(state_content["layout"]["camera"])
476480

481+
# New extended layout properties
482+
if "grid-interval" in state_content["layout"]:
483+
# Add-on available
484+
self.state.grid_interval = state_content["layout"]["grid-interval"]
485+
self.state.spherical_center_lon = state_content["layout"]["map-center-lon"]
486+
self.state.spherical_center_lat = state_content["layout"]["map-center-lat"]
487+
self.view_manager.update_background(state_content["layout"]["bg-color"])
488+
477489
# Update filebrowser state
478490
with self.state:
479491
self.file_browser.set("state_loading", False)

‎src/e3sm_quickview/view_manager.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@ def refresh_ui(self, **_):
164164
view._build_ui()
165165

166166
def update_background(self, color):
167+
if not color:
168+
return
169+
167170
self._bg_color = color
168171
for view in self._var2view.values():
169172
view.update_background(color)

0 commit comments

Comments
 (0)