Add custom buttons to the toolbar using section-button
Button to upload files. Use case image processing, parsing csv
I think all I would do is make it so that the file is placed in a temp directory that can be accessed within python.
How does that sound?
That sounds fine. The workflow I envisage is: upload image
- process image and review result in form
- save form to pdf
- post result of processing to db
cheers
Can you elaborate on the 'post result of processing to db' step? Will that need anything on the ScriptedForms end?
I had been thinking of a way to create sections that influence the toolbar. Like a "section-toolbar" which creates a button on the toolbar using material icons (https://material.io/icons/) which then runs the internal code when that toolbar item is clicked. It might look like:
<section-toolbar icon="save">
```python
code that sends results to db written here
```
</section-toolbar>
The icon would then look like the following:
https://material.io/icons/#ic_save
Post using a REST API - I've not looked at QAtrack in a while but recall an API was on its roadmap. In this case you would just need Requests. I like the toolbar shortcut idea, that way auth credentials could also be hidden.
Im familiar with material design icons as used by home-assistant, perhaps their code might be instructive
Actually, thinking further, it would be better to have it be just the following:
<section-button icon="save" toolbar>
```python
code that sends results to db written here
```
</section-button>
Just make it so the already existing <section-button> can have the 'toolbar' parameter added to it which makes the button move up to the toolbar instead of displaying next to the section itself.
I wouldn't assume any code within the form is truly hidden.
You could use the scriptedforms API to run the following code:
filename = 'robins-template-with-credentials.md'
with open(filename, 'r') as file:
markdown_template = file.read()
print(markdown_template)
Good point. Perhaps just have a constants.py or equivalent where people can define credentials, IP of servers etc, so that scripts can share
That's a good candidate for a yaml metadata file. Just don't think you can hide the contents of any file on or accessible by the host server from the user of a form.
Hi @robmarkcole,
What did I need to do for this issue again?
My original request was for a file upload button in the toolbar, such that upload files are available to scripts
Yup, okay. So if I make the ability to make custom buttons that should solve this.