Fix for QV Refresh button not working.

Possible fix for startup problems on Linux
This commit is contained in:
Charles Haley 2020-09-03 11:20:37 +01:00
parent b0633f3db0
commit 4d02b04ecf
2 changed files with 23 additions and 12 deletions

View File

@ -350,7 +350,7 @@ class Quickview(QDialog, Ui_Quickview):
Refill the table in case the columns displayed changes
'''
self.add_columns_to_widget()
self._refresh(self.current_book_id, self.current_key)
self.refresh(self.view.currentIndex(), ignore_lock=True)
def set_search_text(self, txt):
self.last_search = txt
@ -461,12 +461,18 @@ class Quickview(QDialog, Ui_Quickview):
gprefs['qv_respects_vls'] = self.apply_vls.isChecked()
self._refresh(self.current_book_id, self.current_key)
def refresh(self, idx):
def refresh(self, idx, ignore_lock=False):
'''
Given a cell in the library view, display the information. This method
converts the index into the lookup key
'''
if self.lock_qv.isChecked() or not idx.isValid():
if (not ignore_lock and self.lock_qv.isChecked()):
return
if not idx.isValid():
from calibre.constants import DEBUG
if DEBUG:
from calibre import prints
prints('QuickView: current index is not valid')
return
try:

View File

@ -424,15 +424,6 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{
self.hide_windows()
self.auto_adder = AutoAdder(gprefs['auto_add_path'], self)
# Now that the gui is initialized we can restore the quickview state
# The same thing will be true for any action-based operation with a
# layout button
from calibre.gui2.actions.show_quickview import get_quickview_action_plugin
qv = get_quickview_action_plugin()
if qv:
qv.qv_button.restore_state()
self.save_layout_state()
# Collect cycles now
gc.collect()
@ -444,6 +435,20 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{
QTimer.singleShot(1, self.start_smartdevice)
QTimer.singleShot(100, self.update_toggle_to_tray_action)
# Once the gui is initialized we can restore the quickview state
# The same thing will be true for any action-based operation with a
# layout button
QTimer.singleShot(20, self.start_quickview)
def start_quickview(self):
from calibre.gui2.actions.show_quickview import get_quickview_action_plugin
qv = get_quickview_action_plugin()
if qv:
if DEBUG:
prints('Starting QuickView')
qv.qv_button.restore_state()
self.save_layout_state()
def show_gui_debug_msg(self):
info_dialog(self, _('Debug mode'), '<p>' +
_('You have started calibre in debug mode. After you '