Merge pull request #1495 from pijyoi/future_compat

some fixes for PySide6 future compatibility
This commit is contained in:
Ogi Moore 2021-01-19 21:05:50 -08:00 committed by GitHub
commit 78bc0fd3ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
59 changed files with 1945 additions and 245 deletions

View File

@ -9,19 +9,34 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
qt-lib: [pyqt5, pyside2]
os: [ubuntu-20.04 , windows-latest, macos-latest]
qt-lib: [pyqt, pyside]
python-version: [3.7, 3.8, 3.9]
include:
- python-version: "3.7"
qt-version: "~=5.12.0"
qt-lib: "pyqt"
qt-version: "PyQt5~=5.12.0"
numpy-version: "~=1.17.0"
- python-version: "3.7"
qt-lib: "pyside"
qt-version: "PySide2~=5.12.0"
numpy-version: "~=1.17.0"
- python-version: "3.8"
qt-version: "~=5.15.0"
qt-lib: "pyqt"
qt-version: "PyQt5~=5.15.0"
numpy-version: "~=1.19.0"
- python-version: "3.8"
qt-lib: "pyside"
qt-version: "PySide2~=5.15.0"
numpy-version: "~=1.19.0"
- python-version: "3.9"
qt-version: ""
numpy-version: ""
qt-lib: "pyqt"
qt-version: "PyQt5~=5.15"
numpy-version: "~=1.19.0"
- python-version: "3.9"
qt-lib: "pyside"
qt-version: "PySide6"
numpy-version: "~=1.19.0"
steps:
- name: Checkout
uses: actions/checkout@v2
@ -55,7 +70,7 @@ jobs:
- name: Install Dependencies
run: |
pip install --upgrade pip
pip install ${{ matrix.qt-lib }}${{ matrix.qt-version }} numpy${{ matrix.numpy-version }} scipy pyopengl h5py six matplotlib
pip install ${{ matrix.qt-version }} numpy${{ matrix.numpy-version }} scipy pyopengl h5py six matplotlib
pip install .
pip install pytest pytest-cov pytest-xdist coverage
- name: "Install Linux VirtualDisplay"
@ -63,6 +78,7 @@ jobs:
run: |
sudo apt-get install -y libxkbcommon-x11-0 x11-utils
sudo apt-get install --no-install-recommends -y libyaml-dev libegl1-mesa libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0
sudo apt-get install -y libopengl0
pip install pytest-xvfb
- name: 'Debug Info'
run: |

View File

@ -9,7 +9,7 @@ PyQtGraph
[![Total alerts](https://img.shields.io/lgtm/alerts/g/pyqtgraph/pyqtgraph.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/pyqtgraph/pyqtgraph/alerts/)
[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/pyqtgraph/pyqtgraph.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/pyqtgraph/pyqtgraph/context:python)
A pure-Python graphics library for PyQt5/PySide2
A pure-Python graphics library for PyQt5/PySide2/PySide6
Copyright 2020 Luke Campagnola, University of North Carolina at Chapel Hill
@ -29,33 +29,34 @@ This project supports:
* All minor versions of Python released 42 months prior to the project, and at minimum the two latest minor versions.
* All minor versions of numpy released in the 24 months prior to the project, and at minimum the last three minor versions.
* All minor versions of Qt 5 currently supported by upstream Qt (Note, Qt 6 support is not yet implemented)
* All minor versions of Qt 5 and Qt 6 currently supported by upstream Qt
Currently this means:
* Python 3.7+
* Qt 5.12-5.15
* Qt 5.12-6.0
* Required
* PyQt5 or PySide2
* PyQt5, PySide2 or PySide6
* `numpy` 1.17+
* Optional
* `scipy` for image processing
* `pyopengl` for 3D graphics
* `pyopengl` on macOS Big Sur only works with python 3.9.1+
* `hdf5` for large hdf5 binary format support
* `colorcet` for supplimental colormaps
* `colorcet` for supplemental colormaps
Qt Bindings Test Matrix
-----------------------
The following table represents the python environments we test in our CI system. Our CI system uses Ubuntu 18.04, Windows Server 2019, and macOS 10.15 base images.
The following table represents the python environments we test in our CI system. Our CI system uses Ubuntu 20.04, Windows Server 2019, and macOS 10.15 base images.
| Qt-Bindings | Python 3.7 | Python 3.8 | Python 3.9 |
| :------------- | :----------------: | :----------------: | :----------------: |
| PySide2-5.12 | :white_check_mark: | :x: | :x: |
| PyQt5-5.12 | :white_check_mark: | :x: | :x: |
| PySide2-5.15 | :x: | :white_check_mark: | :white_check_mark: |
| PySide2-5.15 | :x: | :white_check_mark: | :x: |
| PyQt5-5.15 | :x: | :white_check_mark: | :white_check_mark: |
| PySide6-6.0 | :x: | :x: | :white_check_mark: |
Support
-------

View File

@ -12,14 +12,9 @@ path = os.path.abspath(os.path.dirname(__file__))
sys.path.insert(0, path)
app = pg.mkQApp()
if QT_LIB == 'PySide':
from exampleLoaderTemplate_pyside import Ui_Form
elif QT_LIB == 'PySide2':
from exampleLoaderTemplate_pyside2 import Ui_Form
elif QT_LIB == 'PyQt5':
from exampleLoaderTemplate_pyqt5 import Ui_Form
else:
from exampleLoaderTemplate_pyqt import Ui_Form
import importlib
ui_template = importlib.import_module(
f'exampleLoaderTemplate_{QT_LIB.lower()}')
examples = OrderedDict([
('Command-line usage', 'CLIexample.py'),
@ -350,7 +345,7 @@ class PythonHighlighter(QSyntaxHighlighter):
class ExampleLoader(QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
self.ui = Ui_Form()
self.ui = ui_template.Ui_Form()
self.cw = QtGui.QWidget()
self.setCentralWidget(self.cw)
self.ui.setupUi(self.cw)
@ -360,9 +355,7 @@ class ExampleLoader(QtGui.QMainWindow):
self.ui.codeView.setLayout(self.codeLayout)
self.hl = PythonHighlighter(self.ui.codeView.document())
app = QtGui.QApplication.instance()
if QT_LIB in ['PyQt5', 'PySide2']:
# Qt4 does not have a paletteChanged signal
app.paletteChanged.connect(self.updateTheme)
app.paletteChanged.connect(self.updateTheme)
self.codeLayout.addItem(QtGui.QSpacerItem(100,100,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding), 0, 0)
self.codeLayout.addWidget(self.codeBtn, 1, 1)
self.codeBtn.hide()

View File

@ -20,18 +20,13 @@ from pyqtgraph.ptime import time
app = QtGui.QApplication([])
#mw = QtGui.QMainWindow()
#mw.resize(800,800)
if QT_LIB == 'PySide':
from ScatterPlotSpeedTestTemplate_pyside import Ui_Form
elif QT_LIB == 'PySide2':
from ScatterPlotSpeedTestTemplate_pyside2 import Ui_Form
elif QT_LIB == 'PyQt5':
from ScatterPlotSpeedTestTemplate_pyqt5 import Ui_Form
else:
from ScatterPlotSpeedTestTemplate_pyqt import Ui_Form
import importlib
ui_template = importlib.import_module(
f'ScatterPlotSpeedTestTemplate_{QT_LIB.lower()}')
win = QtGui.QWidget()
win.setWindowTitle('pyqtgraph example: ScatterPlotSpeedTest')
ui = Ui_Form()
ui = ui_template.Ui_Form()
ui.setupUi(win)
win.show()

View File

@ -0,0 +1,63 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'ScatterPlotSpeedTestTemplate.ui'
##
## Created by: Qt User Interface Compiler version 6.0.0
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *
from pyqtgraph import PlotWidget
class Ui_Form(object):
def setupUi(self, Form):
if not Form.objectName():
Form.setObjectName(u"Form")
Form.resize(400, 300)
self.gridLayout = QGridLayout(Form)
self.gridLayout.setObjectName(u"gridLayout")
self.sizeSpin = QSpinBox(Form)
self.sizeSpin.setObjectName(u"sizeSpin")
self.sizeSpin.setValue(10)
self.gridLayout.addWidget(self.sizeSpin, 1, 1, 1, 1)
self.pixelModeCheck = QCheckBox(Form)
self.pixelModeCheck.setObjectName(u"pixelModeCheck")
self.gridLayout.addWidget(self.pixelModeCheck, 1, 3, 1, 1)
self.label = QLabel(Form)
self.label.setObjectName(u"label")
self.gridLayout.addWidget(self.label, 1, 0, 1, 1)
self.plot = PlotWidget(Form)
self.plot.setObjectName(u"plot")
self.gridLayout.addWidget(self.plot, 0, 0, 1, 4)
self.randCheck = QCheckBox(Form)
self.randCheck.setObjectName(u"randCheck")
self.gridLayout.addWidget(self.randCheck, 1, 2, 1, 1)
self.retranslateUi(Form)
QMetaObject.connectSlotsByName(Form)
# setupUi
def retranslateUi(self, Form):
Form.setWindowTitle(QCoreApplication.translate("Form", u"PyQtGraph", None))
self.pixelModeCheck.setText(QCoreApplication.translate("Form", u"pixel mode", None))
self.label.setText(QCoreApplication.translate("Form", u"Size", None))
self.randCheck.setText(QCoreApplication.translate("Form", u"Randomize", None))
# retranslateUi

View File

@ -15,14 +15,8 @@ import numpy as np
import pyqtgraph as pg
import pyqtgraph.ptime as ptime
if QT_LIB == 'PySide':
import VideoTemplate_pyside as VideoTemplate
elif QT_LIB == 'PySide2':
import VideoTemplate_pyside2 as VideoTemplate
elif QT_LIB == 'PyQt5':
import VideoTemplate_pyqt5 as VideoTemplate
else:
import VideoTemplate_pyqt as VideoTemplate
import importlib
ui_template = importlib.import_module(f'VideoTemplate_{QT_LIB.lower()}')
#QtGui.QApplication.setGraphicsSystem('raster')
@ -30,7 +24,7 @@ app = QtGui.QApplication([])
win = QtGui.QMainWindow()
win.setWindowTitle('pyqtgraph example: VideoSpeedTest')
ui = VideoTemplate.Ui_MainWindow()
ui = ui_template.Ui_MainWindow()
ui.setupUi(win)
win.show()

View File

@ -0,0 +1,282 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'VideoTemplate.ui'
##
## Created by: Qt User Interface Compiler version 6.0.0
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *
from pyqtgraph import GraphicsView
from pyqtgraph.widgets.RawImageWidget import RawImageWidget
from pyqtgraph import GradientWidget
from pyqtgraph import SpinBox
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
if not MainWindow.objectName():
MainWindow.setObjectName(u"MainWindow")
MainWindow.resize(695, 798)
self.centralwidget = QWidget(MainWindow)
self.centralwidget.setObjectName(u"centralwidget")
self.gridLayout_2 = QGridLayout(self.centralwidget)
self.gridLayout_2.setObjectName(u"gridLayout_2")
self.downsampleCheck = QCheckBox(self.centralwidget)
self.downsampleCheck.setObjectName(u"downsampleCheck")
self.gridLayout_2.addWidget(self.downsampleCheck, 8, 0, 1, 2)
self.scaleCheck = QCheckBox(self.centralwidget)
self.scaleCheck.setObjectName(u"scaleCheck")
self.gridLayout_2.addWidget(self.scaleCheck, 4, 0, 1, 1)
self.gridLayout = QGridLayout()
self.gridLayout.setObjectName(u"gridLayout")
self.rawRadio = QRadioButton(self.centralwidget)
self.rawRadio.setObjectName(u"rawRadio")
self.gridLayout.addWidget(self.rawRadio, 3, 0, 1, 1)
self.gfxRadio = QRadioButton(self.centralwidget)
self.gfxRadio.setObjectName(u"gfxRadio")
self.gfxRadio.setChecked(True)
self.gridLayout.addWidget(self.gfxRadio, 2, 0, 1, 1)
self.stack = QStackedWidget(self.centralwidget)
self.stack.setObjectName(u"stack")
self.page = QWidget()
self.page.setObjectName(u"page")
self.gridLayout_3 = QGridLayout(self.page)
self.gridLayout_3.setObjectName(u"gridLayout_3")
self.graphicsView = GraphicsView(self.page)
self.graphicsView.setObjectName(u"graphicsView")
self.gridLayout_3.addWidget(self.graphicsView, 0, 0, 1, 1)
self.stack.addWidget(self.page)
self.page_2 = QWidget()
self.page_2.setObjectName(u"page_2")
self.gridLayout_4 = QGridLayout(self.page_2)
self.gridLayout_4.setObjectName(u"gridLayout_4")
self.rawImg = RawImageWidget(self.page_2)
self.rawImg.setObjectName(u"rawImg")
sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.rawImg.sizePolicy().hasHeightForWidth())
self.rawImg.setSizePolicy(sizePolicy)
self.gridLayout_4.addWidget(self.rawImg, 0, 0, 1, 1)
self.stack.addWidget(self.page_2)
self.gridLayout.addWidget(self.stack, 0, 0, 1, 1)
self.rawGLRadio = QRadioButton(self.centralwidget)
self.rawGLRadio.setObjectName(u"rawGLRadio")
self.gridLayout.addWidget(self.rawGLRadio, 4, 0, 1, 1)
self.gridLayout_2.addLayout(self.gridLayout, 1, 0, 1, 4)
self.dtypeCombo = QComboBox(self.centralwidget)
self.dtypeCombo.addItem("")
self.dtypeCombo.addItem("")
self.dtypeCombo.addItem("")
self.dtypeCombo.setObjectName(u"dtypeCombo")
self.gridLayout_2.addWidget(self.dtypeCombo, 3, 2, 1, 1)
self.label = QLabel(self.centralwidget)
self.label.setObjectName(u"label")
self.gridLayout_2.addWidget(self.label, 3, 0, 1, 1)
self.rgbLevelsCheck = QCheckBox(self.centralwidget)
self.rgbLevelsCheck.setObjectName(u"rgbLevelsCheck")
self.gridLayout_2.addWidget(self.rgbLevelsCheck, 4, 1, 1, 1)
self.horizontalLayout_2 = QHBoxLayout()
self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
self.minSpin2 = SpinBox(self.centralwidget)
self.minSpin2.setObjectName(u"minSpin2")
self.minSpin2.setEnabled(False)
self.horizontalLayout_2.addWidget(self.minSpin2)
self.label_3 = QLabel(self.centralwidget)
self.label_3.setObjectName(u"label_3")
self.label_3.setAlignment(Qt.AlignCenter)
self.horizontalLayout_2.addWidget(self.label_3)
self.maxSpin2 = SpinBox(self.centralwidget)
self.maxSpin2.setObjectName(u"maxSpin2")
self.maxSpin2.setEnabled(False)
self.horizontalLayout_2.addWidget(self.maxSpin2)
self.gridLayout_2.addLayout(self.horizontalLayout_2, 5, 2, 1, 1)
self.horizontalLayout = QHBoxLayout()
self.horizontalLayout.setObjectName(u"horizontalLayout")
self.minSpin1 = SpinBox(self.centralwidget)
self.minSpin1.setObjectName(u"minSpin1")
self.horizontalLayout.addWidget(self.minSpin1)
self.label_2 = QLabel(self.centralwidget)
self.label_2.setObjectName(u"label_2")
self.label_2.setAlignment(Qt.AlignCenter)
self.horizontalLayout.addWidget(self.label_2)
self.maxSpin1 = SpinBox(self.centralwidget)
self.maxSpin1.setObjectName(u"maxSpin1")
self.horizontalLayout.addWidget(self.maxSpin1)
self.gridLayout_2.addLayout(self.horizontalLayout, 4, 2, 1, 1)
self.horizontalLayout_3 = QHBoxLayout()
self.horizontalLayout_3.setObjectName(u"horizontalLayout_3")
self.minSpin3 = SpinBox(self.centralwidget)
self.minSpin3.setObjectName(u"minSpin3")
self.minSpin3.setEnabled(False)
self.horizontalLayout_3.addWidget(self.minSpin3)
self.label_4 = QLabel(self.centralwidget)
self.label_4.setObjectName(u"label_4")
self.label_4.setAlignment(Qt.AlignCenter)
self.horizontalLayout_3.addWidget(self.label_4)
self.maxSpin3 = SpinBox(self.centralwidget)
self.maxSpin3.setObjectName(u"maxSpin3")
self.maxSpin3.setEnabled(False)
self.horizontalLayout_3.addWidget(self.maxSpin3)
self.gridLayout_2.addLayout(self.horizontalLayout_3, 6, 2, 1, 1)
self.lutCheck = QCheckBox(self.centralwidget)
self.lutCheck.setObjectName(u"lutCheck")
self.gridLayout_2.addWidget(self.lutCheck, 7, 0, 1, 1)
self.alphaCheck = QCheckBox(self.centralwidget)
self.alphaCheck.setObjectName(u"alphaCheck")
self.gridLayout_2.addWidget(self.alphaCheck, 7, 1, 1, 1)
self.gradient = GradientWidget(self.centralwidget)
self.gradient.setObjectName(u"gradient")
sizePolicy.setHeightForWidth(self.gradient.sizePolicy().hasHeightForWidth())
self.gradient.setSizePolicy(sizePolicy)
self.gridLayout_2.addWidget(self.gradient, 7, 2, 1, 2)
self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
self.gridLayout_2.addItem(self.horizontalSpacer, 3, 3, 1, 1)
self.fpsLabel = QLabel(self.centralwidget)
self.fpsLabel.setObjectName(u"fpsLabel")
font = QFont()
font.setPointSize(12)
self.fpsLabel.setFont(font)
self.fpsLabel.setAlignment(Qt.AlignCenter)
self.gridLayout_2.addWidget(self.fpsLabel, 0, 0, 1, 4)
self.rgbCheck = QCheckBox(self.centralwidget)
self.rgbCheck.setObjectName(u"rgbCheck")
self.gridLayout_2.addWidget(self.rgbCheck, 3, 1, 1, 1)
self.label_5 = QLabel(self.centralwidget)
self.label_5.setObjectName(u"label_5")
self.gridLayout_2.addWidget(self.label_5, 2, 0, 1, 1)
self.horizontalLayout_4 = QHBoxLayout()
self.horizontalLayout_4.setObjectName(u"horizontalLayout_4")
self.framesSpin = QSpinBox(self.centralwidget)
self.framesSpin.setObjectName(u"framesSpin")
self.framesSpin.setButtonSymbols(QAbstractSpinBox.NoButtons)
self.framesSpin.setValue(10)
self.horizontalLayout_4.addWidget(self.framesSpin)
self.widthSpin = QSpinBox(self.centralwidget)
self.widthSpin.setObjectName(u"widthSpin")
self.widthSpin.setButtonSymbols(QAbstractSpinBox.PlusMinus)
self.widthSpin.setMaximum(10000)
self.widthSpin.setValue(512)
self.horizontalLayout_4.addWidget(self.widthSpin)
self.heightSpin = QSpinBox(self.centralwidget)
self.heightSpin.setObjectName(u"heightSpin")
self.heightSpin.setButtonSymbols(QAbstractSpinBox.NoButtons)
self.heightSpin.setMaximum(10000)
self.heightSpin.setValue(512)
self.horizontalLayout_4.addWidget(self.heightSpin)
self.gridLayout_2.addLayout(self.horizontalLayout_4, 2, 1, 1, 2)
self.sizeLabel = QLabel(self.centralwidget)
self.sizeLabel.setObjectName(u"sizeLabel")
self.gridLayout_2.addWidget(self.sizeLabel, 2, 3, 1, 1)
MainWindow.setCentralWidget(self.centralwidget)
self.retranslateUi(MainWindow)
self.stack.setCurrentIndex(1)
QMetaObject.connectSlotsByName(MainWindow)
# setupUi
def retranslateUi(self, MainWindow):
MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"MainWindow", None))
self.downsampleCheck.setText(QCoreApplication.translate("MainWindow", u"Auto downsample", None))
self.scaleCheck.setText(QCoreApplication.translate("MainWindow", u"Scale Data", None))
self.rawRadio.setText(QCoreApplication.translate("MainWindow", u"RawImageWidget", None))
self.gfxRadio.setText(QCoreApplication.translate("MainWindow", u"GraphicsView + ImageItem", None))
self.rawGLRadio.setText(QCoreApplication.translate("MainWindow", u"RawGLImageWidget", None))
self.dtypeCombo.setItemText(0, QCoreApplication.translate("MainWindow", u"uint8", None))
self.dtypeCombo.setItemText(1, QCoreApplication.translate("MainWindow", u"uint16", None))
self.dtypeCombo.setItemText(2, QCoreApplication.translate("MainWindow", u"float", None))
self.label.setText(QCoreApplication.translate("MainWindow", u"Data type", None))
self.rgbLevelsCheck.setText(QCoreApplication.translate("MainWindow", u"RGB", None))
self.label_3.setText(QCoreApplication.translate("MainWindow", u"<--->", None))
self.label_2.setText(QCoreApplication.translate("MainWindow", u"<--->", None))
self.label_4.setText(QCoreApplication.translate("MainWindow", u"<--->", None))
self.lutCheck.setText(QCoreApplication.translate("MainWindow", u"Use Lookup Table", None))
self.alphaCheck.setText(QCoreApplication.translate("MainWindow", u"alpha", None))
self.fpsLabel.setText(QCoreApplication.translate("MainWindow", u"FPS", None))
self.rgbCheck.setText(QCoreApplication.translate("MainWindow", u"RGB", None))
self.label_5.setText(QCoreApplication.translate("MainWindow", u"Image size", None))
self.sizeLabel.setText("")
# retranslateUi

View File

@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'designerExample.ui'
##
## Created by: Qt User Interface Compiler version 6.0.0
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *
from pyqtgraph import PlotWidget
class Ui_Form(object):
def setupUi(self, Form):
if not Form.objectName():
Form.setObjectName(u"Form")
Form.resize(400, 300)
self.gridLayout = QGridLayout(Form)
self.gridLayout.setObjectName(u"gridLayout")
self.plotBtn = QPushButton(Form)
self.plotBtn.setObjectName(u"plotBtn")
self.gridLayout.addWidget(self.plotBtn, 0, 0, 1, 1)
self.plot = PlotWidget(Form)
self.plot.setObjectName(u"plot")
self.gridLayout.addWidget(self.plot, 1, 0, 1, 1)
self.retranslateUi(Form)
QMetaObject.connectSlotsByName(Form)
# setupUi
def retranslateUi(self, Form):
Form.setWindowTitle(QCoreApplication.translate("Form", u"PyQtGraph", None))
self.plotBtn.setText(QCoreApplication.translate("Form", u"Plot!", None))
# retranslateUi

View File

@ -115,7 +115,6 @@
<widget class="QLabel" name="loadedFileLabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>

View File

@ -0,0 +1,125 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'exampleLoaderTemplate.ui'
##
## Created by: Qt User Interface Compiler version 6.0.0
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *
class Ui_Form(object):
def setupUi(self, Form):
if not Form.objectName():
Form.setObjectName(u"Form")
Form.resize(846, 552)
self.gridLayout_2 = QGridLayout(Form)
self.gridLayout_2.setObjectName(u"gridLayout_2")
self.splitter = QSplitter(Form)
self.splitter.setObjectName(u"splitter")
self.splitter.setOrientation(Qt.Horizontal)
self.widget = QWidget(self.splitter)
self.widget.setObjectName(u"widget")
self.gridLayout = QGridLayout(self.widget)
self.gridLayout.setObjectName(u"gridLayout")
self.gridLayout.setContentsMargins(0, 0, 0, 0)
self.exampleTree = QTreeWidget(self.widget)
__qtreewidgetitem = QTreeWidgetItem()
__qtreewidgetitem.setText(0, u"1");
self.exampleTree.setHeaderItem(__qtreewidgetitem)
self.exampleTree.setObjectName(u"exampleTree")
self.exampleTree.header().setVisible(False)
self.gridLayout.addWidget(self.exampleTree, 0, 0, 1, 2)
self.graphicsSystemCombo = QComboBox(self.widget)
self.graphicsSystemCombo.addItem("")
self.graphicsSystemCombo.addItem("")
self.graphicsSystemCombo.addItem("")
self.graphicsSystemCombo.addItem("")
self.graphicsSystemCombo.setObjectName(u"graphicsSystemCombo")
self.gridLayout.addWidget(self.graphicsSystemCombo, 2, 1, 1, 1)
self.qtLibCombo = QComboBox(self.widget)
self.qtLibCombo.addItem("")
self.qtLibCombo.addItem("")
self.qtLibCombo.addItem("")
self.qtLibCombo.addItem("")
self.qtLibCombo.addItem("")
self.qtLibCombo.setObjectName(u"qtLibCombo")
self.gridLayout.addWidget(self.qtLibCombo, 1, 1, 1, 1)
self.label_2 = QLabel(self.widget)
self.label_2.setObjectName(u"label_2")
self.gridLayout.addWidget(self.label_2, 2, 0, 1, 1)
self.label = QLabel(self.widget)
self.label.setObjectName(u"label")
self.gridLayout.addWidget(self.label, 1, 0, 1, 1)
self.loadBtn = QPushButton(self.widget)
self.loadBtn.setObjectName(u"loadBtn")
self.gridLayout.addWidget(self.loadBtn, 3, 1, 1, 1)
self.splitter.addWidget(self.widget)
self.widget1 = QWidget(self.splitter)
self.widget1.setObjectName(u"widget1")
self.verticalLayout = QVBoxLayout(self.widget1)
self.verticalLayout.setObjectName(u"verticalLayout")
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.loadedFileLabel = QLabel(self.widget1)
self.loadedFileLabel.setObjectName(u"loadedFileLabel")
font = QFont()
font.setBold(True)
self.loadedFileLabel.setFont(font)
self.loadedFileLabel.setAlignment(Qt.AlignCenter)
self.verticalLayout.addWidget(self.loadedFileLabel)
self.codeView = QPlainTextEdit(self.widget1)
self.codeView.setObjectName(u"codeView")
font1 = QFont()
font1.setFamily(u"Courier New")
self.codeView.setFont(font1)
self.verticalLayout.addWidget(self.codeView)
self.splitter.addWidget(self.widget1)
self.gridLayout_2.addWidget(self.splitter, 0, 0, 1, 1)
self.retranslateUi(Form)
QMetaObject.connectSlotsByName(Form)
# setupUi
def retranslateUi(self, Form):
Form.setWindowTitle(QCoreApplication.translate("Form", u"PyQtGraph", None))
self.graphicsSystemCombo.setItemText(0, QCoreApplication.translate("Form", u"default", None))
self.graphicsSystemCombo.setItemText(1, QCoreApplication.translate("Form", u"native", None))
self.graphicsSystemCombo.setItemText(2, QCoreApplication.translate("Form", u"raster", None))
self.graphicsSystemCombo.setItemText(3, QCoreApplication.translate("Form", u"opengl", None))
self.qtLibCombo.setItemText(0, QCoreApplication.translate("Form", u"default", None))
self.qtLibCombo.setItemText(1, QCoreApplication.translate("Form", u"PyQt4", None))
self.qtLibCombo.setItemText(2, QCoreApplication.translate("Form", u"PySide", None))
self.qtLibCombo.setItemText(3, QCoreApplication.translate("Form", u"PyQt5", None))
self.qtLibCombo.setItemText(4, QCoreApplication.translate("Form", u"PySide2", None))
self.label_2.setText(QCoreApplication.translate("Form", u"Graphics System:", None))
self.label.setText(QCoreApplication.translate("Form", u"Qt Library:", None))
self.loadBtn.setText(QCoreApplication.translate("Form", u"Run Example", None))
self.loadedFileLabel.setText("")
# retranslateUi

View File

@ -2,6 +2,7 @@
## we do this to make sure that, when running examples, the correct library
## version is imported (if there are multiple versions present).
import sys, os
import importlib
if not hasattr(sys, 'frozen'):
if __file__ == '<stdin>':
@ -20,14 +21,10 @@ if not hasattr(sys, 'frozen'):
sys.path.insert(0, p)
## should force example to use PySide instead of PyQt
if 'pyside' in sys.argv:
from PySide import QtGui
elif 'pyqt' in sys.argv:
from PyQt4 import QtGui
elif 'pyqt5' in sys.argv:
from PyQt5 import QtGui
elif 'pyside2' in sys.argv:
from PySide2 import QtGui
for module in ['PyQt5', 'PySide2', 'PySide6', 'PyQt6']:
if module.lower() in sys.argv:
QtGui = importlib.import_module(module + '.QtGui')
break
else:
from pyqtgraph.Qt import QtGui

View File

@ -3,7 +3,7 @@ import time
import weakref
import warnings
from ..Qt import QtCore, QtGui
from ..Qt import QtCore, QtGui, isQObjectAlive
from ..Point import Point
from .. import functions as fn
from .. import ptime as ptime
@ -207,7 +207,7 @@ class GraphicsScene(QtGui.QGraphicsScene):
now = ptime.time()
init = False
## keep track of which buttons are involved in dragging
for btn in [QtCore.Qt.LeftButton, QtCore.Qt.MidButton, QtCore.Qt.RightButton]:
for btn in [QtCore.Qt.LeftButton, QtCore.Qt.MiddleButton, QtCore.Qt.RightButton]:
if int(ev.buttons() & btn) == 0:
continue
if int(btn) not in self.dragButtons: ## see if we've dragged far enough yet
@ -298,7 +298,9 @@ class GraphicsScene(QtGui.QGraphicsScene):
for item in prevItems:
event.currentItem = item
try:
if item.scene() is self:
# NOTE: isQObjectAlive(item) was added for PySide6 where
# verlet_chain_demo.py triggers a RuntimeError.
if isQObjectAlive(item) and item.scene() is self:
item.hoverEvent(event)
except:
debug.printExc("Error sending hover exit event:")

View File

@ -4,14 +4,9 @@ from .. import functions as fn
from ..graphicsItems.ViewBox import ViewBox
from ..graphicsItems.PlotItem import PlotItem
if QT_LIB == 'PySide':
from . import exportDialogTemplate_pyside as exportDialogTemplate
elif QT_LIB == 'PySide2':
from . import exportDialogTemplate_pyside2 as exportDialogTemplate
elif QT_LIB == 'PyQt5':
from . import exportDialogTemplate_pyqt5 as exportDialogTemplate
else:
from . import exportDialogTemplate_pyqt as exportDialogTemplate
import importlib
ui_template = importlib.import_module(
f'.exportDialogTemplate_{QT_LIB.lower()}', package=__package__)
class ExportDialog(QtGui.QWidget):
@ -28,7 +23,7 @@ class ExportDialog(QtGui.QWidget):
self.selectBox.hide()
self.scene.addItem(self.selectBox)
self.ui = exportDialogTemplate.Ui_Form()
self.ui = ui_template.Ui_Form()
self.ui.setupUi(self)
self.ui.closeBtn.clicked.connect(self.close)

View File

@ -0,0 +1,94 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'exportDialogTemplate.ui'
##
## Created by: Qt User Interface Compiler version 6.0.0
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *
from ..parametertree import ParameterTree
class Ui_Form(object):
def setupUi(self, Form):
if not Form.objectName():
Form.setObjectName(u"Form")
Form.resize(241, 367)
self.gridLayout = QGridLayout(Form)
self.gridLayout.setSpacing(0)
self.gridLayout.setObjectName(u"gridLayout")
self.label = QLabel(Form)
self.label.setObjectName(u"label")
self.gridLayout.addWidget(self.label, 0, 0, 1, 3)
self.itemTree = QTreeWidget(Form)
__qtreewidgetitem = QTreeWidgetItem()
__qtreewidgetitem.setText(0, u"1");
self.itemTree.setHeaderItem(__qtreewidgetitem)
self.itemTree.setObjectName(u"itemTree")
self.itemTree.header().setVisible(False)
self.gridLayout.addWidget(self.itemTree, 1, 0, 1, 3)
self.label_2 = QLabel(Form)
self.label_2.setObjectName(u"label_2")
self.gridLayout.addWidget(self.label_2, 2, 0, 1, 3)
self.formatList = QListWidget(Form)
self.formatList.setObjectName(u"formatList")
self.gridLayout.addWidget(self.formatList, 3, 0, 1, 3)
self.exportBtn = QPushButton(Form)
self.exportBtn.setObjectName(u"exportBtn")
self.gridLayout.addWidget(self.exportBtn, 6, 1, 1, 1)
self.closeBtn = QPushButton(Form)
self.closeBtn.setObjectName(u"closeBtn")
self.gridLayout.addWidget(self.closeBtn, 6, 2, 1, 1)
self.paramTree = ParameterTree(Form)
__qtreewidgetitem1 = QTreeWidgetItem()
__qtreewidgetitem1.setText(0, u"1");
self.paramTree.setHeaderItem(__qtreewidgetitem1)
self.paramTree.setObjectName(u"paramTree")
self.paramTree.header().setVisible(False)
self.gridLayout.addWidget(self.paramTree, 5, 0, 1, 3)
self.label_3 = QLabel(Form)
self.label_3.setObjectName(u"label_3")
self.gridLayout.addWidget(self.label_3, 4, 0, 1, 3)
self.copyBtn = QPushButton(Form)
self.copyBtn.setObjectName(u"copyBtn")
self.gridLayout.addWidget(self.copyBtn, 6, 0, 1, 1)
self.retranslateUi(Form)
QMetaObject.connectSlotsByName(Form)
# setupUi
def retranslateUi(self, Form):
Form.setWindowTitle(QCoreApplication.translate("Form", u"Export", None))
self.label.setText(QCoreApplication.translate("Form", u"Item to export:", None))
self.label_2.setText(QCoreApplication.translate("Form", u"Export format", None))
self.exportBtn.setText(QCoreApplication.translate("Form", u"Export", None))
self.closeBtn.setText(QCoreApplication.translate("Form", u"Close", None))
self.label_3.setText(QCoreApplication.translate("Form", u"Export options", None))
self.copyBtn.setText(QCoreApplication.translate("Form", u"Copy", None))
# retranslateUi

View File

@ -18,7 +18,7 @@ class MouseDragEvent(object):
self.currentItem = None
self._buttonDownScenePos = {}
self._buttonDownScreenPos = {}
for btn in [QtCore.Qt.LeftButton, QtCore.Qt.MidButton, QtCore.Qt.RightButton]:
for btn in [QtCore.Qt.LeftButton, QtCore.Qt.MiddleButton, QtCore.Qt.RightButton]:
self._buttonDownScenePos[int(btn)] = moveEvent.buttonDownScenePos(btn)
self._buttonDownScreenPos[int(btn)] = moveEvent.buttonDownScreenPos(btn)
self._scenePos = moveEvent.scenePos()

View File

@ -16,8 +16,10 @@ from .python2_3 import asUnicode
PYSIDE = 'PySide'
PYSIDE2 = 'PySide2'
PYSIDE6 = 'PySide6'
PYQT4 = 'PyQt4'
PYQT5 = 'PyQt5'
PYQT6 = 'PyQt6'
QT_LIB = os.getenv('PYQTGRAPH_QT_LIB')
@ -26,7 +28,7 @@ QT_LIB = os.getenv('PYQTGRAPH_QT_LIB')
## This is done by first checking to see whether one of the libraries
## is already imported. If not, then attempt to import PyQt4, then PySide.
if QT_LIB is None:
libOrder = [PYQT4, PYSIDE, PYQT5, PYSIDE2]
libOrder = [PYQT4, PYSIDE, PYQT5, PYSIDE2, PYSIDE6]
for lib in libOrder:
if lib in sys.modules:
@ -43,7 +45,7 @@ if QT_LIB is None:
pass
if QT_LIB is None:
raise Exception("PyQtGraph requires one of PyQt4, PyQt5, PySide or PySide2; none of these packages could be imported.")
raise Exception("PyQtGraph requires one of PyQt4, PyQt5, PySide, PySide2 or PySide6; none of these packages could be imported.")
class FailedImport(object):
@ -119,10 +121,12 @@ def _loadUiType(uiFile):
# convert ui file to python code
if pysideuic is None:
pyside2version = tuple(map(int, PySide2.__version__.split(".")))
if pyside2version >= (5, 14) and pyside2version < (5, 14, 2, 2):
warnings.warn('For UI compilation, it is recommended to upgrade to PySide >= 5.15')
uipy = subprocess.check_output(['pyside2-uic', uiFile])
if QT_LIB == PYSIDE2:
pyside2version = tuple(map(int, PySide2.__version__.split(".")))
if pyside2version >= (5, 14) and pyside2version < (5, 14, 2, 2):
warnings.warn('For UI compilation, it is recommended to upgrade to PySide >= 5.15')
uic_executable = QT_LIB.lower() + '-uic'
uipy = subprocess.check_output([uic_executable, uiFile])
else:
o = _StringIO()
with open(uiFile, 'r') as f:
@ -243,12 +247,38 @@ elif QT_LIB == PYSIDE2:
import PySide2
VERSION_INFO = 'PySide2 ' + PySide2.__version__ + ' Qt ' + QtCore.__version__
elif QT_LIB == PYSIDE6:
from PySide6 import QtGui, QtCore, QtWidgets
try:
from PySide6 import QtSvg
except ImportError as err:
QtSvg = FailedImport(err)
try:
from PySide6 import QtOpenGLWidgets
except ImportError as err:
QtOpenGLWidgets = FailedImport(err)
try:
from PySide6 import QtTest
QtTest.QTest.qWaitForWindowShown = QtTest.QTest.qWaitForWindowExposed
except ImportError as err:
QtTest = FailedImport(err)
try:
import shiboken6
isQObjectAlive = shiboken6.isValid
except ImportError:
# use approximate version
isQObjectAlive = _isQObjectAlive
import PySide6
VERSION_INFO = 'PySide6 ' + PySide6.__version__ + ' Qt ' + QtCore.__version__
else:
raise ValueError("Invalid Qt lib '%s'" % QT_LIB)
# common to PyQt5 and PySide2
if QT_LIB in [PYQT5, PYSIDE2]:
# common to PyQt5, PySide2 and PySide6
if QT_LIB in [PYQT5, PYSIDE2, PYSIDE6]:
# We're using Qt5 which has a different structure so we're going to use a shim to
# recreate the Qt4 structure
@ -299,8 +329,15 @@ if QT_LIB in [PYQT5, PYSIDE2]:
setattr(QtGui, o, getattr(QtWidgets,o) )
# Common to PySide and PySide2
if QT_LIB in [PYSIDE, PYSIDE2]:
if QT_LIB in [PYQT6, PYSIDE6]:
# We're using Qt6 which has a different structure so we're going to use a shim to
# recreate the Qt5 structure
QtWidgets.QOpenGLWidget = QtOpenGLWidgets.QOpenGLWidget
# Common to PySide, PySide2 and PySide6
if QT_LIB in [PYSIDE, PYSIDE2, PYSIDE6]:
QtVersion = QtCore.__version__
loadUiType = _loadUiType
@ -349,7 +386,7 @@ class App(QtGui.QApplication):
def __init__(self, *args, **kwargs):
super(App, self).__init__(*args, **kwargs)
if QT_LIB in ['PyQt5', 'PySide2']:
if QT_LIB in ['PyQt5', 'PySide2', 'PySide6']:
# qt4 does not have paletteChanged signal!
self.paletteChanged.connect(self.onPaletteChange)
self.onPaletteChange(self.palette())

View File

@ -5,14 +5,9 @@ from ..graphicsItems.ROI import ROI
from ..graphicsItems.ViewBox import ViewBox
from ..graphicsItems.GridItem import GridItem
if QT_LIB == 'PySide':
from .CanvasTemplate_pyside import *
elif QT_LIB == 'PyQt4':
from .CanvasTemplate_pyqt import *
elif QT_LIB == 'PySide2':
from .CanvasTemplate_pyside2 import *
elif QT_LIB == 'PyQt5':
from .CanvasTemplate_pyqt5 import *
import importlib
ui_template = importlib.import_module(
f'.CanvasTemplate_{QT_LIB.lower()}', package=__package__)
import numpy as np
from .. import debug
@ -30,7 +25,7 @@ class Canvas(QtGui.QWidget):
def __init__(self, parent=None, allowTransforms=True, hideCtrl=False, name=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_Form()
self.ui = ui_template.Ui_Form()
self.ui.setupUi(self)
self.view = ViewBox()
self.ui.view.setCentralItem(self.view)

View File

@ -3,14 +3,9 @@ import numpy as np
from ..Qt import QtGui, QtCore, QtSvg, QT_LIB
from ..graphicsItems.ROI import ROI
from .. import SRTTransform, ItemGroup
if QT_LIB == 'PySide':
from . import TransformGuiTemplate_pyside as TransformGuiTemplate
elif QT_LIB == 'PyQt4':
from . import TransformGuiTemplate_pyqt as TransformGuiTemplate
elif QT_LIB == 'PySide2':
from . import TransformGuiTemplate_pyside2 as TransformGuiTemplate
elif QT_LIB == 'PyQt5':
from . import TransformGuiTemplate_pyqt5 as TransformGuiTemplate
import importlib
ui_template = importlib.import_module(
f'.TransformGuiTemplate_{QT_LIB.lower()}', package=__package__)
from .. import debug
@ -78,7 +73,7 @@ class CanvasItem(QtCore.QObject):
self.pasteBtn = QtGui.QPushButton('Paste')
self.transformWidget = QtGui.QWidget()
self.transformGui = TransformGuiTemplate.Ui_Form()
self.transformGui = ui_template.Ui_Form()
self.transformGui.setupUi(self.transformWidget)
self.layout.addWidget(self.transformWidget, 3, 0, 1, 2)
self.transformGui.mirrorImageBtn.clicked.connect(self.mirrorY)

View File

@ -0,0 +1,126 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'CanvasTemplate.ui'
##
## Created by: Qt User Interface Compiler version 6.0.0
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *
from ..widgets.TreeWidget import TreeWidget
from ..widgets.GraphicsView import GraphicsView
from .CanvasManager import CanvasCombo
class Ui_Form(object):
def setupUi(self, Form):
if not Form.objectName():
Form.setObjectName(u"Form")
Form.resize(821, 578)
self.gridLayout_2 = QGridLayout(Form)
self.gridLayout_2.setSpacing(0)
self.gridLayout_2.setContentsMargins(0, 0, 0, 0)
self.gridLayout_2.setObjectName(u"gridLayout_2")
self.splitter = QSplitter(Form)
self.splitter.setObjectName(u"splitter")
self.splitter.setOrientation(Qt.Horizontal)
self.view = GraphicsView(self.splitter)
self.view.setObjectName(u"view")
self.splitter.addWidget(self.view)
self.vsplitter = QSplitter(self.splitter)
self.vsplitter.setObjectName(u"vsplitter")
self.vsplitter.setOrientation(Qt.Vertical)
self.canvasCtrlWidget = QWidget(self.vsplitter)
self.canvasCtrlWidget.setObjectName(u"canvasCtrlWidget")
self.gridLayout = QGridLayout(self.canvasCtrlWidget)
self.gridLayout.setObjectName(u"gridLayout")
self.autoRangeBtn = QPushButton(self.canvasCtrlWidget)
self.autoRangeBtn.setObjectName(u"autoRangeBtn")
sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(1)
sizePolicy.setHeightForWidth(self.autoRangeBtn.sizePolicy().hasHeightForWidth())
self.autoRangeBtn.setSizePolicy(sizePolicy)
self.gridLayout.addWidget(self.autoRangeBtn, 0, 0, 1, 2)
self.horizontalLayout = QHBoxLayout()
self.horizontalLayout.setSpacing(0)
self.horizontalLayout.setObjectName(u"horizontalLayout")
self.redirectCheck = QCheckBox(self.canvasCtrlWidget)
self.redirectCheck.setObjectName(u"redirectCheck")
self.horizontalLayout.addWidget(self.redirectCheck)
self.redirectCombo = CanvasCombo(self.canvasCtrlWidget)
self.redirectCombo.setObjectName(u"redirectCombo")
self.horizontalLayout.addWidget(self.redirectCombo)
self.gridLayout.addLayout(self.horizontalLayout, 1, 0, 1, 2)
self.itemList = TreeWidget(self.canvasCtrlWidget)
__qtreewidgetitem = QTreeWidgetItem()
__qtreewidgetitem.setText(0, u"1");
self.itemList.setHeaderItem(__qtreewidgetitem)
self.itemList.setObjectName(u"itemList")
sizePolicy1 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
sizePolicy1.setHorizontalStretch(0)
sizePolicy1.setVerticalStretch(100)
sizePolicy1.setHeightForWidth(self.itemList.sizePolicy().hasHeightForWidth())
self.itemList.setSizePolicy(sizePolicy1)
self.itemList.setHeaderHidden(True)
self.gridLayout.addWidget(self.itemList, 2, 0, 1, 2)
self.resetTransformsBtn = QPushButton(self.canvasCtrlWidget)
self.resetTransformsBtn.setObjectName(u"resetTransformsBtn")
self.gridLayout.addWidget(self.resetTransformsBtn, 3, 0, 1, 2)
self.mirrorSelectionBtn = QPushButton(self.canvasCtrlWidget)
self.mirrorSelectionBtn.setObjectName(u"mirrorSelectionBtn")
self.gridLayout.addWidget(self.mirrorSelectionBtn, 4, 0, 1, 1)
self.reflectSelectionBtn = QPushButton(self.canvasCtrlWidget)
self.reflectSelectionBtn.setObjectName(u"reflectSelectionBtn")
self.gridLayout.addWidget(self.reflectSelectionBtn, 4, 1, 1, 1)
self.vsplitter.addWidget(self.canvasCtrlWidget)
self.canvasItemCtrl = QWidget(self.vsplitter)
self.canvasItemCtrl.setObjectName(u"canvasItemCtrl")
self.ctrlLayout = QGridLayout(self.canvasItemCtrl)
self.ctrlLayout.setSpacing(0)
self.ctrlLayout.setContentsMargins(0, 0, 0, 0)
self.ctrlLayout.setObjectName(u"ctrlLayout")
self.vsplitter.addWidget(self.canvasItemCtrl)
self.splitter.addWidget(self.vsplitter)
self.gridLayout_2.addWidget(self.splitter, 0, 0, 1, 1)
self.retranslateUi(Form)
QMetaObject.connectSlotsByName(Form)
# setupUi
def retranslateUi(self, Form):
Form.setWindowTitle(QCoreApplication.translate("Form", u"PyQtGraph", None))
self.autoRangeBtn.setText(QCoreApplication.translate("Form", u"Auto Range", None))
#if QT_CONFIG(tooltip)
self.redirectCheck.setToolTip(QCoreApplication.translate("Form", u"Check to display all local items in a remote canvas.", None))
#endif // QT_CONFIG(tooltip)
self.redirectCheck.setText(QCoreApplication.translate("Form", u"Redirect", None))
self.resetTransformsBtn.setText(QCoreApplication.translate("Form", u"Reset Transforms", None))
self.mirrorSelectionBtn.setText(QCoreApplication.translate("Form", u"Mirror Selection", None))
self.reflectSelectionBtn.setText(QCoreApplication.translate("Form", u"MirrorXY", None))
# retranslateUi

View File

@ -0,0 +1,77 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'TransformGuiTemplate.ui'
##
## Created by: Qt User Interface Compiler version 6.0.0
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *
class Ui_Form(object):
def setupUi(self, Form):
if not Form.objectName():
Form.setObjectName(u"Form")
Form.resize(224, 117)
sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth())
Form.setSizePolicy(sizePolicy)
self.verticalLayout = QVBoxLayout(Form)
self.verticalLayout.setSpacing(1)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.verticalLayout.setObjectName(u"verticalLayout")
self.translateLabel = QLabel(Form)
self.translateLabel.setObjectName(u"translateLabel")
self.verticalLayout.addWidget(self.translateLabel)
self.rotateLabel = QLabel(Form)
self.rotateLabel.setObjectName(u"rotateLabel")
self.verticalLayout.addWidget(self.rotateLabel)
self.scaleLabel = QLabel(Form)
self.scaleLabel.setObjectName(u"scaleLabel")
self.verticalLayout.addWidget(self.scaleLabel)
self.horizontalLayout = QHBoxLayout()
self.horizontalLayout.setObjectName(u"horizontalLayout")
self.mirrorImageBtn = QPushButton(Form)
self.mirrorImageBtn.setObjectName(u"mirrorImageBtn")
self.horizontalLayout.addWidget(self.mirrorImageBtn)
self.reflectImageBtn = QPushButton(Form)
self.reflectImageBtn.setObjectName(u"reflectImageBtn")
self.horizontalLayout.addWidget(self.reflectImageBtn)
self.verticalLayout.addLayout(self.horizontalLayout)
self.retranslateUi(Form)
QMetaObject.connectSlotsByName(Form)
# setupUi
def retranslateUi(self, Form):
Form.setWindowTitle(QCoreApplication.translate("Form", u"PyQtGraph", None))
self.translateLabel.setText(QCoreApplication.translate("Form", u"Translate:", None))
self.rotateLabel.setText(QCoreApplication.translate("Form", u"Rotate:", None))
self.scaleLabel.setText(QCoreApplication.translate("Form", u"Scale:", None))
#if QT_CONFIG(tooltip)
self.mirrorImageBtn.setToolTip("")
#endif // QT_CONFIG(tooltip)
self.mirrorImageBtn.setText(QCoreApplication.translate("Form", u"Mirror", None))
self.reflectImageBtn.setText(QCoreApplication.translate("Form", u"Reflect", None))
# retranslateUi

View File

@ -359,7 +359,13 @@ class ColorMap(object):
pos, color = self.getStops(mode=self.BYTE)
color = [QtGui.QColor(*x) for x in color]
g.setStops(list(zip(pos, color)))
stops = zip(pos, color)
if hasattr(g, 'setStops'):
g.setStops(list(stops))
else:
# PySide6 has a missing setStops binding
for pos, col in stops:
g.setColorAt(pos, col)
return g
def getColors(self, mode=None):

View File

@ -7,14 +7,9 @@ from ..python2_3 import basestring
from .. import exceptionHandling as exceptionHandling
from .. import getConfigOption
from ..functions import SignalBlock
if QT_LIB == 'PySide':
from . import template_pyside as template
elif QT_LIB == 'PySide2':
from . import template_pyside2 as template
elif QT_LIB == 'PyQt5':
from . import template_pyqt5 as template
else:
from . import template_pyqt as template
import importlib
ui_template = importlib.import_module(
f'.template_{QT_LIB.lower()}', package=__package__)
class ConsoleWidget(QtGui.QWidget):
@ -60,7 +55,7 @@ class ConsoleWidget(QtGui.QWidget):
self.inCmd = False
self.frames = [] # stack frames to access when an item in the stack list is selected
self.ui = template.Ui_Form()
self.ui = ui_template.Ui_Form()
self.ui.setupUi(self)
self.output = self.ui.output
self.input = self.ui.input

View File

@ -0,0 +1,157 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'template.ui'
##
## Created by: Qt User Interface Compiler version 6.0.0
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *
from .CmdInput import CmdInput
class Ui_Form(object):
def setupUi(self, Form):
if not Form.objectName():
Form.setObjectName(u"Form")
Form.resize(739, 497)
self.gridLayout = QGridLayout(Form)
self.gridLayout.setSpacing(0)
self.gridLayout.setContentsMargins(0, 0, 0, 0)
self.gridLayout.setObjectName(u"gridLayout")
self.splitter = QSplitter(Form)
self.splitter.setObjectName(u"splitter")
self.splitter.setOrientation(Qt.Vertical)
self.layoutWidget = QWidget(self.splitter)
self.layoutWidget.setObjectName(u"layoutWidget")
self.verticalLayout = QVBoxLayout(self.layoutWidget)
self.verticalLayout.setObjectName(u"verticalLayout")
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.output = QPlainTextEdit(self.layoutWidget)
self.output.setObjectName(u"output")
font = QFont()
font.setFamily(u"Monospace")
self.output.setFont(font)
self.output.setReadOnly(True)
self.verticalLayout.addWidget(self.output)
self.horizontalLayout = QHBoxLayout()
self.horizontalLayout.setObjectName(u"horizontalLayout")
self.input = CmdInput(self.layoutWidget)
self.input.setObjectName(u"input")
self.horizontalLayout.addWidget(self.input)
self.historyBtn = QPushButton(self.layoutWidget)
self.historyBtn.setObjectName(u"historyBtn")
self.historyBtn.setCheckable(True)
self.horizontalLayout.addWidget(self.historyBtn)
self.exceptionBtn = QPushButton(self.layoutWidget)
self.exceptionBtn.setObjectName(u"exceptionBtn")
self.exceptionBtn.setCheckable(True)
self.horizontalLayout.addWidget(self.exceptionBtn)
self.verticalLayout.addLayout(self.horizontalLayout)
self.splitter.addWidget(self.layoutWidget)
self.historyList = QListWidget(self.splitter)
self.historyList.setObjectName(u"historyList")
self.historyList.setFont(font)
self.splitter.addWidget(self.historyList)
self.exceptionGroup = QGroupBox(self.splitter)
self.exceptionGroup.setObjectName(u"exceptionGroup")
self.gridLayout_2 = QGridLayout(self.exceptionGroup)
self.gridLayout_2.setObjectName(u"gridLayout_2")
self.gridLayout_2.setHorizontalSpacing(2)
self.gridLayout_2.setVerticalSpacing(0)
self.gridLayout_2.setContentsMargins(-1, 0, -1, 0)
self.clearExceptionBtn = QPushButton(self.exceptionGroup)
self.clearExceptionBtn.setObjectName(u"clearExceptionBtn")
self.clearExceptionBtn.setEnabled(False)
self.gridLayout_2.addWidget(self.clearExceptionBtn, 0, 6, 1, 1)
self.catchAllExceptionsBtn = QPushButton(self.exceptionGroup)
self.catchAllExceptionsBtn.setObjectName(u"catchAllExceptionsBtn")
self.catchAllExceptionsBtn.setCheckable(True)
self.gridLayout_2.addWidget(self.catchAllExceptionsBtn, 0, 1, 1, 1)
self.catchNextExceptionBtn = QPushButton(self.exceptionGroup)
self.catchNextExceptionBtn.setObjectName(u"catchNextExceptionBtn")
self.catchNextExceptionBtn.setCheckable(True)
self.gridLayout_2.addWidget(self.catchNextExceptionBtn, 0, 0, 1, 1)
self.onlyUncaughtCheck = QCheckBox(self.exceptionGroup)
self.onlyUncaughtCheck.setObjectName(u"onlyUncaughtCheck")
self.onlyUncaughtCheck.setChecked(True)
self.gridLayout_2.addWidget(self.onlyUncaughtCheck, 0, 4, 1, 1)
self.exceptionStackList = QListWidget(self.exceptionGroup)
self.exceptionStackList.setObjectName(u"exceptionStackList")
self.exceptionStackList.setAlternatingRowColors(True)
self.gridLayout_2.addWidget(self.exceptionStackList, 2, 0, 1, 7)
self.runSelectedFrameCheck = QCheckBox(self.exceptionGroup)
self.runSelectedFrameCheck.setObjectName(u"runSelectedFrameCheck")
self.runSelectedFrameCheck.setChecked(True)
self.gridLayout_2.addWidget(self.runSelectedFrameCheck, 3, 0, 1, 7)
self.exceptionInfoLabel = QLabel(self.exceptionGroup)
self.exceptionInfoLabel.setObjectName(u"exceptionInfoLabel")
self.exceptionInfoLabel.setWordWrap(True)
self.gridLayout_2.addWidget(self.exceptionInfoLabel, 1, 0, 1, 7)
self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
self.gridLayout_2.addItem(self.horizontalSpacer, 0, 5, 1, 1)
self.label = QLabel(self.exceptionGroup)
self.label.setObjectName(u"label")
self.gridLayout_2.addWidget(self.label, 0, 2, 1, 1)
self.filterText = QLineEdit(self.exceptionGroup)
self.filterText.setObjectName(u"filterText")
self.gridLayout_2.addWidget(self.filterText, 0, 3, 1, 1)
self.splitter.addWidget(self.exceptionGroup)
self.gridLayout.addWidget(self.splitter, 0, 0, 1, 1)
self.retranslateUi(Form)
QMetaObject.connectSlotsByName(Form)
# setupUi
def retranslateUi(self, Form):
Form.setWindowTitle(QCoreApplication.translate("Form", u"Console", None))
self.historyBtn.setText(QCoreApplication.translate("Form", u"History..", None))
self.exceptionBtn.setText(QCoreApplication.translate("Form", u"Exceptions..", None))
self.exceptionGroup.setTitle(QCoreApplication.translate("Form", u"Exception Handling", None))
self.clearExceptionBtn.setText(QCoreApplication.translate("Form", u"Clear Stack", None))
self.catchAllExceptionsBtn.setText(QCoreApplication.translate("Form", u"Show All Exceptions", None))
self.catchNextExceptionBtn.setText(QCoreApplication.translate("Form", u"Show Next Exception", None))
self.onlyUncaughtCheck.setText(QCoreApplication.translate("Form", u"Only Uncaught Exceptions", None))
self.runSelectedFrameCheck.setText(QCoreApplication.translate("Form", u"Run commands in selected stack frame", None))
self.exceptionInfoLabel.setText(QCoreApplication.translate("Form", u"Stack Trace", None))
self.label.setText(QCoreApplication.translate("Form", u"Filter (regex):", None))
# retranslateUi

View File

@ -45,7 +45,7 @@ class PrintExporter(Exporter):
#res = printer.resolution()
sr = self.getSourceRect()
#res = sr.width() * .4 / (self.params['width'] * 100 / 2.54)
res = QtGui.QDesktopWidget().physicalDpiX()
res = QtGui.QGuiApplication.primaryScreen().physicalDotsPerInchX()
printer.setResolution(res)
rect = printer.pageRect()
center = rect.center()

View File

@ -195,7 +195,7 @@ def _generateItemSvg(item, nodes=None, root=None, options={}):
buf = QtCore.QBuffer(arr)
svg = QtSvg.QSvgGenerator()
svg.setOutputDevice(buf)
dpi = QtGui.QDesktopWidget().logicalDpiX()
dpi = QtGui.QGuiApplication.primaryScreen().logicalDotsPerInchX()
svg.setResolution(dpi)
p = QtGui.QPainter()

View File

@ -6,7 +6,16 @@ pytest.importorskip("matplotlib")
app = pg.mkQApp()
skip_qt6 = pytest.mark.skipif(
pg.QT_LIB == "PySide6",
reason= (
"Matplotlib has no Qt6 support yet, "
"see https://github.com/matplotlib/matplotlib/pull/19255"
)
)
@skip_qt6
def test_MatplotlibExporter():
plt = pg.plot()
@ -20,7 +29,7 @@ def test_MatplotlibExporter():
exp = MatplotlibExporter(plt.getPlotItem())
exp.export()
@skip_qt6
def test_MatplotlibExporter_nonplotitem():
# attempting to export something other than a PlotItem raises an exception
plt = pg.plot()
@ -29,7 +38,7 @@ def test_MatplotlibExporter_nonplotitem():
with pytest.raises(Exception):
exp.export()
@skip_qt6
@pytest.mark.parametrize('scale', [1e10, 1e-9])
def test_MatplotlibExporter_siscale(scale):
# coarse test to verify that plot data is scaled before export when

View File

@ -5,19 +5,9 @@ from ..pgcollections import OrderedDict
from ..widgets.TreeWidget import *
from .. import FileDialog, DataTreeWidget
## pyside and pyqt use incompatible ui files.
if QT_LIB == 'PySide':
from . import FlowchartTemplate_pyside as FlowchartTemplate
from . import FlowchartCtrlTemplate_pyside as FlowchartCtrlTemplate
elif QT_LIB == 'PySide2':
from . import FlowchartTemplate_pyside2 as FlowchartTemplate
from . import FlowchartCtrlTemplate_pyside2 as FlowchartCtrlTemplate
elif QT_LIB == 'PyQt5':
from . import FlowchartTemplate_pyqt5 as FlowchartTemplate
from . import FlowchartCtrlTemplate_pyqt5 as FlowchartCtrlTemplate
else:
from . import FlowchartTemplate_pyqt as FlowchartTemplate
from . import FlowchartCtrlTemplate_pyqt as FlowchartCtrlTemplate
import importlib
FlowchartCtrlTemplate = importlib.import_module(
f'.FlowchartCtrlTemplate_{QT_LIB.lower()}', package=__package__)
from .Terminal import Terminal
from numpy import ndarray

View File

@ -89,7 +89,6 @@
<widget class="QLabel" name="fileNameLabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>

View File

@ -0,0 +1,90 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'FlowchartCtrlTemplate.ui'
##
## Created by: Qt User Interface Compiler version 6.0.0
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *
from ..widgets.TreeWidget import TreeWidget
from ..widgets.FeedbackButton import FeedbackButton
class Ui_Form(object):
def setupUi(self, Form):
if not Form.objectName():
Form.setObjectName(u"Form")
Form.resize(217, 499)
self.gridLayout = QGridLayout(Form)
self.gridLayout.setContentsMargins(0, 0, 0, 0)
self.gridLayout.setObjectName(u"gridLayout")
self.gridLayout.setVerticalSpacing(0)
self.loadBtn = QPushButton(Form)
self.loadBtn.setObjectName(u"loadBtn")
self.gridLayout.addWidget(self.loadBtn, 1, 0, 1, 1)
self.saveBtn = FeedbackButton(Form)
self.saveBtn.setObjectName(u"saveBtn")
self.gridLayout.addWidget(self.saveBtn, 1, 1, 1, 2)
self.saveAsBtn = FeedbackButton(Form)
self.saveAsBtn.setObjectName(u"saveAsBtn")
self.gridLayout.addWidget(self.saveAsBtn, 1, 3, 1, 1)
self.reloadBtn = FeedbackButton(Form)
self.reloadBtn.setObjectName(u"reloadBtn")
self.reloadBtn.setCheckable(False)
self.reloadBtn.setFlat(False)
self.gridLayout.addWidget(self.reloadBtn, 4, 0, 1, 2)
self.showChartBtn = QPushButton(Form)
self.showChartBtn.setObjectName(u"showChartBtn")
self.showChartBtn.setCheckable(True)
self.gridLayout.addWidget(self.showChartBtn, 4, 2, 1, 2)
self.ctrlList = TreeWidget(Form)
__qtreewidgetitem = QTreeWidgetItem()
__qtreewidgetitem.setText(0, u"1");
self.ctrlList.setHeaderItem(__qtreewidgetitem)
self.ctrlList.setObjectName(u"ctrlList")
self.ctrlList.header().setVisible(False)
self.ctrlList.header().setStretchLastSection(False)
self.gridLayout.addWidget(self.ctrlList, 3, 0, 1, 4)
self.fileNameLabel = QLabel(Form)
self.fileNameLabel.setObjectName(u"fileNameLabel")
font = QFont()
font.setBold(True)
self.fileNameLabel.setFont(font)
self.fileNameLabel.setAlignment(Qt.AlignCenter)
self.gridLayout.addWidget(self.fileNameLabel, 0, 1, 1, 1)
self.retranslateUi(Form)
QMetaObject.connectSlotsByName(Form)
# setupUi
def retranslateUi(self, Form):
Form.setWindowTitle(QCoreApplication.translate("Form", u"PyQtGraph", None))
self.loadBtn.setText(QCoreApplication.translate("Form", u"Load..", None))
self.saveBtn.setText(QCoreApplication.translate("Form", u"Save", None))
self.saveAsBtn.setText(QCoreApplication.translate("Form", u"As..", None))
self.reloadBtn.setText(QCoreApplication.translate("Form", u"Reload Libs", None))
self.showChartBtn.setText(QCoreApplication.translate("Form", u"Flowchart", None))
self.fileNameLabel.setText("")
# retranslateUi

View File

@ -40,7 +40,6 @@
<widget class="QLabel" name="selNameLabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>

View File

@ -0,0 +1,69 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'FlowchartTemplate.ui'
##
## Created by: Qt User Interface Compiler version 6.0.0
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *
from ..widgets.DataTreeWidget import DataTreeWidget
from ..flowchart.FlowchartGraphicsView import FlowchartGraphicsView
class Ui_Form(object):
def setupUi(self, Form):
if not Form.objectName():
Form.setObjectName(u"Form")
Form.resize(529, 329)
self.selInfoWidget = QWidget(Form)
self.selInfoWidget.setObjectName(u"selInfoWidget")
self.selInfoWidget.setGeometry(QRect(260, 10, 264, 222))
self.gridLayout = QGridLayout(self.selInfoWidget)
self.gridLayout.setObjectName(u"gridLayout")
self.selDescLabel = QLabel(self.selInfoWidget)
self.selDescLabel.setObjectName(u"selDescLabel")
self.selDescLabel.setAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignTop)
self.selDescLabel.setWordWrap(True)
self.gridLayout.addWidget(self.selDescLabel, 0, 0, 1, 1)
self.selNameLabel = QLabel(self.selInfoWidget)
self.selNameLabel.setObjectName(u"selNameLabel")
font = QFont()
font.setBold(True)
self.selNameLabel.setFont(font)
self.gridLayout.addWidget(self.selNameLabel, 0, 1, 1, 1)
self.selectedTree = DataTreeWidget(self.selInfoWidget)
__qtreewidgetitem = QTreeWidgetItem()
__qtreewidgetitem.setText(0, u"1");
self.selectedTree.setHeaderItem(__qtreewidgetitem)
self.selectedTree.setObjectName(u"selectedTree")
self.gridLayout.addWidget(self.selectedTree, 1, 0, 1, 2)
self.hoverText = QTextEdit(Form)
self.hoverText.setObjectName(u"hoverText")
self.hoverText.setGeometry(QRect(0, 240, 521, 81))
self.view = FlowchartGraphicsView(Form)
self.view.setObjectName(u"view")
self.view.setGeometry(QRect(0, 0, 256, 192))
self.retranslateUi(Form)
QMetaObject.connectSlotsByName(Form)
# setupUi
def retranslateUi(self, Form):
Form.setWindowTitle(QCoreApplication.translate("Form", u"PyQtGraph", None))
self.selDescLabel.setText("")
self.selNameLabel.setText("")
# retranslateUi

View File

@ -1260,9 +1260,11 @@ def makeQImage(imgData, alpha=None, copy=True, transpose=True):
if copy is True and copied is False:
imgData = imgData.copy()
if QT_LIB in ['PySide', 'PySide2']:
if QT_LIB == 'PySide':
ch = ctypes.c_char.from_buffer(imgData, 0)
img = QtGui.QImage(ch, imgData.shape[1], imgData.shape[0], imgFormat)
elif QT_LIB in ['PySide2', 'PySide6']:
img = QtGui.QImage(imgData, imgData.shape[1], imgData.shape[0], imgFormat)
else:
## PyQt API for QImage changed between 4.9.3 and 4.9.6 (I don't know exactly which version it was)
## So we first attempt the 4.9.6 API, then fall back to 4.9.3
@ -1288,7 +1290,7 @@ def imageToArray(img, copy=False, transpose=True):
"""
fmt = img.format()
ptr = img.bits()
if QT_LIB in ['PySide', 'PySide2']:
if QT_LIB in ['PySide', 'PySide2', 'PySide6']:
arr = np.frombuffer(ptr, dtype=np.ubyte)
else:
ptr.setsize(img.byteCount())

View File

@ -626,9 +626,10 @@ class GradientEditorItem(TickSliderItem):
def getGradient(self):
"""Return a QLinearGradient object."""
g = QtGui.QLinearGradient(QtCore.QPointF(0,0), QtCore.QPointF(self.length,0))
stops = []
if self.colorMode == 'rgb':
ticks = self.listTicks()
g.setStops([(x, QtGui.QColor(t.color)) for t,x in ticks])
stops = [(x, QtGui.QColor(t.color)) for t,x in ticks]
elif self.colorMode == 'hsv': ## HSV mode is approximated for display by interpolating 10 points between each stop
ticks = self.listTicks()
stops = []
@ -641,7 +642,12 @@ class GradientEditorItem(TickSliderItem):
x = x1 + dx*j
stops.append((x, self.getColor(x)))
stops.append((x2, self.getColor(x2)))
if hasattr(g, 'setStops'):
g.setStops(stops)
else:
# PySide6 has a missing setStops binding
for pos, col in stops:
g.setColorAt(pos, col)
return g
def getColor(self, x, toQColor=True):

View File

@ -19,14 +19,9 @@ from .. InfiniteLine import InfiniteLine
from ...WidgetGroup import WidgetGroup
from ...python2_3 import basestring
if QT_LIB == 'PyQt4':
from .plotConfigTemplate_pyqt import *
elif QT_LIB == 'PySide':
from .plotConfigTemplate_pyside import *
elif QT_LIB == 'PyQt5':
from .plotConfigTemplate_pyqt5 import *
elif QT_LIB == 'PySide2':
from .plotConfigTemplate_pyside2 import *
import importlib
ui_template = importlib.import_module(
f'.plotConfigTemplate_{QT_LIB.lower()}', package=__package__)
__all__ = ['PlotItem']
@ -189,7 +184,7 @@ class PlotItem(GraphicsWidget):
### Set up context menu
w = QtGui.QWidget()
self.ctrl = c = Ui_Form()
self.ctrl = c = ui_template.Ui_Form()
c.setupUi(w)
dv = QtGui.QDoubleValidator(self)

View File

@ -0,0 +1,254 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'plotConfigTemplate.ui'
##
## Created by: Qt User Interface Compiler version 6.0.0
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *
class Ui_Form(object):
def setupUi(self, Form):
if not Form.objectName():
Form.setObjectName(u"Form")
Form.resize(481, 840)
self.averageGroup = QGroupBox(Form)
self.averageGroup.setObjectName(u"averageGroup")
self.averageGroup.setGeometry(QRect(0, 640, 242, 182))
self.averageGroup.setCheckable(True)
self.averageGroup.setChecked(False)
self.gridLayout_5 = QGridLayout(self.averageGroup)
self.gridLayout_5.setSpacing(0)
self.gridLayout_5.setContentsMargins(0, 0, 0, 0)
self.gridLayout_5.setObjectName(u"gridLayout_5")
self.avgParamList = QListWidget(self.averageGroup)
self.avgParamList.setObjectName(u"avgParamList")
self.gridLayout_5.addWidget(self.avgParamList, 0, 0, 1, 1)
self.decimateGroup = QFrame(Form)
self.decimateGroup.setObjectName(u"decimateGroup")
self.decimateGroup.setGeometry(QRect(10, 140, 191, 171))
self.gridLayout_4 = QGridLayout(self.decimateGroup)
self.gridLayout_4.setSpacing(0)
self.gridLayout_4.setContentsMargins(0, 0, 0, 0)
self.gridLayout_4.setObjectName(u"gridLayout_4")
self.clipToViewCheck = QCheckBox(self.decimateGroup)
self.clipToViewCheck.setObjectName(u"clipToViewCheck")
self.gridLayout_4.addWidget(self.clipToViewCheck, 7, 0, 1, 3)
self.maxTracesCheck = QCheckBox(self.decimateGroup)
self.maxTracesCheck.setObjectName(u"maxTracesCheck")
self.gridLayout_4.addWidget(self.maxTracesCheck, 8, 0, 1, 2)
self.downsampleCheck = QCheckBox(self.decimateGroup)
self.downsampleCheck.setObjectName(u"downsampleCheck")
self.gridLayout_4.addWidget(self.downsampleCheck, 0, 0, 1, 3)
self.peakRadio = QRadioButton(self.decimateGroup)
self.peakRadio.setObjectName(u"peakRadio")
self.peakRadio.setChecked(True)
self.gridLayout_4.addWidget(self.peakRadio, 6, 1, 1, 2)
self.maxTracesSpin = QSpinBox(self.decimateGroup)
self.maxTracesSpin.setObjectName(u"maxTracesSpin")
self.gridLayout_4.addWidget(self.maxTracesSpin, 8, 2, 1, 1)
self.forgetTracesCheck = QCheckBox(self.decimateGroup)
self.forgetTracesCheck.setObjectName(u"forgetTracesCheck")
self.gridLayout_4.addWidget(self.forgetTracesCheck, 9, 0, 1, 3)
self.meanRadio = QRadioButton(self.decimateGroup)
self.meanRadio.setObjectName(u"meanRadio")
self.gridLayout_4.addWidget(self.meanRadio, 3, 1, 1, 2)
self.subsampleRadio = QRadioButton(self.decimateGroup)
self.subsampleRadio.setObjectName(u"subsampleRadio")
self.gridLayout_4.addWidget(self.subsampleRadio, 2, 1, 1, 2)
self.autoDownsampleCheck = QCheckBox(self.decimateGroup)
self.autoDownsampleCheck.setObjectName(u"autoDownsampleCheck")
self.autoDownsampleCheck.setChecked(True)
self.gridLayout_4.addWidget(self.autoDownsampleCheck, 1, 2, 1, 1)
self.horizontalSpacer = QSpacerItem(30, 20, QSizePolicy.Maximum, QSizePolicy.Minimum)
self.gridLayout_4.addItem(self.horizontalSpacer, 2, 0, 1, 1)
self.downsampleSpin = QSpinBox(self.decimateGroup)
self.downsampleSpin.setObjectName(u"downsampleSpin")
self.downsampleSpin.setMinimum(1)
self.downsampleSpin.setMaximum(100000)
self.downsampleSpin.setValue(1)
self.gridLayout_4.addWidget(self.downsampleSpin, 1, 1, 1, 1)
self.transformGroup = QFrame(Form)
self.transformGroup.setObjectName(u"transformGroup")
self.transformGroup.setGeometry(QRect(10, 10, 171, 101))
self.gridLayout = QGridLayout(self.transformGroup)
self.gridLayout.setSpacing(0)
self.gridLayout.setContentsMargins(0, 0, 0, 0)
self.gridLayout.setObjectName(u"gridLayout")
self.logYCheck = QCheckBox(self.transformGroup)
self.logYCheck.setObjectName(u"logYCheck")
self.gridLayout.addWidget(self.logYCheck, 2, 0, 1, 1)
self.logXCheck = QCheckBox(self.transformGroup)
self.logXCheck.setObjectName(u"logXCheck")
self.gridLayout.addWidget(self.logXCheck, 1, 0, 1, 1)
self.fftCheck = QCheckBox(self.transformGroup)
self.fftCheck.setObjectName(u"fftCheck")
self.gridLayout.addWidget(self.fftCheck, 0, 0, 1, 1)
self.derivativeCheck = QCheckBox(self.transformGroup)
self.derivativeCheck.setObjectName(u"derivativeCheck")
self.gridLayout.addWidget(self.derivativeCheck, 3, 0, 1, 1)
self.phasemapCheck = QCheckBox(self.transformGroup)
self.phasemapCheck.setObjectName(u"phasemapCheck")
self.gridLayout.addWidget(self.phasemapCheck, 4, 0, 1, 1)
self.pointsGroup = QGroupBox(Form)
self.pointsGroup.setObjectName(u"pointsGroup")
self.pointsGroup.setGeometry(QRect(10, 550, 234, 58))
self.pointsGroup.setCheckable(True)
self.verticalLayout_5 = QVBoxLayout(self.pointsGroup)
self.verticalLayout_5.setObjectName(u"verticalLayout_5")
self.autoPointsCheck = QCheckBox(self.pointsGroup)
self.autoPointsCheck.setObjectName(u"autoPointsCheck")
self.autoPointsCheck.setChecked(True)
self.verticalLayout_5.addWidget(self.autoPointsCheck)
self.gridGroup = QFrame(Form)
self.gridGroup.setObjectName(u"gridGroup")
self.gridGroup.setGeometry(QRect(10, 460, 221, 81))
self.gridLayout_2 = QGridLayout(self.gridGroup)
self.gridLayout_2.setObjectName(u"gridLayout_2")
self.xGridCheck = QCheckBox(self.gridGroup)
self.xGridCheck.setObjectName(u"xGridCheck")
self.gridLayout_2.addWidget(self.xGridCheck, 0, 0, 1, 2)
self.yGridCheck = QCheckBox(self.gridGroup)
self.yGridCheck.setObjectName(u"yGridCheck")
self.gridLayout_2.addWidget(self.yGridCheck, 1, 0, 1, 2)
self.gridAlphaSlider = QSlider(self.gridGroup)
self.gridAlphaSlider.setObjectName(u"gridAlphaSlider")
self.gridAlphaSlider.setMaximum(255)
self.gridAlphaSlider.setValue(128)
self.gridAlphaSlider.setOrientation(Qt.Horizontal)
self.gridLayout_2.addWidget(self.gridAlphaSlider, 2, 1, 1, 1)
self.label = QLabel(self.gridGroup)
self.label.setObjectName(u"label")
self.gridLayout_2.addWidget(self.label, 2, 0, 1, 1)
self.alphaGroup = QGroupBox(Form)
self.alphaGroup.setObjectName(u"alphaGroup")
self.alphaGroup.setGeometry(QRect(10, 390, 234, 60))
self.alphaGroup.setCheckable(True)
self.horizontalLayout = QHBoxLayout(self.alphaGroup)
self.horizontalLayout.setObjectName(u"horizontalLayout")
self.autoAlphaCheck = QCheckBox(self.alphaGroup)
self.autoAlphaCheck.setObjectName(u"autoAlphaCheck")
self.autoAlphaCheck.setChecked(False)
self.horizontalLayout.addWidget(self.autoAlphaCheck)
self.alphaSlider = QSlider(self.alphaGroup)
self.alphaSlider.setObjectName(u"alphaSlider")
self.alphaSlider.setMaximum(1000)
self.alphaSlider.setValue(1000)
self.alphaSlider.setOrientation(Qt.Horizontal)
self.horizontalLayout.addWidget(self.alphaSlider)
self.retranslateUi(Form)
QMetaObject.connectSlotsByName(Form)
# setupUi
def retranslateUi(self, Form):
Form.setWindowTitle(QCoreApplication.translate("Form", u"PyQtGraph", None))
#if QT_CONFIG(tooltip)
self.averageGroup.setToolTip(QCoreApplication.translate("Form", u"Display averages of the curves displayed in this plot. The parameter list allows you to choose parameters to average over (if any are available).", None))
#endif // QT_CONFIG(tooltip)
self.averageGroup.setTitle(QCoreApplication.translate("Form", u"Average", None))
#if QT_CONFIG(tooltip)
self.clipToViewCheck.setToolTip(QCoreApplication.translate("Form", u"Plot only the portion of each curve that is visible. This assumes X values are uniformly spaced.", None))
#endif // QT_CONFIG(tooltip)
self.clipToViewCheck.setText(QCoreApplication.translate("Form", u"Clip to View", None))
#if QT_CONFIG(tooltip)
self.maxTracesCheck.setToolTip(QCoreApplication.translate("Form", u"If multiple curves are displayed in this plot, check this box to limit the number of traces that are displayed.", None))
#endif // QT_CONFIG(tooltip)
self.maxTracesCheck.setText(QCoreApplication.translate("Form", u"Max Traces:", None))
self.downsampleCheck.setText(QCoreApplication.translate("Form", u"Downsample", None))
#if QT_CONFIG(tooltip)
self.peakRadio.setToolTip(QCoreApplication.translate("Form", u"Downsample by drawing a saw wave that follows the min and max of the original data. This method produces the best visual representation of the data but is slower.", None))
#endif // QT_CONFIG(tooltip)
self.peakRadio.setText(QCoreApplication.translate("Form", u"Peak", None))
#if QT_CONFIG(tooltip)
self.maxTracesSpin.setToolTip(QCoreApplication.translate("Form", u"If multiple curves are displayed in this plot, check \"Max Traces\" and set this value to limit the number of traces that are displayed.", None))
#endif // QT_CONFIG(tooltip)
#if QT_CONFIG(tooltip)
self.forgetTracesCheck.setToolTip(QCoreApplication.translate("Form", u"If MaxTraces is checked, remove curves from memory after they are hidden (saves memory, but traces can not be un-hidden).", None))
#endif // QT_CONFIG(tooltip)
self.forgetTracesCheck.setText(QCoreApplication.translate("Form", u"Forget hidden traces", None))
#if QT_CONFIG(tooltip)
self.meanRadio.setToolTip(QCoreApplication.translate("Form", u"Downsample by taking the mean of N samples.", None))
#endif // QT_CONFIG(tooltip)
self.meanRadio.setText(QCoreApplication.translate("Form", u"Mean", None))
#if QT_CONFIG(tooltip)
self.subsampleRadio.setToolTip(QCoreApplication.translate("Form", u"Downsample by taking the first of N samples. This method is fastest and least accurate.", None))
#endif // QT_CONFIG(tooltip)
self.subsampleRadio.setText(QCoreApplication.translate("Form", u"Subsample", None))
#if QT_CONFIG(tooltip)
self.autoDownsampleCheck.setToolTip(QCoreApplication.translate("Form", u"Automatically downsample data based on the visible range. This assumes X values are uniformly spaced.", None))
#endif // QT_CONFIG(tooltip)
self.autoDownsampleCheck.setText(QCoreApplication.translate("Form", u"Auto", None))
#if QT_CONFIG(tooltip)
self.downsampleSpin.setToolTip(QCoreApplication.translate("Form", u"Downsample data before plotting. (plot every Nth sample)", None))
#endif // QT_CONFIG(tooltip)
self.downsampleSpin.setSuffix(QCoreApplication.translate("Form", u"x", None))
self.logYCheck.setText(QCoreApplication.translate("Form", u"Log Y", None))
self.logXCheck.setText(QCoreApplication.translate("Form", u"Log X", None))
self.fftCheck.setText(QCoreApplication.translate("Form", u"Power Spectrum (FFT)", None))
self.derivativeCheck.setText(QCoreApplication.translate("Form", u"dy/dx", None))
self.phasemapCheck.setText(QCoreApplication.translate("Form", u"Y vs. Y'", None))
self.pointsGroup.setTitle(QCoreApplication.translate("Form", u"Points", None))
self.autoPointsCheck.setText(QCoreApplication.translate("Form", u"Auto", None))
self.xGridCheck.setText(QCoreApplication.translate("Form", u"Show X Grid", None))
self.yGridCheck.setText(QCoreApplication.translate("Form", u"Show Y Grid", None))
self.label.setText(QCoreApplication.translate("Form", u"Opacity", None))
self.alphaGroup.setTitle(QCoreApplication.translate("Form", u"Alpha", None))
self.autoAlphaCheck.setText(QCoreApplication.translate("Form", u"Auto", None))
# retranslateUi

View File

@ -721,7 +721,7 @@ class ROI(GraphicsObject):
if self.translatable and ev.acceptDrags(QtCore.Qt.LeftButton):
hover=True
for btn in [QtCore.Qt.LeftButton, QtCore.Qt.RightButton, QtCore.Qt.MidButton]:
for btn in [QtCore.Qt.LeftButton, QtCore.Qt.RightButton, QtCore.Qt.MiddleButton]:
if int(self.acceptedMouseButtons() & btn) > 0 and ev.acceptClicks(btn):
hover=True
if self.contextMenuEnabled():
@ -731,7 +731,7 @@ class ROI(GraphicsObject):
self.setMouseHover(True)
ev.acceptClicks(QtCore.Qt.LeftButton) ## If the ROI is hilighted, we should accept all clicks to avoid confusion.
ev.acceptClicks(QtCore.Qt.RightButton)
ev.acceptClicks(QtCore.Qt.MidButton)
ev.acceptClicks(QtCore.Qt.MiddleButton)
self.sigHoverEvent.emit(self)
else:
self.setMouseHover(False)
@ -1342,7 +1342,7 @@ class Handle(UIGraphicsItem):
if not ev.isExit():
if ev.acceptDrags(QtCore.Qt.LeftButton):
hover=True
for btn in [QtCore.Qt.LeftButton, QtCore.Qt.RightButton, QtCore.Qt.MidButton]:
for btn in [QtCore.Qt.LeftButton, QtCore.Qt.RightButton, QtCore.Qt.MiddleButton]:
if int(self.acceptedMouseButtons() & btn) > 0 and ev.acceptClicks(btn):
hover=True

View File

@ -34,7 +34,7 @@ __all__ = ['ScatterPlotItem', 'SpotItem']
# as the separate calls to this method are the current bottleneck.
# See: https://bugreports.qt.io/browse/PYSIDE-163
_USE_QRECT = QT_LIB != 'PySide2'
_USE_QRECT = QT_LIB not in ['PySide2', 'PySide6']
## Build all symbol paths
name_list = ['o', 's', 't', 't1', 't2', 't3', 'd', '+', 'x', 'p', 'h', 'star',

View File

@ -1243,7 +1243,7 @@ class ViewBox(GraphicsWidget):
mask[1-axis] = 0.0
## Scale or translate based on mouse button
if ev.button() & (QtCore.Qt.LeftButton | QtCore.Qt.MidButton):
if ev.button() & (QtCore.Qt.LeftButton | QtCore.Qt.MiddleButton):
if self.state['mouseMode'] == ViewBox.RectMode and axis is None:
if ev.isFinish(): ## This is the final move in the drag; change the view scale now
#print "finish"

View File

@ -3,14 +3,9 @@ from ...Qt import QtCore, QtGui, QT_LIB
from ...python2_3 import asUnicode
from ...WidgetGroup import WidgetGroup
if QT_LIB == 'PyQt4':
from .axisCtrlTemplate_pyqt import Ui_Form as AxisCtrlTemplate
elif QT_LIB == 'PySide':
from .axisCtrlTemplate_pyside import Ui_Form as AxisCtrlTemplate
elif QT_LIB == 'PyQt5':
from .axisCtrlTemplate_pyqt5 import Ui_Form as AxisCtrlTemplate
elif QT_LIB == 'PySide2':
from .axisCtrlTemplate_pyside2 import Ui_Form as AxisCtrlTemplate
import importlib
ui_template = importlib.import_module(
f'.axisCtrlTemplate_{QT_LIB.lower()}', package=__package__)
import weakref
@ -35,7 +30,7 @@ class ViewBoxMenu(QtGui.QMenu):
m = QtGui.QMenu()
m.setTitle("%s Axis" % axis)
w = QtGui.QWidget()
ui = AxisCtrlTemplate()
ui = ui_template.Ui_Form()
ui.setupUi(w)
a = QtGui.QWidgetAction(self)
a.setDefaultWidget(w)

View File

@ -0,0 +1,138 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'axisCtrlTemplate.ui'
##
## Created by: Qt User Interface Compiler version 6.0.0
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *
class Ui_Form(object):
def setupUi(self, Form):
if not Form.objectName():
Form.setObjectName(u"Form")
Form.resize(186, 154)
Form.setMaximumSize(QSize(200, 16777215))
self.gridLayout = QGridLayout(Form)
self.gridLayout.setSpacing(0)
self.gridLayout.setContentsMargins(0, 0, 0, 0)
self.gridLayout.setObjectName(u"gridLayout")
self.label = QLabel(Form)
self.label.setObjectName(u"label")
self.gridLayout.addWidget(self.label, 7, 0, 1, 2)
self.linkCombo = QComboBox(Form)
self.linkCombo.setObjectName(u"linkCombo")
self.linkCombo.setSizeAdjustPolicy(QComboBox.AdjustToContents)
self.gridLayout.addWidget(self.linkCombo, 7, 2, 1, 2)
self.autoPercentSpin = QSpinBox(Form)
self.autoPercentSpin.setObjectName(u"autoPercentSpin")
self.autoPercentSpin.setEnabled(True)
self.autoPercentSpin.setMinimum(1)
self.autoPercentSpin.setMaximum(100)
self.autoPercentSpin.setSingleStep(1)
self.autoPercentSpin.setValue(100)
self.gridLayout.addWidget(self.autoPercentSpin, 2, 2, 1, 2)
self.autoRadio = QRadioButton(Form)
self.autoRadio.setObjectName(u"autoRadio")
self.autoRadio.setChecked(True)
self.gridLayout.addWidget(self.autoRadio, 2, 0, 1, 2)
self.manualRadio = QRadioButton(Form)
self.manualRadio.setObjectName(u"manualRadio")
self.gridLayout.addWidget(self.manualRadio, 1, 0, 1, 2)
self.minText = QLineEdit(Form)
self.minText.setObjectName(u"minText")
self.gridLayout.addWidget(self.minText, 1, 2, 1, 1)
self.maxText = QLineEdit(Form)
self.maxText.setObjectName(u"maxText")
self.gridLayout.addWidget(self.maxText, 1, 3, 1, 1)
self.invertCheck = QCheckBox(Form)
self.invertCheck.setObjectName(u"invertCheck")
self.gridLayout.addWidget(self.invertCheck, 5, 0, 1, 4)
self.mouseCheck = QCheckBox(Form)
self.mouseCheck.setObjectName(u"mouseCheck")
self.mouseCheck.setChecked(True)
self.gridLayout.addWidget(self.mouseCheck, 6, 0, 1, 4)
self.visibleOnlyCheck = QCheckBox(Form)
self.visibleOnlyCheck.setObjectName(u"visibleOnlyCheck")
self.gridLayout.addWidget(self.visibleOnlyCheck, 3, 2, 1, 2)
self.autoPanCheck = QCheckBox(Form)
self.autoPanCheck.setObjectName(u"autoPanCheck")
self.gridLayout.addWidget(self.autoPanCheck, 4, 2, 1, 2)
self.retranslateUi(Form)
QMetaObject.connectSlotsByName(Form)
# setupUi
def retranslateUi(self, Form):
Form.setWindowTitle(QCoreApplication.translate("Form", u"PyQtGraph", None))
self.label.setText(QCoreApplication.translate("Form", u"Link Axis:", None))
#if QT_CONFIG(tooltip)
self.linkCombo.setToolTip(QCoreApplication.translate("Form", u"<html><head/><body><p>Links this axis with another view. When linked, both views will display the same data range.</p></body></html>", None))
#endif // QT_CONFIG(tooltip)
#if QT_CONFIG(tooltip)
self.autoPercentSpin.setToolTip(QCoreApplication.translate("Form", u"<html><head/><body><p>Percent of data to be visible when auto-scaling. It may be useful to decrease this value for data with spiky noise.</p></body></html>", None))
#endif // QT_CONFIG(tooltip)
self.autoPercentSpin.setSuffix(QCoreApplication.translate("Form", u"%", None))
#if QT_CONFIG(tooltip)
self.autoRadio.setToolTip(QCoreApplication.translate("Form", u"<html><head/><body><p>Automatically resize this axis whenever the displayed data is changed.</p></body></html>", None))
#endif // QT_CONFIG(tooltip)
self.autoRadio.setText(QCoreApplication.translate("Form", u"Auto", None))
#if QT_CONFIG(tooltip)
self.manualRadio.setToolTip(QCoreApplication.translate("Form", u"<html><head/><body><p>Set the range for this axis manually. This disables automatic scaling. </p></body></html>", None))
#endif // QT_CONFIG(tooltip)
self.manualRadio.setText(QCoreApplication.translate("Form", u"Manual", None))
#if QT_CONFIG(tooltip)
self.minText.setToolTip(QCoreApplication.translate("Form", u"<html><head/><body><p>Minimum value to display for this axis.</p></body></html>", None))
#endif // QT_CONFIG(tooltip)
self.minText.setText(QCoreApplication.translate("Form", u"0", None))
#if QT_CONFIG(tooltip)
self.maxText.setToolTip(QCoreApplication.translate("Form", u"<html><head/><body><p>Maximum value to display for this axis.</p></body></html>", None))
#endif // QT_CONFIG(tooltip)
self.maxText.setText(QCoreApplication.translate("Form", u"0", None))
#if QT_CONFIG(tooltip)
self.invertCheck.setToolTip(QCoreApplication.translate("Form", u"<html><head/><body><p>Inverts the display of this axis. (+y points downward instead of upward)</p></body></html>", None))
#endif // QT_CONFIG(tooltip)
self.invertCheck.setText(QCoreApplication.translate("Form", u"Invert Axis", None))
#if QT_CONFIG(tooltip)
self.mouseCheck.setToolTip(QCoreApplication.translate("Form", u"<html><head/><body><p>Enables mouse interaction (panning, scaling) for this axis.</p></body></html>", None))
#endif // QT_CONFIG(tooltip)
self.mouseCheck.setText(QCoreApplication.translate("Form", u"Mouse Enabled", None))
#if QT_CONFIG(tooltip)
self.visibleOnlyCheck.setToolTip(QCoreApplication.translate("Form", u"<html><head/><body><p>When checked, the axis will only auto-scale to data that is visible along the orthogonal axis.</p></body></html>", None))
#endif // QT_CONFIG(tooltip)
self.visibleOnlyCheck.setText(QCoreApplication.translate("Form", u"Visible Data Only", None))
#if QT_CONFIG(tooltip)
self.autoPanCheck.setToolTip(QCoreApplication.translate("Form", u"<html><head/><body><p>When checked, the axis will automatically pan to center on the current data, but the scale along this axis will not change.</p></body></html>", None))
#endif // QT_CONFIG(tooltip)
self.autoPanCheck.setText(QCoreApplication.translate("Form", u"Auto Pan Only", None))
# retranslateUi

View File

@ -16,14 +16,9 @@ import os, sys
import numpy as np
from ..Qt import QtCore, QtGui, QT_LIB
if QT_LIB == 'PySide':
from .ImageViewTemplate_pyside import *
elif QT_LIB == 'PySide2':
from .ImageViewTemplate_pyside2 import *
elif QT_LIB == 'PyQt5':
from .ImageViewTemplate_pyqt5 import *
else:
from .ImageViewTemplate_pyqt import *
import importlib
ui_template = importlib.import_module(
f'.ImageViewTemplate_{QT_LIB.lower()}', package=__package__)
from ..graphicsItems.ImageItem import *
from ..graphicsItems.ROI import *
@ -126,7 +121,7 @@ class ImageView(QtGui.QWidget):
self.image = None
self.axes = {}
self.imageDisp = None
self.ui = Ui_Form()
self.ui = ui_template.Ui_Form()
self.ui.setupUi(self)
self.scene = self.ui.graphicsView.scene()
self.ui.histogram.setLevelMode(levelMode)

View File

@ -116,7 +116,6 @@
<widget class="QLabel" name="label_5">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -129,7 +128,6 @@
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -142,7 +140,6 @@
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>

View File

@ -0,0 +1,197 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'ImageViewTemplate.ui'
##
## Created by: Qt User Interface Compiler version 6.0.0
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *
from ..widgets.PlotWidget import PlotWidget
from ..widgets.GraphicsView import GraphicsView
from ..widgets.HistogramLUTWidget import HistogramLUTWidget
class Ui_Form(object):
def setupUi(self, Form):
if not Form.objectName():
Form.setObjectName(u"Form")
Form.resize(726, 588)
self.gridLayout_3 = QGridLayout(Form)
self.gridLayout_3.setSpacing(0)
self.gridLayout_3.setContentsMargins(0, 0, 0, 0)
self.gridLayout_3.setObjectName(u"gridLayout_3")
self.splitter = QSplitter(Form)
self.splitter.setObjectName(u"splitter")
self.splitter.setOrientation(Qt.Vertical)
self.layoutWidget = QWidget(self.splitter)
self.layoutWidget.setObjectName(u"layoutWidget")
self.gridLayout = QGridLayout(self.layoutWidget)
self.gridLayout.setSpacing(0)
self.gridLayout.setObjectName(u"gridLayout")
self.gridLayout.setContentsMargins(0, 0, 0, 0)
self.graphicsView = GraphicsView(self.layoutWidget)
self.graphicsView.setObjectName(u"graphicsView")
self.gridLayout.addWidget(self.graphicsView, 0, 0, 2, 1)
self.histogram = HistogramLUTWidget(self.layoutWidget)
self.histogram.setObjectName(u"histogram")
self.gridLayout.addWidget(self.histogram, 0, 1, 1, 2)
self.roiBtn = QPushButton(self.layoutWidget)
self.roiBtn.setObjectName(u"roiBtn")
sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(1)
sizePolicy.setHeightForWidth(self.roiBtn.sizePolicy().hasHeightForWidth())
self.roiBtn.setSizePolicy(sizePolicy)
self.roiBtn.setCheckable(True)
self.gridLayout.addWidget(self.roiBtn, 1, 1, 1, 1)
self.menuBtn = QPushButton(self.layoutWidget)
self.menuBtn.setObjectName(u"menuBtn")
sizePolicy.setHeightForWidth(self.menuBtn.sizePolicy().hasHeightForWidth())
self.menuBtn.setSizePolicy(sizePolicy)
self.gridLayout.addWidget(self.menuBtn, 1, 2, 1, 1)
self.splitter.addWidget(self.layoutWidget)
self.roiPlot = PlotWidget(self.splitter)
self.roiPlot.setObjectName(u"roiPlot")
sizePolicy1 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
sizePolicy1.setHorizontalStretch(0)
sizePolicy1.setVerticalStretch(0)
sizePolicy1.setHeightForWidth(self.roiPlot.sizePolicy().hasHeightForWidth())
self.roiPlot.setSizePolicy(sizePolicy1)
self.roiPlot.setMinimumSize(QSize(0, 40))
self.splitter.addWidget(self.roiPlot)
self.gridLayout_3.addWidget(self.splitter, 0, 0, 1, 1)
self.normGroup = QGroupBox(Form)
self.normGroup.setObjectName(u"normGroup")
self.gridLayout_2 = QGridLayout(self.normGroup)
self.gridLayout_2.setSpacing(0)
self.gridLayout_2.setContentsMargins(0, 0, 0, 0)
self.gridLayout_2.setObjectName(u"gridLayout_2")
self.normSubtractRadio = QRadioButton(self.normGroup)
self.normSubtractRadio.setObjectName(u"normSubtractRadio")
self.gridLayout_2.addWidget(self.normSubtractRadio, 0, 2, 1, 1)
self.normDivideRadio = QRadioButton(self.normGroup)
self.normDivideRadio.setObjectName(u"normDivideRadio")
self.normDivideRadio.setChecked(False)
self.gridLayout_2.addWidget(self.normDivideRadio, 0, 1, 1, 1)
self.label_5 = QLabel(self.normGroup)
self.label_5.setObjectName(u"label_5")
font = QFont()
font.setBold(True)
self.label_5.setFont(font)
self.gridLayout_2.addWidget(self.label_5, 0, 0, 1, 1)
self.label_3 = QLabel(self.normGroup)
self.label_3.setObjectName(u"label_3")
self.label_3.setFont(font)
self.gridLayout_2.addWidget(self.label_3, 1, 0, 1, 1)
self.label_4 = QLabel(self.normGroup)
self.label_4.setObjectName(u"label_4")
self.label_4.setFont(font)
self.gridLayout_2.addWidget(self.label_4, 2, 0, 1, 1)
self.normROICheck = QCheckBox(self.normGroup)
self.normROICheck.setObjectName(u"normROICheck")
self.gridLayout_2.addWidget(self.normROICheck, 1, 1, 1, 1)
self.normXBlurSpin = QDoubleSpinBox(self.normGroup)
self.normXBlurSpin.setObjectName(u"normXBlurSpin")
self.gridLayout_2.addWidget(self.normXBlurSpin, 2, 2, 1, 1)
self.label_8 = QLabel(self.normGroup)
self.label_8.setObjectName(u"label_8")
self.label_8.setAlignment(Qt.AlignRight|Qt.AlignTrailing|Qt.AlignVCenter)
self.gridLayout_2.addWidget(self.label_8, 2, 1, 1, 1)
self.label_9 = QLabel(self.normGroup)
self.label_9.setObjectName(u"label_9")
self.label_9.setAlignment(Qt.AlignRight|Qt.AlignTrailing|Qt.AlignVCenter)
self.gridLayout_2.addWidget(self.label_9, 2, 3, 1, 1)
self.normYBlurSpin = QDoubleSpinBox(self.normGroup)
self.normYBlurSpin.setObjectName(u"normYBlurSpin")
self.gridLayout_2.addWidget(self.normYBlurSpin, 2, 4, 1, 1)
self.label_10 = QLabel(self.normGroup)
self.label_10.setObjectName(u"label_10")
self.label_10.setAlignment(Qt.AlignRight|Qt.AlignTrailing|Qt.AlignVCenter)
self.gridLayout_2.addWidget(self.label_10, 2, 5, 1, 1)
self.normOffRadio = QRadioButton(self.normGroup)
self.normOffRadio.setObjectName(u"normOffRadio")
self.normOffRadio.setChecked(True)
self.gridLayout_2.addWidget(self.normOffRadio, 0, 3, 1, 1)
self.normTimeRangeCheck = QCheckBox(self.normGroup)
self.normTimeRangeCheck.setObjectName(u"normTimeRangeCheck")
self.gridLayout_2.addWidget(self.normTimeRangeCheck, 1, 3, 1, 1)
self.normFrameCheck = QCheckBox(self.normGroup)
self.normFrameCheck.setObjectName(u"normFrameCheck")
self.gridLayout_2.addWidget(self.normFrameCheck, 1, 2, 1, 1)
self.normTBlurSpin = QDoubleSpinBox(self.normGroup)
self.normTBlurSpin.setObjectName(u"normTBlurSpin")
self.gridLayout_2.addWidget(self.normTBlurSpin, 2, 6, 1, 1)
self.gridLayout_3.addWidget(self.normGroup, 1, 0, 1, 1)
self.retranslateUi(Form)
QMetaObject.connectSlotsByName(Form)
# setupUi
def retranslateUi(self, Form):
Form.setWindowTitle(QCoreApplication.translate("Form", u"PyQtGraph", None))
self.roiBtn.setText(QCoreApplication.translate("Form", u"ROI", None))
self.menuBtn.setText(QCoreApplication.translate("Form", u"Menu", None))
self.normGroup.setTitle(QCoreApplication.translate("Form", u"Normalization", None))
self.normSubtractRadio.setText(QCoreApplication.translate("Form", u"Subtract", None))
self.normDivideRadio.setText(QCoreApplication.translate("Form", u"Divide", None))
self.label_5.setText(QCoreApplication.translate("Form", u"Operation:", None))
self.label_3.setText(QCoreApplication.translate("Form", u"Mean:", None))
self.label_4.setText(QCoreApplication.translate("Form", u"Blur:", None))
self.normROICheck.setText(QCoreApplication.translate("Form", u"ROI", None))
self.label_8.setText(QCoreApplication.translate("Form", u"X", None))
self.label_9.setText(QCoreApplication.translate("Form", u"Y", None))
self.label_10.setText(QCoreApplication.translate("Form", u"T", None))
self.normOffRadio.setText(QCoreApplication.translate("Form", u"Off", None))
self.normTimeRangeCheck.setText(QCoreApplication.translate("Form", u"Time range", None))
self.normFrameCheck.setText(QCoreApplication.translate("Form", u"Frame", None))
# retranslateUi

View File

@ -1,5 +1,6 @@
"""For starting up remote processes"""
import sys, pickle, os
import importlib
if __name__ == '__main__':
if hasattr(os, 'setpgrp'):
@ -33,12 +34,8 @@ if __name__ == '__main__':
sip.setapi(k, v)
qt_lib = opts.pop('qt_lib', None)
if qt_lib == 'PySide':
import PySide
elif qt_lib == 'PySide2':
import PySide2
elif qt_lib == 'PyQt5':
import PyQt5
if qt_lib is not None:
globals()[qt_lib] = importlib.import_module(qt_lib)
targetStr = opts.pop('targetStr')
try:

View File

@ -1,4 +1,4 @@
from ..Qt import QtCore, QtGui, QtOpenGL, QT_LIB
from ..Qt import QtCore, QtGui, QtWidgets, QT_LIB
from OpenGL.GL import *
import OpenGL.GL.framebufferobjects as glfbo
import numpy as np
@ -9,7 +9,7 @@ from .. import functions as fn
ShareWidget = None
class GLViewWidget(QtOpenGL.QGLWidget):
class GLViewWidget(QtWidgets.QOpenGLWidget):
def __init__(self, parent=None, devicePixelRatio=None, rotationMethod='euler'):
"""
@ -30,13 +30,7 @@ class GLViewWidget(QtOpenGL.QGLWidget):
================ ==============================================================
"""
global ShareWidget
if ShareWidget is None:
## create a dummy widget to allow sharing objects (textures, shaders, etc) between views
ShareWidget = QtOpenGL.QGLWidget()
QtOpenGL.QGLWidget.__init__(self, parent, ShareWidget)
QtWidgets.QOpenGLWidget.__init__(self, parent)
self.setFocusPolicy(QtCore.Qt.ClickFocus)
@ -132,10 +126,7 @@ class GLViewWidget(QtOpenGL.QGLWidget):
if dpr is not None:
return dpr
if hasattr(QtOpenGL.QGLWidget, 'devicePixelRatio'):
return QtOpenGL.QGLWidget.devicePixelRatio(self)
else:
return 1.0
return QtWidgets.QOpenGLWidget.devicePixelRatio(self)
def resizeGL(self, w, h):
pass
@ -421,7 +412,7 @@ class GLViewWidget(QtOpenGL.QGLWidget):
self.pan(diff.x(), diff.y(), 0, relative='view')
else:
self.orbit(-diff.x(), diff.y())
elif ev.buttons() == QtCore.Qt.MidButton:
elif ev.buttons() == QtCore.Qt.MiddleButton:
if (ev.modifiers() & QtCore.Qt.ControlModifier):
self.pan(diff.x(), 0, diff.y(), relative='view-upright')
else:

View File

@ -1,16 +1,12 @@
from ..Qt import QtCore, QtGui, QtOpenGL
from ..Qt import QtWidgets
from OpenGL.GL import *
app = QtGui.QApplication([])
class GLTest(QtOpenGL.QGLWidget):
def __init__(self):
QtOpenGL.QGLWidget.__init__(self)
self.makeCurrent()
class GLTest(QtWidgets.QOpenGLWidget):
def initializeGL(self):
print("GL version:" + glGetString(GL_VERSION).decode("utf-8"))
print("MAX_TEXTURE_SIZE: %d" % glGetIntegerv(GL_MAX_TEXTURE_SIZE))
print("MAX_3D_TEXTURE_SIZE: %d" % glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE))
print("Extensions: " + glGetString(GL_EXTENSIONS).decode("utf-8").replace(" ", "\n"))
GLTest()
app = QtWidgets.QApplication([])
GLTest().show()

View File

@ -429,10 +429,10 @@ class GroupParameterItem(ParameterItem):
tw = self.treeWidget()
if tw is None:
return
tw.setFirstItemColumnSpanned(self, True)
self.setFirstColumnSpanned(True)
if self.addItem is not None:
tw.setItemWidget(self.addItem, 0, self.addWidgetBox)
tw.setFirstItemColumnSpanned(self.addItem, True)
self.addItem.setFirstColumnSpanned(True)
def addChild(self, child): ## make sure added childs are actually inserted before add btn
if self.addItem is not None:
@ -609,7 +609,7 @@ class ActionParameterItem(ParameterItem):
if tree is None:
return
tree.setFirstItemColumnSpanned(self, True)
self.setFirstColumnSpanned(True)
tree.setItemWidget(self, 0, self.layoutWidget)
def titleChanged(self):
@ -646,7 +646,7 @@ class TextParameterItem(WidgetParameterItem):
if tw is None:
return
tw.setFirstItemColumnSpanned(self.subItem, True)
self.subItem.setFirstColumnSpanned(True)
tw.setItemWidget(self.subItem, 0, self.textBox)
# for now, these are copied from ParameterItem.treeWidgetChanged

View File

@ -257,7 +257,7 @@ def assertImageMatch(im1, im2, minCorr=None, pxThreshold=50.,
assert im1.dtype == im2.dtype
if pxCount == -1:
if QT_LIB in {'PyQt5', 'PySide2'}:
if QT_LIB in {'PyQt5', 'PySide2', 'PySide6'}:
# Qt5 generates slightly different results; relax the tolerance
# until test images are updated.
pxCount = int(im1.shape[0] * im1.shape[1] * 0.01)

View File

@ -38,7 +38,7 @@ def mkrefs(*objs):
return [weakref.ref(obj) for obj in allObjs.values()]
@pytest.mark.skipif(pg.Qt.QT_LIB in {'PySide', 'PySide2'}, reason=skipreason)
@pytest.mark.skipif(pg.Qt.QT_LIB in {'PySide'}, reason=skipreason)
def test_PlotWidget():
def mkobjs(*args, **kwds):
w = pg.PlotWidget(*args, **kwds)
@ -56,7 +56,7 @@ def test_PlotWidget():
for i in range(5):
assert_alldead(mkobjs())
@pytest.mark.skipif(pg.Qt.QT_LIB in {'PySide', 'PySide2'}, reason=skipreason)
@pytest.mark.skipif(pg.Qt.QT_LIB in {'PySide', 'PySide2', 'PySide6'}, reason=skipreason)
def test_ImageView():
def mkobjs():
iv = pg.ImageView()
@ -69,7 +69,7 @@ def test_ImageView():
assert_alldead(mkobjs())
@pytest.mark.skipif(pg.Qt.QT_LIB in {'PySide', 'PySide2'}, reason=skipreason)
@pytest.mark.skipif(pg.Qt.QT_LIB in {'PySide'}, reason=skipreason)
def test_GraphicsWindow():
def mkobjs():
w = pg.GraphicsWindow()

View File

@ -43,8 +43,8 @@ def remove_cache(mod):
shutil.rmtree(cachedir)
@pytest.mark.skipif(
pg.Qt.QT_LIB == "PySide2"
and pg.Qt.PySide2.__version__.startswith("5.15")
((pg.Qt.QT_LIB == "PySide2" and pg.Qt.PySide2.__version__.startswith("5.15"))
or (pg.Qt.QT_LIB == "PySide6"))
and sys.version_info > (3, 9),
reason="Unknown Issue")
def test_reload():

View File

@ -1,13 +1,16 @@
from .. import mkQApp
from ..Qt import QtGui
def test_screenInformation():
# a qApp is still needed, otherwise screen is None
qApp = mkQApp()
desktop = qApp.desktop()
resolution = desktop.screenGeometry()
availableResolution = desktop.availableGeometry()
screen = QtGui.QGuiApplication.primaryScreen()
screens = QtGui.QGuiApplication.screens()
resolution = screen.size()
availableResolution = screen.availableSize()
print("Screen resolution: {}x{}".format(resolution.width(), resolution.height()))
print("Available geometry: {}x{}".format(availableResolution.width(), availableResolution.height()))
print("Number of Screens: {}".format(desktop.screenCount()))
print("Number of Screens: {}".format(len(screens)))
return None

View File

@ -24,7 +24,7 @@ class ComboBox(QtGui.QComboBox):
#self.value = default
if 'darwin' in sys.platform: ## because MacOSX can show names that are wider than the comboBox
self.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength)
self.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
#self.setMinimumContentsLength(10)
self._chosenText = None
self._items = OrderedDict()

View File

@ -65,7 +65,7 @@ class DataTreeWidget(QtGui.QTreeWidget):
subnode = QtGui.QTreeWidgetItem(["", "", ""])
node.addChild(subnode)
self.setItemWidget(subnode, 0, widget)
self.setFirstItemColumnSpanned(subnode, True)
subnode.setFirstColumnSpanned(True)
# recurse to children
for key, data in childs.items():

View File

@ -131,10 +131,9 @@ class GraphicsView(QtGui.QGraphicsView):
self.clickAccepted = False
# Set a transparent background QPalette!
if QT_LIB in ["PySide2", "PyQt5"]:
palette = self.palette()
palette.setColor(QtGui.QPalette.Background, QtCore.Qt.transparent)
self.setPalette(palette)
palette = self.palette()
palette.setColor(QtGui.QPalette.Window, QtCore.Qt.transparent)
self.setPalette(palette)
def setAntialiasing(self, aa):
"""Enable or disable default antialiasing.
@ -393,7 +392,7 @@ class GraphicsView(QtGui.QGraphicsView):
self.scale(scale[0], scale[1], center=self.mapToScene(self.mousePressPos))
self.sigDeviceRangeChanged.emit(self, self.range)
elif ev.buttons() in [QtCore.Qt.MidButton, QtCore.Qt.LeftButton]: ## Allow panning by left or mid button.
elif ev.buttons() in [QtCore.Qt.MiddleButton, QtCore.Qt.LeftButton]: ## Allow panning by left or mid button.
px = self.pixelSize()
tr = -delta * px

View File

@ -1,18 +1,8 @@
from ..Qt import QtGui, QtCore, QT_LIB
import matplotlib
if QT_LIB not in ['PyQt5', "PySide2"]:
if QT_LIB == 'PySide':
matplotlib.rcParams['backend.qt4']='PySide'
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
try:
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as NavigationToolbar
except ImportError:
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar
else:
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
from matplotlib.figure import Figure

View File

@ -8,7 +8,7 @@ Distributed under MIT/X11 license. See license.txt for more infomation.
from ..Qt import QtCore, QtGui
try:
from ..Qt import QtOpenGL
from ..Qt import QtWidgets
from OpenGL.GL import *
HAVE_OPENGL = True
@ -74,7 +74,7 @@ class RawImageWidget(QtGui.QWidget):
if HAVE_OPENGL:
class RawImageGLWidget(QtOpenGL.QGLWidget):
class RawImageGLWidget(QtWidgets.QOpenGLWidget):
"""
Similar to RawImageWidget, but uses a GL widget to do all drawing.
Perfomance varies between platforms; see examples/VideoSpeedTest for benchmarking.
@ -83,7 +83,7 @@ if HAVE_OPENGL:
"""
def __init__(self, parent=None, scaled=False):
QtOpenGL.QGLWidget.__init__(self, parent)
QtWidgets.QOpenGLWidget.__init__(self, parent)
self.scaled = scaled
self.image = None
self.uploaded = False
@ -142,7 +142,9 @@ if HAVE_OPENGL:
if not self.uploaded:
self.uploadTexture()
glViewport(0, 0, self.width() * self.devicePixelRatio(), self.height() * self.devicePixelRatio())
dpr = self.devicePixelRatio()
vp = (0, 0, int(self.width() * dpr), int(self.height() * dpr))
glViewport(*vp)
glEnable(GL_TEXTURE_2D)
glBindTexture(GL_TEXTURE_2D, self.texture)
glColor4f(1, 1, 1, 1)

View File

@ -187,7 +187,8 @@ class RemoteGraphicsView(QtGui.QWidget):
return QtGui.QWidget.keyEvent(self, ev)
def enterEvent(self, ev):
self._view.enterEvent(int(ev.type()), _callSync='off')
lws = ev.localPos(), ev.windowPos(), ev.screenPos()
self._view.enterEvent(lws, _callSync='off')
return QtGui.QWidget.enterEvent(self, ev)
def leaveEvent(self, ev):
@ -274,9 +275,8 @@ class Renderer(GraphicsView):
self.shm.resize(size)
## render the scene directly to shared memory
if QT_LIB in ['PySide', 'PySide2']:
if QT_LIB.startswith('PySide'):
ch = ctypes.c_char.from_buffer(self.shm, 0)
#ch = ctypes.c_char_p(address)
self.img = QtGui.QImage(ch, self.width(), self.height(), QtGui.QImage.Format_ARGB32)
else:
address = ctypes.addressof(ctypes.c_char.from_buffer(self.shm, 0))
@ -326,8 +326,8 @@ class Renderer(GraphicsView):
GraphicsView.keyEvent(self, QtGui.QKeyEvent(typ, mods, text, autorep, count))
return ev.accepted()
def enterEvent(self, typ):
ev = QtCore.QEvent(QtCore.QEvent.Type(typ))
def enterEvent(self, lws):
ev = QtGui.QEnterEvent(*lws)
return GraphicsView.enterEvent(self, ev)
def leaveEvent(self, typ):

View File

@ -7,13 +7,12 @@ def test_basics_graphics_view():
app = pg.mkQApp()
view = pg.GraphicsView()
background_role = view.backgroundRole()
assert background_role == QtGui.QPalette.Background
assert background_role == QtGui.QPalette.Window
palette = view.palette()
if pg.Qt.QT_LIB in ["PySide2", "PyQt5"]:
assert palette.isBrushSet(QtGui.QPalette.Active, QtGui.QPalette.Background)
assert palette.color(QtGui.QPalette.Background) == QtCore.Qt.transparent
assert palette.isBrushSet(QtGui.QPalette.Active, QtGui.QPalette.Window)
assert palette.color(QtGui.QPalette.Window) == QtCore.Qt.transparent
assert view.backgroundBrush().color() == QtGui.QColor(0, 0, 0, 255)
assert view.focusPolicy() == QtCore.Qt.StrongFocus
@ -39,10 +38,8 @@ def test_basics_graphics_view():
view.setBackground("w")
assert view._background == "w"
palette = view.palette()
if pg.Qt.QT_LIB in ["PySide2", "PyQt5"]:
assert palette.isBrushSet(QtGui.QPalette.Active, QtGui.QPalette.Background)
assert palette.color(QtGui.QPalette.Background) == QtCore.Qt.transparent
assert palette.isBrushSet(QtGui.QPalette.Active, QtGui.QPalette.Window)
assert palette.color(QtGui.QPalette.Window) == QtCore.Qt.transparent
assert view.backgroundBrush().color() == QtCore.Qt.white
# Set anti aliasing

View File

@ -7,10 +7,10 @@ Script for compiling Qt Designer .ui files to .py
"""
import os, sys, subprocess, tempfile
pyqtuic = 'pyuic4'
pysideuic = 'pyside-uic'
pyqt5uic = 'pyuic5'
pyqt6uic = 'pyuic6'
pyside2uic = 'pyside2-uic'
pyside6uic = 'pyside6-uic'
usage = """Compile .ui files to .py for all supported pyqt/pyside versions.
@ -50,7 +50,8 @@ for arg in args:
# rebuild all requested ui files
for ui in uifiles:
base, _ = os.path.splitext(ui)
for compiler, ext in [(pyqtuic, '_pyqt.py'), (pysideuic, '_pyside.py'), (pyqt5uic, '_pyqt5.py'), (pyside2uic, '_pyside2.py')]:
for compiler, ext in [(pyqt5uic, '_pyqt5.py'), (pyside2uic, '_pyside2.py'),
(pyqt6uic, '_pyqt6.py'), (pyside6uic, '_pyside6.py')]:
py = base + ext
if not force and os.path.exists(py) and os.stat(ui).st_mtime <= os.stat(py).st_mtime:
print("Skipping %s; already compiled." % py)