EasySci commited on
Commit
a617b4a
·
1 Parent(s): ba03def

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -15
app.py CHANGED
@@ -20,23 +20,11 @@ text = pn.pane.Markdown(instructions)
20
  # List to store the entered options
21
  entered_options = ["option1", "option2", "option3", "option5", "option6", "option7", "option8", "option9"]
22
 
23
- # MultiChoice widget to display the filter options
24
- filter_list = pn.widgets.MultiChoice(
25
- name='',
26
- value=[],
27
- options=entered_options,
28
- margin=(20, 10),
29
- sizing_mode='fixed',
30
- styles={'background': '#f0f0f0'},
31
- placeholder = "Search Topics"
32
-
33
- )
34
-
35
  # Create buttons for the header
36
  header_buttons = pn.Row(sizing_mode='stretch_width', css_classes=['header-buttons'])
37
 
38
  # "+" button to trigger the addition to the header
39
- add_to_header_button = pn.widgets.Button(name="",icon='search', icon_size='1.5em', styles={'background': '#f0f0f0'})
40
 
41
  # List to store the names of buttons to be added to the header
42
  buttons_to_add = []
@@ -58,12 +46,25 @@ def update_header():
58
  new_button = pn.widgets.Button(name=button_name, width = 50, sizing_mode='fixed')
59
  header_buttons.append(new_button)
60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  # Layout using Template
62
  template = pn.template.FastListTemplate(
63
  title="EasySciRead",
64
- header=[pn.Row(header_buttons, width = 800, sizing_mode='fixed'), pn.Row(filter_list, width = 250), pn.Row(add_to_header_button,width = 55)],
65
  main=[
66
- # pn.Row(header_buttons),
67
  pn.Column(text),
68
  ],
69
  sidebar=[buttons],
 
20
  # List to store the entered options
21
  entered_options = ["option1", "option2", "option3", "option5", "option6", "option7", "option8", "option9"]
22
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  # Create buttons for the header
24
  header_buttons = pn.Row(sizing_mode='stretch_width', css_classes=['header-buttons'])
25
 
26
  # "+" button to trigger the addition to the header
27
+ add_to_header_button = pn.widgets.Button(name="",icon='search', icon_size='1.5em', button_type='default', styles={'background': '#f0f0f0'})
28
 
29
  # List to store the names of buttons to be added to the header
30
  buttons_to_add = []
 
46
  new_button = pn.widgets.Button(name=button_name, width = 50, sizing_mode='fixed')
47
  header_buttons.append(new_button)
48
 
49
+ # Update the filter list options to exclude buttons that are already in the header
50
+ filter_list.options = [option for option in entered_options if option not in buttons_to_add]
51
+
52
+ # MultiChoice widget to display the filter options with delete buttons
53
+ filter_list = pn.widgets.MultiChoice(
54
+ name='',
55
+ value=[],
56
+ options=entered_options,
57
+ margin=(20, 10),
58
+ sizing_mode='fixed',
59
+ styles={'background': '#f0f0f0'},
60
+ placeholder="Search Topics"
61
+ )
62
+
63
  # Layout using Template
64
  template = pn.template.FastListTemplate(
65
  title="EasySciRead",
66
+ header=[pn.Row(header_buttons, width=800, sizing_mode='fixed'), pn.Row(filter_list, width=250), pn.Row(add_to_header_button, width=55)],
67
  main=[
 
68
  pn.Column(text),
69
  ],
70
  sidebar=[buttons],