1
0

qt desktop gui: upgrade qt5->qt6

closes https://github.com/spesmilo/electrum/issues/8007
This commit is contained in:
SomberNight
2024-09-05 16:20:01 +00:00
parent fcc4e1d387
commit cfe8502f96
89 changed files with 918 additions and 1010 deletions

View File

@@ -1,8 +1,11 @@
This is a stripped-down copy of the 3rd-party `pyperclip` package.
No modifications besides excluding most files.
It is used by the "text" GUI.
At revision https://github.com/asweigart/pyperclip/blob/781603ea491eefce3b58f4f203bf748dbf9ff003/src/pyperclip/__init__.py
(version 1.8.2)
Modifications:
- excluded most files
- added support for pyqt6

View File

@@ -179,9 +179,12 @@ def init_qt_clipboard():
from qtpy.QtWidgets import QApplication
except:
try:
from PyQt5.QtWidgets import QApplication
from PyQt6.QtWidgets import QApplication
except:
from PyQt4.QtGui import QApplication
try:
from PyQt5.QtWidgets import QApplication
except:
from PyQt4.QtGui import QApplication
app = QApplication.instance()
if app is None:
@@ -530,7 +533,7 @@ def determine_clipboard():
accordingly.
'''
global Foundation, AppKit, gtk, qtpy, PyQt4, PyQt5
global Foundation, AppKit, gtk, qtpy, PyQt4, PyQt5, PyQt6
# Setup for the CYGWIN platform:
if 'cygwin' in platform.system().lower(): # Cygwin has a variety of values returned by platform.system(), such as 'CYGWIN_NT-6.1'
@@ -587,12 +590,17 @@ def determine_clipboard():
except ImportError:
# If qtpy isn't installed, fall back on importing PyQt4.
try:
import PyQt5 # check if PyQt5 is installed
import PyQt6 # check if PyQt6 is installed
except ImportError:
try:
import PyQt4 # check if PyQt4 is installed
import PyQt5 # check if PyQt5 is installed
except ImportError:
pass # We want to fail fast for all non-ImportError exceptions.
try:
import PyQt4 # check if PyQt4 is installed
except ImportError:
pass # We want to fail fast for all non-ImportError exceptions.
else:
return init_qt_clipboard()
else:
return init_qt_clipboard()
else: