Fix #1875119 [[Enhancement - Viewer] Edit lookup sources](https://bugs.launchpad.net/calibre/+bug/1875119)

This commit is contained in:
Kovid Goyal 2020-04-26 16:37:18 +05:30
parent 03157763a5
commit cb5f6c7f31
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -6,7 +6,6 @@ from __future__ import absolute_import, division, print_function, unicode_litera
import os import os
import sys import sys
import textwrap
from PyQt5.Qt import ( from PyQt5.Qt import (
QApplication, QComboBox, QDialog, QDialogButtonBox, QFormLayout, QHBoxLayout, QApplication, QComboBox, QDialog, QDialogButtonBox, QFormLayout, QHBoxLayout,
@ -57,6 +56,7 @@ class SourceEditor(Dialog):
self.initial_name = source_to_edit['name'] self.initial_name = source_to_edit['name']
self.initial_url = source_to_edit['url'] self.initial_url = source_to_edit['url']
Dialog.__init__(self, _('Edit lookup source'), 'viewer-edit-lookup-location', parent=parent) Dialog.__init__(self, _('Edit lookup source'), 'viewer-edit-lookup-location', parent=parent)
self.resize(self.sizeHint())
def setup_ui(self): def setup_ui(self):
self.l = l = QFormLayout(self) self.l = l = QFormLayout(self)
@ -70,11 +70,13 @@ class SourceEditor(Dialog):
self.url_edit = u = QLineEdit(self) self.url_edit = u = QLineEdit(self)
u.setPlaceholderText(_('The URL template of the source')) u.setPlaceholderText(_('The URL template of the source'))
u.setMinimumWidth(n.minimumWidth()) u.setMinimumWidth(n.minimumWidth())
u.setToolTip(textwrap.fill(_(
'The URL template must starts with https:// and have {word} in it which will be replaced by the actual query')))
l.addRow(_('&URL:'), u) l.addRow(_('&URL:'), u)
if self.initial_url: if self.initial_url:
u.setText(self.initial_url) u.setText(self.initial_url)
la = QLabel(_(
'The URL template must starts with https:// and have {word} in it which will be replaced by the actual query'))
la.setWordWrap(True)
l.addRow(la)
l.addRow(self.bb) l.addRow(self.bb)
if self.initial_name: if self.initial_name:
u.setFocus(Qt.OtherFocusReason) u.setFocus(Qt.OtherFocusReason)