Skip to content

[FIX] Save dialogs: Avoid weird behavior with extensions on macOS#7195

Merged
markotoplak merged 1 commit intobiolab:masterfrom
janezd:fix-save-extensions-on-macos
Dec 19, 2025
Merged

[FIX] Save dialogs: Avoid weird behavior with extensions on macOS#7195
markotoplak merged 1 commit intobiolab:masterfrom
janezd:fix-save-extensions-on-macos

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 82 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
@janezd janezd marked this pull request as ready for review December 14, 2025 23:10
@MatejBevec
Copy link

Saving data (.tab), workflows (.ows) and reports (.pdf..) works as expected on Windows on this PR - no complaints about the extension, and only a single overwrite dialog when necessary.

@janezd
Copy link
Contributor Author

janezd commented Dec 17, 2025

@MatejBevec , thanks! I tried to install Windows into a virtual machine in VirtualBox on my macOs, but doesn't seem to work on Arm. It is said to work with VmWare, but I gave up.

@janezd
Copy link
Contributor Author

janezd commented Dec 17, 2025

@markotoplak , can you just try this on Linux, merge if OK, and then I guess we're ready for a release?

@markotoplak
Copy link
Member

On Linux it works in a very linuxy way: if I use a filename without an extension, it is NOT added, and I do NOT get any questions about it. I personally like this a lot.

The master branch exhibits the same behavior.

@markotoplak markotoplak merged commit a3a3197 into biolab:master Dec 19, 2025
25 of 30 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.

Save widget adds and rejects a suffix

3 participants