More stupid PyQt enums

This commit is contained in:
Kovid Goyal 2020-12-20 11:58:35 +05:30
parent 3cba0dcec8
commit 15407e24ab
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 7 additions and 7 deletions

View File

@ -17,7 +17,7 @@ from PyQt5.Qt import (
QHBoxLayout, QIcon, QKeySequence, QLabel, QLineEdit, QMenu, QPalette, QHBoxLayout, QIcon, QKeySequence, QLabel, QLineEdit, QMenu, QPalette,
QPlainTextEdit, QPushButton, QSize, QSyntaxHighlighter, Qt, QTabWidget, QPlainTextEdit, QPushButton, QSize, QSyntaxHighlighter, Qt, QTabWidget,
QTextBlockFormat, QTextCharFormat, QTextCursor, QTextEdit, QTextListFormat, QTextBlockFormat, QTextCharFormat, QTextCursor, QTextEdit, QTextListFormat,
QToolBar, QUrl, QVBoxLayout, QWidget, pyqtSignal, pyqtSlot, QToolButton QToolBar, QUrl, QVBoxLayout, QWidget, pyqtSignal, pyqtSlot, QToolButton, QTextFormat
) )
from calibre import xml_replace_entities from calibre import xml_replace_entities
@ -558,11 +558,11 @@ class EditorWidget(QTextEdit, LineEditECM): # {{{
bf.setTopMargin(tmargin), bf.setBottomMargin(bmargin) bf.setTopMargin(tmargin), bf.setBottomMargin(bmargin)
bf.setHeadingLevel(lvl) bf.setHeadingLevel(lvl)
if adjust: if adjust:
bcf.setProperty(QTextCharFormat.FontSizeAdjustment, adjust) bcf.setProperty(QTextFormat.Property.FontSizeAdjustment, adjust)
cf.setProperty(QTextCharFormat.FontSizeAdjustment, adjust) cf.setProperty(QTextFormat.Property.FontSizeAdjustment, adjust)
if wt: if wt:
bcf.setProperty(QTextCharFormat.FontWeight, wt) bcf.setProperty(QTextFormat.Property.FontWeight, wt)
cf.setProperty(QTextCharFormat.FontWeight, wt) cf.setProperty(QTextFormat.Property.FontWeight, wt)
c.setBlockCharFormat(bcf) c.setBlockCharFormat(bcf)
c.mergeCharFormat(cf) c.mergeCharFormat(cf)
c.mergeBlockFormat(bf) c.mergeBlockFormat(bf)

View File

@ -5,7 +5,7 @@
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>' __copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
from PyQt5.Qt import QTextCharFormat from PyQt5.Qt import QTextCharFormat, QTextFormat
from calibre.ebooks.oeb.base import OEB_DOCS, OEB_STYLES from calibre.ebooks.oeb.base import OEB_DOCS, OEB_STYLES
from calibre.ebooks.oeb.polish.container import guess_type from calibre.ebooks.oeb.polish.container import guess_type
@ -42,7 +42,7 @@ def editor_from_syntax(syntax, parent=None):
return Editor(syntax, parent=parent) return Editor(syntax, parent=parent)
SYNTAX_PROPERTY = QTextCharFormat.UserProperty SYNTAX_PROPERTY = QTextFormat.Property.UserProperty
SPELL_PROPERTY = SYNTAX_PROPERTY + 1 SPELL_PROPERTY = SYNTAX_PROPERTY + 1
SPELL_LOCALE_PROPERTY = SPELL_PROPERTY + 1 SPELL_LOCALE_PROPERTY = SPELL_PROPERTY + 1
LINK_PROPERTY = SPELL_LOCALE_PROPERTY + 1 LINK_PROPERTY = SPELL_LOCALE_PROPERTY + 1