Minor cleanups

This commit is contained in:
Kovid Goyal 2010-05-01 11:16:01 -06:00
parent 5c4b41c39e
commit b060a20f71
2 changed files with 10 additions and 13 deletions

View File

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

View File

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