Skip to content

Commit

Permalink
Merge pull request #3739 from t20100/prepare-1.1.2
Browse files Browse the repository at this point in the history
Prepare v1.1.2
  • Loading branch information
t20100 authored Dec 16, 2022
2 parents c586c0e + 0cd5f98 commit 4fdbc1e
Show file tree
Hide file tree
Showing 20 changed files with 132 additions and 29 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ jobs:
run: |
pip install pytest
pip install pytest-xvfb
pip install pytest-mock
- name: Install silx package
run: pip install --pre --find-links dist/ silx
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
Change Log
==========

1.1.2: 2022/12/16
.................

This is a bug fix version:

* `silx.gui`:

* Fixed support of `PySide` 6.4 enums (PR #3737, #3738)
* Fixed OpenGL version parsing (PR #3733, #3738)

* `silx.gui.plot`:

* Fixed issue when `PlotWidget` has a size of 0 (PR #3736, #3738)
* Fixed reset of interaction when closing mask tool (PR #3735, #3738)

* Miscellaneous: Updated Debian packaging (PR #3732, #3738)

1.1.1: 2022/11/30
-----------------

Expand Down
1 change: 1 addition & 0 deletions ci/appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ before_test:
# Install pytest
- "pip install %PIP_OPTIONS% pytest"
- "pip install %PIP_OPTIONS% pytest-xvfb"
- "pip install %PIP_OPTIONS% pytest-mock"

# Install the generated wheel package to test it
# Make sure silx does not come from cache or pypi
Expand Down
1 change: 1 addition & 0 deletions package/debian10/control
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Build-Depends: cython3 (>= 0.23.2),
python3-pyqt5.qtopengl,
python3-pyqt5.qtsvg,
python3-pytest,
python3-pytest-mock,
python3-pytest-xvfb,
python3-scipy,
python3-setuptools,
Expand Down
4 changes: 2 additions & 2 deletions package/debian10/rules
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ override_dh_python3:

# WITH_QT_TEST=False to disable graphical tests
# SILX_OPENCL=False to disable OpenCL tests
# SILX_TEST_LOW_MEM=True to disable tests taking large amount of memory
# SILX_TEST_LOW_MEM=False to disable tests taking large amount of memory
# GPU=False to disable the use of a GPU with OpenCL test
# WITH_GL_TEST=False to disable tests using OpenGL
# UNACTIVATED UNTIL dh_python from UNSTABLE IS FIXED
# https://lists.debian.org/debian-python/2017/08/msg00095.html
override_dh_auto_test:
mkdir -p $(POCL_CACHE_DIR) # create POCL cachedir in order to avoid an FTBFS in sbuild
dh_auto_test -- -s custom --test-args="env PYTHONPATH={build_dir} GPU=False WITH_QT_TEST=False SILX_OPENCL=False SILX_TEST_LAW_MEM=True xvfb-run -a --server-args=\"-screen 0 1024x768x24\" {interpreter} run_tests.py -vv --installed"
dh_auto_test -- -s custom --test-args="env PYTHONPATH={build_dir} GPU=False WITH_QT_TEST=False SILX_OPENCL=False SILX_TEST_LOW_MEM=False xvfb-run -a --server-args=\"-screen 0 1024x768x24\" {interpreter} run_tests.py -vv --installed"

override_dh_installman:
dh_installman -p silx build/man/*.1
Expand Down
1 change: 1 addition & 0 deletions package/debian11/control
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Build-Depends: cython3 (>= 0.23.2),
python3-pyqt5.qtsvg,
python3-pyqt5.qtsvg-dbg,
python3-pytest,
python3-pytest-mock,
python3-pytest-xvfb,
python3-qtconsole,
python3-scipy,
Expand Down
4 changes: 2 additions & 2 deletions package/debian11/rules
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ override_dh_python3:

# WITH_QT_TEST=False to disable graphical tests
# SILX_OPENCL=False to disable OpenCL tests
# SILX_TEST_LOW_MEM=True to disable tests taking large amount of memory
# SILX_TEST_LOW_MEM=False to disable tests taking large amount of memory
# GPU=False to disable the use of a GPU with OpenCL test
# WITH_GL_TEST=False to disable tests using OpenGL
override_dh_auto_test:
mkdir -p $(POCL_CACHE_DIR) # create POCL cachedir in order to avoid an FTBFS in sbuild
dh_auto_test -- -s custom --test-args="env PYTHONPATH={build_dir} GPU=False WITH_QT_TEST=False SILX_OPENCL=False SILX_TEST_LAW_MEM=True xvfb-run -a --server-args=\"-screen 0 1024x768x24\" {interpreter} run_tests.py -vv --installed"
dh_auto_test -- -s custom --test-args="env PYTHONPATH={build_dir} GPU=False WITH_QT_TEST=False SILX_OPENCL=False SILX_TEST_LOW_MEM=False xvfb-run -a --server-args=\"-screen 0 1024x768x24\" {interpreter} run_tests.py -vv --installed"

override_dh_installman:
dh_installman -p silx build/man/*.1
Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pandoc # For documentation Qt snapshot updates
pytest # For testing
pytest-xvfb # For GUI testing
pytest-cov # For coverage
pytest-mock

hdf5plugin # For HDF5 compression filters handling

Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,8 @@ def get_project_configuration():

test_requires = [
"pytest",
"pytest-xvfb"
"pytest-xvfb",
"pytest-mock",
]

extras_require = {
Expand Down
2 changes: 1 addition & 1 deletion src/silx/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

MAJOR = 1
MINOR = 1
MICRO = 1
MICRO = 2
RELEV = "final" # <16
SERIAL = 0 # <16

Expand Down
20 changes: 18 additions & 2 deletions src/silx/gui/_glutils/gl.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,29 @@
GLchar = c_char


def getVersion() -> tuple:
"""Returns the GL version as tuple of integers.
Raises:
ValueError: If the version returned by the driver is not supported
"""
try:
desc = glGetString(GL_VERSION)
if isinstance(desc, bytes):
desc = desc.decode("ascii")
version = desc.split(" ", 1)[0]
return tuple([int(i) for i in version.split('.')])
except Exception as e:
raise ValueError("GL version not properly formatted") from e


def testGL() -> bool:
"""Test if required OpenGL version and extensions are available.
This MUST be run with an active OpenGL context.
"""
version = glGetString(GL_VERSION).split()[0] # get version number
major, minor = int(version[0]), int(version[2])
version = getVersion()
major, minor = version[0], version[1]
if major < 2 or (major == 2 and minor < 1):
_logger.error("OpenGL version >=2.1 required, running with %s" % version)
return False
Expand Down
23 changes: 23 additions & 0 deletions src/silx/gui/_glutils/test/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# /*##########################################################################
#
# Copyright (c) 2015-2022 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
# ###########################################################################*/
36 changes: 36 additions & 0 deletions src/silx/gui/_glutils/test/test_gl.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# /*##########################################################################
#
# Copyright (c) 2015-2022 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
# ###########################################################################*/

from .. import gl


def test_version_bytes(mocker):
mocker.patch('silx.gui._glutils.gl.glGetString', return_value=b"3.0 Mock")
assert gl.getVersion() == (3, 0)


def test_version_str(mocker):
"""In case glGetString returns str"""
mocker.patch('silx.gui._glutils.gl.glGetString', return_value="3.0 Mock")
assert gl.getVersion() == (3, 0)
10 changes: 5 additions & 5 deletions src/silx/gui/plot/MaskToolsWidget.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# /*##########################################################################
#
# Copyright (c) 2017-2021 European Synchrotron Radiation Facility
# Copyright (c) 2017-2022 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -416,7 +416,7 @@ def hideEvent(self, event):

if self.isMaskInteractionActivated():
# Disable drawing tool
self.browseAction.trigger()
self.plot.resetInteractiveMode()

if self.isItemMaskUpdated(): # No "after-care"
self._data = numpy.zeros((0, 0), dtype=numpy.uint8)
Expand Down Expand Up @@ -712,7 +712,7 @@ def _saveMask(self):
"""Open Save mask dialog"""
dialog = qt.QFileDialog(self)
dialog.setWindowTitle("Save Mask")
dialog.setOption(dialog.DontUseNativeDialog)
dialog.setOption(qt.QFileDialog.DontUseNativeDialog)
dialog.setModal(1)
hdf5Filter = 'HDF5 (%s)' % _HDF5_EXT_STR
filters = [
Expand All @@ -733,9 +733,9 @@ def onFilterSelection(filt_):
# disable overwrite confirmation for HDF5,
# because we append the data to existing files
if filt_ == hdf5Filter:
dialog.setOption(dialog.DontConfirmOverwrite)
dialog.setOption(qt.QFileDialog.DontConfirmOverwrite)
else:
dialog.setOption(dialog.DontConfirmOverwrite, False)
dialog.setOption(qt.QFileDialog.DontConfirmOverwrite, False)

dialog.filterSelected.connect(onFilterSelection)
if not dialog.exec():
Expand Down
8 changes: 5 additions & 3 deletions src/silx/gui/plot/ScatterMaskToolsWidget.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# /*##########################################################################
#
# Copyright (c) 2018-2021 European Synchrotron Radiation Facility
# Copyright (c) 2018-2022 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -287,8 +287,10 @@ def hideEvent(self, event):
self.plot.sigActiveScatterChanged.disconnect(self._activeScatterChanged)
except (RuntimeError, TypeError):
_logger.info(sys.exc_info()[1])
if not self.browseAction.isChecked():
self.browseAction.trigger() # Disable drawing tool

if self.isMaskInteractionActivated():
# Disable drawing tool
self.plot.resetInteractiveMode()

if self.getSelectionMask(copy=False) is not None:
self.plot.sigActiveScatterChanged.connect(
Expand Down
4 changes: 2 additions & 2 deletions src/silx/gui/plot/_BaseMaskToolsWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -918,8 +918,8 @@ def changeEvent(self, event):
if (event.type() == qt.QEvent.EnabledChange and
not self.isEnabled() and
self.drawActionGroup.checkedAction()):
# Disable drawing tool by setting interaction to zoom
self.browseAction.trigger()
# Disable drawing tool by reseting interaction to pan or zoom
self.plot.resetInteractiveMode()

def save(self, filename, kind):
"""Save current mask in a file
Expand Down
12 changes: 6 additions & 6 deletions src/silx/gui/plot/actions/io.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# /*##########################################################################
#
# Copyright (c) 2004-2021 European Synchrotron Radiation Facility
# Copyright (c) 2004-2022 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -628,21 +628,21 @@ def _actionTriggered(self, checked=False):

# Create and run File dialog
dialog = qt.QFileDialog(self.plot)
dialog.setOption(dialog.DontUseNativeDialog)
dialog.setOption(qt.QFileDialog.DontUseNativeDialog)
dialog.setWindowTitle("Output File Selection")
dialog.setModal(1)
dialog.setNameFilters(list(filters.keys()))

dialog.setFileMode(dialog.AnyFile)
dialog.setAcceptMode(dialog.AcceptSave)
dialog.setFileMode(qt.QFileDialog.AnyFile)
dialog.setAcceptMode(qt.QFileDialog.AcceptSave)

def onFilterSelection(filt_):
# disable overwrite confirmation for NXdata types,
# because we append the data to existing files
if filt_ in self._appendFilters:
dialog.setOption(dialog.DontConfirmOverwrite)
dialog.setOption(qt.QFileDialog.DontConfirmOverwrite)
else:
dialog.setOption(dialog.DontConfirmOverwrite, False)
dialog.setOption(qt.QFileDialog.DontConfirmOverwrite, False)

dialog.filterSelected.connect(onFilterSelection)

Expand Down
3 changes: 3 additions & 0 deletions src/silx/gui/plot/backends/BackendMatplotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1485,6 +1485,9 @@ def draw(self):
This is directly called by matplotlib for widget resize.
"""
if self.size().isEmpty():
return # Skip rendering of 0-sized canvas

self.updateZOrder()

# Starting with mpl 2.1.0, toggling autoscale raises a ValueError
Expand Down
4 changes: 2 additions & 2 deletions src/silx/gui/plot/backends/glutils/GLPlotCurve.py
Original file line number Diff line number Diff line change
Expand Up @@ -854,8 +854,8 @@ def _getProgram(cls, marker):
@classmethod
def init(cls):
"""OpenGL context initialization"""
version = gl.glGetString(gl.GL_VERSION)
majorVersion = int(version[0])
version = gl.getVersion()
majorVersion = version[0]
assert majorVersion >= 2
gl.glEnable(gl.GL_VERTEX_PROGRAM_POINT_SIZE) # OpenGL 2
gl.glEnable(gl.GL_POINT_SPRITE) # OpenGL 2
Expand Down
6 changes: 3 additions & 3 deletions src/silx/gui/plot3d/actions/io.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# /*##########################################################################
#
# Copyright (c) 2016-2021 European Synchrotron Radiation Facility
# Copyright (c) 2016-2022 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -226,8 +226,8 @@ def _triggered(self, checked=False):
dialog.setModal(True)
dialog.setNameFilters([self.PNG_SERIE_FILTER,
self.MNG_FILTER])
dialog.setFileMode(dialog.AnyFile)
dialog.setAcceptMode(dialog.AcceptSave)
dialog.setFileMode(qt.QFileDialog.AnyFile)
dialog.setAcceptMode(qt.QFileDialog.AcceptSave)

if not dialog.exec():
return
Expand Down

0 comments on commit 4fdbc1e

Please sign in to comment.