mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
More stupid PyQt enums
This commit is contained in:
parent
7ccde5ff0f
commit
865a064dd3
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
from PyQt5.Qt import (
|
from PyQt5.Qt import (
|
||||||
QWidget, QVBoxLayout, QHBoxLayout, QLabel, QComboBox, QLineEdit,
|
QWidget, QVBoxLayout, QHBoxLayout, QLabel, QComboBox, QLineEdit,
|
||||||
QPushButton, QSize, pyqtSignal, QMenu
|
QPushButton, QSize, pyqtSignal, QMenu, QDialogButtonBox
|
||||||
)
|
)
|
||||||
|
|
||||||
from calibre.ebooks.css_transform_rules import (
|
from calibre.ebooks.css_transform_rules import (
|
||||||
@ -204,7 +204,7 @@ class Tester(Dialog): # {{{
|
|||||||
def setup_ui(self):
|
def setup_ui(self):
|
||||||
from calibre.gui2.tweak_book.editor.text import TextEdit
|
from calibre.gui2.tweak_book.editor.text import TextEdit
|
||||||
self.l = l = QVBoxLayout(self)
|
self.l = l = QVBoxLayout(self)
|
||||||
self.bb.setStandardButtons(self.bb.Close)
|
self.bb.setStandardButtons(QDialogButtonBox.StandardButton.Close)
|
||||||
self.la = la = QLabel(self.LABEL)
|
self.la = la = QLabel(self.LABEL)
|
||||||
l.addWidget(la)
|
l.addWidget(la)
|
||||||
self.css = t = TextEdit(self)
|
self.css = t = TextEdit(self)
|
||||||
|
@ -464,7 +464,7 @@ class DetailView(Dialog): # {{{
|
|||||||
w.setReadOnly(True), w.setLineWrapMode(w.NoWrap)
|
w.setReadOnly(True), w.setLineWrapMode(w.NoWrap)
|
||||||
l.addWidget(w)
|
l.addWidget(w)
|
||||||
l.addWidget(self.bb)
|
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)
|
self.copy_button = b = self.bb.addButton(_('&Copy to clipboard'), QDialogButtonBox.ButtonRole.ActionRole)
|
||||||
b.setIcon(QIcon(I('edit-copy.png')))
|
b.setIcon(QIcon(I('edit-copy.png')))
|
||||||
b.clicked.connect(self.copy_to_clipboard)
|
b.clicked.connect(self.copy_to_clipboard)
|
||||||
|
@ -400,7 +400,7 @@ class EditPrograms(Dialog): # {{{
|
|||||||
pl.setIconSize(QSize(48, 48)), pl.setSpacing(5)
|
pl.setIconSize(QSize(48, 48)), pl.setSpacing(5)
|
||||||
l.addWidget(pl)
|
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)
|
self.rb = b = self.bb.addButton(_('&Remove'), QDialogButtonBox.ButtonRole.ActionRole)
|
||||||
b.clicked.connect(self.remove), b.setIcon(QIcon(I('list_remove.png')))
|
b.clicked.connect(self.remove), b.setIcon(QIcon(I('list_remove.png')))
|
||||||
self.cb = b = self.bb.addButton(_('Change &icon'), QDialogButtonBox.ButtonRole.ActionRole)
|
self.cb = b = self.bb.addButton(_('Change &icon'), QDialogButtonBox.ButtonRole.ActionRole)
|
||||||
|
@ -398,7 +398,7 @@ class Tester(Dialog):
|
|||||||
|
|
||||||
def setup_ui(self):
|
def setup_ui(self):
|
||||||
self.l = l = QVBoxLayout(self)
|
self.l = l = QVBoxLayout(self)
|
||||||
self.bb.setStandardButtons(self.bb.Close)
|
self.bb.setStandardButtons(QDialogButtonBox.StandardButton.Close)
|
||||||
self.la = la = QLabel(self.LABEL)
|
self.la = la = QLabel(self.LABEL)
|
||||||
l.addWidget(la)
|
l.addWidget(la)
|
||||||
self.tags = t = QLineEdit(self)
|
self.tags = t = QLineEdit(self)
|
||||||
|
@ -703,7 +703,7 @@ class CharSelect(Dialog):
|
|||||||
self.l = l = QGridLayout(self)
|
self.l = l = QGridLayout(self)
|
||||||
self.setLayout(l)
|
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)
|
self.rearrange_button = b = self.bb.addButton(_('Re-arrange favorites'), QDialogButtonBox.ButtonRole.ActionRole)
|
||||||
b.setCheckable(True)
|
b.setCheckable(True)
|
||||||
b.setChecked(False)
|
b.setChecked(False)
|
||||||
|
@ -83,7 +83,7 @@ class CheckExternalLinks(Dialog):
|
|||||||
ca.stateChanged.connect(self.anchors_changed)
|
ca.stateChanged.connect(self.anchors_changed)
|
||||||
h.addWidget(ca), h.addStretch(100), h.addWidget(self.bb)
|
h.addWidget(ca), h.addStretch(100), h.addWidget(self.bb)
|
||||||
l.addLayout(h)
|
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)
|
self.rb = b = self.bb.addButton(_('&Refresh'), QDialogButtonBox.ButtonRole.ActionRole)
|
||||||
b.setIcon(QIcon(I('view-refresh.png')))
|
b.setIcon(QIcon(I('view-refresh.png')))
|
||||||
b.clicked.connect(self.refresh)
|
b.clicked.connect(self.refresh)
|
||||||
|
@ -297,7 +297,7 @@ class Diff(Dialog):
|
|||||||
self.names = QLabel('')
|
self.names = QLabel('')
|
||||||
self.hl.addWidget(self.names, r)
|
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:
|
if self.revert_button_msg is not None:
|
||||||
self.rvb = b = self.bb.addButton(self.revert_button_msg, QDialogButtonBox.ButtonRole.ActionRole)
|
self.rvb = b = self.bb.addButton(self.revert_button_msg, QDialogButtonBox.ButtonRole.ActionRole)
|
||||||
b.setIcon(QIcon(I('edit-undo.png'))), b.setAutoDefault(False)
|
b.setIcon(QIcon(I('edit-undo.png'))), b.setAutoDefault(False)
|
||||||
|
@ -116,7 +116,7 @@ class DebugOutput(Dialog):
|
|||||||
self.log_text = ''
|
self.log_text = ''
|
||||||
l.addWidget(t)
|
l.addWidget(t)
|
||||||
l.addWidget(self.bb)
|
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)
|
self.cb = b = self.bb.addButton(_('&Copy to clipboard'), QDialogButtonBox.ButtonRole.ActionRole)
|
||||||
b.clicked.connect(self.copy_to_clipboard)
|
b.clicked.connect(self.copy_to_clipboard)
|
||||||
b.setIcon(QIcon(I('edit-copy.png')))
|
b.setIcon(QIcon(I('edit-copy.png')))
|
||||||
|
@ -76,7 +76,7 @@ class EmbeddingData(Dialog):
|
|||||||
self.text = t = QTextEdit(self)
|
self.text = t = QTextEdit(self)
|
||||||
t.setReadOnly(True)
|
t.setReadOnly(True)
|
||||||
l.addWidget(t), l.addWidget(self.bb)
|
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):
|
def populate_text(self):
|
||||||
text = ['<h2>' + self.windowTitle() + '</h2><ul>']
|
text = ['<h2>' + self.windowTitle() + '</h2><ul>']
|
||||||
|
@ -1395,7 +1395,7 @@ class Reports(Dialog):
|
|||||||
la.setStyleSheet('QLabel { font-size: 30pt; font-weight: bold }')
|
la.setStyleSheet('QLabel { font-size: 30pt; font-weight: bold }')
|
||||||
l.addWidget(la, alignment=Qt.AlignmentFlag.AlignHCenter), l.addStretch(1)
|
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)
|
self.refresh_button = b = self.bb.addButton(_('&Refresh'), QDialogButtonBox.ButtonRole.ActionRole)
|
||||||
b.clicked.connect(self.refresh)
|
b.clicked.connect(self.refresh)
|
||||||
b.setIcon(QIcon(I('view-refresh.png')))
|
b.setIcon(QIcon(I('view-refresh.png')))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user