Skip to content

Commit

Permalink
Improvement found while testing: give selected books to the formatter…
Browse files Browse the repository at this point in the history
… in CoverView.
  • Loading branch information
cbhaley committed Jan 25, 2025
1 parent 855520c commit f939f85
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/calibre/gui2/preferences/look_feel_tabs/cover_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,15 @@ def lazy_initialize(self):
'list. This option has no effect when using the Wide user interface layout.'))

def edit_cb_title_template(self):
t = TemplateDialog(self, self.opt_cover_browser_title_template.text(), fm=self.gui.current_db.field_metadata)
rows = self.gui.library_view.selectionModel().selectedRows()
mi = None
db = self.gui.current_db.new_api
if rows:
ids = list(map(self.gui.library_view.model().id, rows))
mi = []
for bk in ids[0:min(10, len(ids))]:
mi.append(db.get_proxy_metadata(bk))
t = TemplateDialog(self, self.opt_cover_browser_title_template.text(), mi=mi, fm=db.field_metadata)
t.setWindowTitle(_('Edit template for caption'))
if t.exec():
self.opt_cover_browser_title_template.setText(t.rule[1])
Expand Down

0 comments on commit f939f85

Please sign in to comment.