How to use the silx.gui.qt 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 / examples / scatterMask.py View on Github external
self._bgImageLegend = "background image"

        # widgets
        centralWidget = qt.QWidget(self)

        self._plot = PlotWidget(parent=centralWidget)

        self._maskToolsWidget = ScatterMaskToolsWidget.ScatterMaskToolsWidget(
            plot=self._plot, parent=centralWidget)

        self._alphaSlider = NamedScatterAlphaSlider(parent=self, plot=self._plot)
        self._alphaSlider.setOrientation(qt.Qt.Horizontal)
        self._alphaSlider.setToolTip("Adjust scatter opacity")

        # layout
        layout = qt.QVBoxLayout(centralWidget)
        layout.addWidget(self._plot)
        layout.addWidget(self._alphaSlider)
        layout.addWidget(self._maskToolsWidget)
        centralWidget.setLayout(layout)

        self.setCentralWidget(centralWidget)
github silx-kit / silx / examples / dropZones.py View on Github external
def mousePressEvent(self, event):
        if event.button() == qt.Qt.LeftButton and self._url is not None:
            mimeData = qt.QMimeData()
            mimeData.setText(self._url.path())
            mimeData.setData(
                "application/x-silx-uri",
                self._url.path().encode(encoding='utf-8'))
            drag = qt.QDrag(self)
            drag.setMimeData(mimeData)
            dropAction = drag.exec_()
github silx-kit / silx / silx / gui / hdf5 / Hdf5HeaderView.py View on Github external
def __updateAutoResize(self):
        """Update the view according to the state of the auto-resize"""
        if QTVERSION < "5.0":
            setResizeMode = self.setResizeMode
        else:
            setResizeMode = self.setSectionResizeMode

        if self.__auto_resize:
            setResizeMode(0, qt.QHeaderView.ResizeToContents)
            setResizeMode(1, qt.QHeaderView.ResizeToContents)
            setResizeMode(2, qt.QHeaderView.ResizeToContents)
            setResizeMode(3, qt.QHeaderView.Interactive)
            setResizeMode(4, qt.QHeaderView.Interactive)
            setResizeMode(5, qt.QHeaderView.ResizeToContents)
        else:
            setResizeMode(0, qt.QHeaderView.Interactive)
            setResizeMode(1, qt.QHeaderView.Interactive)
            setResizeMode(2, qt.QHeaderView.Interactive)
            setResizeMode(3, qt.QHeaderView.Interactive)
            setResizeMode(4, qt.QHeaderView.Interactive)
            setResizeMode(5, qt.QHeaderView.Interactive)
github silx-kit / pyFAI / pyFAI / gui / tasks / GeometryTask.py View on Github external
def eventFilter(self, widget, event):
        if event.type() == qt.QEvent.Leave:
            self.__mouseLeave()
            return True

        if event.type() == qt.QEvent.ToolTip:
            if self.__tth is not None:
                pos = widget.mapFromGlobal(event.globalPos())
                coord = widget.pixelToData(pos.x(), pos.y(), axis="left", check=False)

                pos = coord[0], coord[1]
                x, y = self.__clampOnImage(pos)
                angle = self.__tth[y, x]
                ringId, angle = self.__getClosestAngle(angle)

                if ringId is not None:
                    message = "%s ring" % stringutil.to_ordinal(ringId + 1)
                    qt.QToolTip.showText(event.globalPos(), message)
                else:
                    qt.QToolTip.hideText()
                    event.ignore()
github silx-kit / silx / silx / gui / plot / StackView.py View on Github external
self.setSizePolicy(qt.QSizePolicy.Minimum, qt.QSizePolicy.Minimum)
        layout0 = qt.QHBoxLayout()
        self.setLayout(layout0)
        layout0.setContentsMargins(0, 0, 0, 0)

        layout0.addWidget(qt.QLabel("Axes selection:"))

        # By default, the first dimension (dim0) is the frame index/depth/z,
        # the second dimension is the image row number/y axis
        # and the third dimension is the image column index/x axis

        # 1
        # | 0
        # |/__2
        self.qcbAxisSelection = qt.QComboBox(self)
        self._setCBChoices(first_stack_dimension=0)
        self.qcbAxisSelection.currentIndexChanged[int].connect(
            self.__planeSelectionChanged)

        layout0.addWidget(self.qcbAxisSelection)
github silx-kit / silx / silx / gui / hdf5 / NexusSortFilterProxyModel.py View on Github external
def lessThan(self, sourceLeft, sourceRight):
        """Returns True if the value of the item referred to by the given
        index `sourceLeft` is less than the value of the item referred to by
        the given index `sourceRight`, otherwise returns false.

        :param qt.QModelIndex sourceLeft:
        :param qt.QModelIndex sourceRight:
        :rtype: bool
        """
        if sourceLeft.column() != Hdf5TreeModel.NAME_COLUMN:
            return super(NexusSortFilterProxyModel, self).lessThan(
                sourceLeft, sourceRight)

        # Do not sort child of root (files)
        if sourceLeft.parent() == qt.QModelIndex():
            return sourceLeft.row() < sourceRight.row()

        left = self.sourceModel().data(sourceLeft, Hdf5TreeModel.H5PY_ITEM_ROLE)
        right = self.sourceModel().data(sourceRight, Hdf5TreeModel.H5PY_ITEM_ROLE)

        if self.__isNXentry(left) and self.__isNXentry(right):
            less = self.childDatasetLessThan(left, right, "start_time")
            if less is not None:
                return less
            less = self.childDatasetLessThan(left, right, "end_time")
            if less is not None:
                return less

        left = self.sourceModel().data(sourceLeft, qt.Qt.DisplayRole)
        right = self.sourceModel().data(sourceRight, qt.Qt.DisplayRole)
        return self.nameLessThan(left, right)
github silx-kit / silx / silx / gui / plot / ColorBar.py View on Github external
def __buildGUI(self):
        self.setLayout(qt.QHBoxLayout())

        # create color scale widget
        self._colorScale = ColorScaleBar(parent=self,
                                         colormap=None)
        self.layout().addWidget(self._colorScale)

        # legend (is the right group)
        self.legend = _VerticalLegend('', self)
        self.layout().addWidget(self.legend)

        self.layout().setSizeConstraint(qt.QLayout.SetMinAndMaxSize)