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

Minor fixes in filtering and recents screen #853

Merged
merged 5 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cozy/ui/library_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def _on_library_view_mode_changed(self):
visible_child_name = RECENT_PAGE
elif view_mode == LibraryViewMode.CURRENT:
visible_child_name = RECENT_PAGE
if not self._view_model.is_any_book_in_progress:
if not self._view_model.is_any_book_recent:
books_view_page = NO_RECENT_PAGE
elif view_mode == LibraryViewMode.AUTHOR:
visible_child_name = AUTHOR_PAGE
Expand Down
15 changes: 9 additions & 6 deletions cozy/view_model/library_view_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ def selected_filter(self, value):
self._notify("selected_filter")

@property
def is_any_book_in_progress(self) -> bool:
def is_any_book_recent(self) -> bool:
for book in self.books:
if book.position > 0:
if book.last_played > 0:
Haaruun-I marked this conversation as resolved.
Show resolved Hide resolved
return True
return False

Expand Down Expand Up @@ -134,12 +134,15 @@ def display_book_filter(self, book_element: BookElement):
hide_offline_books = self._application_settings.hide_offline
book_is_online = self._fs_monitor.get_book_online(book)

if self.selected_filter == _("All"):
return True
elif hide_offline_books and not book_is_online and not book.downloaded:

if hide_offline_books and not book_is_online and not book.downloaded:
return False
elif self.library_view_mode == LibraryViewMode.CURRENT:

if self.library_view_mode == LibraryViewMode.CURRENT:
return book.last_played > 0

if self.selected_filter == _("All"):
return True
Haaruun-I marked this conversation as resolved.
Show resolved Hide resolved
elif self.library_view_mode == LibraryViewMode.AUTHOR:
return self.selected_filter in book.author
elif self.library_view_mode == LibraryViewMode.READER:
Expand Down
Loading