aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--src/book_flow.py13
-rw-r--r--src/main_window.py5
3 files changed, 10 insertions, 9 deletions
diff --git a/README.md b/README.md
index 314b40b..bde805b 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,6 @@ pytest
# Improvements
-- book flow: keep header bar visible when scrolling down
- filters:
- textual search
https://stackoverflow.com/questions/55828169/how-to-filter-gtk-flowbox-children-with-gtk-entrysearch
diff --git a/src/book_flow.py b/src/book_flow.py
index 7697f29..e3b1165 100644
--- a/src/book_flow.py
+++ b/src/book_flow.py
@@ -17,10 +17,15 @@ from src.book_transfer import BookTransfer
from src.picture_cache import PictureCache
import src.book_files as book_files
-class BookFlow(Gtk.FlowBox):
+class BookFlow(Gtk.ScrolledWindow):
+
def __init__(self, window, resources, library, ereader, conn, books, progress, genre, msg):
- Gtk.FlowBox.__init__(self)
+ Gtk.ScrolledWindow.__init__(self)
+ self.set_vexpand(True)
+
+ self._flow_box = Gtk.FlowBox()
+ self.set_child(self._flow_box)
self._window = window
self._resources = resources
@@ -40,7 +45,7 @@ class BookFlow(Gtk.FlowBox):
if book_id:
self._picture_cache.invalidate(f'{self._library}/{book_id}/cover-min.png')
- self.remove_all()
+ self._flow_box.remove_all()
self._flow_box_children = {}
for book_id, data in sorted(books.items(), key=book_sort):
if self._is_selected(data, progress, genre):
@@ -60,7 +65,7 @@ class BookFlow(Gtk.FlowBox):
flow_box_child = Gtk.FlowBoxChild()
flow_box_child.set_child(picture)
self._flow_box_children[book_id] = flow_box_child
- self.append(flow_box_child)
+ self._flow_box.append(flow_box_child)
# Private
diff --git a/src/main_window.py b/src/main_window.py
index 420b4ea..5053a81 100644
--- a/src/main_window.py
+++ b/src/main_window.py
@@ -24,9 +24,6 @@ class MainWindow(Gtk.ApplicationWindow):
self._genres = models.get_genres(self._books)
self._genre = models.all_genres
- scrolled_window = Gtk.ScrolledWindow()
- self.set_child(scrolled_window)
-
add_book_button = Gtk.Button(label='Ajouter un livre')
add_book_button.connect('clicked', lambda _: BookForm(self, resources, library, conn, self._progress, self._msg).present())
@@ -41,7 +38,7 @@ class MainWindow(Gtk.ApplicationWindow):
box.append(header)
self._book_flow = BookFlow(self, resources, library, ereader, conn, self._books, self._progress, self._genre, self._msg)
box.append(self._book_flow)
- scrolled_window.set_child(box)
+ self.set_child(box)
def _msg(self, msg):
match msg: