mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Added a book_edited event
This commit is contained in:
parent
9b33a033bf
commit
b5ae66ee06
@ -137,6 +137,7 @@ class Cache(object):
|
|||||||
All table reading/sorting/searching/caching logic is re-implemented. This
|
All table reading/sorting/searching/caching logic is re-implemented. This
|
||||||
was necessary for maximum performance and flexibility.
|
was necessary for maximum performance and flexibility.
|
||||||
'''
|
'''
|
||||||
|
EventType = EventType
|
||||||
|
|
||||||
def __init__(self, backend):
|
def __init__(self, backend):
|
||||||
self.backend = backend
|
self.backend = backend
|
||||||
|
@ -38,6 +38,9 @@ class EventType(Enum):
|
|||||||
#: Arguments: (field_name, affected book ids, ids of removed items)
|
#: Arguments: (field_name, affected book ids, ids of removed items)
|
||||||
items_removed = auto()
|
items_removed = auto()
|
||||||
|
|
||||||
|
#: When a book format is edited, with arguments: (book_id, fmt)
|
||||||
|
book_edited = auto()
|
||||||
|
|
||||||
|
|
||||||
class EventDispatcher:
|
class EventDispatcher:
|
||||||
|
|
||||||
|
@ -793,6 +793,7 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{
|
|||||||
db.format_metadata(book_id, fmt, allow_cache=False, update_db=True)
|
db.format_metadata(book_id, fmt, allow_cache=False, update_db=True)
|
||||||
db.update_last_modified((book_id,))
|
db.update_last_modified((book_id,))
|
||||||
m.refresh_ids((book_id,))
|
m.refresh_ids((book_id,))
|
||||||
|
db.event_dispatcher(db.EventType.book_edited, book_id, fmt)
|
||||||
except Exception:
|
except Exception:
|
||||||
import traceback
|
import traceback
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user