Skip to content

Commit

Permalink
MNT: adjust fill_uuids to take depth optional argument, consolidate c…
Browse files Browse the repository at this point in the history
…lient.setter method in RootTreeView
  • Loading branch information
tangkong committed Dec 3, 2024
1 parent 742d87c commit 4d3a24c
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions superscore/widgets/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,15 @@ def __init__(
self._bridge_cache[id(data)] = bridge
self.bridge = bridge

def fill_uuids(self, client: Optional[Client] = None) -> None:
"""Fill this item's data if it is a uuid, using ``client``"""
def fill_uuids(
self,
client: Optional[Client] = None,
fill_depth: int = 2
) -> None:
"""
Fill this item's data if it is a uuid, using ``client``.
By default fills to a depth of 2, to keep the tree view data loading lazy
"""
if client is None:
return

Expand All @@ -82,7 +89,7 @@ def fill_uuids(self, client: Optional[Client] = None) -> None:

if isinstance(self._data, Nestable):
if any(isinstance(child, UUID) for child in self._data.children):
client.fill(self._data, fill_depth=2)
client.fill(self._data, fill_depth=fill_depth)

# re-construct child EntryItems if there is a mismatch or if any
# hold UUIDs as _data
Expand Down Expand Up @@ -539,9 +546,6 @@ def client(self):

@client.setter
def client(self, client: Client):
self._set_client(client)

def _set_client(self, client: Client):
if client is self._client:
return

Expand Down

0 comments on commit 4d3a24c

Please sign in to comment.