For some reason I don't understand, the array of mi values mst be a list, not a tuple.

When a tuple, this line:
w.setText(mi[r].title)

produces the exception:
Traceback (most recent call last):
  File "C:\CBH_Data\calibre.git\calibre_dev\src\calibre\gui2\preferences\save_template.py", line 63, in do_open_editor
  File "C:\CBH_Data\calibre.git\calibre_dev\src\calibre\gui2\dialogs\template_dialog.py", line 433, in __init__
  File "C:\CBH_Data\calibre.git\calibre_dev\src\calibre\gui2\dialogs\template_dialog.py", line 578, in set_mi
AttributeError: 'tuple' object has no attribute 'title'
This commit is contained in:
Charles Haley 2023-08-16 15:21:05 +01:00
parent 212564d578
commit ec7196bb4a

View File

@ -53,7 +53,7 @@ class SaveTemplate(QWidget, Ui_Form):
from calibre.gui2.ui import get_gui from calibre.gui2.ui import get_gui
db = get_gui().current_db db = get_gui().current_db
view = get_gui().library_view view = get_gui().library_view
mi = tuple(map(db.new_api.get_proxy_metadata, view.get_selected_ids()[:10])) mi = list(map(db.new_api.get_proxy_metadata, view.get_selected_ids()[:10]))
if not mi: if not mi:
error_dialog(self, _('Must select books'), error_dialog(self, _('Must select books'),
_('One or more books must be selected so the template ' _('One or more books must be selected so the template '