Skip to content

Commit

Permalink
added a shared tier gui
Browse files Browse the repository at this point in the history
  • Loading branch information
0Hughman0 committed Aug 24, 2024
1 parent 1c4b5f6 commit dbd300c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
17 changes: 17 additions & 0 deletions cassini/sharing.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,21 @@ def find_paths(self) -> List[Path]:
paths.extend(nosey_path.compress())

return paths


class SharedTierGui:
"""
Essentially a mock version of TierGui, for use during a shared context.
"""

def __init__(self, stier: SharedTier):
self.stier = stier

def header(self):
print("Cassini header cannot gui cannot be used in a shared context - check out cassini to set it up for yourself!")

def meta_editor(self, name=None):
print("Cassini meta editor cannot be used in a shared context - check out cassini to set it up for yourself!")


class SharedTier:
Expand All @@ -353,6 +368,8 @@ def __init__(self, name: str) -> None:
self.shared_project: Union[None, ShareableProject] = None
self.base_path: Union[Path, None] = None
self.meta: Union[Meta, None] = None
self.gui = SharedTierGui(self)

self._accessed: Dict[str, Any] = {}
self._called: Dict[str, Dict[ArgsKwargsType, Any]] = {}

Expand Down
14 changes: 14 additions & 0 deletions tests/test_sharing.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
NoseyPath,
SharedTierData,
SharedTier,
SharedTierGui,
SharingTier,
SharedTierCalls,
GetChildCall,
Expand Down Expand Up @@ -388,3 +389,16 @@ def test_getting_tier_children(get_Project, tmp_path):

assert stier_child.exists()
assert (stier_child / 'file').read_text() == 'data'


def test_shared_gui_header():
stier = SharedTier('name')
assert isinstance(stier.gui, SharedTierGui)
assert stier.gui.header() is None


def test_shared_gui_meta_editor():
stier = SharedTier('name')
assert isinstance(stier.gui, SharedTierGui)
assert stier.gui.meta_editor() is None
assert stier.gui.meta_editor(['name']) is None

0 comments on commit dbd300c

Please sign in to comment.