From b56398495213fb10ee43b01c2f5fcfb1532dc28e Mon Sep 17 00:00:00 2001 From: rdbende Date: Sun, 14 Jul 2024 18:39:07 +0200 Subject: [PATCH] Format files --- cozy/ui/book_detail_view.py | 11 +++++++---- cozy/view_model/book_detail_view_model.py | 7 ++++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/cozy/ui/book_detail_view.py b/cozy/ui/book_detail_view.py index b502aa18..6ef8e0be 100644 --- a/cozy/ui/book_detail_view.py +++ b/cozy/ui/book_detail_view.py @@ -1,19 +1,20 @@ import logging import time +from math import pi as PI from threading import Event, Thread from typing import Callable, Final -from math import pi as PI -from gi.repository import Adw, GLib, Gtk, GObject, Gdk, Graphene, Gsk, Gio import cairo +from gi.repository import Adw, Gio, GLib, GObject, Graphene, Gtk + from cozy.control.artwork_cache import ArtworkCache from cozy.ext import inject from cozy.model.book import Book from cozy.model.chapter import Chapter from cozy.report import reporter from cozy.ui.chapter_element import ChapterElement -from cozy.view_model.book_detail_view_model import BookDetailViewModel from cozy.ui.toaster import ToastNotifier +from cozy.view_model.book_detail_view_model import BookDetailViewModel log = logging.getLogger(__name__) @@ -303,7 +304,9 @@ def _display_external_section(self): if external: self.available_offline_action.handler_block_by_func(self._download_switch_changed) - self.available_offline_action.set_state(GLib.Variant.new_boolean(self._view_model.book.offline)) + self.available_offline_action.set_state( + GLib.Variant.new_boolean(self._view_model.book.offline) + ) self.available_offline_action.handler_unblock_by_func(self._download_switch_changed) def _set_cover_image(self, book: Book): diff --git a/cozy/view_model/book_detail_view_model.py b/cozy/view_model/book_detail_view_model.py index e5313123..81d229dd 100644 --- a/cozy/view_model/book_detail_view_model.py +++ b/cozy/view_model/book_detail_view_model.py @@ -189,7 +189,12 @@ def _on_playback_speed_changed(self): self._notify("length") def _on_offline_cache_event(self, event, message) -> None: - if self._book and isinstance(message, Book) and self._book.id == message.id and event in {"book-offline-removed", "book-offline"}: + if ( + self._book + and isinstance(message, Book) + and self._book.id == message.id + and event in {"book-offline-removed", "book-offline"} + ): self._notify("downloaded") def _on_app_setting_changed(self, event, _):