diff options
Diffstat (limited to 'src/application.py')
| -rw-r--r-- | src/application.py | 45 |
1 files changed, 2 insertions, 43 deletions
diff --git a/src/application.py b/src/application.py index 46ab901..24c2a9a 100644 --- a/src/application.py +++ b/src/application.py @@ -2,51 +2,10 @@ # https://github.com/Taiko2k/GTK4PythonTutorial/blob/main/README.md#adding-your-custom-css-stylesheet import gi -gi.require_version('Gtk', '4.0') gi.require_version('Adw', '1') -from gi.repository import Gtk, Adw +from gi.repository import Adw -from src.book_flow import BookFlow -from src.filters import Filters -from src.book_form import BookForm -import src.utils as utils - -class MainWindow(Gtk.ApplicationWindow): - def __init__(self, resources, library, ereader, conn, *args, **kwargs): - super().__init__(*args, **kwargs) - - utils.set_header_bar(self, 'Books') - - scrolled_window = Gtk.ScrolledWindow() - self.set_child(scrolled_window) - - init_progress = 'Reading' - - add_book_button = Gtk.Button(label='Ajouter un livre') - add_book_button.connect('clicked', lambda _: BookForm(self, resources, library, conn, self._filters.get_progress(), self._on_book_added).present()) - - header = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) - utils.set_margin(header, 20) - self._filters = Filters(init_progress, self._update_book_flow_progress) - self._filters.set_hexpand(True) - header.append(self._filters) - header.append(add_book_button) - - box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0) - box.append(header) - self._book_flow = BookFlow(self, resources, library, ereader, conn, init_progress, self._update_filters_progress) - box.append(self._book_flow) - scrolled_window.set_child(box) - - def _update_book_flow_progress(self, progress): - self._book_flow.update_progress(progress) - - def _update_filters_progress(self, progress): - self._filters.update_progress(progress) - - def _on_book_added(self, book_id, data): - self._update_filters_progress(data['progress']) - self._book_flow.add_book(book_id, data) +from src.main_window import MainWindow class Application(Adw.Application): def __init__(self, resources, library, ereader, conn, **kwargs): |
