mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #1923094 [[Enhancement - Viewer] Open path folder](https://bugs.launchpad.net/calibre/+bug/1923094)
This commit is contained in:
parent
f772957cd7
commit
eb7f51de50
@ -274,6 +274,7 @@ class ViewerBridge(Bridge):
|
||||
speak_simple_text = from_js(object)
|
||||
tts = from_js(object, object)
|
||||
edit_book = from_js(object, object, object)
|
||||
show_book_folder = from_js()
|
||||
|
||||
create_view = to_js()
|
||||
start_book_load = to_js()
|
||||
@ -535,6 +536,7 @@ class WebView(RestartingWebEngineView):
|
||||
self.bridge.close_prep_finished.connect(self.close_prep_finished)
|
||||
self.bridge.highlights_changed.connect(self.highlights_changed)
|
||||
self.bridge.edit_book.connect(self.edit_book)
|
||||
self.bridge.show_book_folder.connect(self.show_book_folder)
|
||||
self.bridge.open_url.connect(safe_open_url)
|
||||
self.bridge.speak_simple_text.connect(self.tts.speak_simple_text)
|
||||
self.bridge.tts.connect(self.tts.action)
|
||||
@ -736,3 +738,7 @@ class WebView(RestartingWebEngineView):
|
||||
|
||||
def tts_settings_changed(self, ui_settings):
|
||||
self.execute_when_ready('tts_event', 'configured', ui_settings)
|
||||
|
||||
def show_book_folder(self):
|
||||
path = os.path.dirname(os.path.abspath(set_book_path.pathtoebook))
|
||||
safe_open_url(QUrl.fromLocalFile(path))
|
||||
|
@ -787,7 +787,16 @@ class Overlay:
|
||||
if pathtoebook:
|
||||
container.lastChild.appendChild(E.div(
|
||||
style='margin-top: 1ex; padding-top: 1ex; border-top: solid 1px',
|
||||
_('Path: {}').format(pathtoebook)))
|
||||
_('Path:'), ' ',
|
||||
E.a(
|
||||
href='javascript: void(0)',
|
||||
class_='blue-link', title=_('Click to open the folder the book is in'),
|
||||
onclick=def():
|
||||
ui_operations.show_book_folder()
|
||||
,
|
||||
pathtoebook)
|
||||
)
|
||||
)
|
||||
|
||||
book = self.view.book
|
||||
key = book.key or v'[null, 0]'
|
||||
|
@ -421,6 +421,8 @@ if window is window.top:
|
||||
to_python.tts(action, data or v'{}')
|
||||
ui_operations.edit_book = def (spine_name, frac, selected_text):
|
||||
to_python.edit_book(spine_name, frac, selected_text or '')
|
||||
ui_operations.show_book_folder = def():
|
||||
to_python.show_book_folder()
|
||||
|
||||
document.body.appendChild(E.div(id='view'))
|
||||
window.onerror = onerror
|
||||
|
Loading…
x
Reference in New Issue
Block a user