Skip to content

Conversation

@janezd
Copy link
Contributor

@janezd janezd commented Nov 20, 2025

Issue

Fixes #7156.

  1. On macOS, the native file dialog added a (correct) extension and then complained that, e.g. extension .tab is invalid and that the required extension is .tab. This may be due to changed behavior in Qt6 or macOS Sequoia.

  2. Furthermore, macOS native dialog already asks whether to override the file (the flag DontConfirmOverwrite is ignored), hence the user was asked twice.

Description of changes
  1. This seems to be fixed by

    a. keeping the * in filters and
    b. by not giving the extension to the initial file name.

    Point a won't affect Window because we already had * there. Point 2 can; we need to try and patch if necessary.

  2. I removed the confirmation dialog for macOS, but kept it for Windows.

Includes
  • Code changes

@janezd janezd force-pushed the fix-save-extensions-on-macos branch from d376297 to d7aadbd Compare November 20, 2025 11:35
@codecov
Copy link

codecov bot commented Nov 20, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.91%. Comparing base (c807a41) to head (d7aadbd).
⚠️ Report is 20 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #7195   +/-   ##
=======================================
  Coverage   88.91%   88.91%           
=======================================
  Files         335      335           
  Lines       73978    74074   +96     
=======================================
+ Hits        65779    65866   +87     
- Misses       8199     8208    +9     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@janezd janezd added this to the 3.40 milestone Nov 21, 2025
def initial_start_dir(self):
if self.filename and os.path.exists(os.path.split(self.filename)[0]):
return self.filename
return os.path.splitext(self.filename)[0]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change might affect Windows. We need to check and, if necessary, do this only for macOS.

"""
if self.filename and os.path.exists(os.path.split(self.filename)[0]):
return self.filename
return os.path.splitext(self.filename)[0]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The same change as in the base class. See whether this is OK for Windows, too.

@markotoplak markotoplak changed the title Save dialogs: Avoid weird behavior with extensions on macOS [FIX] Save dialogs: Avoid weird behavior with extensions on macOS Nov 21, 2025
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.

Save widget adds and rejects a suffix

2 participants