Spaces:
Running
Running
Update app2.py
Browse files
app2.py
CHANGED
|
@@ -107,15 +107,18 @@ def update_header():
|
|
| 107 |
header_button = pn.widgets.Button(name=button_name, button_type = 'primary', button_style = 'outline')
|
| 108 |
header_button.on_click(remove_from_header) # Add callback to remove the header button
|
| 109 |
header_buttons.append(header_button)
|
| 110 |
-
|
|
|
|
| 111 |
# Update the filter list options to exclude buttons that are already in the header
|
| 112 |
filter_list.options = [option for option in entered_options if option not in buttons_to_add]
|
| 113 |
main_body_instance.main_body = TLDR.update_mainTLDR(buttons_to_add, paper_list)
|
| 114 |
|
| 115 |
# Callback to remove the clicked header button
|
| 116 |
def remove_from_header(event):
|
|
|
|
| 117 |
button = event.obj # Get the clicked button
|
| 118 |
if button.name in buttons_to_add:
|
|
|
|
| 119 |
buttons_to_add.remove(button.name) # Remove from the header buttons list
|
| 120 |
filter_list.options.append(button.name) # Add back to the filter list options
|
| 121 |
update_header() # Update the header and filter list
|
|
|
|
| 107 |
header_button = pn.widgets.Button(name=button_name, button_type = 'primary', button_style = 'outline')
|
| 108 |
header_button.on_click(remove_from_header) # Add callback to remove the header button
|
| 109 |
header_buttons.append(header_button)
|
| 110 |
+
|
| 111 |
+
print("Change in buttons:", paper_list, flush=True)
|
| 112 |
# Update the filter list options to exclude buttons that are already in the header
|
| 113 |
filter_list.options = [option for option in entered_options if option not in buttons_to_add]
|
| 114 |
main_body_instance.main_body = TLDR.update_mainTLDR(buttons_to_add, paper_list)
|
| 115 |
|
| 116 |
# Callback to remove the clicked header button
|
| 117 |
def remove_from_header(event):
|
| 118 |
+
global paper_list
|
| 119 |
button = event.obj # Get the clicked button
|
| 120 |
if button.name in buttons_to_add:
|
| 121 |
+
paper_list.remove(buttons_to_add.index(button.name))
|
| 122 |
buttons_to_add.remove(button.name) # Remove from the header buttons list
|
| 123 |
filter_list.options.append(button.name) # Add back to the filter list options
|
| 124 |
update_header() # Update the header and filter list
|