mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-11 09:13:57 -04:00
Ensure Tag Browser recount is always called in the GUI thread.
This commit is contained in:
parent
2f36b3523f
commit
64c423ba08
@ -592,6 +592,11 @@ def is_ok_to_use_qt():
|
|||||||
gui_thread = QThread.currentThread()
|
gui_thread = QThread.currentThread()
|
||||||
return gui_thread is QThread.currentThread()
|
return gui_thread is QThread.currentThread()
|
||||||
|
|
||||||
|
def is_gui_thread():
|
||||||
|
global gui_thread
|
||||||
|
return gui_thread is QThread.currentThread()
|
||||||
|
|
||||||
|
|
||||||
def find_forms(srcdir):
|
def find_forms(srcdir):
|
||||||
base = os.path.join(srcdir, 'calibre', 'gui2')
|
base = os.path.join(srcdir, 'calibre', 'gui2')
|
||||||
forms = []
|
forms = []
|
||||||
|
@ -12,7 +12,7 @@ from itertools import izip
|
|||||||
from PyQt4.Qt import Qt, QTreeView, QApplication, \
|
from PyQt4.Qt import Qt, QTreeView, QApplication, \
|
||||||
QFont, SIGNAL, QSize, QIcon, QPoint, \
|
QFont, SIGNAL, QSize, QIcon, QPoint, \
|
||||||
QAbstractItemModel, QVariant, QModelIndex
|
QAbstractItemModel, QVariant, QModelIndex
|
||||||
from calibre.gui2 import config, NONE
|
from calibre.gui2 import config, NONE, is_gui_thread, Dispatcher
|
||||||
from calibre.utils.search_query_parser import saved_searches
|
from calibre.utils.search_query_parser import saved_searches
|
||||||
from calibre.library.database2 import Tag
|
from calibre.library.database2 import Tag
|
||||||
|
|
||||||
@ -54,6 +54,9 @@ class TagsView(QTreeView):
|
|||||||
self.model().clear_state()
|
self.model().clear_state()
|
||||||
|
|
||||||
def recount(self, *args):
|
def recount(self, *args):
|
||||||
|
if not is_gui_thread():
|
||||||
|
# Re-call in GUI thread
|
||||||
|
return Dispatcher(self.recount)(*args)
|
||||||
ci = self.currentIndex()
|
ci = self.currentIndex()
|
||||||
if not ci.isValid():
|
if not ci.isValid():
|
||||||
ci = self.indexAt(QPoint(10, 10))
|
ci = self.indexAt(QPoint(10, 10))
|
||||||
|
@ -536,7 +536,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
|||||||
self.connect(self.library_view.model(),
|
self.connect(self.library_view.model(),
|
||||||
SIGNAL('count_changed(int)'), self.location_view.count_changed)
|
SIGNAL('count_changed(int)'), self.location_view.count_changed)
|
||||||
self.connect(self.library_view.model(), SIGNAL('count_changed(int)'),
|
self.connect(self.library_view.model(), SIGNAL('count_changed(int)'),
|
||||||
self.tags_view.recount)
|
self.tags_view.recount, Qt.QueuedConnection)
|
||||||
self.connect(self.search, SIGNAL('cleared()'), self.tags_view_clear)
|
self.connect(self.search, SIGNAL('cleared()'), self.tags_view_clear)
|
||||||
self.connect(self.saved_search, SIGNAL('changed()'), self.tags_view.recount, Qt.QueuedConnection)
|
self.connect(self.saved_search, SIGNAL('changed()'), self.tags_view.recount, Qt.QueuedConnection)
|
||||||
if not gprefs.get('quick_start_guide_added', False):
|
if not gprefs.get('quick_start_guide_added', False):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user