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
2b69620c51
commit
dc10461cba
@ -17,7 +17,7 @@ from PyQt5.Qt import (
|
||||
QHBoxLayout, QIcon, QKeySequence, QLabel, QLineEdit, QMenu, QPalette,
|
||||
QPlainTextEdit, QPushButton, QSize, QSyntaxHighlighter, Qt, QTabWidget,
|
||||
QTextBlockFormat, QTextCharFormat, QTextCursor, QTextEdit, QTextListFormat,
|
||||
QToolBar, QUrl, QVBoxLayout, QWidget, pyqtSignal, pyqtSlot
|
||||
QToolBar, QUrl, QVBoxLayout, QWidget, pyqtSignal, pyqtSlot, QToolButton
|
||||
)
|
||||
|
||||
from calibre import xml_replace_entities
|
||||
@ -1126,7 +1126,7 @@ class Editor(QWidget): # {{{
|
||||
self.toolbar2.addAction(self.editor.action_block_style)
|
||||
w = self.toolbar2.widgetForAction(self.editor.action_block_style)
|
||||
if hasattr(w, 'setPopupMode'):
|
||||
w.setPopupMode(w.InstantPopup)
|
||||
w.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup)
|
||||
self.toolbar2.addAction(self.editor.action_insert_link)
|
||||
self.toolbar2.addAction(self.editor.action_insert_hr)
|
||||
# }}}
|
||||
|
@ -634,7 +634,7 @@ class LayoutMixin(object): # {{{
|
||||
else:
|
||||
self.layout_button = b = QToolButton(self)
|
||||
b.setAutoRaise(True), b.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||
b.setPopupMode(b.InstantPopup)
|
||||
b.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup)
|
||||
b.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
|
||||
b.setText(_('Layout')), b.setIcon(QIcon(I('config.png')))
|
||||
b.setMenu(LayoutMenu(self))
|
||||
|
@ -198,7 +198,7 @@ class SearchBar(QFrame): # {{{
|
||||
|
||||
x = parent.virtual_library = QToolButton(self)
|
||||
x.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||
x.setPopupMode(x.InstantPopup)
|
||||
x.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup)
|
||||
x.setText(_('Virtual library'))
|
||||
x.setAutoRaise(True)
|
||||
x.setIcon(QIcon(I('vl.png')))
|
||||
@ -304,7 +304,7 @@ class SearchBar(QFrame): # {{{
|
||||
x.setText(_('Saved search'))
|
||||
x.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
|
||||
x.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||
x.setPopupMode(x.InstantPopup)
|
||||
x.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup)
|
||||
x.setAutoRaise(True)
|
||||
x.setIcon(QIcon(I("bookmarks.png")))
|
||||
l.addWidget(x)
|
||||
|
@ -699,7 +699,7 @@ class GridView(QListView):
|
||||
setup_dnd_interface(self)
|
||||
self.setUniformItemSizes(True)
|
||||
self.setWrapping(True)
|
||||
self.setFlow(self.LeftToRight)
|
||||
self.setFlow(Qt.LayoutDirection.LeftToRight)
|
||||
# We cannot set layout mode to batched, because that breaks
|
||||
# restore_vpos()
|
||||
# self.setLayoutMode(self.Batched)
|
||||
|
@ -80,7 +80,7 @@ class ConfigWidget(QWidget):
|
||||
g.setContentsMargins(0, 0, 0, 0)
|
||||
self.fields_view = v = FieldsList(self)
|
||||
g.addWidget(v)
|
||||
v.setFlow(v.LeftToRight)
|
||||
v.setFlow(Qt.LayoutDirection.LeftToRight)
|
||||
v.setWrapping(True)
|
||||
v.setResizeMode(v.Adjust)
|
||||
self.fields_model = FieldsModel(self.plugin)
|
||||
|
@ -769,7 +769,7 @@ class CoversView(QListView): # {{{
|
||||
self.m = CoversModel(current_cover, self)
|
||||
self.setModel(self.m)
|
||||
|
||||
self.setFlow(self.LeftToRight)
|
||||
self.setFlow(Qt.LayoutDirection.LeftToRight)
|
||||
self.setWrapping(True)
|
||||
self.setResizeMode(self.Adjust)
|
||||
self.setGridSize(QSize(190, 260))
|
||||
|
@ -47,7 +47,7 @@ class TextureChooser(QDialog):
|
||||
il.itemDoubleClicked.connect(self.accept, type=Qt.ConnectionType.QueuedConnection)
|
||||
il.setIconSize(QSize(256, 256))
|
||||
il.setViewMode(il.IconMode)
|
||||
il.setFlow(il.LeftToRight)
|
||||
il.setFlow(Qt.LayoutDirection.LeftToRight)
|
||||
il.setSpacing(20)
|
||||
il.setSelectionMode(QAbstractItemView.SelectionMode.SingleSelection)
|
||||
il.itemSelectionChanged.connect(self.update_remove_state)
|
||||
|
@ -468,7 +468,7 @@ class TagBrowserBar(QWidget): # {{{
|
||||
b.setAutoRaise(True)
|
||||
b.setText(_('Configure')), b.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
|
||||
b.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||
b.setPopupMode(b.InstantPopup)
|
||||
b.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup)
|
||||
b.setToolTip(textwrap.fill(_(
|
||||
'Change how the Tag browser works, such as,'
|
||||
' how it is sorted, what happens when you click'
|
||||
|
@ -591,7 +591,7 @@ class CharView(QListView):
|
||||
self.delegate = CharDelegate(self)
|
||||
self.setResizeMode(self.Adjust)
|
||||
self.setItemDelegate(self.delegate)
|
||||
self.setFlow(self.LeftToRight)
|
||||
self.setFlow(Qt.LayoutDirection.LeftToRight)
|
||||
self.setWrapping(True)
|
||||
self.setMouseTracking(True)
|
||||
self.setSpacing(2)
|
||||
|
@ -280,7 +280,7 @@ class Diff(Dialog):
|
||||
b.setIcon(QIcon(I('config.png')))
|
||||
b.setText(_('&Options')), b.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
|
||||
b.setToolTip(_('Change how the differences are displayed'))
|
||||
b.setPopupMode(b.InstantPopup)
|
||||
b.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup)
|
||||
m = QMenu(b)
|
||||
b.setMenu(m)
|
||||
cm = self.cm = QMenu(_('Lines of context around each change'))
|
||||
|
@ -215,7 +215,7 @@ class InsertImage(Dialog):
|
||||
|
||||
self.view = v = QListView(self)
|
||||
v.setViewMode(v.IconMode)
|
||||
v.setFlow(v.LeftToRight)
|
||||
v.setFlow(Qt.LayoutDirection.LeftToRight)
|
||||
v.setSpacing(4)
|
||||
v.setResizeMode(v.Adjust)
|
||||
v.setUniformItemSizes(True)
|
||||
|
@ -486,7 +486,7 @@ class EditSnippet(QWidget):
|
||||
add_row(_('&Template:'), t)
|
||||
|
||||
self.types = t = QListWidget(self)
|
||||
t.setFlow(t.LeftToRight)
|
||||
t.setFlow(Qt.LayoutDirection.LeftToRight)
|
||||
t.setWrapping(True), t.setResizeMode(t.Adjust), t.setSpacing(5)
|
||||
fm = t.fontMetrics()
|
||||
t.setMaximumHeight(2*(fm.ascent() + fm.descent()) + 25)
|
||||
|
@ -206,7 +206,7 @@ class ActionsToolBar(ToolBar):
|
||||
pass
|
||||
w = self.widgetForAction(self.color_scheme_action)
|
||||
if w:
|
||||
w.setPopupMode(w.InstantPopup)
|
||||
w.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup)
|
||||
|
||||
def update_mode_action(self):
|
||||
mode = get_session_pref('read_mode', default='paged', group=None)
|
||||
|
Loading…
x
Reference in New Issue
Block a user