Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -36,9 +36,6 @@ header_buttons = pn.Column(sizing_mode='stretch_width', css_classes=['header-but
|
|
| 36 |
# "+" button to trigger the addition to the header
|
| 37 |
add_to_header_button = pn.widgets.Button(name="Add to Header", button_type='primary')
|
| 38 |
|
| 39 |
-
# "Add" button to add selected options to the header
|
| 40 |
-
add_button = pn.widgets.Button(name="Add", button_type='primary')
|
| 41 |
-
|
| 42 |
# List to store the names of buttons to be added to the header
|
| 43 |
buttons_to_add = []
|
| 44 |
|
|
@@ -48,24 +45,21 @@ def add_to_header(event):
|
|
| 48 |
if selected_options:
|
| 49 |
buttons_to_add.extend(selected_options) # Extend the list with selected options
|
| 50 |
filter_list.value = [] # Clear the selected options after adding them to the list
|
|
|
|
| 51 |
|
| 52 |
add_to_header_button.on_click(add_to_header)
|
| 53 |
|
| 54 |
-
#
|
| 55 |
-
def
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
buttons_to_add.clear() # Clear the list after adding the buttons
|
| 62 |
-
|
| 63 |
-
add_button.on_click(add_selected_to_header)
|
| 64 |
|
| 65 |
# Layout using Template
|
| 66 |
template = pn.template.FastListTemplate(
|
| 67 |
title="EasySciRead",
|
| 68 |
-
header=[pn.Row(header_buttons, sizing_mode='stretch_width'), pn.Row(filter_list, add_to_header_button
|
| 69 |
main=[
|
| 70 |
# pn.Row(header_buttons),
|
| 71 |
pn.Column(text),
|
|
|
|
| 36 |
# "+" button to trigger the addition to the header
|
| 37 |
add_to_header_button = pn.widgets.Button(name="Add to Header", button_type='primary')
|
| 38 |
|
|
|
|
|
|
|
|
|
|
| 39 |
# List to store the names of buttons to be added to the header
|
| 40 |
buttons_to_add = []
|
| 41 |
|
|
|
|
| 45 |
if selected_options:
|
| 46 |
buttons_to_add.extend(selected_options) # Extend the list with selected options
|
| 47 |
filter_list.value = [] # Clear the selected options after adding them to the list
|
| 48 |
+
update_header() # Update the header after adding options
|
| 49 |
|
| 50 |
add_to_header_button.on_click(add_to_header)
|
| 51 |
|
| 52 |
+
# Function to update the header layout with the newly created buttons
|
| 53 |
+
def update_header():
|
| 54 |
+
header_buttons.clear() # Clear the existing buttons
|
| 55 |
+
for button_name in buttons_to_add:
|
| 56 |
+
new_button = pn.widgets.Button(name=button_name, width=130, sizing_mode='fixed')
|
| 57 |
+
header_buttons.append(new_button)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
# Layout using Template
|
| 60 |
template = pn.template.FastListTemplate(
|
| 61 |
title="EasySciRead",
|
| 62 |
+
header=[pn.Row(header_buttons, sizing_mode='stretch_width'), pn.Row(filter_list, add_to_header_button)],
|
| 63 |
main=[
|
| 64 |
# pn.Row(header_buttons),
|
| 65 |
pn.Column(text),
|