From d416b6440c777e6701af1bc9b0e68decd678724d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 19 Dec 2020 12:26:45 +0530 Subject: [PATCH] More stupid PyQt enums --- src/calibre/gui2/dialogs/scheduler.py | 4 ++-- src/calibre/gui2/tag_browser/view.py | 4 ++-- src/calibre/gui2/wizard/send_email.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/calibre/gui2/dialogs/scheduler.py b/src/calibre/gui2/dialogs/scheduler.py index 318ec6af30..45bbaa50eb 100644 --- a/src/calibre/gui2/dialogs/scheduler.py +++ b/src/calibre/gui2/dialogs/scheduler.py @@ -370,8 +370,8 @@ class SchedulerDialog(QDialog): return QSize(800, 600) def set_pw_echo_mode(self, state): - self.password.setEchoMode(self.password.Normal - if state == Qt.CheckState.Checked else self.password.Password) + self.password.setEchoMode(QLineEdit.EchoMode.Normal + if state == Qt.CheckState.Checked else QLineEdit.EchoMode.Password) def schedule_type_selected(self, *args): for i, st in enumerate(self.SCHEDULE_TYPES): diff --git a/src/calibre/gui2/tag_browser/view.py b/src/calibre/gui2/tag_browser/view.py index cea2fefaf0..59a84a7b59 100644 --- a/src/calibre/gui2/tag_browser/view.py +++ b/src/calibre/gui2/tag_browser/view.py @@ -55,13 +55,13 @@ class TagDelegate(QStyledItemDelegate): # {{{ painter.fillRect(r, bg) style.proxy().drawPrimitive(style.PE_PanelItemViewItem, option, painter, widget) painter.setOpacity(0.3) - icon.paint(painter, r, option.decorationAlignment, icon.Normal, icon.On) + icon.paint(painter, r, option.decorationAlignment, QIcon.Mode.Normal, QIcon.Mode.On) painter.restore() def draw_icon(self, style, painter, option, widget): r = style.subElementRect(style.SE_ItemViewItemDecoration, option, widget) icon = option.icon - icon.paint(painter, r, option.decorationAlignment, icon.Normal, icon.On) + icon.paint(painter, r, option.decorationAlignment, QIcon.Mode.Normal, QIcon.Mode.On) def paint_text(self, painter, rect, flags, text, hover): set_color = hover and QApplication.instance().is_dark_theme diff --git a/src/calibre/gui2/wizard/send_email.py b/src/calibre/gui2/wizard/send_email.py index fcfc1ebbb7..c73c192c20 100644 --- a/src/calibre/gui2/wizard/send_email.py +++ b/src/calibre/gui2/wizard/send_email.py @@ -117,9 +117,9 @@ class RelaySetup(QDialog): self.ptoggle = QCheckBox(_('&Show password'), self) l.addWidget(self.ptoggle, r, 2) self.ptoggle.stateChanged.connect( - lambda s: self.password.setEchoMode(self.password.Normal if s == Qt.CheckState.Checked else self.password.Password)) + lambda s: self.password.setEchoMode(QLineEdit.EchoMode.Normal if s == Qt.CheckState.Checked else QLineEdit.EchoMode.Password)) self.username.setText(service['username']) - self.password.setEchoMode(self.password.Password) + self.password.setEchoMode(QLineEdit.EchoMode.Password) self.bl = QLabel('

' + _( 'If you plan to use email to send books to your Kindle, remember to' ' add your %s email address to the allowed email addresses in your '