From b060a20f71bcf24e90b7609b4d2845cab25267de Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 1 May 2010 11:16:01 -0600 Subject: [PATCH] Minor cleanups --- src/calibre/gui2/dialogs/comments_dialog.py | 1 + src/calibre/gui2/library.py | 22 +++++++++------------ 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/calibre/gui2/dialogs/comments_dialog.py b/src/calibre/gui2/dialogs/comments_dialog.py index f9806b44d1..8b4df07fbc 100644 --- a/src/calibre/gui2/dialogs/comments_dialog.py +++ b/src/calibre/gui2/dialogs/comments_dialog.py @@ -7,6 +7,7 @@ from PyQt4.Qt import QDialog from calibre.gui2.dialogs.comments_dialog_ui import Ui_CommentsDialog class CommentsDialog(QDialog, Ui_CommentsDialog): + def __init__(self, parent, text): QDialog.__init__(self, parent) Ui_CommentsDialog.__init__(self) diff --git a/src/calibre/gui2/library.py b/src/calibre/gui2/library.py index f499c95e14..545cc1f5e1 100644 --- a/src/calibre/gui2/library.py +++ b/src/calibre/gui2/library.py @@ -162,17 +162,16 @@ class TagsDelegate(QStyledItemDelegate): editor = TagsLineEdit(parent, self.db.all_tags()) else: editor = TagsLineEdit(parent, sorted(list(self.db.all_custom(label=col)))) - return editor; + return editor else: editor = EnLineEdit(parent) return editor class CcTextDelegate(QStyledItemDelegate): - def __init__(self, parent): - ''' - Delegate for text/int/float data. - ''' - QStyledItemDelegate.__init__(self, parent) + ''' + Delegate for text/int/float data. + ''' + def createEditor(self, parent, option, index): m = index.model() col = m.column_map[index.column()] @@ -191,12 +190,9 @@ class CcTextDelegate(QStyledItemDelegate): return editor class CcCommentsDelegate(QStyledItemDelegate): - def __init__(self, parent): - ''' - Delegate for comments data. - ''' - QStyledItemDelegate.__init__(self, parent) - self.parent = parent + ''' + Delegate for comments data. + ''' def createEditor(self, parent, option, index): m = index.model() @@ -211,7 +207,7 @@ class CcCommentsDelegate(QStyledItemDelegate): return None def setModelData(self, editor, model, index): - model.setData(index, QVariant(editor.textbox.text()), Qt.EditRole) + model.setData(index, QVariant(editor.textbox.toPlainText()), Qt.EditRole) class CcBoolDelegate(QStyledItemDelegate): def __init__(self, parent):