Spaces:
Sleeping
Sleeping
Update app2.py
Browse files
app2.py
CHANGED
|
@@ -15,7 +15,6 @@ def load_categories():
|
|
| 15 |
|
| 16 |
def run_code(event):
|
| 17 |
categories = buttons_to_add
|
| 18 |
-
print("!!!!!!!!!!!This:", categories, flush=True)
|
| 19 |
timeframe_today = (datetime.combine(date.today(), datetime.min.time())).replace(tzinfo = pytz.utc)
|
| 20 |
timeframe_week = timeframe_today + relativedelta(weekday=MO(-1))
|
| 21 |
|
|
@@ -87,14 +86,13 @@ buttons_to_add = []
|
|
| 87 |
# Callback for adding selected options to the list
|
| 88 |
def add_to_header(event):
|
| 89 |
selected_options = filter_list.value
|
| 90 |
-
print("This is the button list2:", filter_list, filter_list.value, buttons_to_add, flush=True)
|
| 91 |
if selected_options:
|
| 92 |
for option in selected_options:
|
| 93 |
if option not in buttons_to_add: # Check if option is already in header
|
| 94 |
buttons_to_add.append(option) # Add to header if not already present
|
| 95 |
filter_list.value = [] # Clear the selected options after adding them to the header
|
| 96 |
update_header() # Update the header after adding options
|
| 97 |
-
|
| 98 |
run_tldr = partial(run_code, buttons_to_add)
|
| 99 |
add_to_header_button.on_click(add_to_header)
|
| 100 |
|
|
@@ -129,7 +127,6 @@ filter_list = pn.widgets.MultiChoice(
|
|
| 129 |
# Callback to remove the clicked header button
|
| 130 |
def remove_from_header(event):
|
| 131 |
button = event.obj # Get the clicked button
|
| 132 |
-
print("This is the button list3:", filter_list.value, flush=True)
|
| 133 |
if button.name in buttons_to_add:
|
| 134 |
buttons_to_add.remove(button.name) # Remove from the header buttons list
|
| 135 |
filter_list.options.append(button.name) # Add back to the filter list options
|
|
|
|
| 15 |
|
| 16 |
def run_code(event):
|
| 17 |
categories = buttons_to_add
|
|
|
|
| 18 |
timeframe_today = (datetime.combine(date.today(), datetime.min.time())).replace(tzinfo = pytz.utc)
|
| 19 |
timeframe_week = timeframe_today + relativedelta(weekday=MO(-1))
|
| 20 |
|
|
|
|
| 86 |
# Callback for adding selected options to the list
|
| 87 |
def add_to_header(event):
|
| 88 |
selected_options = filter_list.value
|
|
|
|
| 89 |
if selected_options:
|
| 90 |
for option in selected_options:
|
| 91 |
if option not in buttons_to_add: # Check if option is already in header
|
| 92 |
buttons_to_add.append(option) # Add to header if not already present
|
| 93 |
filter_list.value = [] # Clear the selected options after adding them to the header
|
| 94 |
update_header() # Update the header after adding options
|
| 95 |
+
print("This is the button list2:", buttons_to_add, flush=True)
|
| 96 |
run_tldr = partial(run_code, buttons_to_add)
|
| 97 |
add_to_header_button.on_click(add_to_header)
|
| 98 |
|
|
|
|
| 127 |
# Callback to remove the clicked header button
|
| 128 |
def remove_from_header(event):
|
| 129 |
button = event.obj # Get the clicked button
|
|
|
|
| 130 |
if button.name in buttons_to_add:
|
| 131 |
buttons_to_add.remove(button.name) # Remove from the header buttons list
|
| 132 |
filter_list.options.append(button.name) # Add back to the filter list options
|