mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
More busy work for PyQt's stupid enum backwards incompatibility change
This commit is contained in:
parent
962e68ed19
commit
9d1cb5376d
@ -15,7 +15,7 @@ from collections import defaultdict
|
||||
from PyQt5.Qt import (
|
||||
QToolButton, QDialog, QGridLayout, QIcon, QLabel, QDialogButtonBox,
|
||||
QApplication, QLineEdit, QHBoxLayout, QFormLayout, QCheckBox, QWidget,
|
||||
QScrollArea, QVBoxLayout, Qt, QListWidgetItem, QListWidget, QSize)
|
||||
QScrollArea, QVBoxLayout, Qt, QListWidgetItem, QListWidget, QSize, QAbstractItemView)
|
||||
|
||||
from calibre import as_unicode
|
||||
from calibre.constants import ismacos
|
||||
@ -207,7 +207,7 @@ class ChooseLibrary(Dialog): # {{{
|
||||
def setup_ui(self):
|
||||
self.l = l = QGridLayout(self)
|
||||
self.items = i = QListWidget(self)
|
||||
i.setSelectionMode(i.SingleSelection)
|
||||
i.setSelectionMode(QAbstractItemView.SelectionMode.SingleSelection)
|
||||
i.currentItemChanged.connect(self.current_changed)
|
||||
l.addWidget(i)
|
||||
self.v = v = QVBoxLayout()
|
||||
|
@ -7,7 +7,7 @@ __copyright__ = '2012, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
from PyQt5.Qt import (
|
||||
QLineEdit, QAbstractListModel, Qt, pyqtSignal, QObject, QKeySequence,
|
||||
QLineEdit, QAbstractListModel, Qt, pyqtSignal, QObject, QKeySequence, QAbstractItemView,
|
||||
QApplication, QListView, QPoint, QModelIndex,
|
||||
QStyleOptionComboBox, QStyle, QComboBox, QTimer)
|
||||
try:
|
||||
@ -93,7 +93,7 @@ class Completer(QListView): # {{{
|
||||
self.setEditTriggers(self.NoEditTriggers)
|
||||
self.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
|
||||
self.setSelectionBehavior(self.SelectRows)
|
||||
self.setSelectionMode(self.SingleSelection)
|
||||
self.setSelectionMode(QAbstractItemView.SelectionMode.SingleSelection)
|
||||
self.setUniformItemSizes(True)
|
||||
self.setAlternatingRowColors(True)
|
||||
self.setModel(CompleteModel(self, sort_func=sort_func, strip_completion_entries=strip_completion_entries))
|
||||
|
@ -9,7 +9,7 @@ from collections import OrderedDict
|
||||
|
||||
from PyQt5.Qt import (
|
||||
QDialog, QGridLayout, QDialogButtonBox, QListWidget, QApplication, Qt,
|
||||
pyqtSignal, QSize, QPushButton, QIcon, QStyledItemDelegate, QLabel)
|
||||
pyqtSignal, QSize, QPushButton, QIcon, QStyledItemDelegate, QLabel, QAbstractItemView)
|
||||
|
||||
from calibre.utils.config_base import tweaks
|
||||
from calibre.gui2 import gprefs
|
||||
@ -51,7 +51,7 @@ class List(QListWidget):
|
||||
def __init__(self, all_authors, parent):
|
||||
QListWidget.__init__(self, parent)
|
||||
self.setDragEnabled(True)
|
||||
self.setSelectionMode(self.ExtendedSelection)
|
||||
self.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||
self.setDropIndicatorShown(True)
|
||||
self.setDragDropMode(self.InternalMove)
|
||||
self.setAlternatingRowColors(True)
|
||||
|
@ -10,7 +10,7 @@ import os, stat
|
||||
from PyQt5.Qt import (
|
||||
QSize, QStackedLayout, QWidget, QVBoxLayout, QLabel, QPushButton,
|
||||
QListWidget, QListWidgetItem, QIcon, Qt, pyqtSignal, QGridLayout,
|
||||
QProgressBar, QDialog, QDialogButtonBox, QScrollArea, QLineEdit, QFrame
|
||||
QProgressBar, QDialog, QDialogButtonBox, QScrollArea, QLineEdit, QFrame, QAbstractItemView
|
||||
)
|
||||
|
||||
from calibre import human_readable, as_unicode
|
||||
@ -200,7 +200,7 @@ class EximDialog(Dialog):
|
||||
la.setWordWrap(True), l.addWidget(la)
|
||||
self.lib_list = ll = QListWidget(self)
|
||||
l.addWidget(ll)
|
||||
ll.setSelectionMode(ll.ExtendedSelection)
|
||||
ll.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||
ll.setStyleSheet('QListView::item { padding: 5px }')
|
||||
ll.setAlternatingRowColors(True)
|
||||
lpaths = all_known_libraries()
|
||||
|
@ -8,7 +8,7 @@ __docformat__ = 'restructuredtext en'
|
||||
|
||||
|
||||
from PyQt5.Qt import QVBoxLayout, QDialog, QLabel, QDialogButtonBox, Qt, \
|
||||
QAbstractListModel, QListView, QSize, QApplication
|
||||
QAbstractListModel, QListView, QSize, QApplication, QAbstractItemView
|
||||
|
||||
from calibre.gui2 import file_icon_provider
|
||||
|
||||
@ -70,8 +70,8 @@ class SelectFormats(QDialog):
|
||||
self.fview.setStyleSheet('QListView { %s }' % sheet)
|
||||
self._l.addWidget(self.fview)
|
||||
self.fview.setModel(self.formats)
|
||||
self.fview.setSelectionMode(self.fview.SingleSelection if single else
|
||||
self.fview.MultiSelection)
|
||||
self.fview.setSelectionMode(QAbstractItemView.SelectionMode.SingleSelection if single else
|
||||
QAbstractItemView.SelectionMode.MultiSelection)
|
||||
self.bbox = \
|
||||
QDialogButtonBox(QDialogButtonBox.StandardButton.Ok|QDialogButtonBox.StandardButton.Cancel,
|
||||
Qt.Orientation.Horizontal, self)
|
||||
|
@ -12,7 +12,7 @@ from PyQt5.Qt import (QFontInfo, QFontMetrics, Qt, QFont, QFontDatabase, QPen,
|
||||
QStyledItemDelegate, QSize, QStyle, QStringListModel, pyqtSignal,
|
||||
QDialog, QVBoxLayout, QApplication, QFontComboBox, QPushButton,
|
||||
QToolButton, QGridLayout, QListView, QWidget, QDialogButtonBox, QIcon,
|
||||
QHBoxLayout, QLabel, QLineEdit, QSizePolicy)
|
||||
QHBoxLayout, QLabel, QLineEdit, QSizePolicy, QAbstractItemView)
|
||||
|
||||
from calibre.constants import config_dir
|
||||
from calibre.gui2 import choose_files, error_dialog, info_dialog, empty_index
|
||||
@ -186,7 +186,7 @@ class FontsView(QListView):
|
||||
|
||||
def __init__(self, parent):
|
||||
QListView.__init__(self, parent)
|
||||
self.setSelectionMode(self.SingleSelection)
|
||||
self.setSelectionMode(QAbstractItemView.SelectionMode.SingleSelection)
|
||||
self.setAlternatingRowColors(True)
|
||||
self.d = FontFamilyDelegate(self)
|
||||
self.setItemDelegate(self.d)
|
||||
|
@ -16,7 +16,7 @@ from PyQt5.Qt import (
|
||||
QLineEdit, QSpinBox, QTextEdit, QSize, QListWidgetItem, QIcon, QImage,
|
||||
pyqtSignal, QStackedLayout, QWidget, QLabel, Qt, QComboBox, QPixmap,
|
||||
QGridLayout, QStyledItemDelegate, QApplication, QStaticText,
|
||||
QStyle, QPen, QProgressDialog
|
||||
QStyle, QPen, QProgressDialog, QAbstractItemView
|
||||
)
|
||||
try:
|
||||
from PyQt5 import sip
|
||||
@ -217,7 +217,7 @@ class ThemeCreateDialog(Dialog):
|
||||
l.setFieldGrowthPolicy(l.ExpandingFieldsGrow)
|
||||
self.missing_icons_group = mg = QGroupBox(self)
|
||||
self.mising_icons = mi = QListWidget(mg)
|
||||
mi.setSelectionMode(mi.NoSelection)
|
||||
mi.setSelectionMode(QAbstractItemView.SelectionMode.NoSelection)
|
||||
mg.l = QVBoxLayout(mg)
|
||||
mg.l.addWidget(mi)
|
||||
self.splitter.addWidget(mg)
|
||||
|
@ -704,7 +704,7 @@ class GridView(QListView):
|
||||
# restore_vpos()
|
||||
# self.setLayoutMode(self.Batched)
|
||||
self.setResizeMode(self.Adjust)
|
||||
self.setSelectionMode(self.ExtendedSelection)
|
||||
self.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||
self.setVerticalScrollMode(self.ScrollPerPixel)
|
||||
self.delegate = CoverDelegate(self)
|
||||
self.delegate.animation.valueChanged.connect(self.animation_value_changed)
|
||||
|
@ -10,7 +10,7 @@ from PyQt5.Qt import (
|
||||
QApplication, QCheckBox, QComboBox, QCursor, QDateTime, QFont, QFormLayout,
|
||||
QHBoxLayout, QIcon, QKeySequence, QLabel, QMenu, QPalette, QPlainTextEdit, QSize,
|
||||
QSplitter, Qt, QTextBrowser, QTimer, QToolButton, QTreeWidget, QTreeWidgetItem,
|
||||
QVBoxLayout, QWidget, pyqtSignal
|
||||
QVBoxLayout, QWidget, pyqtSignal, QAbstractItemView
|
||||
)
|
||||
|
||||
from calibre import prepare_string_for_xml
|
||||
@ -204,7 +204,7 @@ class ResultsList(QTreeWidget):
|
||||
def __init__(self, parent):
|
||||
QTreeWidget.__init__(self, parent)
|
||||
self.setHeaderHidden(True)
|
||||
self.setSelectionMode(self.ExtendedSelection)
|
||||
self.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||
self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
|
||||
self.customContextMenuRequested.connect(self.show_context_menu)
|
||||
self.delegate = AnnotsResultsDelegate(self)
|
||||
|
@ -11,7 +11,7 @@ from threading import Thread
|
||||
from glob import glob
|
||||
|
||||
from PyQt5.Qt import (
|
||||
QDialog, QApplication, QLabel, QVBoxLayout, QDialogButtonBox, Qt,
|
||||
QDialog, QApplication, QLabel, QVBoxLayout, QDialogButtonBox, Qt, QAbstractItemView,
|
||||
pyqtSignal, QListWidget, QListWidgetItem, QSize, QPixmap, QStyledItemDelegate
|
||||
)
|
||||
try:
|
||||
@ -59,7 +59,7 @@ class PDFCovers(QDialog):
|
||||
self.item_delegate = CoverDelegate(self)
|
||||
c.setItemDelegate(self.item_delegate)
|
||||
c.setIconSize(QSize(120, 160))
|
||||
c.setSelectionMode(c.SingleSelection)
|
||||
c.setSelectionMode(QAbstractItemView.SelectionMode.SingleSelection)
|
||||
c.setViewMode(c.IconMode)
|
||||
c.setUniformItemSizes(True)
|
||||
c.setResizeMode(c.Adjust)
|
||||
|
@ -20,7 +20,7 @@ from PyQt5.Qt import (
|
||||
QWidget, QTableView, QGridLayout, QPalette, QTimer, pyqtSignal,
|
||||
QAbstractTableModel, QSize, QListView, QPixmap, QModelIndex,
|
||||
QAbstractListModel, QRect, QTextBrowser, QStringListModel, QMenu,
|
||||
QCursor, QHBoxLayout, QPushButton, QSizePolicy, QSplitter)
|
||||
QCursor, QHBoxLayout, QPushButton, QSizePolicy, QSplitter, QAbstractItemView)
|
||||
|
||||
from calibre.customize.ui import metadata_plugins
|
||||
from calibre.ebooks.metadata import authors_to_string, rating_to_stars
|
||||
@ -214,7 +214,7 @@ class ResultsView(QTableView): # {{{
|
||||
def __init__(self, parent=None):
|
||||
QTableView.__init__(self, parent)
|
||||
self.rt_delegate = RichTextDelegate(self)
|
||||
self.setSelectionMode(self.SingleSelection)
|
||||
self.setSelectionMode(QAbstractItemView.SelectionMode.SingleSelection)
|
||||
self.setAlternatingRowColors(True)
|
||||
self.setSelectionBehavior(self.SelectRows)
|
||||
self.setIconSize(QSize(24, 24))
|
||||
@ -774,7 +774,7 @@ class CoversView(QListView): # {{{
|
||||
self.setResizeMode(self.Adjust)
|
||||
self.setGridSize(QSize(190, 260))
|
||||
self.setIconSize(QSize(*CoverDelegate.ICON_SIZE))
|
||||
self.setSelectionMode(self.SingleSelection)
|
||||
self.setSelectionMode(QAbstractItemView.SelectionMode.SingleSelection)
|
||||
self.setViewMode(self.IconMode)
|
||||
|
||||
self.delegate = CoverDelegate(self)
|
||||
|
@ -12,7 +12,7 @@ from PyQt5.Qt import (QWidget, QDialog, QLabel, QGridLayout, QComboBox, QSize,
|
||||
QLineEdit, QIntValidator, QDoubleValidator, QFrame, Qt, QIcon, QHBoxLayout,
|
||||
QScrollArea, QPushButton, QVBoxLayout, QDialogButtonBox, QToolButton,
|
||||
QListView, QAbstractListModel, pyqtSignal, QSizePolicy, QSpacerItem,
|
||||
QApplication, QStandardItem, QStandardItemModel, QCheckBox, QMenu)
|
||||
QApplication, QStandardItem, QStandardItemModel, QCheckBox, QMenu, QAbstractItemView)
|
||||
|
||||
from calibre import prepare_string_for_xml, sanitize_file_name, as_unicode
|
||||
from calibre.constants import config_dir
|
||||
@ -911,7 +911,7 @@ class EditRules(QWidget): # {{{
|
||||
self.g = g = QGridLayout()
|
||||
self.rules_view = QListView(self)
|
||||
self.rules_view.doubleClicked.connect(self.edit_rule)
|
||||
self.rules_view.setSelectionMode(self.rules_view.ExtendedSelection)
|
||||
self.rules_view.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||
self.rules_view.setAlternatingRowColors(True)
|
||||
self.rtfd = RichTextDelegate(parent=self.rules_view, max_width=400)
|
||||
self.rules_view.setItemDelegate(self.rtfd)
|
||||
|
@ -9,7 +9,7 @@ import glob, os, shutil
|
||||
from functools import partial
|
||||
from PyQt5.Qt import (
|
||||
QDialog, QVBoxLayout, QListWidget, QListWidgetItem, Qt, QIcon,
|
||||
QApplication, QSize, QDialogButtonBox, QTimer, QLabel)
|
||||
QApplication, QSize, QDialogButtonBox, QTimer, QLabel, QAbstractItemView)
|
||||
|
||||
from calibre.constants import config_dir
|
||||
from calibre.gui2 import choose_files, error_dialog
|
||||
@ -49,7 +49,7 @@ class TextureChooser(QDialog):
|
||||
il.setViewMode(il.IconMode)
|
||||
il.setFlow(il.LeftToRight)
|
||||
il.setSpacing(20)
|
||||
il.setSelectionMode(il.SingleSelection)
|
||||
il.setSelectionMode(QAbstractItemView.SelectionMode.SingleSelection)
|
||||
il.itemSelectionChanged.connect(self.update_remove_state)
|
||||
l.addWidget(il)
|
||||
|
||||
|
@ -9,7 +9,7 @@ from functools import partial
|
||||
|
||||
from PyQt5.Qt import (
|
||||
Qt, QMenu, QIcon, QDialog, QGridLayout, QLabel, QLineEdit, QComboBox,
|
||||
QDialogButtonBox, QSize, QVBoxLayout, QListWidget, QRadioButton, QAction, QTextBrowser)
|
||||
QDialogButtonBox, QSize, QVBoxLayout, QListWidget, QRadioButton, QAction, QTextBrowser, QAbstractItemView)
|
||||
|
||||
from calibre.gui2 import error_dialog, question_dialog, gprefs
|
||||
from calibre.gui2.dialogs.confirm_delete import confirm
|
||||
@ -32,7 +32,7 @@ class SelectNames(QDialog): # {{{
|
||||
|
||||
self._names = QListWidget(self)
|
||||
self._names.addItems(sorted(names, key=sort_key))
|
||||
self._names.setSelectionMode(self._names.MultiSelection)
|
||||
self._names.setSelectionMode(QAbstractItemView.SelectionMode.MultiSelection)
|
||||
l.addWidget(self._names)
|
||||
|
||||
self._or = QRadioButton(_('Match any of the selected %s')%txt)
|
||||
|
@ -8,7 +8,7 @@ import textwrap
|
||||
|
||||
from PyQt5.Qt import (
|
||||
QWidget, QVBoxLayout, QHBoxLayout, QPushButton, QLabel, QListWidget, QIcon,
|
||||
QSize, QComboBox, QLineEdit, QListWidgetItem, QStyledItemDelegate,
|
||||
QSize, QComboBox, QLineEdit, QListWidgetItem, QStyledItemDelegate, QAbstractItemView,
|
||||
QStaticText, Qt, QStyle, QToolButton, QInputDialog, QMenu, pyqtSignal
|
||||
)
|
||||
|
||||
@ -295,7 +295,7 @@ class Rules(QWidget):
|
||||
l.addLayout(h)
|
||||
self.rule_list = r = QListWidget(self)
|
||||
self.delegate = Delegate(self)
|
||||
r.setSelectionMode(r.ExtendedSelection)
|
||||
r.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||
r.setItemDelegate(self.delegate)
|
||||
r.doubleClicked.connect(self.edit_rule)
|
||||
h.addWidget(r)
|
||||
|
@ -10,7 +10,7 @@ from functools import partial
|
||||
from PyQt5.Qt import (
|
||||
QApplication, QCheckBox, QCursor, QDialog, QDialogButtonBox, QFrame, QGridLayout,
|
||||
QIcon, QInputDialog, QItemSelectionModel, QKeySequence, QLabel, QMenu,
|
||||
QPushButton, QScrollArea, QSize, QSizePolicy, QStackedWidget, Qt,
|
||||
QPushButton, QScrollArea, QSize, QSizePolicy, QStackedWidget, Qt, QAbstractItemView,
|
||||
QToolButton, QTreeWidget, QTreeWidgetItem, QVBoxLayout, QWidget, pyqtSignal
|
||||
)
|
||||
from threading import Thread
|
||||
@ -386,7 +386,7 @@ class TreeWidget(QTreeWidget): # {{{
|
||||
self.setHeaderLabel(_('Table of Contents'))
|
||||
self.setIconSize(QSize(ICON_SIZE, ICON_SIZE))
|
||||
self.setDragEnabled(True)
|
||||
self.setSelectionMode(self.ExtendedSelection)
|
||||
self.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||
self.viewport().setAcceptDrops(True)
|
||||
self.setDropIndicatorShown(True)
|
||||
self.setDragDropMode(self.InternalMove)
|
||||
|
@ -13,7 +13,7 @@ from PyQt5.Qt import (
|
||||
QAbstractItemModel, QAbstractListModel, QApplication, QCheckBox, QGridLayout,
|
||||
QHBoxLayout, QIcon, QInputMethodEvent, QLabel, QListView, QMenu, QMimeData,
|
||||
QModelIndex, QPen, QPushButton, QSize, QSizePolicy, QSplitter,
|
||||
QStyledItemDelegate, Qt, QToolButton, QTreeView, pyqtSignal
|
||||
QStyledItemDelegate, Qt, QToolButton, QTreeView, pyqtSignal, QAbstractItemView
|
||||
)
|
||||
|
||||
from calibre.gui2.tweak_book import tprefs
|
||||
@ -618,7 +618,7 @@ class CharView(QListView):
|
||||
self.setDropIndicatorShown(True)
|
||||
self._model.allow_dnd = False
|
||||
else:
|
||||
self.setSelectionMode(self.ExtendedSelection)
|
||||
self.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||
self.viewport().setAcceptDrops(True)
|
||||
self.setDragEnabled(True)
|
||||
self.setAcceptDrops(True)
|
||||
|
@ -9,7 +9,8 @@ import sys
|
||||
|
||||
from PyQt5.Qt import (
|
||||
QIcon, Qt, QSplitter, QListWidget, QTextBrowser, QPalette, QMenu,
|
||||
QListWidgetItem, pyqtSignal, QApplication, QStyledItemDelegate)
|
||||
QListWidgetItem, pyqtSignal, QApplication, QStyledItemDelegate,
|
||||
QAbstractItemView)
|
||||
|
||||
from calibre.ebooks.oeb.polish.check.base import WARN, INFO, DEBUG, ERROR, CRITICAL
|
||||
from calibre.ebooks.oeb.polish.check.main import run_checks, fix_errors
|
||||
@ -70,7 +71,7 @@ class Check(QSplitter):
|
||||
self.items.setSpacing(3)
|
||||
self.items.itemDoubleClicked.connect(self.current_item_activated)
|
||||
self.items.currentItemChanged.connect(self.current_item_changed)
|
||||
self.items.setSelectionMode(self.items.NoSelection)
|
||||
self.items.setSelectionMode(QAbstractItemView.SelectionMode.NoSelection)
|
||||
self.delegate = Delegate(self.items)
|
||||
self.items.setItemDelegate(self.delegate)
|
||||
self.addWidget(i)
|
||||
|
@ -11,7 +11,7 @@ from collections import Counter, OrderedDict, defaultdict
|
||||
from functools import partial
|
||||
from PyQt5.Qt import (
|
||||
QApplication, QCheckBox, QDialog, QDialogButtonBox, QFont, QFormLayout,
|
||||
QGridLayout, QIcon, QInputDialog, QLabel, QLineEdit, QListWidget,
|
||||
QGridLayout, QIcon, QInputDialog, QLabel, QLineEdit, QListWidget, QAbstractItemView,
|
||||
QListWidgetItem, QMenu, QPainter, QPixmap, QRadioButton, QScrollArea, QSize,
|
||||
QSpinBox, QStyle, QStyledItemDelegate, Qt, QTimer, QTreeWidget, QTreeWidgetItem,
|
||||
QVBoxLayout, QWidget, pyqtSignal
|
||||
@ -252,7 +252,7 @@ class FileList(QTreeWidget, OpenWithHandler):
|
||||
self.header().close()
|
||||
self.setDragEnabled(True)
|
||||
self.setEditTriggers(self.EditKeyPressed)
|
||||
self.setSelectionMode(self.ExtendedSelection)
|
||||
self.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||
self.viewport().setAcceptDrops(True)
|
||||
self.setDropIndicatorShown(True)
|
||||
self.setDragDropMode(self.InternalMove)
|
||||
|
@ -11,7 +11,7 @@ from io import BytesIO
|
||||
from PyQt5.Qt import (
|
||||
QSplitter, QVBoxLayout, QTableView, QWidget, QLabel, QAbstractTableModel,
|
||||
Qt, QTimer, QPushButton, pyqtSignal, QFormLayout, QLineEdit, QIcon, QSize,
|
||||
QHBoxLayout, QTextEdit, QApplication, QMessageBox)
|
||||
QHBoxLayout, QTextEdit, QApplication, QMessageBox, QAbstractItemView)
|
||||
|
||||
from calibre.ebooks.oeb.polish.container import get_container
|
||||
from calibre.ebooks.oeb.polish.fonts import font_family_data, change_font
|
||||
@ -253,7 +253,7 @@ class ManageFonts(Dialog):
|
||||
fv.setSortingEnabled(True)
|
||||
fv.setShowGrid(False)
|
||||
fv.setAlternatingRowColors(True)
|
||||
fv.setSelectionMode(fv.ExtendedSelection)
|
||||
fv.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||
fv.setSelectionBehavior(fv.SelectRows)
|
||||
fv.horizontalHeader().setSortIndicator(1, Qt.SortOrder.AscendingOrder)
|
||||
self.container = c = QWidget()
|
||||
|
@ -12,7 +12,7 @@ from PyQt5.Qt import (
|
||||
QTextBrowser, QVBoxLayout, QDialog, QDialogButtonBox, QIcon, QLabel,
|
||||
QCheckBox, Qt, QListWidgetItem, QHBoxLayout, QListWidget, QPixmap,
|
||||
QSpinBox, QStyledItemDelegate, QSize, QStyle, QPen,
|
||||
QProgressBar, pyqtSignal, QApplication
|
||||
QProgressBar, pyqtSignal, QApplication, QAbstractItemView
|
||||
)
|
||||
|
||||
from calibre import human_readable, fit_image, force_unicode
|
||||
@ -185,7 +185,7 @@ class CompressImages(Dialog):
|
||||
for name in sorted(get_compressible_images(c), key=numeric_sort_key):
|
||||
x = QListWidgetItem(name, i)
|
||||
x.setData(Qt.ItemDataRole.UserRole, c.filesize(name))
|
||||
i.setSelectionMode(i.ExtendedSelection)
|
||||
i.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||
i.setMinimumHeight(350), i.setMinimumWidth(350)
|
||||
i.selectAll(), i.setSpacing(5)
|
||||
self.delegate = ImageItemDelegate(self)
|
||||
|
@ -18,7 +18,7 @@ from PyQt5.Qt import (
|
||||
QDialog, QGridLayout, QStackedWidget, QDialogButtonBox, QListWidget,
|
||||
QListWidgetItem, QIcon, QWidget, QSize, QFormLayout, Qt, QSpinBox,
|
||||
QCheckBox, pyqtSignal, QDoubleSpinBox, QComboBox, QLabel, QFont, QApplication,
|
||||
QFontComboBox, QPushButton, QSizePolicy, QHBoxLayout, QGroupBox,
|
||||
QFontComboBox, QPushButton, QSizePolicy, QHBoxLayout, QGroupBox, QAbstractItemView,
|
||||
QToolButton, QVBoxLayout, QSpacerItem, QTimer, QRadioButton)
|
||||
|
||||
from calibre import prepare_string_for_xml
|
||||
@ -434,7 +434,7 @@ class ToolbarList(QListWidget):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QListWidget.__init__(self, parent)
|
||||
self.setSelectionMode(self.ExtendedSelection)
|
||||
self.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||
|
||||
|
||||
class ToolbarSettings(QWidget):
|
||||
|
@ -20,7 +20,7 @@ from PyQt5.Qt import (
|
||||
QListWidgetItem, QLineEdit, QStackedWidget, QSplitter, QByteArray, QPixmap,
|
||||
QStyledItemDelegate, QModelIndex, QRect, QStyle, QPalette, QTimer, QMenu,
|
||||
QAbstractItemModel, QTreeView, QFont, QRadioButton, QHBoxLayout,
|
||||
QFontDatabase, QComboBox, QUrl)
|
||||
QFontDatabase, QComboBox, QUrl, QAbstractItemView)
|
||||
|
||||
from calibre import human_readable, fit_image
|
||||
from calibre.constants import DEBUG
|
||||
@ -130,7 +130,8 @@ class FilesView(QTableView):
|
||||
|
||||
def __init__(self, model, parent=None):
|
||||
QTableView.__init__(self, parent)
|
||||
self.setSelectionBehavior(self.SelectRows), self.setSelectionMode(self.ExtendedSelection)
|
||||
self.setSelectionBehavior(self.SelectRows)
|
||||
self.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||
self.setAlternatingRowColors(True)
|
||||
self.setSortingEnabled(True)
|
||||
self.proxy = p = ProxyModel(self)
|
||||
|
@ -14,7 +14,7 @@ from PyQt5.Qt import (
|
||||
QGridLayout, QHBoxLayout, QIcon, QItemSelection, QKeySequence, QLabel, QLineEdit,
|
||||
QListView, QMenu, QMimeData, QModelIndex, QPushButton, QScrollArea, QSize,
|
||||
QSizePolicy, QStackedLayout, QStyledItemDelegate, Qt, QTimer, QToolBar,
|
||||
QToolButton, QVBoxLayout, QWidget, pyqtSignal
|
||||
QToolButton, QVBoxLayout, QWidget, pyqtSignal, QAbstractItemView
|
||||
)
|
||||
|
||||
from calibre import prepare_string_for_xml
|
||||
@ -912,7 +912,7 @@ class SavedSearches(QWidget):
|
||||
self.model.dataChanged.connect(self.show_details)
|
||||
searches.setModel(self.model)
|
||||
searches.selectionModel().currentChanged.connect(self.show_details)
|
||||
searches.setSelectionMode(searches.ExtendedSelection)
|
||||
searches.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||
self.delegate = SearchDelegate(searches)
|
||||
searches.setItemDelegate(self.delegate)
|
||||
searches.setAlternatingRowColors(True)
|
||||
|
@ -16,7 +16,7 @@ from PyQt5.Qt import (
|
||||
QInputDialog, QKeySequence, QLabel, QLineEdit, QListWidget, QListWidgetItem,
|
||||
QMenu, QModelIndex, QPlainTextEdit, QPushButton, QSize, QStackedLayout, Qt,
|
||||
QTableView, QTimer, QToolButton, QTreeWidget, QTreeWidgetItem, QVBoxLayout,
|
||||
QWidget, pyqtSignal
|
||||
QWidget, pyqtSignal, QAbstractItemView
|
||||
)
|
||||
from threading import Thread
|
||||
|
||||
@ -216,7 +216,7 @@ class ManageUserDictionaries(Dialog):
|
||||
self.la = la = QLabel(_('Words in this dictionary:'))
|
||||
l.addWidget(la)
|
||||
self.words = w = UserWordList(self)
|
||||
w.setSelectionMode(w.ExtendedSelection)
|
||||
w.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||
l.addWidget(w)
|
||||
self.add_word_button = b = QPushButton(_('&Add word'), self)
|
||||
b.clicked.connect(self.add_word)
|
||||
|
@ -10,7 +10,8 @@ from itertools import chain
|
||||
from PyQt5.Qt import (
|
||||
QColor, QFont, QHBoxLayout, QIcon, QImage, QItemSelectionModel, QKeySequence,
|
||||
QLabel, QMenu, QPainter, QPainterPath, QPixmap, QPushButton, QRect, QSizePolicy,
|
||||
Qt, QTextEdit, QTreeWidget, QTreeWidgetItem, QVBoxLayout, QWidget, pyqtSignal
|
||||
Qt, QTextEdit, QTreeWidget, QTreeWidgetItem, QVBoxLayout, QWidget, pyqtSignal,
|
||||
QAbstractItemView
|
||||
)
|
||||
|
||||
from calibre.constants import (
|
||||
@ -156,7 +157,7 @@ class Highlights(QTreeWidget):
|
||||
self.default_decoration = QIcon(I('blank.png'))
|
||||
self.setHeaderHidden(True)
|
||||
self.num_of_items = 0
|
||||
self.setSelectionMode(self.ExtendedSelection)
|
||||
self.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||
set_no_activate_on_click(self)
|
||||
self.itemActivated.connect(self.item_activated)
|
||||
self.currentItemChanged.connect(self.current_item_changed)
|
||||
|
@ -8,7 +8,8 @@ from functools import partial
|
||||
|
||||
from PyQt5.Qt import (
|
||||
QAction, QGroupBox, QHBoxLayout, QIcon, QKeySequence, QLabel, QListWidget,
|
||||
QListWidgetItem, QMenu, Qt, QToolBar, QToolButton, QVBoxLayout, pyqtSignal
|
||||
QListWidgetItem, QMenu, Qt, QToolBar, QToolButton, QVBoxLayout, pyqtSignal,
|
||||
QAbstractItemView
|
||||
)
|
||||
from PyQt5.QtWebEngineWidgets import QWebEnginePage
|
||||
|
||||
@ -305,7 +306,7 @@ class ActionsList(QListWidget):
|
||||
|
||||
def __init__(self, actions, parent=None, is_source=True):
|
||||
QListWidget.__init__(self, parent)
|
||||
self.setSelectionMode(self.ExtendedSelection)
|
||||
self.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||
self.setDragEnabled(True)
|
||||
self.viewport().setAcceptDrops(True)
|
||||
self.setDropIndicatorShown(True)
|
||||
|
Loading…
x
Reference in New Issue
Block a user