Skip to content

Commit

Permalink
fixes vl navigation, click on a breaker on the currently displayed SL…
Browse files Browse the repository at this point in the history
…D, when the VL filter is active (#9)

Signed-off-by: Christian Biasuzzi <christian.biasuzzi@soft.it>
  • Loading branch information
CBiasuzzi authored May 29, 2024
1 parent 37d8e36 commit 6ffb715
Showing 1 changed file with 12 additions and 7 deletions.
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

0 comments on commit 6ffb715

Please sign in to comment.