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 from calibre.gui2.dialogs.comments_dialog_ui import Ui_CommentsDialog
class CommentsDialog(QDialog, Ui_CommentsDialog): class CommentsDialog(QDialog, Ui_CommentsDialog):
def __init__(self, parent, text): def __init__(self, parent, text):
QDialog.__init__(self, parent) QDialog.__init__(self, parent)
Ui_CommentsDialog.__init__(self) Ui_CommentsDialog.__init__(self)

View File

@ -162,17 +162,16 @@ class TagsDelegate(QStyledItemDelegate):
editor = TagsLineEdit(parent, self.db.all_tags()) editor = TagsLineEdit(parent, self.db.all_tags())
else: else:
editor = TagsLineEdit(parent, sorted(list(self.db.all_custom(label=col)))) editor = TagsLineEdit(parent, sorted(list(self.db.all_custom(label=col))))
return editor; return editor
else: else:
editor = EnLineEdit(parent) editor = EnLineEdit(parent)
return editor return editor
class CcTextDelegate(QStyledItemDelegate): class CcTextDelegate(QStyledItemDelegate):
def __init__(self, parent): '''
''' Delegate for text/int/float data.
Delegate for text/int/float data. '''
'''
QStyledItemDelegate.__init__(self, parent)
def createEditor(self, parent, option, index): def createEditor(self, parent, option, index):
m = index.model() m = index.model()
col = m.column_map[index.column()] col = m.column_map[index.column()]
@ -191,12 +190,9 @@ class CcTextDelegate(QStyledItemDelegate):
return editor return editor
class CcCommentsDelegate(QStyledItemDelegate): class CcCommentsDelegate(QStyledItemDelegate):
def __init__(self, parent): '''
''' Delegate for comments data.
Delegate for comments data. '''
'''
QStyledItemDelegate.__init__(self, parent)
self.parent = parent
def createEditor(self, parent, option, index): def createEditor(self, parent, option, index):
m = index.model() m = index.model()
@ -211,7 +207,7 @@ class CcCommentsDelegate(QStyledItemDelegate):
return None return None
def setModelData(self, editor, model, index): 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): class CcBoolDelegate(QStyledItemDelegate):
def __init__(self, parent): def __init__(self, parent):