From 3db2d844cb6d945ec0a17bb037c05b7f5ad515d7 Mon Sep 17 00:00:00 2001 From: Charles Haley Date: Sat, 21 Sep 2013 09:16:34 +0200 Subject: [PATCH] When editing custom comments from the spreadsheet, add the column name to the title bar --- src/calibre/gui2/dialogs/comments_dialog.py | 5 ++++- src/calibre/gui2/library/delegates.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/dialogs/comments_dialog.py b/src/calibre/gui2/dialogs/comments_dialog.py index 51b29fa989..2734a1bd21 100644 --- a/src/calibre/gui2/dialogs/comments_dialog.py +++ b/src/calibre/gui2/dialogs/comments_dialog.py @@ -9,7 +9,7 @@ from calibre.library.comments import comments_to_html class CommentsDialog(QDialog, Ui_CommentsDialog): - def __init__(self, parent, text): + def __init__(self, parent, text, column_name=None): QDialog.__init__(self, parent) Ui_CommentsDialog.__init__(self) self.setupUi(self) @@ -24,3 +24,6 @@ class CommentsDialog(QDialog, Ui_CommentsDialog): self.buttonBox.button(QDialogButtonBox.Ok).setText(_('&OK')) self.buttonBox.button(QDialogButtonBox.Cancel).setText(_('&Cancel')) + if column_name: + self.setWindowTitle(_('Edit "{0}"').format(column_name)) + diff --git a/src/calibre/gui2/library/delegates.py b/src/calibre/gui2/library/delegates.py index e14e79fb3e..6895f34667 100644 --- a/src/calibre/gui2/library/delegates.py +++ b/src/calibre/gui2/library/delegates.py @@ -398,7 +398,7 @@ class CcCommentsDelegate(QStyledItemDelegate): # {{{ m = index.model() col = m.column_map[index.column()] text = m.db.data[index.row()][m.custom_columns[col]['rec_index']] - editor = CommentsDialog(parent, text) + editor = CommentsDialog(parent, text, column_name=m.custom_columns[col]['name']) d = editor.exec_() if d: m.setData(index, QVariant(editor.textbox.html), Qt.EditRole)