mirror of
https://github.com/TagStudioDev/TagStudio.git
synced 2026-02-11 04:12:28 +00:00
refactor: split QtDriver into View and Controller to follow MVC model (#935)
* fix: incorrect qt enum accesses * refactor: clean up main_window.py and reenable ruff checks for it * refactor: completely reorganise main_window.py * refactor: factor out regions into separate methods * refactor: move preview_panel to MainWindow * refactor: move file menu construction to MainMenuBar * refactor: move edit menu construction to MainMenuBar * refactor: move view menu construction to MainMenuBar * refactor: move tools menu construction to MainMenuBar * refactor: move macros menu construction to MainMenuBar * refactor: move help menu construction to MainMenuBar * refactor: move ui construction code out of QtDriver and into MainWindow * fix: remove unnecessary imports * fix: tests were failing
This commit is contained in:
@@ -155,14 +155,15 @@ def qt_driver(qtbot, library, library_dir: Path):
|
||||
|
||||
driver.app = Mock()
|
||||
driver.main_window = Mock()
|
||||
driver.preview_panel = Mock()
|
||||
driver.flow_container = Mock()
|
||||
driver.main_window.preview_panel = Mock()
|
||||
driver.main_window.thumb_grid = Mock()
|
||||
driver.main_window.thumb_size = 128
|
||||
driver.item_thumbs = []
|
||||
driver.autofill_action = Mock()
|
||||
driver.main_window.menu_bar.autofill_action = Mock()
|
||||
|
||||
driver.copy_buffer = {"fields": [], "tags": []}
|
||||
driver.copy_fields_action = Mock()
|
||||
driver.paste_fields_action = Mock()
|
||||
driver.main_window.menu_bar.copy_fields_action = Mock()
|
||||
driver.main_window.menu_bar.paste_fields_action = Mock()
|
||||
|
||||
driver.lib = library
|
||||
# TODO - downsize this method and use it
|
||||
|
||||
@@ -121,18 +121,18 @@ def test_title_update(
|
||||
qt_driver.settings.show_filepath = filepath_option
|
||||
menu_bar = QMenuBar()
|
||||
|
||||
qt_driver.open_recent_library_menu = QMenu(menu_bar)
|
||||
qt_driver.manage_file_ext_action = QAction(menu_bar)
|
||||
qt_driver.save_library_backup_action = QAction(menu_bar)
|
||||
qt_driver.close_library_action = QAction(menu_bar)
|
||||
qt_driver.refresh_dir_action = QAction(menu_bar)
|
||||
qt_driver.tag_manager_action = QAction(menu_bar)
|
||||
qt_driver.color_manager_action = QAction(menu_bar)
|
||||
qt_driver.new_tag_action = QAction(menu_bar)
|
||||
qt_driver.fix_dupe_files_action = QAction(menu_bar)
|
||||
qt_driver.fix_unlinked_entries_action = QAction(menu_bar)
|
||||
qt_driver.clear_thumb_cache_action = QAction(menu_bar)
|
||||
qt_driver.folders_to_tags_action = QAction(menu_bar)
|
||||
qt_driver.main_window.menu_bar.open_recent_library_menu = QMenu(menu_bar)
|
||||
qt_driver.main_window.menu_bar.manage_file_ext_action = QAction(menu_bar)
|
||||
qt_driver.main_window.menu_bar.save_library_backup_action = QAction(menu_bar)
|
||||
qt_driver.main_window.menu_bar.close_library_action = QAction(menu_bar)
|
||||
qt_driver.main_window.menu_bar.refresh_dir_action = QAction(menu_bar)
|
||||
qt_driver.main_window.menu_bar.tag_manager_action = QAction(menu_bar)
|
||||
qt_driver.main_window.menu_bar.color_manager_action = QAction(menu_bar)
|
||||
qt_driver.main_window.menu_bar.new_tag_action = QAction(menu_bar)
|
||||
qt_driver.main_window.menu_bar.fix_unlinked_entries_action = QAction(menu_bar)
|
||||
qt_driver.main_window.menu_bar.fix_dupe_files_action = QAction(menu_bar)
|
||||
qt_driver.main_window.menu_bar.clear_thumb_cache_action = QAction(menu_bar)
|
||||
qt_driver.main_window.menu_bar.folders_to_tags_action = QAction(menu_bar)
|
||||
|
||||
# Trigger the update
|
||||
qt_driver._init_library(library_dir, open_status)
|
||||
|
||||
Reference in New Issue
Block a user