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

[RFC/WIP] Optional per-playlist column settings #698

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

rokm
Copy link
Member

@rokm rokm commented Apr 19, 2020

This PR implements an option to detach the playlist's column settings from the global state, and use private playlist-specific settings instead. The switch is added at the top of the columns context menu.

My primary use case is having the default columns (#, Title, Album, Artist, Length) for album-based playlists, and having only Title and Artist for custom-made playlists.

This involves reworking of how the column settings are managed; instead of direct access to the properties in the settings handle, the settings are now managed by the PlaylistView object in the GUI/widgets layer. However, to minimize the changes on the playlist save/restore codepath, the settings are also mirrored to the underlying xl.playlist.Playlist for storage purposes. I'm not entirely happy with this design, but it seems less intrusive than either trying to serialize/deserialize the column settings at the GUI layer, or trying to push the settings management all the way down to the xl.playlist.Playlist.

is_column_selected() and on_column_item_activate() within the
__register_playlist_columns_menuitems() are unused. The actual
callbacks used with ColumnMenuItem instances are the class-provided
is_selected() and on_item_activate().
…ings within PlaylistView

The playlist columns and their sizing settings (resizable flag and
individual column sizes) are now managed by PlaylistView instead
of direct access to settings. This will allow us to implement the
option to switch between global column settings and individual, per
playlist column settings.
…ettings

For now, we will piggyback on the existing playlist save/restore
infrastructure for persistent global/custom playlist column
settings.
…t columns switch

The columns context menu now has a "Global playlist columns"
checkbox, which allows user to switch between using global and
playlist-specific columns settings.
'global_playlist_columns',
'playlist_columns',
'resizable_cols',
'playlist_column_widths',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about grouping these under sort of a namespace, e.g. custom_columns/...?

resizable_cols = property(lambda self: self.__resizable_cols, _set_resizable_cols)
playlist_column_widths = property(
lambda self: self.__playlist_column_widths, _set_playlist_column_widths
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would look nicer with the @property and @....setter pattern.

global_columns_item = menu.check_menu_item(
'global-columns',
after,
_('Global columns settings'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I'm not sure about this. I'd probably prefer this be the reverse ("custom columns settings"), but I still don't find that clear enough.

@sjohannes
Copy link
Member

Regarding the design, I'm fine with it; seems the most reasonable option. It's probably not ideal having a GUI option leaking to what is part of "core", but it's not a big deal. But I think grouping the settings (as mentioned in my review comment) would make it better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants