TomographicImaging / eqt

A number of templates and tools to develop Qt GUI's with Python effectively.
Other
2 stars 3 forks source link

Add methods to UIFormWidget for saving and reinstating values of widgets #61

Closed lauramurgatroyd closed 1 year ago

lauramurgatroyd commented 1 year ago

https://github.com/paskino/qt-elements/blob/3efa58cf7dc4f2bb87565d0165179805ff237b18/eqt/ui/UIFormWidget.py#L4

I think it would be best to save a dictionary with the name of the widget and its state

lauramurgatroyd commented 1 year ago

Make sure it can handle the following widget types:

lauramurgatroyd commented 1 year ago

As well as their status (i.e. current value) we also want to save and be able to reload whether the widgets are enabled or not. Should we have two dictionaries - one for widget values and one for widget enabled?

paskino commented 1 year ago

Or one with multiple info per widget?

lauramurgatroyd commented 1 year ago

Each widget could have a dict with 'value', 'enabled' and 'visibility'. value could be a bool, str or int depending on the type of widget.

e.g. state = {'widget name' : {'value': True, 'visibility': False, 'enabled': True}}

lauramurgatroyd commented 1 year ago

Current code used for saving and restoring widgets in viewer toolbar dialogs is here: https://github.com/Dagonite/CILViewer/blob/3c070b25fbbea7dc35bf8b77a21b784998e973d0/Wrappers/Python/ccpi/viewer/ui/SettingsDialog.py#L35-L59