Skip to content

Commit

Permalink
Merge pull request #1798 from McStasMcXtrace/qt5qt6-pyqtgraph-fix-1768
Browse files Browse the repository at this point in the history
Qt5qt6 pyqtgraph candidate fix 1768
  • Loading branch information
willend authored Dec 12, 2024
2 parents 4662602 + 7b5c03f commit 86cf6c8
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 11 deletions.
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ dependencies:
- pillow
- pyqtgraph
- pyqt
- qtpy
- qscintilla2
- nexus
- nexusformat
Expand Down
1 change: 1 addition & 0 deletions mcstas-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ dependencies:
- pillow
- pyqtgraph
- pyqt
- qtpy
- qscintilla2
- nexusformat
- nexpy
Expand Down
1 change: 1 addition & 0 deletions mcxtrace-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ dependencies:
- pillow
- pyqtgraph
- pyqt
- qtpy
- qscintilla2
- nexusformat
- nexpy
Expand Down
1 change: 1 addition & 0 deletions meta-pkgs/windows/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ dependencies:
- pillow
- pyqtgraph
- pyqt
- qtpy
- qscintilla2
- nexus
- nexusformat
Expand Down
5 changes: 3 additions & 2 deletions tools/Python/mccodelib/pqtgfrontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import subprocess
import numpy as np

import qtpy
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui, QtWidgets

Expand Down Expand Up @@ -103,11 +104,11 @@ def __init__(self, plotgraph, sourcedir, plot_func, invcanvas):
if hasattr(self.app, "exec_"):
try:
import PySide6
self.isQt6 = True
self.isQt6 = False
except:
self.isQt6 = False
else:
self.isQt6 = True
self.isQt6 = False

if invcanvas:
# switch to using white background and black foreground
Expand Down
2 changes: 1 addition & 1 deletion tools/Python/mcdisplay/pyqtgraph/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ set(CPACK_NSIS_DISPLAY_NAME "${NSIS_NAME}")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${NSIS_NAME}")

# Debian
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${FLAVOR}, python3, python3-pyqtgraph, python3-ply, python3-numpy")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${FLAVOR}, python3, python3-pyqtgraph, python3-ply, python3-numpy, python3-qtpy")
set(CPACK_DEBIAN_PACKAGE_REPLACES "${FLAVOR}-tools-python-${P}display-pyqtgraph-3.5.1")

# RPM
Expand Down
2 changes: 1 addition & 1 deletion tools/Python/mcdisplay/pyqtgraph/mcdisplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import numpy as np
from enum import Enum
import PyQt5
import qtpy
from pyqtgraph.Qt import QtGui, QtCore, QtWidgets
import pyqtgraph as pg
from pyqtgraph.graphicsItems.LegendItem import LegendItem, ItemSample
Expand Down
2 changes: 1 addition & 1 deletion tools/Python/mcplot/pyqtgraph/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ set(CPACK_NSIS_DISPLAY_NAME "${NSIS_NAME}")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${NSIS_NAME}")

# Debian
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${FLAVOR}, python3-pyqtgraph, python3-numpy")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${FLAVOR}, python3-pyqtgraph, python3-numpy, python3-qtpy")
set(CPACK_DEBIAN_PACKAGE_REPLACES "${FLAVOR}-tools-python-${P}plot-pyqtgraph-3.5.1")

# RPM
Expand Down
6 changes: 0 additions & 6 deletions tools/Python/mcplot/pyqtgraph/mcplot.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ canrun() {
cmd="${cmd}import ${name}; "
done
python3 -c "${cmd}"

python3 -c "import PySide6" 2> /dev/null
if [ $? == 0 ]; then
mcstas_errmsg Your Python has PySide6 - ${TOOL} will not function correctly. Please run in an environment with PyQt5 only.
exit 127;
fi
}

if ( canrun ); then
Expand Down
1 change: 1 addition & 0 deletions tools/Python/mcplot/pyqtgraph/mcplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import sys
import subprocess

import qtpy
import plotfuncs

sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..'))
Expand Down

0 comments on commit 86cf6c8

Please sign in to comment.