mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
More stupid PyQt enums
This commit is contained in:
parent
17e875a326
commit
f80f13c607
@ -504,7 +504,7 @@ class Text(Base):
|
|||||||
else:
|
else:
|
||||||
w = EditWithComplete(parent)
|
w = EditWithComplete(parent)
|
||||||
w.set_separator(None)
|
w.set_separator(None)
|
||||||
w.setSizeAdjustPolicy(w.AdjustToMinimumContentsLengthWithIcon)
|
w.setSizeAdjustPolicy(QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
|
||||||
w.setMinimumContentsLength(25)
|
w.setMinimumContentsLength(25)
|
||||||
self.set_to_undefined = w.clearEditText
|
self.set_to_undefined = w.clearEditText
|
||||||
self.widgets = [QLabel(label_string(self.col_metadata['name']), parent)]
|
self.widgets = [QLabel(label_string(self.col_metadata['name']), parent)]
|
||||||
@ -578,7 +578,7 @@ class Series(Base):
|
|||||||
def setup_ui(self, parent):
|
def setup_ui(self, parent):
|
||||||
w = EditWithComplete(parent)
|
w = EditWithComplete(parent)
|
||||||
w.set_separator(None)
|
w.set_separator(None)
|
||||||
w.setSizeAdjustPolicy(w.AdjustToMinimumContentsLengthWithIcon)
|
w.setSizeAdjustPolicy(QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
|
||||||
w.setMinimumContentsLength(25)
|
w.setMinimumContentsLength(25)
|
||||||
self.name_widget = w
|
self.name_widget = w
|
||||||
self.widgets = [QLabel(label_string(self.col_metadata['name']), parent)]
|
self.widgets = [QLabel(label_string(self.col_metadata['name']), parent)]
|
||||||
@ -1156,7 +1156,7 @@ class BulkSeries(BulkBase):
|
|||||||
self.make_widgets(parent, EditWithComplete)
|
self.make_widgets(parent, EditWithComplete)
|
||||||
values = self.all_values = list(self.db.all_custom(num=self.col_id))
|
values = self.all_values = list(self.db.all_custom(num=self.col_id))
|
||||||
values.sort(key=sort_key)
|
values.sort(key=sort_key)
|
||||||
self.main_widget.setSizeAdjustPolicy(self.main_widget.AdjustToMinimumContentsLengthWithIcon)
|
self.main_widget.setSizeAdjustPolicy(QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
|
||||||
self.main_widget.setMinimumContentsLength(25)
|
self.main_widget.setMinimumContentsLength(25)
|
||||||
self.widgets.append(QLabel('', parent))
|
self.widgets.append(QLabel('', parent))
|
||||||
w = QWidget(parent)
|
w = QWidget(parent)
|
||||||
@ -1401,7 +1401,7 @@ class BulkText(BulkBase):
|
|||||||
self.make_widgets(parent, EditWithComplete)
|
self.make_widgets(parent, EditWithComplete)
|
||||||
self.main_widget.set_separator(None)
|
self.main_widget.set_separator(None)
|
||||||
self.main_widget.setSizeAdjustPolicy(
|
self.main_widget.setSizeAdjustPolicy(
|
||||||
self.main_widget.AdjustToMinimumContentsLengthWithIcon)
|
QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
|
||||||
self.main_widget.setMinimumContentsLength(25)
|
self.main_widget.setMinimumContentsLength(25)
|
||||||
self.ignore_change_signals = False
|
self.ignore_change_signals = False
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
|
@ -40,7 +40,7 @@ class AddEmptyBookDialog(QDialog):
|
|||||||
|
|
||||||
self.authors_combo = EditWithComplete(self)
|
self.authors_combo = EditWithComplete(self)
|
||||||
self.authors_combo.setSizeAdjustPolicy(
|
self.authors_combo.setSizeAdjustPolicy(
|
||||||
self.authors_combo.AdjustToMinimumContentsLengthWithIcon)
|
QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
|
||||||
self.authors_combo.setEditable(True)
|
self.authors_combo.setEditable(True)
|
||||||
self._layout.addWidget(self.authors_combo, 3, 0, 1, 1)
|
self._layout.addWidget(self.authors_combo, 3, 0, 1, 1)
|
||||||
self.initialize_authors(db, author)
|
self.initialize_authors(db, author)
|
||||||
@ -56,7 +56,7 @@ class AddEmptyBookDialog(QDialog):
|
|||||||
|
|
||||||
self.series_combo = EditWithComplete(self)
|
self.series_combo = EditWithComplete(self)
|
||||||
self.series_combo.setSizeAdjustPolicy(
|
self.series_combo.setSizeAdjustPolicy(
|
||||||
self.authors_combo.AdjustToMinimumContentsLengthWithIcon)
|
QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
|
||||||
self.series_combo.setEditable(True)
|
self.series_combo.setEditable(True)
|
||||||
self._layout.addWidget(self.series_combo, 5, 0, 1, 1)
|
self._layout.addWidget(self.series_combo, 5, 0, 1, 1)
|
||||||
self.initialize_series(db, series)
|
self.initialize_series(db, series)
|
||||||
|
@ -9,7 +9,7 @@ from io import BytesIO
|
|||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
|
||||||
from PyQt5.Qt import (
|
from PyQt5.Qt import (
|
||||||
QCompleter, QCoreApplication, QDateTime, QDialog, QDialogButtonBox, QFont, QProgressBar,
|
QCompleter, QCoreApplication, QDateTime, QDialog, QDialogButtonBox, QFont, QProgressBar, QComboBox,
|
||||||
QGridLayout, QInputDialog, QLabel, QLineEdit, QSize, Qt, QVBoxLayout, pyqtSignal, QApplication
|
QGridLayout, QInputDialog, QLabel, QLineEdit, QSize, Qt, QVBoxLayout, pyqtSignal, QApplication
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1087,7 +1087,7 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog):
|
|||||||
self.initialize_publisher()
|
self.initialize_publisher()
|
||||||
for x in ('authors', 'publisher', 'series'):
|
for x in ('authors', 'publisher', 'series'):
|
||||||
x = getattr(self, x)
|
x = getattr(self, x)
|
||||||
x.setSizeAdjustPolicy(x.AdjustToMinimumContentsLengthWithIcon)
|
x.setSizeAdjustPolicy(QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
|
||||||
x.setMinimumContentsLength(25)
|
x.setMinimumContentsLength(25)
|
||||||
|
|
||||||
def initalize_authors(self):
|
def initalize_authors(self):
|
||||||
|
@ -6,6 +6,7 @@ __license__ = 'GPL v3'
|
|||||||
__copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>'
|
__copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||||
__docformat__ = 'restructuredtext en'
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
|
from PyQt5.Qt import QComboBox
|
||||||
from calibre.gui2 import gui_prefs
|
from calibre.gui2 import gui_prefs
|
||||||
from calibre.gui2.complete2 import EditWithComplete
|
from calibre.gui2.complete2 import EditWithComplete
|
||||||
from calibre.utils.localization import lang_map_for_ui
|
from calibre.utils.localization import lang_map_for_ui
|
||||||
@ -20,7 +21,7 @@ class LanguagesEdit(EditWithComplete):
|
|||||||
self.refresh_recently_used()
|
self.refresh_recently_used()
|
||||||
EditWithComplete.__init__(self, parent, sort_func=self.sort_language_items_key)
|
EditWithComplete.__init__(self, parent, sort_func=self.sort_language_items_key)
|
||||||
|
|
||||||
self.setSizeAdjustPolicy(self.AdjustToMinimumContentsLengthWithIcon)
|
self.setSizeAdjustPolicy(QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
|
||||||
self.setMinimumContentsLength(20)
|
self.setMinimumContentsLength(20)
|
||||||
self._lang_map = lang_map_for_ui()
|
self._lang_map = lang_map_for_ui()
|
||||||
self.names_with_commas = [x for x in itervalues(self._lang_map) if ',' in x]
|
self.names_with_commas = [x for x in itervalues(self._lang_map) if ',' in x]
|
||||||
|
@ -15,7 +15,7 @@ from datetime import date, datetime
|
|||||||
from PyQt5.Qt import (
|
from PyQt5.Qt import (
|
||||||
QAction, QApplication, QDateTime, QDialog, QDialogButtonBox, QDoubleSpinBox,
|
QAction, QApplication, QDateTime, QDialog, QDialogButtonBox, QDoubleSpinBox,
|
||||||
QGridLayout, QIcon, QKeySequence, QLabel, QLineEdit, QListWidgetItem, QMenu,
|
QGridLayout, QIcon, QKeySequence, QLabel, QLineEdit, QListWidgetItem, QMenu,
|
||||||
QMessageBox, QPixmap, QPlainTextEdit, QSize, QSizePolicy, Qt, QToolButton,
|
QMessageBox, QPixmap, QPlainTextEdit, QSize, QSizePolicy, Qt, QToolButton, QComboBox,
|
||||||
QUndoCommand, QUndoStack, QUrl, QVBoxLayout, QWidget, pyqtSignal
|
QUndoCommand, QUndoStack, QUrl, QVBoxLayout, QWidget, pyqtSignal
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -344,7 +344,7 @@ class AuthorsEdit(EditWithComplete, ToMetadataMixin):
|
|||||||
self.setToolTip(self.TOOLTIP)
|
self.setToolTip(self.TOOLTIP)
|
||||||
self.setWhatsThis(self.TOOLTIP)
|
self.setWhatsThis(self.TOOLTIP)
|
||||||
self.setEditable(True)
|
self.setEditable(True)
|
||||||
self.setSizeAdjustPolicy(self.AdjustToMinimumContentsLengthWithIcon)
|
self.setSizeAdjustPolicy(QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
|
||||||
self.manage_authors_signal = manage_authors
|
self.manage_authors_signal = manage_authors
|
||||||
manage_authors.triggered.connect(self.manage_authors)
|
manage_authors.triggered.connect(self.manage_authors)
|
||||||
self.lineEdit().createStandardContextMenu = self.createStandardContextMenu
|
self.lineEdit().createStandardContextMenu = self.createStandardContextMenu
|
||||||
@ -601,7 +601,7 @@ class SeriesEdit(EditWithComplete, ToMetadataMixin):
|
|||||||
self.set_separator(None)
|
self.set_separator(None)
|
||||||
self.dialog = parent
|
self.dialog = parent
|
||||||
self.setSizeAdjustPolicy(
|
self.setSizeAdjustPolicy(
|
||||||
self.AdjustToMinimumContentsLengthWithIcon)
|
QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
|
||||||
self.setToolTip(self.TOOLTIP)
|
self.setToolTip(self.TOOLTIP)
|
||||||
self.setWhatsThis(self.TOOLTIP)
|
self.setWhatsThis(self.TOOLTIP)
|
||||||
self.setEditable(True)
|
self.setEditable(True)
|
||||||
@ -1770,7 +1770,7 @@ class PublisherEdit(EditWithComplete, ToMetadataMixin): # {{{
|
|||||||
self.currentTextChanged.connect(self.data_changed)
|
self.currentTextChanged.connect(self.data_changed)
|
||||||
self.set_separator(None)
|
self.set_separator(None)
|
||||||
self.setSizeAdjustPolicy(
|
self.setSizeAdjustPolicy(
|
||||||
self.AdjustToMinimumContentsLengthWithIcon)
|
QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
|
||||||
self.books_to_refresh = set()
|
self.books_to_refresh = set()
|
||||||
self.clear_button = QToolButton(parent)
|
self.clear_button = QToolButton(parent)
|
||||||
self.clear_button.setIcon(QIcon(I('trash.png')))
|
self.clear_button.setIcon(QIcon(I('trash.png')))
|
||||||
|
@ -143,7 +143,7 @@ class ConditionEditor(QWidget): # {{{
|
|||||||
self.action_box.currentIndexChanged.connect(self.init_value_box)
|
self.action_box.currentIndexChanged.connect(self.init_value_box)
|
||||||
|
|
||||||
for b in (self.column_box, self.action_box):
|
for b in (self.column_box, self.action_box):
|
||||||
b.setSizeAdjustPolicy(b.AdjustToMinimumContentsLengthWithIcon)
|
b.setSizeAdjustPolicy(QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
|
||||||
b.setMinimumContentsLength(20)
|
b.setMinimumContentsLength(20)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -358,7 +358,7 @@ class RuleEditor(QDialog): # {{{
|
|||||||
v.setIconSize(QSize(32, 32))
|
v.setIconSize(QSize(32, 32))
|
||||||
self.filename_box.setView(v)
|
self.filename_box.setView(v)
|
||||||
self.orig_filenamebox_view = f.view()
|
self.orig_filenamebox_view = f.view()
|
||||||
f.setMinimumContentsLength(20), f.setSizeAdjustPolicy(f.AdjustToMinimumContentsLengthWithIcon)
|
f.setMinimumContentsLength(20), f.setSizeAdjustPolicy(QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
|
||||||
self.populate_icon_filenames()
|
self.populate_icon_filenames()
|
||||||
|
|
||||||
if self.rule_kind == 'color':
|
if self.rule_kind == 'color':
|
||||||
@ -433,7 +433,7 @@ class RuleEditor(QDialog): # {{{
|
|||||||
|
|
||||||
if self.rule_kind == 'color':
|
if self.rule_kind == 'color':
|
||||||
for b in (self.column_box, ):
|
for b in (self.column_box, ):
|
||||||
b.setSizeAdjustPolicy(b.AdjustToMinimumContentsLengthWithIcon)
|
b.setSizeAdjustPolicy(QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
|
||||||
b.setMinimumContentsLength(15)
|
b.setMinimumContentsLength(15)
|
||||||
|
|
||||||
for key in sorted(displayable_columns(fm),
|
for key in sorted(displayable_columns(fm),
|
||||||
|
@ -10,7 +10,7 @@ from operator import attrgetter
|
|||||||
|
|
||||||
from PyQt5.Qt import (
|
from PyQt5.Qt import (
|
||||||
QAbstractListModel, QApplication, QDialog, QDialogButtonBox, QFont, QGridLayout,
|
QAbstractListModel, QApplication, QDialog, QDialogButtonBox, QFont, QGridLayout,
|
||||||
QGroupBox, QIcon, QLabel, QListView, QMenu, QModelIndex, QPlainTextEdit,
|
QGroupBox, QIcon, QLabel, QListView, QMenu, QModelIndex, QPlainTextEdit, QComboBox,
|
||||||
QPushButton, QSizePolicy, QSplitter, QStyle, QStyledItemDelegate, QAbstractItemView, QItemSelectionModel,
|
QPushButton, QSizePolicy, QSplitter, QStyle, QStyledItemDelegate, QAbstractItemView, QItemSelectionModel,
|
||||||
QStyleOptionViewItem, Qt, QVBoxLayout, QWidget, pyqtSignal
|
QStyleOptionViewItem, Qt, QVBoxLayout, QWidget, pyqtSignal
|
||||||
)
|
)
|
||||||
@ -408,7 +408,7 @@ class ConfigWidget(ConfigWidgetBase):
|
|||||||
|
|
||||||
self.search = sb = SearchBox2(self)
|
self.search = sb = SearchBox2(self)
|
||||||
sb.sizePolicy().setHorizontalStretch(10)
|
sb.sizePolicy().setHorizontalStretch(10)
|
||||||
sb.setSizeAdjustPolicy(sb.AdjustToMinimumContentsLength)
|
sb.setSizeAdjustPolicy(QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLength)
|
||||||
sb.setMinimumContentsLength(10)
|
sb.setMinimumContentsLength(10)
|
||||||
g.addWidget(self.search, 0, 0, 1, 1)
|
g.addWidget(self.search, 0, 0, 1, 1)
|
||||||
self.next_button = b = QPushButton(self)
|
self.next_button = b = QPushButton(self)
|
||||||
|
@ -140,7 +140,7 @@ class SearchBox2(QComboBox): # {{{
|
|||||||
self.timer.timeout.connect(self.timer_event, type=Qt.ConnectionType.QueuedConnection)
|
self.timer.timeout.connect(self.timer_event, type=Qt.ConnectionType.QueuedConnection)
|
||||||
self.setInsertPolicy(self.NoInsert)
|
self.setInsertPolicy(self.NoInsert)
|
||||||
self.setMaxCount(self.MAX_COUNT)
|
self.setMaxCount(self.MAX_COUNT)
|
||||||
self.setSizeAdjustPolicy(self.AdjustToMinimumContentsLengthWithIcon)
|
self.setSizeAdjustPolicy(QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
|
||||||
self.setMinimumContentsLength(25)
|
self.setMinimumContentsLength(25)
|
||||||
self._in_a_search = False
|
self._in_a_search = False
|
||||||
self.tool_tip_text = self.toolTip()
|
self.tool_tip_text = self.toolTip()
|
||||||
@ -343,7 +343,7 @@ class SavedSearchBox(QComboBox): # {{{
|
|||||||
|
|
||||||
self.setEditable(True)
|
self.setEditable(True)
|
||||||
self.setInsertPolicy(self.NoInsert)
|
self.setInsertPolicy(self.NoInsert)
|
||||||
self.setSizeAdjustPolicy(self.AdjustToMinimumContentsLengthWithIcon)
|
self.setSizeAdjustPolicy(QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
|
||||||
self.setMinimumContentsLength(10)
|
self.setMinimumContentsLength(10)
|
||||||
self.tool_tip_text = self.toolTip()
|
self.tool_tip_text = self.toolTip()
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ import textwrap
|
|||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
from PyQt5.Qt import (
|
from PyQt5.Qt import (
|
||||||
Qt, QIcon, QWidget, QHBoxLayout, QVBoxLayout, QToolButton, QLabel, QFrame, QDialog,
|
Qt, QIcon, QWidget, QHBoxLayout, QVBoxLayout, QToolButton, QLabel, QFrame, QDialog, QComboBox,
|
||||||
QTimer, QMenu, QActionGroup, QAction, QSizePolicy, pyqtSignal)
|
QTimer, QMenu, QActionGroup, QAction, QSizePolicy, pyqtSignal)
|
||||||
|
|
||||||
from calibre.gui2 import error_dialog, question_dialog, gprefs
|
from calibre.gui2 import error_dialog, question_dialog, gprefs
|
||||||
@ -480,7 +480,7 @@ class TagBrowserBar(QWidget): # {{{
|
|||||||
|
|
||||||
self.item_search = FindBox(parent)
|
self.item_search = FindBox(parent)
|
||||||
self.item_search.setMinimumContentsLength(5)
|
self.item_search.setMinimumContentsLength(5)
|
||||||
self.item_search.setSizeAdjustPolicy(self.item_search.AdjustToMinimumContentsLengthWithIcon)
|
self.item_search.setSizeAdjustPolicy(QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
|
||||||
self.item_search.initialize('tag_browser_search')
|
self.item_search.initialize('tag_browser_search')
|
||||||
self.item_search.completer().setCaseSensitivity(Qt.CaseSensitivity.CaseSensitive)
|
self.item_search.completer().setCaseSensitivity(Qt.CaseSensitivity.CaseSensitive)
|
||||||
self.item_search.setToolTip(
|
self.item_search.setToolTip(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user