Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -36,6 +36,9 @@ 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 |
# List to store the names of buttons to be added to the header
|
| 40 |
buttons_to_add = []
|
| 41 |
|
|
@@ -48,17 +51,21 @@ def add_to_header(event):
|
|
| 48 |
|
| 49 |
add_to_header_button.on_click(add_to_header)
|
| 50 |
|
| 51 |
-
#
|
| 52 |
-
def
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
# Layout using Template
|
| 59 |
template = pn.template.FastListTemplate(
|
| 60 |
title="EasySciRead",
|
| 61 |
-
header=[pn.Row(
|
| 62 |
main=[
|
| 63 |
# pn.Row(header_buttons),
|
| 64 |
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 |
+
# "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 |
|
|
|
|
| 51 |
|
| 52 |
add_to_header_button.on_click(add_to_header)
|
| 53 |
|
| 54 |
+
# Callback for the "Add" button to add the selected options to the header buttons
|
| 55 |
+
def add_selected_to_header(event):
|
| 56 |
+
if buttons_to_add:
|
| 57 |
+
for button_name in buttons_to_add:
|
| 58 |
+
new_button = pn.widgets.Button(name=button_name, width=130, sizing_mode='fixed')
|
| 59 |
+
header_buttons.append(new_button)
|
| 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, add_button)],
|
| 69 |
main=[
|
| 70 |
# pn.Row(header_buttons),
|
| 71 |
pn.Column(text),
|