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
Itemviews refactoring #2454
Closed
Closed
Itemviews refactoring #2454
Conversation
This file contains 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
phw
reviewed
May 7, 2024
zas
force-pushed
the
itemsview_cleanup
branch
3 times, most recently
from
May 8, 2024 10:26
84f6fe7
to
e1cbff8
Compare
When moving ensure update_acoustid happens before calling parent.add_file but after parent has been changed. This ensures the fingerprint status is correct when the parent updates and makes another update afterwards unnecessary.
- Get rid of MainPanel._column_indexes - Get rid of direct access to MainPanel.columns
- drop MainPanel.get_column_index() and iterate_columns() - use Columns.pos() and Columns.iterate() instead - Column is extensible (add properties align & size as examples) - Columns.pos() is O(1) if dict was built, build the dict if needed only - Columns works like a list when it comes to insert/append/remove/etc - Columns elements have to be instances of Column
Call it for each view in MainPanel.__init__() (for now)
MainPanel.columns is now a copy of DEFAULT_COLUMNS
- it has an off-by-one error so it is always executed on unlock, though it was intended to not be for last column - disabling it doesn't seem to cause any issue, locking/unlocking doesn't seem to affect sizes anyway
It replaces matches for `~fingerprint` column and code was modified to work for any icon column
- when saving state to config, save the prelock state, and restore it before locking again on restore from config - do not change header settings when unlocking, just restore previous state if any - when locking, save state before changing header settings
- move a good part of the code out ConfigurableColumnsHeader to new set_header_defaults() - simplify restoration of headers, ensure proper defaults are set in case of failure
- it relies on a function that is called when needed, mainly because icontheme.lookup() cannot be called before QApplication - it caches the result - icon size and border have to be set too
- sometimes treeWidget() is returning None, while *Item update() is called, I added a warning about this - parent object wasn't always passed to *Item(), this also causes various issues
Suggested by outsidecontext
It will now log: ``` D: 13:03:20,551 ui/itemviews.save_state:833: Save state of FileTreeView's header D: 13:03:20,551 ui/itemviews.save_state:833: Save state of AlbumTreeView's header ``` Instead of: ``` D: 12:48:28,894 ui/itemviews.save_state:830: Save state of <picard.ui.itemviews.ConfigurableColumnsHeader object at 0x7f6ea0693c70> D: 12:48:28,894 ui/itemviews.save_state:830: Save state of <picard.ui.itemviews.ConfigurableColumnsHeader object at 0x7f6ea0693d90> ```
…ce code redundancy
Log output: ``` D: 14:34:12,224 ui/itemviews.save_state:838: Save state of file view's header D: 14:34:12,224 ui/itemviews.save_state:838: Save state of album view's header ```
…ions aren't loaded
In this context, obj is always an Album
phw
reviewed
May 9, 2024
…tension_points.item_actions - it breaks plugins of course
- get rid of FileTreeView dependency
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Problem
Solution
Action
Additional actions required: