Skip to content

Commit

Permalink
qed.ux: the {store} now harvests the {views} of the {plexus}
Browse files Browse the repository at this point in the history
  • Loading branch information
aivazis committed Apr 15, 2024
1 parent 97b9879 commit 18331e8
Showing 1 changed file with 33 additions and 12 deletions.
45 changes: 33 additions & 12 deletions pkg/ux/Store.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,25 +575,19 @@ def __init__(self, plexus, docroot, **kwds):
super().__init__(plexus=plexus, spec="store", **kwds)
# save the root of the document
self._docroot = docroot

# build my registries
# map: name -> data archive
archives = self._loadPersistentArchives(plexus)
archives = self._loadPersistentArchives(plexus=plexus)
# map: name -> data source
sources = self._loadPersistentSources(plexus)
# my viewports: start out with one
viewport = Viewport(name=str(uuid.uuid1()))

# if there is only one source
if len(sources) == 1:
# grab it
source = tuple(sources.sources())[0]
# and select it
viewport.selectSource(source=source)
sources = self._loadPersistentSources(plexus=plexus)
# list: the sequence of visible viewports
viewports = self._loadPersistentViewports(plexus=plexus, sources=sources)

# record my state
self._dataArchives = archives
self._dataSources = sources
self._viewports = [viewport]
self._viewports = viewports

# all done
return
Expand Down Expand Up @@ -629,6 +623,33 @@ def _loadPersistentSources(self, plexus):
# all done
return sources

def _loadPersistentViewports(self, plexus, sources):
"""
Transfer the persistent viewports from the plexus
"""
# make a pile
viewports = []
# go through the plexus views
for view in plexus.views:
# make a viewport with each one
viewport = Viewport(name=str(uuid.uuid1()), view=view.clone())
# and add it to the pile
viewports.append(viewport)
# if there weren't any
if not viewports:
# make a blank one
viewport = Viewport(name=str(uuid.uuid1()))
# if there is only one source
if len(sources) == 1:
# grab it
source = tuple(sources.sources())[0]
# and select it
viewport.selectSource(source=source)
# and add it to the pile
viewports.append(viewport)
# all done
return viewports

def _syncedWith(self, viewport, aspect, exclude=False):
"""
Build a sequence of viewports that are {aspect} synced with {viewport}
Expand Down

0 comments on commit 18331e8

Please sign in to comment.