Skip to content

Commit

Permalink
feat: reverse logic functionality for SwitchWithRefs
Browse files Browse the repository at this point in the history
  • Loading branch information
shxshxshxshx committed Oct 17, 2023
1 parent 7f894dd commit ad1c560
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions kintree/gui/views/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,18 @@ class SwitchWithRefs(ft.Switch):
def __init__(
self,
refs: List[ft.Ref] = None,
reverse_dir: bool = False,
**kwargs,
):
super().__init__(**kwargs)
if refs:
self.refs = refs
self.enable_refs(self.value)
self.reverse_dir = reverse_dir

def enable_refs(self, enable):
if self.reverse_dir:
enable = not enable
for ref in self.linked_refs:
ref.current.visible = enable
try:
Expand Down

0 comments on commit ad1c560

Please sign in to comment.