Here’s mock up of how it might work in anvil.js.window
from anvil.js.window import Uppy
import anvil.js
class UppyComponent(UppyComponentTemplate):
def __init__(self, **properties):
# Set Form properties and Data Bindings.
self.init_components(**properties)
# Any code you write here will run when the form opens.
self.uppy = Uppy.Core().use(Uppy.Dashboard, {
'inline': True,
'showProgressDetails': True,
'target': anvil.js.get_dom_node(self)
})\
.use(Uppy.Tus, {'endpoint': 'your tus server here'})\
self.uppy.on('progress', self.progress)
self.uppy.on('upload-progress', self.upload_progress)
self.uppy.on('complete', self.complete)
self.uppy.on('file-added', self.file_added)
def file_added(self, file, *args):
print(file)
def progress(self, progress, *args):
print(progress)
def upload_progress(self, file, progress, *args):
print(file.id, progress.bytesUploaded, progress.bytesTotal)
def complete(self, result, *args):
print(result)
I can add files as you’d expect.
I can’t upload files because I don’t have a TUS endpoint to upload them too… But it looks as if things would work if I had an endpoint. The spinner spins and then immediately fails - so the ui is working for me as I’d expect