NIST-ISODB / isotherm-digitizer-panel

Contribution form for NIST adsorption isotherm database implemented using pyviz panel
2 stars 3 forks source link

add button to reset all values #13

Open ltalirz opened 4 years ago

ltalirz commented 4 years ago

workaround: simply reload the page

dwsideriusNIST commented 4 years ago

Initial version in https://github.com/dwsideriusNIST/isotherm-digitizer-panel/tree/feature-reset

Currently a reset for the self.figure_image widget is not working.

ltalirz commented 4 years ago

Thanks Dan! I had a quick look and I would hope that I can simplify things a bit so that one does not have to reproduce the list of input elements multiple times. I'll look into this when I find time

dwsideriusNIST commented 4 years ago

Leo, I agree: that list of form elements appears several places in the code and I was thinking of something along the same lines. Given the way it is used differently in the reset and load_json operations, it may need to be a tuple or similar. (I was already leaning that way for reset operation to genericize the for loop.)

dwsideriusNIST commented 4 years ago

I looked at this more closely today and don't have a good solution yet. Here is where the list of form elements would be useful:

  1. Reset form (obv)
  2. load_isotherm_json (pre-fill)
  3. Building the actual form at self.layout = pn.Column(

A list of tuples could be useful, where each tuple contains the element's form object, the reset value, and a mapping of that element to the appropriate JSON key. I'm sure there would be a cluster of "non-standard" operations that would have to be written for specific form elements.