Skip to content
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
wants to merge 56 commits into from
Closed

Itemviews refactoring #2454

wants to merge 56 commits into from

Conversation

zas
Copy link
Collaborator

@zas zas commented May 6, 2024

Summary

  • This is a…
    • Bug fix
    • Feature addition
    • Refactoring
    • Minor / simple change (like a typo)
    • Other
  • Describe this change in 1-2 sentences:

Problem

  • JIRA ticket (optional): PICARD-XXX

Solution

Action

Additional actions required:

  • Update Picard documentation (please include a reference to this PR)
  • Other (please specify below)

picard/ui/itemviews.py Outdated Show resolved Hide resolved
@zas zas force-pushed the itemsview_cleanup branch 3 times, most recently from 84f6fe7 to e1cbff8 Compare May 8, 2024 10:26
phw and others added 26 commits May 8, 2024 14:23
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
zas added 2 commits May 8, 2024 14:25
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>
```
@zas zas requested review from phw and rdswift May 8, 2024 13:36
@zas zas changed the title WIP: itemviews cleanup Itemviews refactoring May 8, 2024
@zas zas marked this pull request as ready for review May 8, 2024 16:34
@zas
Copy link
Collaborator Author

zas commented May 12, 2024

Obsolete PR, most changes were introduced in smaller PRs.

See:
#2461
#2462
#2463
#2464
#2466

@zas zas closed this May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants