mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
Fix #1397183 [Stand Alone Comments - Editor OK button & cell highlight](https://bugs.launchpad.net/calibre/+bug/1397183)
This commit is contained in:
parent
261eae0758
commit
c049cdfe8d
@ -5,7 +5,7 @@ __license__ = 'GPL v3'
|
||||
|
||||
from PyQt5.Qt import Qt, QDialog, QDialogButtonBox
|
||||
|
||||
from calibre.gui2 import gprefs
|
||||
from calibre.gui2 import gprefs, Application
|
||||
from calibre.gui2.dialogs.comments_dialog_ui import Ui_CommentsDialog
|
||||
from calibre.library.comments import comments_to_html
|
||||
|
||||
@ -23,7 +23,7 @@ class CommentsDialog(QDialog, Ui_CommentsDialog):
|
||||
self.textbox.html = comments_to_html(text) if text else ''
|
||||
self.textbox.wyswyg_dirtied()
|
||||
# self.textbox.setTabChangesFocus(True)
|
||||
self.buttonBox.button(QDialogButtonBox.Ok).setText(_('&OK'))
|
||||
self.buttonBox.button(QDialogButtonBox.Ok).setText(_('O&K'))
|
||||
self.buttonBox.button(QDialogButtonBox.Cancel).setText(_('&Cancel'))
|
||||
|
||||
if column_name:
|
||||
@ -48,3 +48,9 @@ class CommentsDialog(QDialog, Ui_CommentsDialog):
|
||||
self.save_geometry()
|
||||
return QDialog.closeEvent(self, ev)
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = Application([])
|
||||
d = CommentsDialog(None, 'testing', 'Comments')
|
||||
d.exec_()
|
||||
del d
|
||||
del app
|
||||
|
@ -416,17 +416,15 @@ class CcCommentsDelegate(QStyledItemDelegate): # {{{
|
||||
else option.widget.style()
|
||||
self.document.setHtml(option.text)
|
||||
option.text = u''
|
||||
if hasattr(QStyle, 'CE_ItemViewItem'):
|
||||
style.drawControl(QStyle.CE_ItemViewItem, option, painter)
|
||||
style.drawPrimitive(QStyle.PE_PanelItemViewItem, option, painter, widget=option.widget)
|
||||
ctx = QAbstractTextDocumentLayout.PaintContext()
|
||||
ctx.palette = option.palette # .setColor(QPalette.Text, QColor("red"));
|
||||
if hasattr(QStyle, 'SE_ItemViewItemText'):
|
||||
textRect = style.subElementRect(QStyle.SE_ItemViewItemText, option)
|
||||
painter.save()
|
||||
painter.translate(textRect.topLeft())
|
||||
painter.setClipRect(textRect.translated(-textRect.topLeft()))
|
||||
self.document.documentLayout().draw(painter, ctx)
|
||||
painter.restore()
|
||||
ctx.palette = option.palette
|
||||
textRect = style.subElementRect(QStyle.SE_ItemViewItemText, option)
|
||||
painter.save()
|
||||
painter.translate(textRect.topLeft())
|
||||
painter.setClipRect(textRect.translated(-textRect.topLeft()))
|
||||
self.document.documentLayout().draw(painter, ctx)
|
||||
painter.restore()
|
||||
|
||||
def createEditor(self, parent, option, index):
|
||||
m = index.model()
|
||||
|
Loading…
x
Reference in New Issue
Block a user