How to use the silx.gui.qt.QWidget function in silx

To help you get started, we’ve selected a few silx examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github silx-kit / silx / test / colorbar.py View on Github external
legend='image5',
                           colormap=self.colormap3)
        self.plot.addImage(data=image6,
                           origin=(100, 200),
                           legend='image6',
                           colormap=self.colormap3)

    def _buildColormapEditors(self):
        self._cmpEditor = qt.QWidget(parent=self)
        self._cmpEditor.setLayout(qt.QVBoxLayout())
        self._cmpEditor.layout().addWidget(_ColormapEditor(self.colormap3))
        self._cmpEditor.layout().addWidget(_ColormapEditor(self.colormap2))
        self._cmpEditor.layout().addWidget(_ColormapEditor(self.colormap1))


class _ColormapEditor(qt.QWidget):
    """Simple colormap editor"""

    def __init__(self, colormap):
        qt.QWidget.__init__(self)
        self.setLayout(qt.QVBoxLayout())
        self._colormap = colormap
        self._buildGUI()

        self.setColormap(colormap)

        # connect GUI and colormap
        self._qcbName.currentIndexChanged.connect(self._nameChanged)
        self._qgbNorm._qrbLinear.toggled.connect(self._normalizationHaschanged)
        self._qgbNorm._qrbLog.toggled.connect(self._normalizationHaschanged)
        self._vminWidget.sigValueChanged.connect(self._vminHasChanged)
        self._vmaxWidget.sigValueChanged.connect(self._vmaxHasChanged)
github silx-kit / silx / examples / syncaxis.py View on Github external
def __init__(self):
        qt.QMainWindow.__init__(self)
        self.setWindowTitle("Plot with synchronized axes")
        widget = qt.QWidget(self)
        self.setCentralWidget(widget)

        layout = qt.QGridLayout()
        widget.setLayout(layout)

        backend = "mpl"
        self.plot2d = plot.Plot2D(parent=widget, backend=backend)
        self.plot2d.setInteractiveMode('pan')
        self.plot1d_x1 = plot.Plot1D(parent=widget, backend=backend)
        self.plot1d_x2 = plot.PlotWidget(parent=widget, backend=backend)
        self.plot1d_y1 = plot.Plot1D(parent=widget, backend=backend)
        self.plot1d_y2 = plot.PlotWidget(parent=widget, backend=backend)

        data = numpy.arange(100 * 100)
        data = (data % 100) / 5.0
        data = numpy.sin(data)
github silx-kit / silx / silx / gui / plot3d / tools / PositionInfoWidget.py View on Github external
__date__ = "01/10/2018"


import logging
import weakref

from ... import qt
from .. import items
from ..items import volume
from ..SceneWidget import SceneWidget


_logger = logging.getLogger(__name__)


class PositionInfoWidget(qt.QWidget):
    """Widget displaying information about picked position

    :param QWidget parent: See :class:`QWidget`
    """

    def __init__(self, parent=None):
        super(PositionInfoWidget, self).__init__(parent)
        self._sceneWidgetRef = None

        self.setToolTip("Double-click on a data point to show its value")
        layout = qt.QBoxLayout(qt.QBoxLayout.LeftToRight, self)

        self._xLabel = self._addInfoField('X')
        self._yLabel = self._addInfoField('Y')
        self._zLabel = self._addInfoField('Z')
        self._dataLabel = self._addInfoField('Data')
github silx-kit / silx / silx / gui / data / DataViewerFrame.py View on Github external
# THE SOFTWARE.
#
# ###########################################################################*/
"""This module contains a DataViewer with a view selector.
"""

__authors__ = ["V. Valls"]
__license__ = "MIT"
__date__ = "12/02/2019"

from silx.gui import qt
from .DataViewer import DataViewer
from .DataViewerSelector import DataViewerSelector


class DataViewerFrame(qt.QWidget):
    """
    A :class:`DataViewer` with a view selector.

    .. image:: img/DataViewerFrame.png

    This widget provides the same API as :class:`DataViewer`. Therefore, for more
    documentation, take a look at the documentation of the class
    :class:`DataViewer`.

    .. code-block:: python

        import numpy
        data = numpy.random.rand(500,500)
        viewer = DataViewerFrame()
        viewer.setData(data)
        viewer.setVisible(True)
github silx-kit / silx / silx / gui / data / NXdataWidgets.py View on Github external
self._plot.getYAxis().setLabel(self.__signals_names[0])

    def _setYLabelFromActiveLegend(self, previous_legend, new_legend):
        for ylabel in self.__signals_names:
            if new_legend is not None and new_legend == ylabel:
                self._plot.getYAxis().setLabel(ylabel)
                break

    def clear(self):
        old = self._selector.blockSignals(True)
        self._selector.clear()
        self._selector.blockSignals(old)
        self._plot.clear()


class XYVScatterPlot(qt.QWidget):
    """
    Widget for plotting one or more scatters
    (with identical x, y coordinates).
    """
    def __init__(self, parent=None):
        """

        :param parent: Parent QWidget
        """
        super(XYVScatterPlot, self).__init__(parent)

        self.__y_axis = None
        """1D array"""
        self.__y_axis_name = None
        self.__values = None
        """List of 1D arrays (for multiple scatters with identical
github silx-kit / silx / examples / simplewidget.py View on Github external
def createLegendIconPanel(self, parent):
        panel = qt.QWidget(parent)
        layout = qt.QVBoxLayout(panel)

        # Empty
        legend = LegendIconWidget(panel)
        layout.addWidget(legend)

        # Line
        legend = LegendIconWidget(panel)
        legend.setLineStyle("-")
        legend.setLineColor("blue")
        legend.setLineWidth(2)
        layout.addWidget(legend)

        # Symbol
        legend = LegendIconWidget(panel)
        legend.setSymbol("o")
github silx-kit / pyFAI / pyFAI / gui / tasks / GeometryTask.py View on Github external
def addParameterToLayout(self, layout, param):
        # an empty grid returns 1
        row = layout.rowCount()
        widgets = param.widgets()
        for i, widget in enumerate(widgets):
            if isinstance(widget, qt.QWidget):
                layout.addWidget(widget, row, i)
            else:
                layout.addLayout(widget, row, i)
github silx-kit / pyFAI / pyFAI / gui / IntegrationDialog.py View on Github external
def __init__(self, input_data=None, output_path=None, json_file=".azimint.json", context=None):
        qt.QWidget.__init__(self)
        filename = get_ui_file("integration-dialog.ui")
        qt.loadUi(filename, self)

        pyfaiIcon = icons.getQIcon("pyfai:gui/images/icon")
        self.setWindowIcon(pyfaiIcon)

        self.__context = context
        if context is not None:
            context.restoreWindowLocationSettings("main-window", self)

        self.__workerConfigurator = WorkerConfigurator(self._holder)
        layout = qt.QVBoxLayout(self._holder)
        layout.addWidget(self.__workerConfigurator)
        layout.setContentsMargins(0, 0, 0, 0)
        self._holder.setLayout(layout)
github silx-kit / silx / examples / periodicTable.py View on Github external
def click_table(item):
    print("New table click: %s (%s)" % (item.name, item.subcategory))


def change_table(items):
    print("New table selection:", [item.symbol for item in items])


pt.sigElementClicked.connect(click_table)
pt.sigSelectionChanged.connect(change_table)
pl.sigSelectionChanged.connect(change_list)
pc.sigSelectionChanged.connect(change_combo)

# move combo into container widget to preventing it from filling
# the tab inside TabWidget
comboContainer = qt.QWidget(w)
comboContainer.setLayout(qt.QVBoxLayout())
comboContainer.layout().addWidget(pc)

w.addTab(pt, "PeriodicTable")
w.addTab(pl, "PeriodicList")
w.addTab(comboContainer, "PeriodicCombo")
w.show()

a.exec_()
github silx-kit / silx / examples / simplewidget.py View on Github external
def createElidedLabelPanel(self, parent):
        panel = qt.QWidget(parent)
        layout = qt.QVBoxLayout(panel)

        label = ElidedLabel(parent)
        label.setText("A very long text which is far too long.")
        layout.addWidget(label)

        label = ElidedLabel(parent)
        label.setText("A very long text which is far too long.")
        label.setElideMode(qt.Qt.ElideMiddle)
        layout.addWidget(label)

        label = ElidedLabel(parent)
        label.setText("Basically nothing.")
        layout.addWidget(label)

        return panel