Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes SLD's VL navigation when the filter is active #9

Merged
merged 1 commit into from
May 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions src/pypowsybl_jupyter/networkexplorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,13 @@ def network_explorer(network: Network, vl_id : str = None, depth: int = 0, high_

def go_to_vl(event: any):
nonlocal selected_vl
selected_vl= str(event.clicked_nextvl)
found.value=selected_vl
arrow_vl= str(event.clicked_nextvl)
vl_filtered_list=list(found.options)
if arrow_vl not in vl_filtered_list:
vl_filtered_list.append(arrow_vl)
found.options=vl_filtered_list
selected_vl=arrow_vl
found.value=arrow_vl

def toggle_switch(event: any):
idswitch = event.clicked_switch.get('id')
Expand Down Expand Up @@ -106,12 +111,12 @@ def on_nadslider_changed(d):
)

def on_text_changed(d):
nonlocal selected_vl
found.options = vls[vls.index.str.contains(d['new'], regex=False)].index
if len(found.options) > 0:
selected_vl=d['new']
nonlocal found
if d['new'] != '':
found.options = vls[vls.index.str.contains(d['new'], regex=False)].index
else:
selected_vl=None
found.options=list(vls.index)
found.value=selected_vl

vl_input.observe(on_text_changed, names='value')

Expand Down