When editing custom comments from the spreadsheet, add the column name to the title bar

This commit is contained in:
Charles Haley 2013-09-21 09:16:34 +02:00
parent 8b820767d0
commit 3db2d844cb
2 changed files with 5 additions and 2 deletions

View File

@ -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))

View File

@ -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)