diff --git a/src/calibre/gui2/preferences/tweaks.py b/src/calibre/gui2/preferences/tweaks.py index 23951d669d..6b70ec36a2 100644 --- a/src/calibre/gui2/preferences/tweaks.py +++ b/src/calibre/gui2/preferences/tweaks.py @@ -6,14 +6,12 @@ import textwrap from collections import OrderedDict from functools import partial -from math import ceil, floor from operator import attrgetter - from qt.core import ( - QAbstractListModel, QApplication, QDialog, QDialogButtonBox, QFont, QGridLayout, - QGroupBox, QIcon, QLabel, QListView, QMenu, QModelIndex, QPlainTextEdit, QComboBox, - QPushButton, QSizePolicy, QSplitter, QStyle, QStyledItemDelegate, QAbstractItemView, QItemSelectionModel, - QStyleOptionViewItem, Qt, QVBoxLayout, QWidget, pyqtSignal, QTextDocument + QAbstractItemView, QAbstractListModel, QApplication, QComboBox, QDialog, + QDialogButtonBox, QFont, QGridLayout, QGroupBox, QIcon, QItemSelectionModel, + QLabel, QListView, QMenu, QModelIndex, QPlainTextEdit, QPushButton, QSizePolicy, + QSplitter, Qt, QVBoxLayout, QWidget, pyqtSignal ) from calibre import isbytestring @@ -62,22 +60,6 @@ class AdaptSQP(SearchQueryParser): pass -class Delegate(QStyledItemDelegate): # {{{ - - def __init__(self, view): - QStyledItemDelegate.__init__(self, view) - self.view = view - - def paint(self, p, opt, idx): - copy = QStyleOptionViewItem(opt) - copy.showDecorationSelected = True - if self.view.currentIndex() == idx: - copy.state |= QStyle.StateFlag.State_HasFocus - QStyledItemDelegate.paint(self, p, copy, idx) - -# }}} - - class Tweak: # {{{ def __init__(self, name, doc, var_names, defaults, custom): @@ -140,11 +122,6 @@ class Tweak: # {{{ # }}} -# This is the width of the tweaks list view. Add the vertical scrollbar and -# the margins to it. -tweaks_list_minimum_width = 280 - - class Tweaks(QAbstractListModel, AdaptSQP): # {{{ def __init__(self, parent=None): @@ -162,17 +139,7 @@ class Tweaks(QAbstractListModel, AdaptSQP): # {{{ except: return None if role == Qt.ItemDataRole.DisplayRole: - # Compute the display length of the string then word wrap it so it - # fits in minimum_width. This seems much harder than it should be. - d = QTextDocument() - d.setDocumentMargin(0) - if tweak.is_customized: - d.setHtml('' + tweak.name + '