From 59839ae5c7720f48019d72f31c47a043f1c9d58e Mon Sep 17 00:00:00 2001 From: NoDRM Date: Wed, 3 Aug 2022 17:16:42 +0200 Subject: [PATCH] Fix Calibre 6 issue in Obok plugin --- CHANGELOG.md | 3 ++- Obok_plugin/common_utils.py | 8 ++++---- Obok_plugin/utilities.py | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d48de7..feb8a84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -69,4 +69,5 @@ List of changes since the fork of Apprentice Harper's repository: ## Fixes on master (not yet released): -- Fix a bug introduced with #48 that breaks DeDRM'ing on Calibre 4 (fixes #101). \ No newline at end of file +- Fix a bug introduced with #48 that breaks DeDRM'ing on Calibre 4 (fixes #101). +- Fix some more Calibre-6 bugs in the Obok plugin (should fix #114). diff --git a/Obok_plugin/common_utils.py b/Obok_plugin/common_utils.py index 21b7f19..fe67f42 100644 --- a/Obok_plugin/common_utils.py +++ b/Obok_plugin/common_utils.py @@ -265,13 +265,13 @@ class ReadOnlyTableWidgetItem(QTableWidgetItem): def __init__(self, text): if text is None: text = '' - QTableWidgetItem.__init__(self, text, QTableWidgetItem.UserType) + QTableWidgetItem.__init__(self, text, QTableWidgetItem.ItemType.UserType) self.setFlags(Qt.ItemIsSelectable|Qt.ItemIsEnabled) class RatingTableWidgetItem(QTableWidgetItem): def __init__(self, rating, is_read_only=False): - QTableWidgetItem.__init__(self, '', QTableWidgetItem.UserType) + QTableWidgetItem.__init__(self, '', QTableWidgetItem.ItemType.UserType) self.setData(Qt.DisplayRole, rating) if is_read_only: self.setFlags(Qt.ItemIsSelectable|Qt.ItemIsEnabled) @@ -284,11 +284,11 @@ class DateTableWidgetItem(QTableWidgetItem): if date_read is None or date_read == UNDEFINED_DATE and default_to_today: date_read = now() if is_read_only: - QTableWidgetItem.__init__(self, format_date(date_read, fmt), QTableWidgetItem.UserType) + QTableWidgetItem.__init__(self, format_date(date_read, fmt), QTableWidgetItem.ItemType.UserType) self.setFlags(Qt.ItemIsSelectable|Qt.ItemIsEnabled) self.setData(Qt.DisplayRole, QDateTime(date_read)) else: - QTableWidgetItem.__init__(self, '', QTableWidgetItem.UserType) + QTableWidgetItem.__init__(self, '', QTableWidgetItem.ItemType.UserType) self.setData(Qt.DisplayRole, QDateTime(date_read)) from calibre.gui2.library.delegates import DateDelegate as _DateDelegate diff --git a/Obok_plugin/utilities.py b/Obok_plugin/utilities.py index b2f02ad..ba0d7fc 100644 --- a/Obok_plugin/utilities.py +++ b/Obok_plugin/utilities.py @@ -224,5 +224,5 @@ class ReadOnlyTableWidgetItem(QTableWidgetItem): def __init__(self, text): if text is None: text = '' - QTableWidgetItem.__init__(self, text, QTableWidgetItem.UserType) + QTableWidgetItem.__init__(self, text, QTableWidgetItem.ItemType.UserType) self.setFlags(Qt.ItemIsSelectable|Qt.ItemIsEnabled)