Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,10 +2,9 @@ import panel as pn
|
|
| 2 |
from bokeh.models import Button
|
| 3 |
|
| 4 |
# Create buttons for the toggleable sidebar
|
| 5 |
-
button1 = pn.widgets.Button(icon
|
| 6 |
-
button2 = pn.widgets.Button(icon
|
| 7 |
-
button3 = pn.widgets.Button(icon
|
| 8 |
-
|
| 9 |
|
| 10 |
# Create a column layout for the buttons inside the toggleable sidebar
|
| 11 |
buttons = pn.Column(button1, button2, button3, sizing_mode='stretch_width', css_classes=['hidden'])
|
|
@@ -47,26 +46,31 @@ def show_hide_checklist(event):
|
|
| 47 |
new_options_checklist.options = options
|
| 48 |
checklist_visible = not checklist_visible
|
| 49 |
|
| 50 |
-
# "+" button
|
| 51 |
add_option_button = Button(label="+", button_type="primary")
|
| 52 |
add_option_button.on_click(show_hide_checklist)
|
| 53 |
|
| 54 |
# Layout using Template
|
| 55 |
template = pn.template.FastListTemplate(
|
| 56 |
title="EasySciRead",
|
| 57 |
-
header=[filter_list],
|
|
|
|
| 58 |
main=[
|
| 59 |
-
pn.Row(
|
| 60 |
-
pn.Row(new_options_checklist, sizing_mode='stretch_width'),
|
| 61 |
pn.Column(text),
|
| 62 |
],
|
| 63 |
accent_base_color="#88d8b0",
|
| 64 |
header_background="#FFFFFF",
|
| 65 |
-
header_color
|
| 66 |
-
text_align
|
| 67 |
-
sidebar_width
|
| 68 |
-
|
| 69 |
)
|
| 70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
# Run the app
|
| 72 |
template.servable()
|
|
|
|
| 2 |
from bokeh.models import Button
|
| 3 |
|
| 4 |
# Create buttons for the toggleable sidebar
|
| 5 |
+
button1 = pn.widgets.Button(icon='home', name="Home", icon_size='2em', width=130)
|
| 6 |
+
button2 = pn.widgets.Button(icon='file-analytics', name='My papers', icon_size='2em', width=130)
|
| 7 |
+
button3 = pn.widgets.Button(icon='settings', icon_size='2em', name='Settings', width=130)
|
|
|
|
| 8 |
|
| 9 |
# Create a column layout for the buttons inside the toggleable sidebar
|
| 10 |
buttons = pn.Column(button1, button2, button3, sizing_mode='stretch_width', css_classes=['hidden'])
|
|
|
|
| 46 |
new_options_checklist.options = options
|
| 47 |
checklist_visible = not checklist_visible
|
| 48 |
|
| 49 |
+
# "+" button to show the search options
|
| 50 |
add_option_button = Button(label="+", button_type="primary")
|
| 51 |
add_option_button.on_click(show_hide_checklist)
|
| 52 |
|
| 53 |
# Layout using Template
|
| 54 |
template = pn.template.FastListTemplate(
|
| 55 |
title="EasySciRead",
|
| 56 |
+
header=[pn.Row(filter_list, add_option_button, new_option_input, sizing_mode='stretch_width')],
|
| 57 |
+
sidebar=[buttons],
|
| 58 |
main=[
|
| 59 |
+
pn.Row(new_options_checklist, sizing_mode='stretch_width'),
|
|
|
|
| 60 |
pn.Column(text),
|
| 61 |
],
|
| 62 |
accent_base_color="#88d8b0",
|
| 63 |
header_background="#FFFFFF",
|
| 64 |
+
header_color="#000000",
|
| 65 |
+
text_align='center',
|
| 66 |
+
sidebar_width=150
|
|
|
|
| 67 |
)
|
| 68 |
|
| 69 |
+
# Update buttons' options based on filter_list
|
| 70 |
+
def update_buttons_options(event):
|
| 71 |
+
button2.options = filter_list.options
|
| 72 |
+
|
| 73 |
+
filter_list.param.watch(update_buttons_options, 'options')
|
| 74 |
+
|
| 75 |
# Run the app
|
| 76 |
template.servable()
|