-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add methods to UIFormWidget for saving and restoring widget states #64
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lauramurgatroyd
changed the title
Save widget states
Add methods to UIFormWidget for saving and restoring widget states
Jan 18, 2023
paskino
requested changes
Jan 18, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some docstrings to be updated.
Why should we keep the default of role set to None
?
I don't understand why the default widget name is name
.
Co-authored-by: Edoardo Pasca <edo.paskino@gmail.com>
Co-authored-by: Edoardo Pasca <edo.paskino@gmail.com>
Co-authored-by: Edoardo Pasca <edo.paskino@gmail.com>
Co-authored-by: Edoardo Pasca <edo.paskino@gmail.com>
I have updated the docstrings as you suggested |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #61
Adds the following new methods to UIFormWidget, FormWidget, FormDialog and FormDockWidget:
saveAllWidgetStates
- Saves the state of all widgets in the form. This can be used to restore the state of the widgets using the restoreAllSavedWidgetStates method.restoreAllSavedWidgetStates
- Restores the state of all widgets in the form to the state saved by the saveAllWidgetStates method. If the saveAllWidgetStates method has not been called, this method will do nothing.getAllWidgetStates
- Returns a dictionary of the state of all widgets in the form.getWidgetState
- Returns the state of the widget.applyWidgetState
- Applies the given state to the widget with the given name.applyWidgetStates
- Applies the given state to the widgets in the form given by the keys of the state dictionary.Adds an example of a FormDialog:
dialog_save_state_example.py
where all of the widgets are saved and restored if you press "Ok", whereas the previous values of the dialog are restored if you press "Cancel".Adds unit tests to fully cover all of the new methods
setup.py: