|
97 | 97 | from tagstudio.qt.utils.custom_runnable import CustomRunnable |
98 | 98 | from tagstudio.qt.utils.file_deleter import delete_file |
99 | 99 | from tagstudio.qt.utils.function_iterator import FunctionIterator |
| 100 | +from tagstudio.qt.views.add_url_entry_panel_view import AddUrlEntryPanel |
100 | 101 | from tagstudio.qt.views.main_window import MainWindow |
101 | 102 | from tagstudio.qt.views.panel_modal import PanelModal |
102 | 103 | from tagstudio.qt.views.splash import SplashScreen |
@@ -426,6 +427,10 @@ def set_open_last_loaded_on_startup(checked: bool): |
426 | 427 | lambda: self.add_tag_action_callback() |
427 | 428 | ) |
428 | 429 |
|
| 430 | + self.main_window.menu_bar.new_url_entry_action.triggered.connect( |
| 431 | + lambda: self.add_url_entry_action_callback() |
| 432 | + ) |
| 433 | + |
429 | 434 | self.main_window.menu_bar.select_all_action.triggered.connect( |
430 | 435 | self.select_all_action_callback |
431 | 436 | ) |
@@ -775,6 +780,7 @@ def close_library(self, is_shutdown: bool = False): |
775 | 780 | self.main_window.menu_bar.color_manager_action.setEnabled(False) |
776 | 781 | self.main_window.menu_bar.ignore_modal_action.setEnabled(False) |
777 | 782 | self.main_window.menu_bar.new_tag_action.setEnabled(False) |
| 783 | + self.main_window.menu_bar.new_url_entry_action.setEnabled(False) |
778 | 784 | self.main_window.menu_bar.fix_unlinked_entries_action.setEnabled(False) |
779 | 785 | self.main_window.menu_bar.fix_ignored_entries_action.setEnabled(False) |
780 | 786 | self.main_window.menu_bar.fix_dupe_files_action.setEnabled(False) |
@@ -846,6 +852,17 @@ def add_tag_action_callback(self): |
846 | 852 | ) |
847 | 853 | self.modal.show() |
848 | 854 |
|
| 855 | + def add_url_entry_action_callback(self): |
| 856 | + panel = AddUrlEntryPanel(self.lib) |
| 857 | + self.modal = PanelModal( |
| 858 | + panel, |
| 859 | + Translations["entry.new.url"], |
| 860 | + Translations["entry.add"], |
| 861 | + has_save=True, |
| 862 | + ) |
| 863 | + |
| 864 | + self.modal.show() |
| 865 | + |
849 | 866 | def select_all_action_callback(self): |
850 | 867 | """Set the selection to all visible items.""" |
851 | 868 | self.main_window.thumb_layout.select_all() |
@@ -1650,6 +1667,7 @@ def _init_library(self, path: Path, open_status: LibraryStatus): |
1650 | 1667 | self.main_window.menu_bar.color_manager_action.setEnabled(True) |
1651 | 1668 | self.main_window.menu_bar.ignore_modal_action.setEnabled(True) |
1652 | 1669 | self.main_window.menu_bar.new_tag_action.setEnabled(True) |
| 1670 | + self.main_window.menu_bar.new_url_entry_action.setEnabled(True) |
1653 | 1671 | self.main_window.menu_bar.fix_unlinked_entries_action.setEnabled(True) |
1654 | 1672 | self.main_window.menu_bar.fix_ignored_entries_action.setEnabled(True) |
1655 | 1673 | self.main_window.menu_bar.fix_dupe_files_action.setEnabled(True) |
|
0 commit comments