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

Fix password #1033

Merged
merged 1 commit into from
Sep 26, 2023
Merged

Fix password #1033

merged 1 commit into from
Sep 26, 2023

Conversation

nstelter-slac
Copy link
Collaborator

@nstelter-slac nstelter-slac commented Sep 19, 2023

Issue was when using designer, entering a password in "Property" window on right-side of screen would not save the encrypted password to the .ui file as expected, and password feature would not work.

This is because editing the "password" property would in-turn update the "protectedPassword" property,
but designer would not consider the "protectedPassword" property as having been edited, and would then not save it out to the .ui file.

Fix is to update the "protectedPassword" widget property directly with "setProperty" when the "password" is set, to make sure designer knows to save the "protectedPassword" value.

Widget-update code grabbed from the "update_property_for_widget" function in "pydm/widgets/designer_settings.py":

def update_property_for_widget(widget: QtWidgets.QWidget, name: str, value):
    """Update a Property for the given widget in the designer."""
    formWindow = QtDesigner.QDesignerFormWindowInterface.findFormWindow(widget)
    logger.info("Updating %s.%s = %s", widget.objectName(), name, value)
    if formWindow:
        formWindow.cursor().setProperty(name, value)
    else:
        setattr(widget, name, value)

@nstelter-slac
Copy link
Collaborator Author

To verify fix:

-open shell_command/shell_command.ui in designer
-select one of the buttons, check "passwordProtected" and enter "password"
-save in designer, and then run shell_command.ui again
-click on modified button, enter password, confirm the password is accepted

@nstelter-slac nstelter-slac marked this pull request as ready for review September 21, 2023 19:56
Copy link
Collaborator

@YektaY YektaY left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. thank you

@YektaY YektaY merged commit cab9336 into slaclab:master Sep 26, 2023
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Password protected property not working in designer
2 participants