mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix event delivery
This commit is contained in:
parent
b5ae66ee06
commit
41c4b96c33
@ -42,7 +42,7 @@ class EventType(Enum):
|
||||
book_edited = auto()
|
||||
|
||||
|
||||
class EventDispatcher:
|
||||
class EventDispatcher(Thread):
|
||||
|
||||
def __init__(self):
|
||||
Thread.__init__(self, name='DBListener', daemon=True)
|
||||
|
@ -15,6 +15,13 @@ from calibre.utils.monotonic import monotonic
|
||||
from polyglot.builtins import iteritems, itervalues
|
||||
|
||||
|
||||
def gui_on_db_event(event_type, library_id, event_data):
|
||||
from calibre.gui2.ui import get_gui
|
||||
gui = get_gui()
|
||||
if gui is not None:
|
||||
gui.library_broker.on_db_event(event_type, library_id, event_data)
|
||||
|
||||
|
||||
def canonicalize_path(p):
|
||||
if isinstance(p, bytes):
|
||||
p = p.decode(filesystem_encoding)
|
||||
@ -222,7 +229,7 @@ class GuiLibraryBroker(LibraryBroker):
|
||||
with self:
|
||||
self.listening_for_db_events = True
|
||||
for db in self.loaded_dbs.values():
|
||||
db.new_api.add_listener(self.on_db_event)
|
||||
db.new_api.add_listener(gui_on_db_event)
|
||||
|
||||
def on_db_event(self, event_type, library_id, event_data):
|
||||
from calibre.gui2.ui import get_gui
|
||||
|
Loading…
x
Reference in New Issue
Block a user