mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Fix configure metadata source widget not useable on small screens
This commit is contained in:
parent
a67fb90335
commit
e38ae0e58e
@ -6,10 +6,12 @@ __license__ = 'GPL v3'
|
|||||||
__copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>'
|
__copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||||
__docformat__ = 'restructuredtext en'
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
import textwrap, numbers
|
import numbers
|
||||||
|
import textwrap
|
||||||
from PyQt5.Qt import (QWidget, QGridLayout, QGroupBox, QListView, Qt, QSpinBox,
|
from PyQt5.Qt import (
|
||||||
QDoubleSpinBox, QCheckBox, QLineEdit, QComboBox, QLabel)
|
QCheckBox, QComboBox, QDoubleSpinBox, QGridLayout, QGroupBox, QLabel, QLineEdit,
|
||||||
|
QListView, QSpinBox, Qt, QVBoxLayout, QWidget
|
||||||
|
)
|
||||||
|
|
||||||
from calibre.gui2.preferences.metadata_sources import FieldsModel as FM
|
from calibre.gui2.preferences.metadata_sources import FieldsModel as FM
|
||||||
from calibre.utils.icu import sort_key
|
from calibre.utils.icu import sort_key
|
||||||
@ -54,35 +56,41 @@ class FieldsModel(FM): # {{{
|
|||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
|
||||||
|
class FieldsList(QListView):
|
||||||
|
|
||||||
|
def sizeHint(self):
|
||||||
|
return self.minimumSizeHint()
|
||||||
|
|
||||||
|
|
||||||
class ConfigWidget(QWidget):
|
class ConfigWidget(QWidget):
|
||||||
|
|
||||||
def __init__(self, plugin):
|
def __init__(self, plugin):
|
||||||
QWidget.__init__(self)
|
QWidget.__init__(self)
|
||||||
self.plugin = plugin
|
self.plugin = plugin
|
||||||
|
|
||||||
self.l = l = QGridLayout()
|
self.overl = l = QVBoxLayout(self)
|
||||||
self.setLayout(l)
|
|
||||||
|
|
||||||
self.gb = QGroupBox(_('Metadata fields to download'), self)
|
self.gb = QGroupBox(_('Metadata fields to download'), self)
|
||||||
if plugin.config_help_message:
|
if plugin.config_help_message:
|
||||||
self.pchm = QLabel(plugin.config_help_message)
|
self.pchm = QLabel(plugin.config_help_message)
|
||||||
self.pchm.setWordWrap(True)
|
self.pchm.setWordWrap(True)
|
||||||
self.pchm.setOpenExternalLinks(True)
|
self.pchm.setOpenExternalLinks(True)
|
||||||
l.addWidget(self.pchm, 0, 0, 1, 2)
|
l.addWidget(self.pchm, 10)
|
||||||
l.addWidget(self.gb, l.rowCount(), 0, 1, 2)
|
l.addWidget(self.gb)
|
||||||
self.gb.l = QGridLayout()
|
self.gb.l = g = QVBoxLayout(self.gb)
|
||||||
self.gb.setLayout(self.gb.l)
|
g.setContentsMargins(0, 0, 0, 0)
|
||||||
self.fields_view = v = QListView(self)
|
self.fields_view = v = FieldsList(self)
|
||||||
self.gb.l.addWidget(v, 0, 0)
|
g.addWidget(v)
|
||||||
v.setFlow(v.LeftToRight)
|
v.setFlow(v.LeftToRight)
|
||||||
v.setWrapping(True)
|
v.setWrapping(True)
|
||||||
v.setResizeMode(v.Adjust)
|
v.setResizeMode(v.Adjust)
|
||||||
self.fields_model = FieldsModel(self.plugin)
|
self.fields_model = FieldsModel(self.plugin)
|
||||||
self.fields_model.initialize()
|
self.fields_model.initialize()
|
||||||
v.setModel(self.fields_model)
|
v.setModel(self.fields_model)
|
||||||
|
|
||||||
self.memory = []
|
self.memory = []
|
||||||
self.widgets = []
|
self.widgets = []
|
||||||
|
self.l = QGridLayout()
|
||||||
|
self.l.setContentsMargins(0, 0, 0, 0)
|
||||||
|
l.addLayout(self.l, 100)
|
||||||
for opt in plugin.options:
|
for opt in plugin.options:
|
||||||
self.create_widgets(opt)
|
self.create_widgets(opt)
|
||||||
|
|
||||||
|
@ -7,16 +7,19 @@ __copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>'
|
|||||||
__docformat__ = 'restructuredtext en'
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
from operator import attrgetter
|
from operator import attrgetter
|
||||||
|
from PyQt5.Qt import (
|
||||||
|
QAbstractListModel, QAbstractTableModel, QDialogButtonBox, QFrame, QIcon, QLabel,
|
||||||
|
QScrollArea, Qt, QVBoxLayout, QWidget, pyqtSignal
|
||||||
|
)
|
||||||
|
|
||||||
from PyQt5.Qt import (QAbstractTableModel, Qt, QAbstractListModel, QWidget,
|
from calibre.customize.ui import (
|
||||||
pyqtSignal, QVBoxLayout, QDialogButtonBox, QFrame, QLabel, QIcon)
|
all_metadata_plugins, default_disabled_plugins, disable_plugin, enable_plugin,
|
||||||
|
is_disabled
|
||||||
|
)
|
||||||
|
from calibre.ebooks.metadata.sources.prefs import msprefs
|
||||||
|
from calibre.gui2 import error_dialog, question_dialog
|
||||||
from calibre.gui2.preferences import ConfigWidgetBase, test_widget
|
from calibre.gui2.preferences import ConfigWidgetBase, test_widget
|
||||||
from calibre.gui2.preferences.metadata_sources_ui import Ui_Form
|
from calibre.gui2.preferences.metadata_sources_ui import Ui_Form
|
||||||
from calibre.ebooks.metadata.sources.prefs import msprefs
|
|
||||||
from calibre.customize.ui import (all_metadata_plugins, is_disabled,
|
|
||||||
enable_plugin, disable_plugin, default_disabled_plugins)
|
|
||||||
from calibre.gui2 import error_dialog, question_dialog
|
|
||||||
from polyglot.builtins import iteritems
|
from polyglot.builtins import iteritems
|
||||||
|
|
||||||
|
|
||||||
@ -275,7 +278,10 @@ class PluginConfig(QWidget): # {{{
|
|||||||
l.addWidget(c)
|
l.addWidget(c)
|
||||||
|
|
||||||
self.config_widget = plugin.config_widget()
|
self.config_widget = plugin.config_widget()
|
||||||
self.l.addWidget(self.config_widget)
|
self.sa = sa = QScrollArea(self)
|
||||||
|
sa.setWidgetResizable(True)
|
||||||
|
sa.setWidget(self.config_widget)
|
||||||
|
l.addWidget(sa)
|
||||||
|
|
||||||
self.bb = QDialogButtonBox(
|
self.bb = QDialogButtonBox(
|
||||||
QDialogButtonBox.Save|QDialogButtonBox.Cancel,
|
QDialogButtonBox.Save|QDialogButtonBox.Cancel,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user