diff options
| author | Joris Guyonvarch | 2025-12-26 18:41:26 +0100 |
|---|---|---|
| committer | Joris Guyonvarch | 2025-12-27 20:41:44 +0100 |
| commit | a110c200e86d2325af07167531fac0f61d9681a0 (patch) | |
| tree | 90e843f915a2e153ba735849afd83710d90560bf /src/book_delete.py | |
| parent | a26d92ad5055fa057647158eb79511e7b1841162 (diff) | |
Switch to GUI to manage the library
Allow to regroup the CLI and the view into one unique tool.
Diffstat (limited to 'src/book_delete.py')
| -rw-r--r-- | src/book_delete.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/book_delete.py b/src/book_delete.py new file mode 100644 index 0000000..c7e789f --- /dev/null +++ b/src/book_delete.py @@ -0,0 +1,35 @@ +import gi +gi.require_version('Gtk', '4.0') +from gi.repository import Gtk +import os + +import src.utils as utils +import src.book_files as book_files + +class BookDelete(Gtk.Window): + + def __init__(self, parent_window, library, book_id, data, on_parent_confirm): + Gtk.Window.__init__(self) + + self._on_parent_confirm = on_parent_confirm + + utils.configure_dialog(self, parent_window, data['title'], width=None, height=None) + + box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=20) + self.set_child(box) + utils.set_margin(box, 20) + + picture = Gtk.Picture.new_for_filename(f'{library}/{book_id}/cover.png') + picture.set_can_shrink(False) + box.append(picture) + + for path in book_files.get(library, book_id): + box.append(utils.label(os.path.basename(path))) + + confirm_button = Gtk.Button(label='Supprimer') + confirm_button.connect('clicked', lambda _: self._on_confirm()) + box.append(confirm_button) + + def _on_confirm(self): + self._on_parent_confirm() + self.close() |
