summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorPicca Frédéric-Emmanuel <picca@debian.org>2022-02-02 14:19:58 +0100
committerPicca Frédéric-Emmanuel <picca@debian.org>2022-02-02 14:19:58 +0100
commit4e774db12d5ebe7a20eded6dd434a289e27999e5 (patch)
treea9822974ba45196f1e3740995ab157d6eb214a04 /examples
parentd3194b1a9c4404ba93afac43d97172ab24c57098 (diff)
New upstream version 1.0.0+dfsg
Diffstat (limited to 'examples')
-rw-r--r--examples/colormapDialog.py8
-rw-r--r--examples/compareImages.py4
-rw-r--r--examples/compositeline.py2
-rw-r--r--examples/customDataView.py2
-rw-r--r--examples/customHdf5TreeModel.py2
-rw-r--r--examples/dropZones.py4
-rw-r--r--examples/exampleBaseline.py4
-rwxr-xr-xexamples/fftPlotAction.py2
-rw-r--r--examples/fileDialog.py12
-rw-r--r--examples/findContours.py4
-rwxr-xr-xexamples/hdf5widget.py11
-rw-r--r--examples/icons.py4
-rw-r--r--examples/imageStack.py4
-rwxr-xr-xexamples/imageview.py87
-rw-r--r--examples/periodicTable.py5
-rw-r--r--examples/plot3dContextMenu.py6
-rw-r--r--examples/plot3dSceneWindow.py4
-rw-r--r--examples/plot3dUpdateScatterFromThread.py2
-rw-r--r--examples/plotClearAction.py4
-rw-r--r--examples/plotContextMenu.py4
-rw-r--r--examples/plotCurveLegendWidget.py6
-rw-r--r--examples/plotInteractiveImageROI.py4
-rwxr-xr-xexamples/plotItemsSelector.py4
-rw-r--r--examples/plotLimits.py4
-rw-r--r--examples/plotProfile.py2
-rw-r--r--examples/plotROIStats.py6
-rw-r--r--examples/plotStats.py4
-rw-r--r--examples/plotUpdateCurveFromThread.py4
-rw-r--r--examples/plotUpdateImageFromThread.py5
-rw-r--r--examples/plotWidget.py6
-rwxr-xr-xexamples/printPreview.py4
-rw-r--r--examples/scatterMask.py2
-rwxr-xr-xexamples/scatterview.py2
-rwxr-xr-xexamples/shiftPlotAction.py4
-rwxr-xr-xexamples/simplewidget.py2
-rw-r--r--examples/stackView.py2
-rw-r--r--examples/syncPlotLocation.py2
-rw-r--r--examples/syncaxis.py2
-rw-r--r--examples/viewer3DVolume.py2
39 files changed, 157 insertions, 85 deletions
diff --git a/examples/colormapDialog.py b/examples/colormapDialog.py
index c9e7c35..d389327 100644
--- a/examples/colormapDialog.py
+++ b/examples/colormapDialog.py
@@ -1,7 +1,7 @@
# coding: utf-8
# /*##########################################################################
#
-# Copyright (c) 2017-2018 European Synchrotron Radiation Facility
+# Copyright (c) 2017-2021 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
@@ -140,7 +140,7 @@ class ColormapDialogExample(qt.QMainWindow):
button = qt.QPushButton("Negative to positive")
button.clicked.connect(self.setDataFromNegToPos)
layout.addWidget(button)
- button = qt.QPushButton("Only non finite values")
+ button = qt.QPushButton("With non finite values")
button.clicked.connect(self.setDataWithNonFinite)
layout.addWidget(button)
@@ -259,7 +259,7 @@ class ColormapDialogExample(qt.QMainWindow):
if scipy is not None:
from scipy import ndimage
data = ndimage.gaussian_filter(data, sigma=20)
- data = numpy.random.poisson(data)
+ data = numpy.random.poisson(data).astype(numpy.float32)
data[10] = float("nan")
data[50] = float("+inf")
data[100] = float("-inf")
@@ -275,7 +275,7 @@ def main():
example = ColormapDialogExample()
example.show()
- app.exec_()
+ app.exec()
if __name__ == '__main__':
diff --git a/examples/compareImages.py b/examples/compareImages.py
index 623216a..3408a72 100644
--- a/examples/compareImages.py
+++ b/examples/compareImages.py
@@ -2,7 +2,7 @@
# coding: utf-8
# /*##########################################################################
#
-# Copyright (c) 2016-2017 European Synchrotron Radiation Facility
+# Copyright (c) 2016-2021 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
@@ -208,4 +208,4 @@ if __name__ == "__main__":
window.setFiles(options.files)
window.setVisible(True)
- app.exec_()
+ app.exec()
diff --git a/examples/compositeline.py b/examples/compositeline.py
index 892ecf3..72398e6 100644
--- a/examples/compositeline.py
+++ b/examples/compositeline.py
@@ -72,7 +72,7 @@ def main(argv=None):
addLine([70, 0], [70, 100], "_", "_", "l6", "black")
mainWindow.setVisible(True)
- return app.exec_()
+ return app.exec()
if __name__ == "__main__":
diff --git a/examples/customDataView.py b/examples/customDataView.py
index 33662e8..e02e577 100644
--- a/examples/customDataView.py
+++ b/examples/customDataView.py
@@ -96,7 +96,7 @@ def main():
widget.addView(MyColorView(widget))
widget.setData(Color.GREEN)
widget.show()
- result = app.exec_()
+ result = app.exec()
# remove ending warnings relative to QTimer
app.deleteLater()
sys.exit(result)
diff --git a/examples/customHdf5TreeModel.py b/examples/customHdf5TreeModel.py
index fde76c5..ffc0220 100644
--- a/examples/customHdf5TreeModel.py
+++ b/examples/customHdf5TreeModel.py
@@ -279,7 +279,7 @@ def main(filenames):
sys.excepthook = qt.exceptionHandler
window = Hdf5TreeViewExample(filenames)
window.show()
- result = app.exec_()
+ result = app.exec()
# remove ending warnings relative to QTimer
app.deleteLater()
sys.exit(result)
diff --git a/examples/dropZones.py b/examples/dropZones.py
index 68d0a57..6593bbb 100644
--- a/examples/dropZones.py
+++ b/examples/dropZones.py
@@ -140,7 +140,7 @@ class DragLabel(qt.QLabel):
self._url.path().encode(encoding='utf-8'))
drag = qt.QDrag(self)
drag.setMimeData(mimeData)
- dropAction = drag.exec_()
+ dropAction = drag.exec()
class DragAndDropExample(qt.QMainWindow):
@@ -178,7 +178,7 @@ def main():
silx.io.url.DataUrl(file_path=filename, data_path='/curve', scheme="silx")))
example.setWindowTitle("Drag&Drop URLs sample code")
example.show()
- app.exec_()
+ app.exec()
if __name__ == "__main__":
diff --git a/examples/exampleBaseline.py b/examples/exampleBaseline.py
index edd0fc3..b53b412 100644
--- a/examples/exampleBaseline.py
+++ b/examples/exampleBaseline.py
@@ -2,7 +2,7 @@
# coding: utf-8
# /*##########################################################################
#
-# Copyright (c) 2017-2018 European Synchrotron Radiation Facility
+# Copyright (c) 2017-2021 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
@@ -157,7 +157,7 @@ def main(argv):
plot_log = get_plot_log(backend=options.backend)
plot_log.show()
- qapp.exec_()
+ qapp.exec()
if __name__ == '__main__':
diff --git a/examples/fftPlotAction.py b/examples/fftPlotAction.py
index bdea08d..f7c819f 100755
--- a/examples/fftPlotAction.py
+++ b/examples/fftPlotAction.py
@@ -190,5 +190,5 @@ plotwin.getYAxis().setLabel("amplitude")
plotwin.getXAxis().setLabel("time")
plotwin.show()
-app.exec_()
+app.exec()
sys.excepthook = sys.__excepthook__
diff --git a/examples/fileDialog.py b/examples/fileDialog.py
index 40191bb..fa11ed5 100644
--- a/examples/fileDialog.py
+++ b/examples/fileDialog.py
@@ -2,7 +2,7 @@
# coding: utf-8
# /*##########################################################################
#
-# Copyright (c) 2016-2019 European Synchrotron Radiation Facility
+# Copyright (c) 2016-2021 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
@@ -216,7 +216,7 @@ class DialogExample(qt.QMainWindow):
dialog = self.createDialog()
# Execute the dialog as modal
- result = dialog.exec_()
+ result = dialog.exec()
self.printResult(dialog, result)
def openDialogStoredState(self):
@@ -226,7 +226,7 @@ class DialogExample(qt.QMainWindow):
dialog.restoreState(self.__state[dialog.__class__])
# Execute the dialog as modal
- result = dialog.exec_()
+ result = dialog.exec()
self.__state[dialog.__class__] = dialog.saveState()
self.printResult(dialog, result)
@@ -237,7 +237,7 @@ class DialogExample(qt.QMainWindow):
dialog.setDirectory(path)
# Execute the dialog as modal
- result = dialog.exec_()
+ result = dialog.exec()
self.printResult(dialog, result)
def openDialogAtComputer(self):
@@ -247,7 +247,7 @@ class DialogExample(qt.QMainWindow):
dialog.setDirectory(path)
# Execute the dialog as modal
- result = dialog.exec_()
+ result = dialog.exec()
self.printResult(dialog, result)
@@ -255,7 +255,7 @@ def main():
app = qt.QApplication([])
example = DialogExample()
example.show()
- app.exec_()
+ app.exec()
if __name__ == "__main__":
diff --git a/examples/findContours.py b/examples/findContours.py
index 6199ba6..acf5199 100644
--- a/examples/findContours.py
+++ b/examples/findContours.py
@@ -2,7 +2,7 @@
# coding: utf-8
# /*##########################################################################
#
-# Copyright (c) 2016-2019 European Synchrotron Radiation Facility
+# Copyright (c) 2016-2021 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
@@ -694,7 +694,7 @@ def main():
window = FindContours()
window.generateIsland()
window.show()
- result = app.exec_()
+ result = app.exec()
# remove ending warnings relative to QTimer
app.deleteLater()
return result
diff --git a/examples/hdf5widget.py b/examples/hdf5widget.py
index 0d45b8f..82ce27d 100755
--- a/examples/hdf5widget.py
+++ b/examples/hdf5widget.py
@@ -2,7 +2,7 @@
# coding: utf-8
# /*##########################################################################
#
-# Copyright (c) 2016-2019 European Synchrotron Radiation Facility
+# Copyright (c) 2016-2021 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
@@ -25,12 +25,12 @@
# ###########################################################################*/
"""Qt Hdf5 widget examples"""
+import html
import logging
import sys
import tempfile
import numpy
-import six
logging.basicConfig()
_logger = logging.getLogger("hdf5widget")
@@ -46,7 +46,6 @@ except ImportError:
import h5py
import silx.gui.hdf5
-import silx.utils.html
from silx.gui import qt
from silx.gui.data.DataViewerFrame import DataViewerFrame
from silx.gui.widgets.ThreadPoolPushButton import ThreadPoolPushButton
@@ -59,7 +58,7 @@ _file_cache = {}
def str_attrs(str_list):
"""Return a numpy array of unicode strings"""
- text_dtype = h5py.special_dtype(vlen=six.text_type)
+ text_dtype = h5py.special_dtype(vlen=str)
return numpy.array(str_list, dtype=text_dtype)
@@ -573,7 +572,7 @@ class Hdf5TreeViewExample(qt.QMainWindow):
"""Called to log event in widget
"""
def formatKey(name, value):
- name, value = silx.utils.html.escape(str(name)), silx.utils.html.escape(str(value))
+ name, value = html.escape(str(name)), html.escape(str(value))
return "<li><b>%s</b>: %s</li>" % (name, value)
text = "<html>"
@@ -791,7 +790,7 @@ def main(filenames):
sys.excepthook = qt.exceptionHandler
window = Hdf5TreeViewExample(filenames)
window.show()
- result = app.exec_()
+ result = app.exec()
# remove ending warnings relative to QTimer
app.deleteLater()
sys.exit(result)
diff --git a/examples/icons.py b/examples/icons.py
index ae77630..ff8410d 100644
--- a/examples/icons.py
+++ b/examples/icons.py
@@ -2,7 +2,7 @@
# coding: utf-8
# /*##########################################################################
#
-# Copyright (c) 2016-2018 European Synchrotron Radiation Facility
+# Copyright (c) 2016-2021 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
@@ -177,4 +177,4 @@ if __name__ == "__main__":
app = qt.QApplication([])
window = IconPreview()
window.setVisible(True)
- app.exec_()
+ app.exec()
diff --git a/examples/imageStack.py b/examples/imageStack.py
index 0437a6e..4c211b5 100644
--- a/examples/imageStack.py
+++ b/examples/imageStack.py
@@ -2,7 +2,7 @@
# coding: utf-8
# /*##########################################################################
#
-# Copyright (c) 2016-2018 European Synchrotron Radiation Facility
+# Copyright (c) 2016-2021 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
@@ -132,7 +132,7 @@ def main():
urls = create_datasets(folder=dataset_folder)
widget.setUrls(urls=urls)
widget.show()
- qapp.exec_()
+ qapp.exec()
widget.close()
shutil.rmtree(dataset_folder)
diff --git a/examples/imageview.py b/examples/imageview.py
index 81741b1..40b5dff 100755
--- a/examples/imageview.py
+++ b/examples/imageview.py
@@ -40,14 +40,76 @@ __license__ = "MIT"
__date__ = "08/11/2018"
import logging
+import numpy
+import time
+import threading
+
+from silx.gui.utils import concurrent
from silx.gui.plot.ImageView import ImageViewMainWindow
from silx.gui import qt
-import numpy
logging.basicConfig()
logger = logging.getLogger(__name__)
+Nx = 150
+Ny = 50
+
+
+class UpdateThread(threading.Thread):
+ """Thread updating the image of a :class:`~sil.gui.plot.Plot2D`
+
+ :param plot2d: The Plot2D to update."""
+
+ def __init__(self, imageview):
+ self.imageview = imageview
+ self.running = False
+ self.future_result = None
+ super(UpdateThread, self).__init__()
+
+ def start(self):
+ """Start the update thread"""
+ self.running = True
+ super(UpdateThread, self).start()
+
+ def run(self, pos={'x0': 0, 'y0': 0}):
+ """Method implementing thread loop that updates the plot
+
+ It produces an image every 10 ms or so, and
+ either updates the plot or skip the image
+ """
+ while self.running:
+ time.sleep(0.01)
+
+ # Create image
+ # width of peak
+ sigma_x = 0.15
+ sigma_y = 0.25
+ # x and y positions
+ x = numpy.linspace(-1.5, 1.5, Nx)
+ y = numpy.linspace(-1.0, 1.0, Ny)
+ xv, yv = numpy.meshgrid(x, y)
+ signal = numpy.exp(- ((xv - pos['x0']) ** 2 / sigma_x ** 2
+ + (yv - pos['y0']) ** 2 / sigma_y ** 2))
+ # add noise
+ signal += 0.3 * numpy.random.random(size=signal.shape)
+ # random walk of center of peak ('drift')
+ pos['x0'] += 0.05 * (numpy.random.random() - 0.5)
+ pos['y0'] += 0.05 * (numpy.random.random() - 0.5)
+
+ # If previous frame was not added to the plot yet, skip this one
+ if self.future_result is None or self.future_result.done():
+ # plot the data asynchronously, and
+ # keep a reference to the `future` object
+ self.future_result = concurrent.submitToQtMainThread(
+ self.imageview.setImage, signal, resetzoom=False)
+
+ def stop(self):
+ """Stop the update thread"""
+ self.running = False
+ self.join(2)
+
+
def main(argv=None):
"""Display an image from a file in an :class:`ImageView` widget.
@@ -82,12 +144,17 @@ def main(argv=None):
parser.add_argument(
'filename', nargs='?',
help='EDF filename of the image to open')
+ parser.add_argument(
+ '--live', action='store_true',
+ help='Live update of a generated image')
args = parser.parse_args(args=argv)
# Open the input file
- if not args.filename:
+ edfFile = None
+ if args.live:
+ data = None
+ elif not args.filename:
logger.warning('No image file provided, displaying dummy data')
- edfFile = None
size = 512
xx, yy = numpy.ogrid[-size:size, -size:size]
data = numpy.cos(xx / (size//5)) + numpy.cos(yy / (size//5))
@@ -118,9 +185,10 @@ def main(argv=None):
colormap = mainWindow.getDefaultColormap()
colormap.setNormalization(colormap.LOGARITHM)
- mainWindow.setImage(data,
- origin=args.origin,
- scale=args.scale)
+ if data is not None:
+ mainWindow.setImage(data,
+ origin=args.origin,
+ scale=args.scale)
if edfFile is not None and nbFrames > 1:
# Add a toolbar for multi-frame EDF support
@@ -144,7 +212,12 @@ def main(argv=None):
mainWindow.show()
mainWindow.setFocus(qt.Qt.OtherFocusReason)
- return app.exec_()
+ if args.live:
+ # Start updating the plot
+ updateThread = UpdateThread(mainWindow)
+ updateThread.start()
+
+ return app.exec()
if __name__ == "__main__":
diff --git a/examples/periodicTable.py b/examples/periodicTable.py
index e329ef7..fc3985f 100644
--- a/examples/periodicTable.py
+++ b/examples/periodicTable.py
@@ -2,7 +2,7 @@
# coding: utf-8
# /*##########################################################################
#
-# Copyright (c) 2004-2017 European Synchrotron Radiation Facility
+# Copyright (c) 2004-2021 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
@@ -77,5 +77,4 @@ w.addTab(pl, "PeriodicList")
w.addTab(comboContainer, "PeriodicCombo")
w.show()
-a.exec_()
-
+a.exec()
diff --git a/examples/plot3dContextMenu.py b/examples/plot3dContextMenu.py
index d33bb8f..0802b29 100644
--- a/examples/plot3dContextMenu.py
+++ b/examples/plot3dContextMenu.py
@@ -1,7 +1,7 @@
# coding: utf-8
# /*##########################################################################
#
-# Copyright (c) 2017 European Synchrotron Radiation Facility
+# Copyright (c) 2017-2021 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
@@ -86,7 +86,7 @@ class ScalarFieldViewWithContextMenu(ScalarFieldView):
# The position received as argument is relative to Plot3DWidget
# and needs to be converted.
globalPosition = self.getPlot3DWidget().mapToGlobal(pos)
- menu.exec_(globalPosition)
+ menu.exec(globalPosition)
# Start Qt QApplication
@@ -109,4 +109,4 @@ window.setData(data)
window.addIsosurface(0.2, '#FF0000FF')
window.show()
-app.exec_()
+app.exec()
diff --git a/examples/plot3dSceneWindow.py b/examples/plot3dSceneWindow.py
index 1b2f808..436b121 100644
--- a/examples/plot3dSceneWindow.py
+++ b/examples/plot3dSceneWindow.py
@@ -1,7 +1,7 @@
# coding: utf-8
# /*##########################################################################
#
-# Copyright (c) 2017-2019 European Synchrotron Radiation Facility
+# Copyright (c) 2017-2021 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
@@ -200,4 +200,4 @@ window.show()
sys.excepthook = qt.exceptionHandler
# Run Qt event loop
-qapp.exec_()
+qapp.exec()
diff --git a/examples/plot3dUpdateScatterFromThread.py b/examples/plot3dUpdateScatterFromThread.py
index 9c2213f..a02fec6 100644
--- a/examples/plot3dUpdateScatterFromThread.py
+++ b/examples/plot3dUpdateScatterFromThread.py
@@ -167,7 +167,7 @@ def main():
updateThread = UpdateScatterThread(scatter)
updateThread.start() # Start updating the plot
- app.exec_()
+ app.exec()
updateThread.stop() # Stop updating the plot
diff --git a/examples/plotClearAction.py b/examples/plotClearAction.py
index e1130cb..6f1823a 100644
--- a/examples/plotClearAction.py
+++ b/examples/plotClearAction.py
@@ -1,7 +1,7 @@
# coding: utf-8
# /*##########################################################################
#
-# Copyright (c) 2018 European Synchrotron Radiation Facility
+# Copyright (c) 2018-2021 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
@@ -72,4 +72,4 @@ if __name__ == '__main__':
plot.addCurve((0, 1, 2, 3, 4), (0, 1, 1.5, 1, 0)) # Add a curve to the plot
plot.show() # Show the plot widget
- app.exec_() # Start Qt application
+ app.exec() # Start Qt application
diff --git a/examples/plotContextMenu.py b/examples/plotContextMenu.py
index 5f02f5f..bd1ad87 100644
--- a/examples/plotContextMenu.py
+++ b/examples/plotContextMenu.py
@@ -87,7 +87,7 @@ class PlotWidgetWithContextMenu(PlotWidget):
# plot area, and thus needs to be converted.
plotArea = self.getWidgetHandle()
globalPosition = plotArea.mapToGlobal(pos)
- menu.exec_(globalPosition)
+ menu.exec(globalPosition)
# Start the QApplication
@@ -100,4 +100,4 @@ plot.addCurve(x, numpy.sin(x), legend='sin')
# Show the widget and start the application
plot.show()
-app.exec_()
+app.exec()
diff --git a/examples/plotCurveLegendWidget.py b/examples/plotCurveLegendWidget.py
index 97c516a..98ba30b 100644
--- a/examples/plotCurveLegendWidget.py
+++ b/examples/plotCurveLegendWidget.py
@@ -1,7 +1,7 @@
# coding: utf-8
# /*##########################################################################
#
-# Copyright (c) 2018-2020 European Synchrotron Radiation Facility
+# Copyright (c) 2018-2021 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
@@ -112,7 +112,7 @@ class MyCurveLegendsWidget(CurveLegendsWidget):
functools.partial(self._switchCurveVisibility, curve))
globalPosition = self.mapToGlobal(pos)
- menu.exec_(globalPosition)
+ menu.exec(globalPosition)
# First create the QApplication
@@ -151,4 +151,4 @@ window.addDockWidget(qt.Qt.RightDockWidgetArea, dock)
window.setAttribute(qt.Qt.WA_DeleteOnClose)
window.show()
-app.exec_()
+app.exec()
diff --git a/examples/plotInteractiveImageROI.py b/examples/plotInteractiveImageROI.py
index 7254b7e..298f7af 100644
--- a/examples/plotInteractiveImageROI.py
+++ b/examples/plotInteractiveImageROI.py
@@ -2,7 +2,7 @@
# coding: utf-8
# /*##########################################################################
#
-# Copyright (c) 2018-2020 European Synchrotron Radiation Facility
+# Copyright (c) 2018-2021 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
@@ -153,6 +153,6 @@ plot.addTabbedDockWidget(dock)
# Show the widget and start the application
plot.show()
-result = app.exec_()
+result = app.exec()
app.deleteLater()
sys.exit(result)
diff --git a/examples/plotItemsSelector.py b/examples/plotItemsSelector.py
index 177489f..d7493ae 100755
--- a/examples/plotItemsSelector.py
+++ b/examples/plotItemsSelector.py
@@ -46,11 +46,11 @@ pw.show()
isd = ItemsSelectionDialog(plot=pw)
isd.setItemsSelectionMode(qt.QTableWidget.ExtendedSelection)
-result = isd.exec_()
+result = isd.exec()
if result:
for item in isd.getSelectedItems():
print(item.getName(), type(item))
else:
print("Selection cancelled")
-app.exec_()
+app.exec()
diff --git a/examples/plotLimits.py b/examples/plotLimits.py
index c7cc7f5..75440f4 100644
--- a/examples/plotLimits.py
+++ b/examples/plotLimits.py
@@ -2,7 +2,7 @@
# coding: utf-8
# /*##########################################################################
#
-# Copyright (c) 2016-2017 European Synchrotron Radiation Facility
+# Copyright (c) 2016-2021 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
@@ -90,4 +90,4 @@ if __name__ == "__main__":
app = qt.QApplication([])
window = ConstrainedViewPlot()
window.setVisible(True)
- app.exec_()
+ app.exec()
diff --git a/examples/plotProfile.py b/examples/plotProfile.py
index 931f9b4..40e199a 100644
--- a/examples/plotProfile.py
+++ b/examples/plotProfile.py
@@ -201,7 +201,7 @@ def main():
app = qt.QApplication([])
widget = Example()
widget.show()
- app.exec_()
+ app.exec()
if __name__ == "__main__":
main()
diff --git a/examples/plotROIStats.py b/examples/plotROIStats.py
index 3caff7e..e713592 100644
--- a/examples/plotROIStats.py
+++ b/examples/plotROIStats.py
@@ -248,7 +248,7 @@ def example_curve(mode):
window.setUpdateMode(mode)
window.show()
- app.exec_()
+ app.exec()
def example_image(mode):
@@ -278,7 +278,7 @@ def example_image(mode):
window.setUpdateMode(mode)
window.show()
- app.exec_()
+ app.exec()
updateThread.stop() # Stop updating the plot
@@ -314,7 +314,7 @@ def example_curve_image(mode):
updateThread.start() # Start updating the plot
window.show()
- app.exec_()
+ app.exec()
updateThread.stop() # Stop updating the plot
diff --git a/examples/plotStats.py b/examples/plotStats.py
index 030caf8..433088f 100644
--- a/examples/plotStats.py
+++ b/examples/plotStats.py
@@ -2,7 +2,7 @@
# coding: utf-8
# /*##########################################################################
#
-# Copyright (c) 2016-2019 European Synchrotron Radiation Facility
+# Copyright (c) 2016-2021 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
@@ -161,7 +161,7 @@ def main(argv):
plot.getStatsWidget().parent().setVisible(True)
plot.show()
- app.exec_()
+ app.exec()
updateThread.stop() # Stop updating the plot
diff --git a/examples/plotUpdateCurveFromThread.py b/examples/plotUpdateCurveFromThread.py
index a36e5ee..27dbf9b 100644
--- a/examples/plotUpdateCurveFromThread.py
+++ b/examples/plotUpdateCurveFromThread.py
@@ -1,7 +1,7 @@
# coding: utf-8
# /*##########################################################################
#
-# Copyright (c) 2017-2018 European Synchrotron Radiation Facility
+# Copyright (c) 2017-2021 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
@@ -95,7 +95,7 @@ def main():
updateThread = UpdateThread(plot1d)
updateThread.start() # Start updating the plot
- app.exec_()
+ app.exec()
updateThread.stop() # Stop updating the plot
diff --git a/examples/plotUpdateImageFromThread.py b/examples/plotUpdateImageFromThread.py
index 5850263..de23d3f 100644
--- a/examples/plotUpdateImageFromThread.py
+++ b/examples/plotUpdateImageFromThread.py
@@ -1,7 +1,7 @@
# coding: utf-8
# /*##########################################################################
#
-# Copyright (c) 2017-2018 European Synchrotron Radiation Facility
+# Copyright (c) 2017-2021 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
@@ -116,6 +116,7 @@ def main():
# Create a Plot2D, set its limits and display it
plot2d = Plot2D()
+ plot2d.getIntensityHistogramAction().setVisible(True)
plot2d.setLimits(0, Nx, 0, Ny)
plot2d.getDefaultColormap().setVRange(0., 1.5)
plot2d.show()
@@ -124,7 +125,7 @@ def main():
updateThread = UpdateThread(plot2d)
updateThread.start() # Start updating the plot
- app.exec_()
+ app.exec()
updateThread.stop() # Stop updating the plot
diff --git a/examples/plotWidget.py b/examples/plotWidget.py
index af64afb..5d1f4b6 100644
--- a/examples/plotWidget.py
+++ b/examples/plotWidget.py
@@ -1,7 +1,7 @@
# coding: utf-8
# /*##########################################################################
#
-# Copyright (c) 2017-2018 European Synchrotron Radiation Facility
+# Copyright (c) 2017-2021 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
@@ -64,7 +64,7 @@ class MyPlotWindow(qt.QMainWindow):
# Make ColorBarWidget background white by changing its palette
colorBar.setAutoFillBackground(True)
palette = colorBar.palette()
- palette.setColor(qt.QPalette.Background, qt.Qt.white)
+ palette.setColor(qt.QPalette.Window, qt.Qt.white)
palette.setColor(qt.QPalette.Window, qt.Qt.white)
colorBar.setPalette(palette)
@@ -178,7 +178,7 @@ def main():
window.setAttribute(qt.Qt.WA_DeleteOnClose)
window.show()
window.showImage()
- app.exec_()
+ app.exec()
if __name__ == '__main__':
diff --git a/examples/printPreview.py b/examples/printPreview.py
index 6de8209..7fe5480 100755
--- a/examples/printPreview.py
+++ b/examples/printPreview.py
@@ -2,7 +2,7 @@
# coding: utf-8
# /*##########################################################################
#
-# Copyright (c) 2016-2018 European Synchrotron Radiation Facility
+# Copyright (c) 2016-2021 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
@@ -96,4 +96,4 @@ pw3.show()
pw3.addCurve(x, numpy.cos(x * 2 * numpy.pi / 1000))
-app.exec_()
+app.exec()
diff --git a/examples/scatterMask.py b/examples/scatterMask.py
index 7a407ad..839fa3a 100644
--- a/examples/scatterMask.py
+++ b/examples/scatterMask.py
@@ -150,4 +150,4 @@ if __name__ == "__main__":
msw.setScatter(x, y, v=v)
msw.setBackgroundImage(bg_img)
msw.show()
- app.exec_()
+ app.exec()
diff --git a/examples/scatterview.py b/examples/scatterview.py
index cab32c0..5df11be 100755
--- a/examples/scatterview.py
+++ b/examples/scatterview.py
@@ -91,7 +91,7 @@ def main(argv=None):
mainWindow.show()
mainWindow.setFocus(qt.Qt.OtherFocusReason)
- return app.exec_()
+ return app.exec()
if __name__ == "__main__":
diff --git a/examples/shiftPlotAction.py b/examples/shiftPlotAction.py
index f272cda..6c5f8cf 100755
--- a/examples/shiftPlotAction.py
+++ b/examples/shiftPlotAction.py
@@ -2,7 +2,7 @@
# coding: utf-8
# /*##########################################################################
#
-# Copyright (c) 2016-2018 European Synchrotron Radiation Facility
+# Copyright (c) 2016-2021 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
@@ -110,4 +110,4 @@ plotwin.addCurve(x, y1, legend="triangle shaped curve")
plotwin.addCurve(x, y2, legend="oblique line")
plotwin.show()
-app.exec_()
+app.exec()
diff --git a/examples/simplewidget.py b/examples/simplewidget.py
index 0e9038e..0a1c336 100755
--- a/examples/simplewidget.py
+++ b/examples/simplewidget.py
@@ -219,7 +219,7 @@ def main():
sys.excepthook = qt.exceptionHandler
window = SimpleWidgetExample()
window.show()
- result = app.exec_()
+ result = app.exec()
# remove ending warnings relative to QTimer
app.deleteLater()
sys.excepthook = sys.__excepthook__
diff --git a/examples/stackView.py b/examples/stackView.py
index a4b6e8c..f857140 100644
--- a/examples/stackView.py
+++ b/examples/stackView.py
@@ -61,4 +61,4 @@ maskToolsWidget.setItemMaskUpdated(True)
sv.show()
-app.exec_()
+app.exec()
diff --git a/examples/syncPlotLocation.py b/examples/syncPlotLocation.py
index 55332bc..83c1ade 100644
--- a/examples/syncPlotLocation.py
+++ b/examples/syncPlotLocation.py
@@ -102,4 +102,4 @@ if __name__ == "__main__":
window = SyncPlot()
window.setAttribute(qt.Qt.WA_DeleteOnClose, True)
window.setVisible(True)
- app.exec_()
+ app.exec()
diff --git a/examples/syncaxis.py b/examples/syncaxis.py
index 02505c9..2976231 100644
--- a/examples/syncaxis.py
+++ b/examples/syncaxis.py
@@ -99,4 +99,4 @@ if __name__ == "__main__":
window = SyncPlot()
window.setAttribute(qt.Qt.WA_DeleteOnClose, True)
window.setVisible(True)
- app.exec_()
+ app.exec()
diff --git a/examples/viewer3DVolume.py b/examples/viewer3DVolume.py
index 2193402..5b86199 100644
--- a/examples/viewer3DVolume.py
+++ b/examples/viewer3DVolume.py
@@ -203,4 +203,4 @@ else:
window.addIsosurface(default_isolevel, '#FF0000FF')
window.show()
-app.exec_()
+app.exec()