From f04a7882fde32a35d60668ff3ac0b469501c2b12 Mon Sep 17 00:00:00 2001 From: Kashiko Koibumi Date: Thu, 30 May 2024 11:15:11 +0900 Subject: [PATCH] fix for newer versions of Python3 --- src/bitmessageqt/__init__.py | 2 +- src/bitmessageqt/foldertree.py | 5 ++++- src/shutdown.py | 6 +++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index b448422b..bf82525c 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -808,7 +808,7 @@ class MyForm(settingsmixin.SMainWindow): elif TTL > 28 * 24 * 60 * 60: # 28 days TTL = 28 * 24 * 60 * 60 self.ui.horizontalSliderTTL.setSliderPosition( - (TTL - 3600) ** (1 / 3.199)) + int((TTL - 3600) ** (1 / 3.199))) self.updateHumanFriendlyTTLDescription(TTL) self.ui.horizontalSliderTTL.valueChanged.connect(self.updateTTL) diff --git a/src/bitmessageqt/foldertree.py b/src/bitmessageqt/foldertree.py index 5d62b4f3..db09a5d6 100644 --- a/src/bitmessageqt/foldertree.py +++ b/src/bitmessageqt/foldertree.py @@ -4,7 +4,10 @@ Folder tree and messagelist widgets definitions. # pylint: disable=too-many-arguments # pylint: disable=attribute-defined-outside-init -from cgi import escape +try: + from cgi import escape +except ImportError: + from html import escape from unqstr import ustr, unic from dbcompat import dbstr diff --git a/src/shutdown.py b/src/shutdown.py index 441d655e..7b875f64 100644 --- a/src/shutdown.py +++ b/src/shutdown.py @@ -23,7 +23,11 @@ def doCleanShutdown(): objectProcessorQueue.put(('checkShutdownVariable', 'no data')) for thread in threading.enumerate(): - if thread.isAlive() and isinstance(thread, StoppableThread): + try: + alive = thread.isAlive() + except AttributeError: + alive = thread.is_alive() + if alive and isinstance(thread, StoppableThread): thread.stopThread() UISignalQueue.put((