Skip to content

Commit c8dde27

Browse files
committed
fix(ui): same default confirm button on win/mac
- Make "Yes" the default choice in the delete file modal for both Windows and macOS (Linux untested) - Change status messages to be more broad, since they also are displayed when cancelling the operation
1 parent 02c2455 commit c8dde27

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

tagstudio/src/qt/ts_qt.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,10 @@ def delete_files_callback(self, origin_path: str | Path):
866866
pending.append(filepath)
867867

868868
if pending:
869-
if self.delete_file_confirmation(len(pending), pending[0]) == 3:
869+
return_code = self.delete_file_confirmation(len(pending), pending[0])
870+
logging.info(return_code)
871+
# If there was a confirmation and not a cancellation
872+
if return_code == 2 and return_code != 3:
870873
for i, f in enumerate(pending):
871874
if (origin_path == f) or (not origin_path):
872875
self.preview_panel.stop_file_use()
@@ -887,18 +890,14 @@ def delete_files_callback(self, origin_path: str | Path):
887890
self.preview_panel.update_widgets()
888891

889892
if len(self.selected) <= 1 and deleted_count == 0:
890-
self.main_window.statusbar.showMessage(
891-
"No files deleted. Check if any of the files are currently in use."
892-
)
893+
self.main_window.statusbar.showMessage("No files deleted.")
893894
elif len(self.selected) <= 1 and deleted_count == 1:
894895
self.main_window.statusbar.showMessage(f"Deleted {deleted_count} file!")
895896
elif len(self.selected) > 1 and deleted_count == 0:
896-
self.main_window.statusbar.showMessage(
897-
"No files deleted! Check if any of the files are currently in use."
898-
)
897+
self.main_window.statusbar.showMessage("No files deleted.")
899898
elif len(self.selected) > 1 and deleted_count < len(self.selected):
900899
self.main_window.statusbar.showMessage(
901-
f"Only deleted {deleted_count} file{'' if deleted_count == 1 else 's'}! Check if any of the files are currently in use"
900+
f"Only deleted {deleted_count} file{'' if deleted_count == 1 else 's'}! Check if any of the files are currently missing or in use."
902901
)
903902
elif len(self.selected) > 1 and deleted_count == len(self.selected):
904903
self.main_window.statusbar.showMessage(f"Deleted {deleted_count} files!")
@@ -941,8 +940,10 @@ def delete_file_confirmation(self, count: int, filename: Path | None = None) ->
941940
"<h4>This will remove them from TagStudio <i>AND</i> your file system!</h4>"
942941
f"{perm_warning}<br>"
943942
)
943+
944+
yes_button: QPushButton = msg.addButton("&Yes", QMessageBox.ButtonRole.YesRole)
944945
msg.addButton("&No", QMessageBox.ButtonRole.NoRole)
945-
msg.addButton("&Yes", QMessageBox.ButtonRole.YesRole)
946+
msg.setDefaultButton(yes_button)
946947

947948
return msg.exec()
948949

0 commit comments

Comments
 (0)