I’m using panel 1.8.5 with python 3.12 and having problems with the filedropper widget
Is there something obviously wrong here?
Symtoms: When I drop an xml file on the widget, there is a little progress bar like it’s trying to update, but the value of the widget never actually updates.
import panel as pn
import param
pn.extension(
'filedropper',
notifications=True,
disconnect_notification='Connection lost, try reloading the page'
)
class MainWindow(pn.viewable.Viewer):
def __init__(self):
self.template = pn.template.MaterialTemplate(
title = "XML Viewer"
)
self.main = pn.Column(scroll=True, sizing_mode="stretch_both")
self.template.main.append(self.main)
self.filedrop = pn.widgets.FileDropper(
accepted_filetypes = ['.xml'],
multiple = False,
)
self.button = pn.widgets.Button(name="Peek at filedrop state",
button_type='primary')
self.main.objects = [
"# Drop a .xml file here",
self.filedrop,
self.button
]
super().__init__()
@param.depends("filedrop.value", watch=True)
def on_file_upload(self, *args):
assert False, "This callback is never reached"
@param.depends("button.clicks", watch=True)
def on_button_click(self, *args):
if self.filedrop.value:
pn.state.notifications.success("Dictionary keys {}" % self.filedrop.value.keys())
else:
pn.state.notifications.info("Dictionary is empty {}" % self.filedrop.value)
def __panel__(self):
return self.template
if pn.state.served:
MainWindow().servable()