From 8fb186853d3949e5ca281d801b8e24798404d9ce Mon Sep 17 00:00:00 2001 From: brookite Date: Thu, 12 Oct 2023 22:08:34 +0300 Subject: [PATCH] Open folder with book option --- app/widgets/book.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/widgets/book.py b/app/widgets/book.py index b663078..924545d 100644 --- a/app/widgets/book.py +++ b/app/widgets/book.py @@ -41,6 +41,8 @@ def _book_menu(self) -> QMenu: menu = QMenu(self) thumbnailAction = menu.addAction(tr("Set thumbnail")) thumbnailAction.triggered.connect(self.set_external_thumbnail) + thumbnailAction = menu.addAction(tr("Open folder")) + thumbnailAction.triggered.connect(self.open_folder) thumbnailAction = menu.addAction(tr("Reset thumbnail")) thumbnailAction.triggered.connect(self.reset_thumbnail) removeAction = menu.addAction(tr("Remove book")) @@ -58,6 +60,12 @@ def _selection_menu(self) -> QMenu: def reset_thumbnail(self): self._thumbnailer.reload_thumbnail(self) + def open_folder(self): + path = self.owner.owner.settings.resolve_env_path(self.metadata["src"]) + path = os.path.dirname(path) + if os.path.exists(path): + open_file(path) + def set_external_thumbnail(self): filename = QFileDialog.getOpenFileName( self, tr("Set external thumbnails"), "",