mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Quickview: Fix regression in previous release that broke the "Lock quickview" control
Also add a keyboard shortcut to refresh the quickview contents Merge branch 'master' of https://github.com/cbhaley/calibre
This commit is contained in:
commit
3a76f6387e
@ -350,7 +350,7 @@ class EditMetadataAction(InterfaceAction):
|
||||
self.gui.tags_view.recount_with_position_based_index()
|
||||
qv = get_quickview_action_plugin()
|
||||
if qv:
|
||||
qv.refill_quickview()
|
||||
qv.refresh_quickview(current)
|
||||
|
||||
def do_edit_metadata(self, row_list, current_row, editing_multiple):
|
||||
from calibre.gui2.metadata.single import edit_metadata
|
||||
|
@ -87,6 +87,15 @@ class ShowQuickviewAction(InterfaceAction):
|
||||
group=self.action_spec[0])
|
||||
self.focus_bl_action.triggered.connect(self.focus_booklist)
|
||||
|
||||
self.focus_refresh_action = QAction(self.gui)
|
||||
self.gui.addAction(self.focus_refresh_action)
|
||||
self.gui.keyboard.register_shortcut('Refresh from Quickview',
|
||||
_('Refresh Quickview'),
|
||||
description=_('Refresh the information shown in the Quickview pane'),
|
||||
action=self.focus_refresh_action,
|
||||
group=self.action_spec[0])
|
||||
self.focus_refresh_action.triggered.connect(self.refill_quickview)
|
||||
|
||||
self.search_action = QAction(self.gui)
|
||||
self.gui.addAction(self.search_action)
|
||||
self.gui.keyboard.register_shortcut('Search from Quickview', _('Search from Quickview'),
|
||||
@ -96,6 +105,7 @@ class ShowQuickviewAction(InterfaceAction):
|
||||
self.search_action.triggered.connect(self.search_quickview)
|
||||
self.search_action.changed.connect(self.set_search_shortcut)
|
||||
self.menuless_qaction.changed.connect(self.set_search_shortcut)
|
||||
|
||||
self.qv_button = QuickviewButton(self.gui, self)
|
||||
|
||||
def initialization_complete(self):
|
||||
@ -149,11 +159,18 @@ class ShowQuickviewAction(InterfaceAction):
|
||||
|
||||
def refill_quickview(self):
|
||||
'''
|
||||
Called when the data or the columns shown in the QV pane might have changed.
|
||||
Called when the columns shown in the QV pane might have changed.
|
||||
'''
|
||||
if self.current_instance and not self.current_instance.is_closed:
|
||||
self.current_instance.refill()
|
||||
|
||||
def refresh_quickview(self, idx):
|
||||
'''
|
||||
Called when the data shown in the QV pane might have changed.
|
||||
'''
|
||||
if self.current_instance and not self.current_instance.is_closed:
|
||||
self.current_instance.refresh(idx)
|
||||
|
||||
def change_quickview_column(self, idx):
|
||||
'''
|
||||
Called from the column header context menu to change the QV query column
|
||||
|
@ -193,9 +193,11 @@ class Quickview(QDialog, Ui_Quickview):
|
||||
self.books_table.installEventFilter(focus_filter)
|
||||
|
||||
self.close_button.clicked.connect(self.close_button_clicked)
|
||||
self.refresh_button.clicked.connect(self.refill)
|
||||
|
||||
self.tab_order_widgets = [self.items, self.books_table, self.lock_qv,
|
||||
self.dock_button, self.search_button, self.close_button]
|
||||
self.dock_button, self.search_button, self.refresh_button,
|
||||
self.close_button]
|
||||
for idx,widget in enumerate(self.tab_order_widgets):
|
||||
widget.installEventFilter(WidgetTabFilter(widget, idx, self.tab_pressed_signal))
|
||||
|
||||
@ -239,8 +241,10 @@ class Quickview(QDialog, Ui_Quickview):
|
||||
self.dock_button.setText(_('Undock'))
|
||||
self.dock_button.setToolTip(_('Pop up the quickview panel into its own floating window'))
|
||||
self.dock_button.setIcon(QIcon(I('arrow-up.png')))
|
||||
# Remove the ampersands from the buttons because shortcuts exist.
|
||||
self.lock_qv.setText(_('Lock Quickview contents'))
|
||||
self.search_button.setText(_('Search'))
|
||||
self.refresh_button.setText(_('Refresh'))
|
||||
self.gui.quickview_splitter.add_quickview_dialog(self)
|
||||
self.close_button.setVisible(False)
|
||||
else:
|
||||
@ -252,6 +256,13 @@ class Quickview(QDialog, Ui_Quickview):
|
||||
self.dock_button.clicked.connect(self.show_as_pane_changed)
|
||||
self.gui.search.cleared.connect(self.indicate_no_items)
|
||||
|
||||
# Enable the refresh button only when QV is locked
|
||||
self.refresh_button.setEnabled(False)
|
||||
self.lock_qv.stateChanged.connect(self.lock_qv_changed)
|
||||
|
||||
def lock_qv_changed(self, state):
|
||||
self.refresh_button.setEnabled(state)
|
||||
|
||||
def add_columns_to_widget(self):
|
||||
'''
|
||||
Get the list of columns from the preferences. Clear the current table
|
||||
@ -267,7 +278,7 @@ class Quickview(QDialog, Ui_Quickview):
|
||||
|
||||
def refill(self):
|
||||
'''
|
||||
Refill the table in case the book data changes
|
||||
Refill the table in case the columns displayed changes
|
||||
'''
|
||||
self.add_columns_to_widget()
|
||||
self._refresh(self.current_book_id, self.current_key)
|
||||
@ -371,7 +382,7 @@ class Quickview(QDialog, Ui_Quickview):
|
||||
# operation if we get an exception. The "close" will come
|
||||
# eventually.
|
||||
try:
|
||||
self._refresh(mi.get('id'), self.current_key)
|
||||
self.refresh(self.view.model().index(self.db.row(mi.id), self.current_column))
|
||||
except:
|
||||
pass
|
||||
|
||||
|
@ -148,6 +148,32 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="refresh_button">
|
||||
<property name="text">
|
||||
<string>&Refresh</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>When Quickview is locked, refresh the window using the last selected book and that book's value in the last selected column.</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="close_button">
|
||||
<property name="text">
|
||||
|
Loading…
x
Reference in New Issue
Block a user