mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
Merge branch 'master' of https://github.com/cbhaley/calibre
This commit is contained in:
commit
b72c99d12f
@ -898,7 +898,7 @@ class ActionFetchNews(InterfaceActionBase):
|
|||||||
|
|
||||||
|
|
||||||
class ActionQuickview(InterfaceActionBase):
|
class ActionQuickview(InterfaceActionBase):
|
||||||
name = 'Show Quickview'
|
name = 'Quickview'
|
||||||
actual_plugin = 'calibre.gui2.actions.show_quickview:ShowQuickviewAction'
|
actual_plugin = 'calibre.gui2.actions.show_quickview:ShowQuickviewAction'
|
||||||
description = _('Show a list of related books quickly')
|
description = _('Show a list of related books quickly')
|
||||||
|
|
||||||
|
@ -54,14 +54,18 @@ def get_quickview_action_plugin():
|
|||||||
|
|
||||||
class ShowQuickviewAction(InterfaceAction):
|
class ShowQuickviewAction(InterfaceAction):
|
||||||
|
|
||||||
name = 'Show Quickview'
|
name = 'Quickview'
|
||||||
action_spec = (_('Show Quickview'), 'quickview.png', None, _('Q'))
|
action_spec = (_('Quickview'), 'quickview.png', None, None)
|
||||||
dont_add_to = frozenset(['context-menu-device'])
|
dont_add_to = frozenset(['context-menu-device'])
|
||||||
action_type = 'current'
|
action_type = 'current'
|
||||||
|
|
||||||
current_instance = None
|
current_instance = None
|
||||||
|
|
||||||
def genesis(self):
|
def genesis(self):
|
||||||
|
self.gui.keyboard.register_shortcut('Toggle Quickview', _('Toggle Quickview'),
|
||||||
|
description=_('Open/close the Quickview panel/window'),
|
||||||
|
default_keys=('Q',), action=self.qaction,
|
||||||
|
group=self.action_spec[0])
|
||||||
self.focus_action = QAction(self.gui)
|
self.focus_action = QAction(self.gui)
|
||||||
self.gui.addAction(self.focus_action)
|
self.gui.addAction(self.focus_action)
|
||||||
self.gui.keyboard.register_shortcut('Focus To Quickview', _('Focus to Quickview'),
|
self.gui.keyboard.register_shortcut('Focus To Quickview', _('Focus to Quickview'),
|
||||||
@ -70,6 +74,15 @@ class ShowQuickviewAction(InterfaceAction):
|
|||||||
group=self.action_spec[0])
|
group=self.action_spec[0])
|
||||||
self.focus_action.triggered.connect(self.focus_quickview)
|
self.focus_action.triggered.connect(self.focus_quickview)
|
||||||
|
|
||||||
|
self.focus_bl_action = QAction(self.gui)
|
||||||
|
self.gui.addAction(self.focus_bl_action)
|
||||||
|
self.gui.keyboard.register_shortcut('Focus from Quickview',
|
||||||
|
_('Focus from Quickview to the book list'),
|
||||||
|
description=_('Move the focus from Quickview to the book list'),
|
||||||
|
default_keys=('Shift+Alt+Q',), action=self.focus_bl_action,
|
||||||
|
group=self.action_spec[0])
|
||||||
|
self.focus_bl_action.triggered.connect(self.focus_booklist)
|
||||||
|
|
||||||
self.search_action = QAction(self.gui)
|
self.search_action = QAction(self.gui)
|
||||||
self.gui.addAction(self.search_action)
|
self.gui.addAction(self.search_action)
|
||||||
self.gui.keyboard.register_shortcut('Search from Quickview', _('Search from Quickview'),
|
self.gui.keyboard.register_shortcut('Search from Quickview', _('Search from Quickview'),
|
||||||
@ -116,6 +129,7 @@ class ShowQuickviewAction(InterfaceAction):
|
|||||||
|
|
||||||
def set_search_shortcut(self):
|
def set_search_shortcut(self):
|
||||||
if self.current_instance and not self.current_instance.is_closed:
|
if self.current_instance and not self.current_instance.is_closed:
|
||||||
|
self.current_instance.addAction(self.focus_bl_action)
|
||||||
self.current_instance.set_shortcuts(self.search_action.shortcut().toString(),
|
self.current_instance.set_shortcuts(self.search_action.shortcut().toString(),
|
||||||
self.menuless_qaction.shortcut().toString())
|
self.menuless_qaction.shortcut().toString())
|
||||||
|
|
||||||
@ -160,6 +174,10 @@ class ShowQuickviewAction(InterfaceAction):
|
|||||||
else:
|
else:
|
||||||
self.current_instance.set_focus()
|
self.current_instance.set_focus()
|
||||||
|
|
||||||
|
def focus_booklist(self):
|
||||||
|
self.gui.activateWindow()
|
||||||
|
self.gui.library_view.setFocus()
|
||||||
|
|
||||||
def search_quickview(self):
|
def search_quickview(self):
|
||||||
if not self.current_instance or self.current_instance.is_closed:
|
if not self.current_instance or self.current_instance.is_closed:
|
||||||
return
|
return
|
||||||
|
@ -166,7 +166,7 @@ class LibraryWidget(Splitter): # {{{
|
|||||||
parent.quickview_splitter.addWidget(stack)
|
parent.quickview_splitter.addWidget(stack)
|
||||||
|
|
||||||
l = QVBoxLayout()
|
l = QVBoxLayout()
|
||||||
l.setContentsMargins(0, 0, 0, 0)
|
l.setContentsMargins(4, 0, 0, 0)
|
||||||
quickview_widget.setLayout(l)
|
quickview_widget.setLayout(l)
|
||||||
parent.quickview_splitter.addWidget(quickview_widget)
|
parent.quickview_splitter.addWidget(quickview_widget)
|
||||||
parent.quickview_splitter.hide_quickview_widget()
|
parent.quickview_splitter.hide_quickview_widget()
|
||||||
@ -571,8 +571,10 @@ class LayoutMixin(object): # {{{
|
|||||||
button_order = ('sb', 'tb', 'cb', 'gv', 'qv', 'bd')
|
button_order = ('sb', 'tb', 'cb', 'gv', 'qv', 'bd')
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
self.qv = find_plugin('Show Quickview')
|
# This must use the base method to find the plugin because it hasn't
|
||||||
if self.qv:
|
# been fully initialized yet
|
||||||
|
self.qv = find_plugin('Quickview')
|
||||||
|
if self.qv and self.qv.actual_plugin_:
|
||||||
self.qv = self.qv.actual_plugin_
|
self.qv = self.qv.actual_plugin_
|
||||||
|
|
||||||
self.status_bar = StatusBar(self)
|
self.status_bar = StatusBar(self)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user