More stupid PyQt enums

This commit is contained in:
Kovid Goyal 2020-12-19 10:36:33 +05:30
parent 7ccde5ff0f
commit 865a064dd3
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
10 changed files with 11 additions and 11 deletions

View File

@ -5,7 +5,7 @@
from PyQt5.Qt import (
QWidget, QVBoxLayout, QHBoxLayout, QLabel, QComboBox, QLineEdit,
QPushButton, QSize, pyqtSignal, QMenu
QPushButton, QSize, pyqtSignal, QMenu, QDialogButtonBox
)
from calibre.ebooks.css_transform_rules import (
@ -204,7 +204,7 @@ class Tester(Dialog): # {{{
def setup_ui(self):
from calibre.gui2.tweak_book.editor.text import TextEdit
self.l = l = QVBoxLayout(self)
self.bb.setStandardButtons(self.bb.Close)
self.bb.setStandardButtons(QDialogButtonBox.StandardButton.Close)
self.la = la = QLabel(self.LABEL)
l.addWidget(la)
self.css = t = TextEdit(self)

View File

@ -464,7 +464,7 @@ class DetailView(Dialog): # {{{
w.setReadOnly(True), w.setLineWrapMode(w.NoWrap)
l.addWidget(w)
l.addWidget(self.bb)
self.bb.clear(), self.bb.setStandardButtons(self.bb.Close)
self.bb.clear(), self.bb.setStandardButtons(QDialogButtonBox.StandardButton.Close)
self.copy_button = b = self.bb.addButton(_('&Copy to clipboard'), QDialogButtonBox.ButtonRole.ActionRole)
b.setIcon(QIcon(I('edit-copy.png')))
b.clicked.connect(self.copy_to_clipboard)

View File

@ -400,7 +400,7 @@ class EditPrograms(Dialog): # {{{
pl.setIconSize(QSize(48, 48)), pl.setSpacing(5)
l.addWidget(pl)
self.bb.clear(), self.bb.setStandardButtons(self.bb.Close)
self.bb.clear(), self.bb.setStandardButtons(QDialogButtonBox.StandardButton.Close)
self.rb = b = self.bb.addButton(_('&Remove'), QDialogButtonBox.ButtonRole.ActionRole)
b.clicked.connect(self.remove), b.setIcon(QIcon(I('list_remove.png')))
self.cb = b = self.bb.addButton(_('Change &icon'), QDialogButtonBox.ButtonRole.ActionRole)

View File

@ -398,7 +398,7 @@ class Tester(Dialog):
def setup_ui(self):
self.l = l = QVBoxLayout(self)
self.bb.setStandardButtons(self.bb.Close)
self.bb.setStandardButtons(QDialogButtonBox.StandardButton.Close)
self.la = la = QLabel(self.LABEL)
l.addWidget(la)
self.tags = t = QLineEdit(self)

View File

@ -703,7 +703,7 @@ class CharSelect(Dialog):
self.l = l = QGridLayout(self)
self.setLayout(l)
self.bb.setStandardButtons(self.bb.Close)
self.bb.setStandardButtons(QDialogButtonBox.StandardButton.Close)
self.rearrange_button = b = self.bb.addButton(_('Re-arrange favorites'), QDialogButtonBox.ButtonRole.ActionRole)
b.setCheckable(True)
b.setChecked(False)

View File

@ -83,7 +83,7 @@ class CheckExternalLinks(Dialog):
ca.stateChanged.connect(self.anchors_changed)
h.addWidget(ca), h.addStretch(100), h.addWidget(self.bb)
l.addLayout(h)
self.bb.setStandardButtons(self.bb.Close)
self.bb.setStandardButtons(QDialogButtonBox.StandardButton.Close)
self.rb = b = self.bb.addButton(_('&Refresh'), QDialogButtonBox.ButtonRole.ActionRole)
b.setIcon(QIcon(I('view-refresh.png')))
b.clicked.connect(self.refresh)

View File

@ -297,7 +297,7 @@ class Diff(Dialog):
self.names = QLabel('')
self.hl.addWidget(self.names, r)
self.bb.setStandardButtons(self.bb.Close)
self.bb.setStandardButtons(QDialogButtonBox.StandardButton.Close)
if self.revert_button_msg is not None:
self.rvb = b = self.bb.addButton(self.revert_button_msg, QDialogButtonBox.ButtonRole.ActionRole)
b.setIcon(QIcon(I('edit-undo.png'))), b.setAutoDefault(False)

View File

@ -116,7 +116,7 @@ class DebugOutput(Dialog):
self.log_text = ''
l.addWidget(t)
l.addWidget(self.bb)
self.bb.setStandardButtons(self.bb.Close)
self.bb.setStandardButtons(QDialogButtonBox.StandardButton.Close)
self.cb = b = self.bb.addButton(_('&Copy to clipboard'), QDialogButtonBox.ButtonRole.ActionRole)
b.clicked.connect(self.copy_to_clipboard)
b.setIcon(QIcon(I('edit-copy.png')))

View File

@ -76,7 +76,7 @@ class EmbeddingData(Dialog):
self.text = t = QTextEdit(self)
t.setReadOnly(True)
l.addWidget(t), l.addWidget(self.bb)
self.bb.clear(), self.bb.setStandardButtons(self.bb.Close)
self.bb.clear(), self.bb.setStandardButtons(QDialogButtonBox.StandardButton.Close)
def populate_text(self):
text = ['<h2>' + self.windowTitle() + '</h2><ul>']

View File

@ -1395,7 +1395,7 @@ class Reports(Dialog):
la.setStyleSheet('QLabel { font-size: 30pt; font-weight: bold }')
l.addWidget(la, alignment=Qt.AlignmentFlag.AlignHCenter), l.addStretch(1)
self.bb.setStandardButtons(self.bb.Close)
self.bb.setStandardButtons(QDialogButtonBox.StandardButton.Close)
self.refresh_button = b = self.bb.addButton(_('&Refresh'), QDialogButtonBox.ButtonRole.ActionRole)
b.clicked.connect(self.refresh)
b.setIcon(QIcon(I('view-refresh.png')))