Skip to content

Commit 3180e1d

Browse files
Migrate from PySide2 to PySide6 to fix Qt symbol compatibility issues
- Updated all import statements from PySide2 to PySide6 across the codebase - Fixed QAction import (moved from QtWidgets to QtGui in PySide6) - Updated dependencies: PySide2~=5.15 → PySide6~=6.5 - Switched to opencv-contrib-python-headless to avoid Qt conflicts - Fixed indentation errors in uihelper_transparency.py - Resolves ImportError: undefined symbol _ZdlPvm, version Qt_5
1 parent 923662b commit 3180e1d

10 files changed

Lines changed: 38 additions & 41 deletions

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ test_sources = [
4141

4242

4343
requires = [
44-
"opencv-contrib-python==4.8.1.78",
45-
"PySide2~=5.15",
44+
"opencv-contrib-python-headless==4.8.1.78",
45+
"PySide6~=6.5",
4646
"mediapipe==0.10.7",
4747
"numpy~=1.19",
4848
"pyqtdarktheme ~=2.1.0",

src/photoglimmer/colorcurverwidget.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
21
import sys
3-
from PySide2 import QtWidgets, QtGui, QtCore
4-
from PySide2.QtWidgets import QWidget, QApplication, QVBoxLayout, QHBoxLayout, QPushButton # Added layouts/button
5-
from PySide2.QtGui import QPainter, QPen, QBrush, QColor, QPainterPath, QPalette
6-
from PySide2.QtCore import QPointF, QRectF, Qt, Signal
2+
from PySide6 import QtWidgets, QtGui, QtCore
3+
from PySide6.QtWidgets import QWidget, QApplication, QVBoxLayout, QHBoxLayout, QPushButton # Added layouts/button
4+
from PySide6.QtGui import QPainter, QPen, QBrush, QColor, QPainterPath, QPalette
5+
from PySide6.QtCore import QPointF, QRectF, Qt, Signal
76
import math
87
from pympler import asizeof
98
# import copy # Needed for deep copying QPointF list during save/load if necessary

src/photoglimmer/customfiledialog.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
# File license CC BY-SA 3.0
66
# ###############################################################################
77
import sys
8-
from PySide2.QtCore import Qt
9-
from PySide2.QtGui import QPixmap
10-
from PySide2.QtWidgets import QApplication, QFileDialog, QVBoxLayout, QLabel, QDialog
8+
from PySide6.QtCore import Qt
9+
from PySide6.QtGui import QPixmap
10+
from PySide6.QtWidgets import QApplication, QFileDialog, QVBoxLayout, QLabel, QDialog
1111
import qdarktheme
1212

1313

src/photoglimmer/imagewidget.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# ###############################################################################
32
# Copyright : Rahul Singh
43
# URL : https://github.com/codecliff/PhotoGlimmer
@@ -14,7 +13,7 @@
1413
# ###############################################################################
1514
import sys
1615
from enum import Enum
17-
from PySide2 import QtCore, QtGui, QtWidgets
16+
from PySide6 import QtCore, QtGui, QtWidgets
1817
# --- Interaction Modes Enum ---
1918

2019

src/photoglimmer/photoglimmer_ui.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
#imports
1515
import os, sys, shutil, time, tempfile
1616
# QT
17-
from PySide2 import QtWidgets, QtCore
18-
from PySide2.QtUiTools import QUiLoader
19-
from PySide2.QtGui import QPixmap, QIcon, QMovie, QKeySequence
20-
from PySide2.QtCore import QThreadPool, QFile,QSettings,QStandardPaths
21-
from PySide2.QtWidgets import QStyle, QMessageBox, QAction, QGridLayout,QLabel, QDialog
17+
from PySide6 import QtWidgets, QtCore
18+
from PySide6.QtUiTools import QUiLoader
19+
from PySide6.QtGui import QPixmap, QIcon, QMovie, QKeySequence, QAction
20+
from PySide6.QtCore import QThreadPool, QFile,QSettings,QStandardPaths
21+
from PySide6.QtWidgets import QStyle, QMessageBox, QGridLayout,QLabel, QDialog
2222
# Only if using qdarktheme style
2323
import qdarktheme
2424
# This application
@@ -190,7 +190,7 @@ def setUpMyUI(self):
190190

191191

192192
def getImagesDirectory(self):
193-
from PySide2.QtCore import QStandardPaths
193+
from PySide6.QtCore import QStandardPaths
194194
pth=QStandardPaths.PicturesLocation
195195
sysimgfolder= str(QStandardPaths.writableLocation(pth) )
196196
if os.path.exists(sysimgfolder):
@@ -636,7 +636,8 @@ def openBrowser(self, path_to_open):
636636

637637

638638
def getScreenSize( self ):
639-
from PySide2.QtWidgets import QApplication, QDesktopWidget
639+
from PySide6.QtWidgets import QApplication
640+
from PySide6.QtGui import QScreen
640641
desktop = QDesktopWidget()
641642
screen_width = desktop.screenGeometry().width()
642643
screen_height = desktop.screenGeometry().height()

src/photoglimmer/prefs/preferences_dialog.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
# preferences_dialog.py
33
import sys
44
import os
5-
from PySide2.QtWidgets import (QApplication, QDialog, QFileDialog, QMessageBox,
5+
from PySide6.QtWidgets import (QApplication, QDialog, QFileDialog, QMessageBox,
66
QWidget, QRadioButton, QVBoxLayout,
77
QDialogButtonBox)
8-
from PySide2.QtCore import QFile, QSettings, QStandardPaths, Slot
9-
from PySide2.QtUiTools import QUiLoader
8+
from PySide6.QtCore import QFile, QSettings, QStandardPaths, Slot
9+
from PySide6.QtUiTools import QUiLoader
1010
# --- Import the configuration ---
1111
#standard way of importing form same package is to add . prefix
1212
from .settings_config import SettingsConfig

src/photoglimmer/prefs/settings_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
# settings_config.py
3-
from PySide2.QtCore import QStandardPaths
3+
from PySide6.QtCore import QStandardPaths
44

55

66
class SettingsConfig:

src/photoglimmer/requirements.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
"opencv-contrib-python==4.8.1.78",
2-
"PySide2~=5.15",
3-
"mediapipe==0.10.7",
4-
"numpy~=1.19",
5-
"pyqtdarktheme ~=2.1.0",
6-
"splines ~= 0.3.0",
7-
"piexif ~= 1.1.3",
8-
"Pympler ~=1.1",
9-
"memory-profiler ~=0.61.0",
10-
"line-profiler ~=4.2.0"
1+
opencv-contrib-python-headless==4.8.1.78
2+
PySide6~=6.5
3+
mediapipe==0.10.7
4+
numpy~=1.19
5+
pyqtdarktheme~=2.1.0
6+
splines~=0.3.0
7+
piexif~=1.1.3
8+
Pympler~=1.1
9+
memory-profiler~=0.61.0
10+
line-profiler~=4.2.0

src/photoglimmer/threadwork.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
21
# source for all the code in this file :
32
# https://gist.github.com/sabapathygithub/160ecf262063bcb826787a7af1637f44
4-
from PySide2.QtCore import QObject,QRunnable,QThreadPool
5-
from PySide2.QtCore import Signal as pyqtSignal
6-
from PySide2.QtCore import Slot as pyqtSlot
3+
from PySide6.QtCore import QObject,QRunnable,QThreadPool
4+
from PySide6.QtCore import Signal as pyqtSignal
5+
from PySide6.QtCore import Slot as pyqtSlot
76
import sys,traceback
87

98

src/photoglimmer/uihelper_transparency.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# import backend
32
import os
43
import photoglimmer.photoglimmer_backend as backend
@@ -14,16 +13,16 @@ def __init__(self, uiobject):
1413

1514

1615
def convert_and_copy_to_clipboard(self, bgra_image):
17-
from PySide2.QtGui import QImage, QPixmap,QClipboard
18-
from PySide2.QtWidgets import QApplication
16+
from PySide6.QtGui import QImage, QPixmap,QClipboard
17+
from PySide6.QtWidgets import QApplication
1918
rgba_image = backend.cv2.cvtColor(bgra_image, backend.cv2.COLOR_BGRA2RGBA)
2019
height, width, channels = rgba_image.shape
2120
bytes_per_line = channels * width
2221
qimage = QImage(rgba_image.data, width, height, bytes_per_line,
2322
QImage.Format_RGBA8888)
2423
clipboard = QApplication.clipboard()
2524
clipboard.setPixmap(QPixmap(qimage), QClipboard.Clipboard)
26-
return
25+
return
2726

2827

2928
def transparency_to_clipboard( self, tempdirpath,originalImgPath):

0 commit comments

Comments
 (0)