mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge branch 'master' of https://github.com/cbhaley/calibre
This commit is contained in:
commit
decbb7edd2
@ -8,6 +8,7 @@ __docformat__ = 'restructuredtext en'
|
|||||||
|
|
||||||
from qt.core import QLineEdit
|
from qt.core import QLineEdit
|
||||||
|
|
||||||
|
from calibre import prints
|
||||||
from calibre.gui2.dialogs.template_dialog import TemplateDialog
|
from calibre.gui2.dialogs.template_dialog import TemplateDialog
|
||||||
|
|
||||||
|
|
||||||
@ -19,6 +20,17 @@ class TemplateLineEditor(QLineEdit):
|
|||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
QLineEdit.__init__(self, parent)
|
QLineEdit.__init__(self, parent)
|
||||||
|
try:
|
||||||
|
from calibre.gui2.ui import get_gui
|
||||||
|
gui = get_gui()
|
||||||
|
view = gui.library_view
|
||||||
|
db = gui.current_db
|
||||||
|
mi = []
|
||||||
|
for _id in view.get_selected_ids()[:5]:
|
||||||
|
mi.append(db.new_api.get_metadata(_id))
|
||||||
|
self.mi = mi
|
||||||
|
except Exception as e:
|
||||||
|
prints(f'TemplateLineEditor: exception fetching metadata: {str(e)}')
|
||||||
self.mi = None
|
self.mi = None
|
||||||
self.setClearButtonEnabled(True)
|
self.setClearButtonEnabled(True)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user