Skip to content

Postpone instantiating modal windows #425

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions tagstudio/src/qt/ts_qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,14 +469,24 @@ def start(self) -> None:
window_menu.addAction(check_action)

# Tools Menu ===========================================================
def create_fix_unlinked_entries_modal():
"""Postpone the creation of the modal until it is needed."""
if not hasattr(self, "unlinked_modal"):
self.unlinked_modal = FixUnlinkedEntriesModal(self.lib, self)
self.unlinked_modal.show()

fix_unlinked_entries_action = QAction("Fix &Unlinked Entries", menu_bar)
fue_modal = FixUnlinkedEntriesModal(self.lib, self)
fix_unlinked_entries_action.triggered.connect(lambda: fue_modal.show())
fix_unlinked_entries_action.triggered.connect(create_fix_unlinked_entries_modal)
tools_menu.addAction(fix_unlinked_entries_action)

def create_dupe_files_modal():
"""Postpone the creation of the modal until it is needed."""
if not hasattr(self, "dupe_modal"):
self.dupe_modal = FixDupeFilesModal(self.lib, self)
self.dupe_modal.show()

fix_dupe_files_action = QAction("Fix Duplicate &Files", menu_bar)
fdf_modal = FixDupeFilesModal(self.lib, self)
fix_dupe_files_action.triggered.connect(lambda: fdf_modal.show())
fix_dupe_files_action.triggered.connect(create_dupe_files_modal)
tools_menu.addAction(fix_dupe_files_action)

create_collage_action = QAction("Create Collage", menu_bar)
Expand Down Expand Up @@ -527,9 +537,14 @@ def start(self) -> None:
)
window_menu.addAction(show_libs_list_action)

def create_folders_tags_modal():
"""Postpone the creation of the modal until it is needed."""
if not hasattr(self, "folders_modal"):
self.folders_modal = FoldersToTagsModal(self.lib, self)
self.folders_modal.show()

folders_to_tags_action = QAction("Folders to Tags", menu_bar)
ftt_modal = FoldersToTagsModal(self.lib, self)
folders_to_tags_action.triggered.connect(lambda: ftt_modal.show())
folders_to_tags_action.triggered.connect(create_folders_tags_modal)
macros_menu.addAction(folders_to_tags_action)

# Help Menu ==========================================================
Expand Down