mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Edit Book: Fix customize template window not freely resizable on windows. Fixes #1650924 ["Customize templates" window is too tall and cannot be resized](https://bugs.launchpad.net/calibre/+bug/1650924)
This commit is contained in:
parent
5b8023dfb6
commit
78add734f8
@ -587,13 +587,17 @@ class TemplatesDialog(Dialog): # {{{
|
|||||||
def setup_ui(self):
|
def setup_ui(self):
|
||||||
from calibre.gui2.tweak_book.templates import DEFAULT_TEMPLATES
|
from calibre.gui2.tweak_book.templates import DEFAULT_TEMPLATES
|
||||||
from calibre.gui2.tweak_book.editor.text import TextEdit
|
from calibre.gui2.tweak_book.editor.text import TextEdit
|
||||||
self.l = l = QFormLayout(self)
|
# Cannot use QFormLayout as it does not play nice with TextEdit on windows
|
||||||
self.setLayout(l)
|
self.l = l = QVBoxLayout(self)
|
||||||
|
|
||||||
self.syntaxes = s = QComboBox(self)
|
self.syntaxes = s = QComboBox(self)
|
||||||
s.addItems(sorted(DEFAULT_TEMPLATES.iterkeys()))
|
s.addItems(sorted(DEFAULT_TEMPLATES.iterkeys()))
|
||||||
s.setCurrentIndex(s.findText('html'))
|
s.setCurrentIndex(s.findText('html'))
|
||||||
l.addRow(_('Choose the &type of template to edit:'), s)
|
h = QHBoxLayout()
|
||||||
|
l.addLayout(h)
|
||||||
|
la = QLabel(_('Choose the &type of template to edit:'))
|
||||||
|
la.setBuddy(s)
|
||||||
|
h.addWidget(la), h.addWidget(s), h.addStretch(10)
|
||||||
s.currentIndexChanged.connect(self.show_template)
|
s.currentIndexChanged.connect(self.show_template)
|
||||||
|
|
||||||
self.helpl = la = QLabel(_(
|
self.helpl = la = QLabel(_(
|
||||||
@ -602,14 +606,14 @@ class TemplatesDialog(Dialog): # {{{
|
|||||||
' for example for CSS rules, you have to escape them, like this: {3}').format(*['<code>%s</code>'%x for x in
|
' for example for CSS rules, you have to escape them, like this: {3}').format(*['<code>%s</code>'%x for x in
|
||||||
['{TITLE}', '{AUTHOR}', '%CURSOR%', 'body {{ color: red }}']]))
|
['{TITLE}', '{AUTHOR}', '%CURSOR%', 'body {{ color: red }}']]))
|
||||||
la.setWordWrap(True)
|
la.setWordWrap(True)
|
||||||
l.addRow(la)
|
l.addWidget(la)
|
||||||
|
|
||||||
self.save_timer = t = QTimer(self)
|
self.save_timer = t = QTimer(self)
|
||||||
t.setSingleShot(True), t.setInterval(100)
|
t.setSingleShot(True), t.setInterval(100)
|
||||||
t.timeout.connect(self._save_syntax)
|
t.timeout.connect(self._save_syntax)
|
||||||
|
|
||||||
self.editor = e = TextEdit(self)
|
self.editor = e = TextEdit(self)
|
||||||
l.addRow(e)
|
l.addWidget(e)
|
||||||
e.textChanged.connect(self.save_syntax)
|
e.textChanged.connect(self.save_syntax)
|
||||||
|
|
||||||
self.show_template()
|
self.show_template()
|
||||||
@ -618,7 +622,7 @@ class TemplatesDialog(Dialog): # {{{
|
|||||||
self.bb.addButton(self.bb.Close)
|
self.bb.addButton(self.bb.Close)
|
||||||
self.rd = b = self.bb.addButton(self.bb.RestoreDefaults)
|
self.rd = b = self.bb.addButton(self.bb.RestoreDefaults)
|
||||||
b.clicked.connect(self.restore_defaults)
|
b.clicked.connect(self.restore_defaults)
|
||||||
l.addRow(self.bb)
|
l.addWidget(self.bb)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_syntax(self):
|
def current_syntax(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user