mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix for #1875030: QuickView didn't always change the selected item when moving between books.
Related enhancement: if in GridView, automatically switch to the authors column if the current item is empty in the selected book.
This commit is contained in:
parent
7eecf4ec94
commit
0fd62344bb
@ -450,7 +450,6 @@ class Quickview(QDialog, Ui_Quickview):
|
|||||||
label_text = _('&Item: {0} ({1})')
|
label_text = _('&Item: {0} ({1})')
|
||||||
if self.is_pane:
|
if self.is_pane:
|
||||||
label_text = label_text.replace('&', '')
|
label_text = label_text.replace('&', '')
|
||||||
self.items_label.setText(label_text.format(self.fm[key]['name'], key))
|
|
||||||
|
|
||||||
self.items.blockSignals(True)
|
self.items.blockSignals(True)
|
||||||
self.items.clear()
|
self.items.clear()
|
||||||
@ -459,6 +458,24 @@ class Quickview(QDialog, Ui_Quickview):
|
|||||||
mi = self.db.get_metadata(book_id, index_is_id=True, get_user_categories=False)
|
mi = self.db.get_metadata(book_id, index_is_id=True, get_user_categories=False)
|
||||||
vals = mi.get(key, None)
|
vals = mi.get(key, None)
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Check if we are in the GridView and there are no values for the
|
||||||
|
# selected column. In this case switch the column to 'authors'
|
||||||
|
# because there isn't an easy way to switch columns in GridView
|
||||||
|
# when the QV box is empty.
|
||||||
|
if not vals:
|
||||||
|
is_grid_view = (self.gui.current_view().alternate_views.current_view !=
|
||||||
|
self.gui.current_view().alternate_views.main_view)
|
||||||
|
if is_grid_view:
|
||||||
|
key = 'authors'
|
||||||
|
vals = mi.get(key, None)
|
||||||
|
except:
|
||||||
|
traceback.print_exc()
|
||||||
|
|
||||||
|
self.current_book_id = book_id
|
||||||
|
self.current_key = key
|
||||||
|
self.items_label.setText(label_text.format(self.fm[key]['name'], key))
|
||||||
|
|
||||||
if vals:
|
if vals:
|
||||||
self.no_valid_items = False
|
self.no_valid_items = False
|
||||||
if self.fm[key]['datatype'] == 'rating':
|
if self.fm[key]['datatype'] == 'rating':
|
||||||
@ -475,9 +492,6 @@ class Quickview(QDialog, Ui_Quickview):
|
|||||||
self.items.addItem(a)
|
self.items.addItem(a)
|
||||||
self.items.setCurrentRow(0)
|
self.items.setCurrentRow(0)
|
||||||
|
|
||||||
self.current_book_id = book_id
|
|
||||||
self.current_key = key
|
|
||||||
|
|
||||||
self.fill_in_books_box(vals[0])
|
self.fill_in_books_box(vals[0])
|
||||||
else:
|
else:
|
||||||
self.indicate_no_items()
|
self.indicate_no_items()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user