feder-observatory / stellarphot

Stellar aperture photometry
https://stellarphot.readthedocs.io
BSD 3-Clause "New" or "Revised" License
4 stars 12 forks source link

Save button is enabled after clicking edit even though no changes have been made #309

Closed mwcraig closed 6 months ago

mwcraig commented 6 months ago

This sequence of events leads to an save button that is enabled even though no changes have been made:

  1. Make a new camera or edit an existing one.
  2. Click save (after making a change if necessary)
  3. Click confirm if necessary
  4. Click Edit
  5. The save button will be enabled even though no changes have been made.

The root cause is these lines which are an attempt to make to prevent the save button dfrom being enabled unless the model is valid.

That is useful, but whether there are any unsaved changes also needs to be taken into account. That is available in SaveButtonBar.unsaved_changes.

mwcraig commented 6 months ago

Note to self: Turns out this is the default behavior in ipyautoui. The save and revert buttons are always enabled, regardless of the validation state and whether changes have been made.

Rather than making a fix in custom_widgets.py I think it is better to make the change in ui_generator in views.py so that all of the ipyautoui forms have the same behavior.