-
-
Notifications
You must be signed in to change notification settings - Fork 411
refactor(preview_panel): mvc split #952
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
Open
Computerdores
wants to merge
13
commits into
TagStudioDev:main
Choose a base branch
from
Computerdores:refactor/mvc-split-preview-panel
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
1193cda
refactor: basic split
Computerdores caa2a32
fix: renaming and usage test didn't work for the tests
Computerdores f3cd938
fix: tests
Computerdores b115a6a
refactor: restructuring
Computerdores 47a365e
refactor: further separation and lots of related changes
Computerdores f079312
refactor: remove last reference to a widget from controller
Computerdores 1e2864c
refactor: address todo
Computerdores 892eeab
fix: failing tests and mypy compaint
Computerdores 60bd9ac
refactor: move control logic to controller
Computerdores 3bdb69b
refactor: more readable button style
Computerdores fcc48be
Merge branch 'main' into refactor/mvc-split-preview-panel
Computerdores 18508a1
Merge branch 'main' into refactor/mvc-split-preview-panel
Computerdores 1341da3
fix: set_selection was called with invalid argument
Computerdores File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/tagstudio/qt/controller/widgets/preview_panel_controller.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import typing | ||
from warnings import catch_warnings | ||
|
||
from PySide6.QtWidgets import QListWidgetItem | ||
|
||
from tagstudio.core.library.alchemy.library import Library | ||
from tagstudio.qt.modals.add_field import AddFieldModal | ||
from tagstudio.qt.modals.tag_search import TagSearchModal | ||
from tagstudio.qt.view.widgets.preview_panel_view import PreviewPanelView | ||
|
||
if typing.TYPE_CHECKING: | ||
from tagstudio.qt.ts_qt import QtDriver | ||
|
||
|
||
class PreviewPanel(PreviewPanelView): | ||
def __init__(self, library: Library, driver: "QtDriver"): | ||
super().__init__(library, driver) | ||
|
||
self.__add_field_modal = AddFieldModal(self.lib) | ||
self.__add_tag_modal = TagSearchModal(self.lib, is_tag_chooser=True) | ||
|
||
def _add_field_button_callback(self): | ||
self.__add_field_modal.show() | ||
|
||
def _add_tag_button_callback(self): | ||
self.__add_tag_modal.show() | ||
|
||
def _set_selection_callback(self): | ||
with catch_warnings(record=True): | ||
self.__add_field_modal.done.disconnect() | ||
self.__add_tag_modal.tsp.tag_chosen.disconnect() | ||
|
||
self.__add_field_modal.done.connect(self._add_field_to_selected) | ||
self.__add_tag_modal.tsp.tag_chosen.connect(self._add_tag_to_selected) | ||
|
||
def _add_field_to_selected(self, field_list: list[QListWidgetItem]): | ||
self._fields.add_field_to_selected(field_list) | ||
if len(self._selected) == 1: | ||
self._fields.update_from_entry(self._selected[0]) | ||
|
||
def _add_tag_to_selected(self, tag_id: int): | ||
self._fields.add_tags_to_selected(tag_id) | ||
if len(self._selected) == 1: | ||
self._fields.update_from_entry(self._selected[0]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.