Skip to content

Commit

Permalink
Open folder with book option
Browse files Browse the repository at this point in the history
  • Loading branch information
brookite committed Oct 12, 2023
1 parent 16867c4 commit 8fb1868
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/widgets/book.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand All @@ -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"), "",
Expand Down

0 comments on commit 8fb1868

Please sign in to comment.