mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
Revert to using a QPlainText for extra css. Apparently the more sophisticated editor was causing crashes for some people. Fixes #1557147 [2.53 crashes in Qt5Gui.dll when starting conversions](https://bugs.launchpad.net/calibre/+bug/1557147)
This commit is contained in:
parent
701bec4a91
commit
10ed72992d
@ -215,10 +215,10 @@ class Widget(QWidget):
|
|||||||
return
|
return
|
||||||
if isinstance(g, (QSpinBox, QDoubleSpinBox)):
|
if isinstance(g, (QSpinBox, QDoubleSpinBox)):
|
||||||
g.setValue(val)
|
g.setValue(val)
|
||||||
elif isinstance(g, (QLineEdit, QTextEdit)):
|
elif isinstance(g, (QLineEdit, QTextEdit, QPlainTextEdit)):
|
||||||
if not val:
|
if not val:
|
||||||
val = ''
|
val = ''
|
||||||
getattr(g, 'setPlainText', g.setText)(val)
|
getattr(g, 'setPlainText', getattr(g, 'setText', None))(val)
|
||||||
getattr(g, 'setCursorPosition', lambda x: x)(0)
|
getattr(g, 'setCursorPosition', lambda x: x)(0)
|
||||||
elif isinstance(g, QFontComboBox):
|
elif isinstance(g, QFontComboBox):
|
||||||
g.setCurrentFont(QFont(val or ''))
|
g.setCurrentFont(QFont(val or ''))
|
||||||
|
@ -8,7 +8,7 @@ __docformat__ = 'restructuredtext en'
|
|||||||
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from PyQt5.Qt import Qt, QSize
|
from PyQt5.Qt import Qt
|
||||||
|
|
||||||
from calibre.gui2.convert.look_and_feel_ui import Ui_Form
|
from calibre.gui2.convert.look_and_feel_ui import Ui_Form
|
||||||
from calibre.gui2.convert import Widget
|
from calibre.gui2.convert import Widget
|
||||||
@ -63,7 +63,6 @@ class LookAndFeelWidget(Widget, Ui_Form):
|
|||||||
self.opt_unsmarten_punctuation.stateChanged.connect(
|
self.opt_unsmarten_punctuation.stateChanged.connect(
|
||||||
lambda state: state != Qt.Unchecked and
|
lambda state: state != Qt.Unchecked and
|
||||||
self.opt_smarten_punctuation.setCheckState(Qt.Unchecked))
|
self.opt_smarten_punctuation.setCheckState(Qt.Unchecked))
|
||||||
self.opt_extra_css.size_hint = QSize(400, 300)
|
|
||||||
|
|
||||||
def get_value_handler(self, g):
|
def get_value_handler(self, g):
|
||||||
if g is self.opt_change_justification:
|
if g is self.opt_change_justification:
|
||||||
@ -107,9 +106,6 @@ class LookAndFeelWidget(Widget, Ui_Form):
|
|||||||
w.setChecked(False)
|
w.setChecked(False)
|
||||||
self.filter_css_others.setText(', '.join(items))
|
self.filter_css_others.setText(', '.join(items))
|
||||||
return True
|
return True
|
||||||
if g is self.opt_extra_css:
|
|
||||||
g.load_text(val or '', 'css')
|
|
||||||
return True
|
|
||||||
if g is self.opt_transform_css_rules:
|
if g is self.opt_transform_css_rules:
|
||||||
g.rules = json.loads(val) if val else []
|
g.rules = json.loads(val) if val else []
|
||||||
return True
|
return True
|
||||||
|
@ -374,7 +374,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_4">
|
<layout class="QGridLayout" name="gridLayout_4">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="TextEdit" name="opt_extra_css"/>
|
<widget class="QPlainTextEdit" name="opt_extra_css"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
@ -515,11 +515,6 @@
|
|||||||
<extends>QWidget</extends>
|
<extends>QWidget</extends>
|
||||||
<header>calibre/gui2/font_family_chooser.h</header>
|
<header>calibre/gui2/font_family_chooser.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
|
||||||
<class>TextEdit</class>
|
|
||||||
<extends>QPlainTextEdit</extends>
|
|
||||||
<header>calibre/gui2/tweak_book/editor/text.h</header>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>RulesWidget</class>
|
<class>RulesWidget</class>
|
||||||
<extends>QWidget</extends>
|
<extends>QWidget</extends>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user