Skip to content
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

FormDialog widget_states KeyErrors in insert/remove widget examples #178

Open
jcornall opened this issue Jan 29, 2025 · 0 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@jcornall
Copy link
Collaborator

The examples insert_widgets_example.py and remove_widgets_example.py both raise FormDialog KeyErrors when accessing the widget_states dictionary in specific situations:

insert_widgets_example.py:

  • After clicking the Open Form Dialog button and clicking Cancel, the following error message is displayed:
Traceback (most recent call last):
  File "C:\Users\pam62425\AppData\Local\mambaforge\envs\eqt_env\Lib\site-packages\eqt\ui\FormDialog.py", line 43, in _onCancel
    self.onCancel()
  File "c:\Users\pam62425\github\eqt\examples\insert_widgets_example.py", line 91, in onCancel
    ) != self.dialog.getWidgetStates()['Button insert vertical_field']['enabled'] is True:
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'Button insert vertical_field'
  • The message no longer displays after the user clicks OK and reopens the FormDialog - clicking Cancel no longer raises the KeyError

remove_widgets_example.py:

  • After clicking the Open Form Dialog button and Remove widget 1, clicking Cancel results in the following error message:
Traceback (most recent call last):
  File "C:\Users\pam62425\AppData\Local\mambaforge\envs\eqt_env\Lib\site-packages\eqt\ui\FormDialog.py", line 45, in _onCancel
    self.restoreAllSavedWidgetStates()
  File "C:\Users\pam62425\AppData\Local\mambaforge\envs\eqt_env\Lib\site-packages\eqt\ui\FormDialog.py", line 260, in restoreAllSavedWidgetStates
    self.formWidget.restoreAllSavedWidgetStates()
  File "C:\Users\pam62425\AppData\Local\mambaforge\envs\eqt_env\Lib\site-packages\eqt\ui\UIFormWidget.py", line 474, in restoreAllSavedWidgetStates
    self.applyWidgetStates(self.default_widget_states)
  File "C:\Users\pam62425\AppData\Local\mambaforge\envs\eqt_env\Lib\site-packages\eqt\ui\UIFormWidget.py", line 440, in applyWidgetStates
    raise KeyError(f"states={set(states)} do not match form widgets ({set(self.widgets)})")
KeyError: "states={'userinput_field', 'Widget 1_label', 'Button Remove w1_field', 'Button remove vertical_field', 'Widget 2_field', 'Button Remove Spanning_field', 'Widget 2_label', 'ok_cancel_instructions_field', 'Widget 3_field', 'userinput_label', 'Widget 3_label', 'input_title_field', 'Widget 1_field'} do not match form widgets ({'userinput_field', 'Button Remove w1_field', 'Button remove vertical_field', 'Widget 2_field', 'Button Remove Spanning_field', 'ok_cancel_instructions_field', 'Widget 3_field', 'userinput_label', 'Widget 3_label', 'input_title_field', 'Widget 2_label'})"
@jcornall jcornall added the bug Something isn't working label Jan 29, 2025
@jcornall jcornall self-assigned this Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant