mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -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 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.gui2.dialogs.comments_dialog_ui import Ui_CommentsDialog
|
||||||
from calibre.library.comments import comments_to_html
|
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.html = comments_to_html(text) if text else ''
|
||||||
self.textbox.wyswyg_dirtied()
|
self.textbox.wyswyg_dirtied()
|
||||||
# self.textbox.setTabChangesFocus(True)
|
# 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'))
|
self.buttonBox.button(QDialogButtonBox.Cancel).setText(_('&Cancel'))
|
||||||
|
|
||||||
if column_name:
|
if column_name:
|
||||||
@ -48,3 +48,9 @@ class CommentsDialog(QDialog, Ui_CommentsDialog):
|
|||||||
self.save_geometry()
|
self.save_geometry()
|
||||||
return QDialog.closeEvent(self, ev)
|
return QDialog.closeEvent(self, ev)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
app = Application([])
|
||||||
|
d = CommentsDialog(None, 'testing', 'Comments')
|
||||||
|
d.exec_()
|
||||||
|
del d
|
||||||
|
del app
|
||||||
|
@ -416,11 +416,9 @@ class CcCommentsDelegate(QStyledItemDelegate): # {{{
|
|||||||
else option.widget.style()
|
else option.widget.style()
|
||||||
self.document.setHtml(option.text)
|
self.document.setHtml(option.text)
|
||||||
option.text = u''
|
option.text = u''
|
||||||
if hasattr(QStyle, 'CE_ItemViewItem'):
|
style.drawPrimitive(QStyle.PE_PanelItemViewItem, option, painter, widget=option.widget)
|
||||||
style.drawControl(QStyle.CE_ItemViewItem, option, painter)
|
|
||||||
ctx = QAbstractTextDocumentLayout.PaintContext()
|
ctx = QAbstractTextDocumentLayout.PaintContext()
|
||||||
ctx.palette = option.palette # .setColor(QPalette.Text, QColor("red"));
|
ctx.palette = option.palette
|
||||||
if hasattr(QStyle, 'SE_ItemViewItemText'):
|
|
||||||
textRect = style.subElementRect(QStyle.SE_ItemViewItemText, option)
|
textRect = style.subElementRect(QStyle.SE_ItemViewItemText, option)
|
||||||
painter.save()
|
painter.save()
|
||||||
painter.translate(textRect.topLeft())
|
painter.translate(textRect.topLeft())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user