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 logic for selecting action in file dialog #2003

Merged

Conversation

greschd
Copy link
Contributor

@greschd greschd commented Mar 23, 2023

The FileDialog.action can have values open, open files, or save as, see https://github.com/enthought/pyface/blob/a9bf0264cb2afe9d05ce8856de650fd6efbc2684/pyface/ui/wx/file_dialog.py#L37 and https://github.com/enthought/pyface/blob/a9bf0264cb2afe9d05ce8856de650fd6efbc2684/pyface/ui/qt/file_dialog.py#L36.

The dialog_style on the other hand can have values open and save, see

#: Should be one of 'open' or 'save'
dialog_style = Str("open")

As such, the logic for converting from dialog_style to action was the wrong way around. As a result,
the file dialog would always open in "open" mode.

Copy link
Contributor

@corranwebster corranwebster left a comment

Choose a reason for hiding this comment

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

Looks good to me!

Thanks for the PR.

@greschd
Copy link
Contributor Author

greschd commented Apr 6, 2023

While running this change, I've noticed that the FileEditor doesn't properly clear its error state. I've created a follow-up PR (#2007) for this.

@corranwebster
Copy link
Contributor

Could you update this to the current main branch - we've moved traitsui/qt4 to traitsui/qt and github can't automatically merge

@greschd greschd force-pushed the fix/file_editor_open_save_mode branch from 906224b to f83cd39 Compare April 6, 2023 21:04
@corranwebster corranwebster merged commit 70925b5 into enthought:main Apr 11, 2023
@greschd greschd deleted the fix/file_editor_open_save_mode branch April 11, 2023 13:26
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.

2 participants