How to use the silx.gui.qt.QHBoxLayout 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 / pyFAI / pyFAI / gui / widgets / FitParamView.py View on Github external
self.__quantity = QuantityEdit(parent)
        self.__quantity.setAlignment(qt.Qt.AlignRight)
        self.__quantity.sigValueAccepted.connect(self.__fireValueAccepted)
        self.__unit = UnitLabel(parent)
        self.__unit.setUnitEditable(True)
        self.__min = qt.QToolButton(parent)
        self.__min.setFixedWidth(12)
        self.__min.setAutoRaise(True)
        self.__min.clicked.connect(self.__dropContraintsOnMin)
        self.__max = qt.QToolButton(parent)
        self.__max.setAutoRaise(True)
        self.__max.setFixedWidth(12)
        self.__max.clicked.connect(self.__dropContraintsOnMax)
        self.__defaultConstraintsModel = None

        self.__subLayout = qt.QHBoxLayout()
        self.__subLayout.setSpacing(0)
        self.__subLayout.setContentsMargins(0, 0, 0, 0)
        self.__subLayout.addWidget(self.__min)
        self.__subLayout.addWidget(self.__quantity)
        self.__subLayout.addWidget(self.__max)

        if displayedUnit is None:
            displayedUnit = internalUnit

        self.__quantity.setModelUnit(internalUnit)

        if isinstance(displayedUnit, units.Unit):
            model = DataModel()
            model.setValue(displayedUnit)
            displayedUnit = model
        elif isinstance(displayedUnit, DataModel):
github silx-kit / silx / silx / gui / dialog / ColormapDialog.py View on Github external
self._plotToolbar.addAction(action)
        group.addAction(action)
        action = qt.QAction("Histogram", self)
        action.setToolTip("Display the data histogram within the colormap range. A slow data processing have to be done. ")
        action.setIcon(icons.getQIcon('colormap-histogram'))
        action.setCheckable(True)
        action.setData(_DataInPlotMode.HISTOGRAM)
        action.setChecked(action.data() == self._dataInPlotMode)
        self._plotToolbar.addAction(action)
        group.addAction(action)
        group.triggered.connect(self._displayDataInPlotModeChanged)

        self._plotBox = qt.QWidget(self)
        self._plotInit()

        plotBoxLayout = qt.QHBoxLayout()
        plotBoxLayout.setContentsMargins(0, 0, 0, 0)
        plotBoxLayout.setSpacing(2)
        plotBoxLayout.addWidget(self._plotToolbar)
        plotBoxLayout.addWidget(self._plot)
        plotBoxLayout.setSizeConstraint(qt.QLayout.SetMinimumSize)
        self._plotBox.setLayout(plotBoxLayout)
        vLayout.addWidget(self._plotBox)

        # define modal buttons
        types = qt.QDialogButtonBox.Ok | qt.QDialogButtonBox.Cancel
        self._buttonsModal = qt.QDialogButtonBox(parent=self)
        self._buttonsModal.setStandardButtons(types)
        self.layout().addWidget(self._buttonsModal)
        self._buttonsModal.accepted.connect(self.accept)
        self._buttonsModal.rejected.connect(self.reject)
github silx-kit / silx / silx / gui / plot3d / ParamTreeView.py View on Github external
def __init__(self, parent=None, flags=qt.Qt.Widget):
        super(Vector4DEditor, self).__init__(parent, flags)
        layout = qt.QHBoxLayout(self)
        # layout.setSpacing(0)
        layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(layout)
        self._xEdit = _FloatEdit(parent=self, value=0.)
        self._xEdit.setAlignment(qt.Qt.AlignLeft)
        # self._xEdit.editingFinished.connect(self._emit)
        self._yEdit = _FloatEdit(parent=self, value=0.)
        self._yEdit.setAlignment(qt.Qt.AlignLeft)
        # self._yEdit.editingFinished.connect(self._emit)
        self._zEdit = _FloatEdit(parent=self, value=0.)
        self._zEdit.setAlignment(qt.Qt.AlignLeft)
        # self._zEdit.editingFinished.connect(self._emit)
        self._wEdit = _FloatEdit(parent=self, value=0.)
        self._wEdit.setAlignment(qt.Qt.AlignLeft)
        # self._wEdit.editingFinished.connect(self._emit)
        layout.addWidget(qt.QLabel('x:'))
github silx-kit / silx / silx / gui / plot / _BaseMaskToolsWidget.py View on Github external
def _hboxWidget(*widgets, **kwargs):
        """Place widgets in widget with horizontal layout

        :param widgets: Widgets to position horizontally
        :param bool stretch: True for trailing stretch (default),
                             False for no trailing stretch
        :return: A QWidget with a QHBoxLayout
        """
        stretch = kwargs.get('stretch', True)

        layout = qt.QHBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        for widget in widgets:
            layout.addWidget(widget)
        if stretch:
            layout.addStretch(1)
        widget = qt.QWidget()
        widget.setLayout(layout)
        return widget
github silx-kit / silx / silx / gui / plot / tools / profile / editors.py View on Github external
def createWidget(self, parent):
        """Inherit the method to create a new editor"""
        widget = qt.QWidget(parent)
        layout = qt.QHBoxLayout(widget)
        if isinstance(parent, qt.QMenu):
            margins = layout.contentsMargins()
            layout.setContentsMargins(margins.left(), 0, margins.right(), 0)
        else:
            layout.setContentsMargins(0, 0, 0, 0)

        editorClass = self.getEditorClass(self.__roi)
        editor = editorClass(parent)
        editor.setEditorData(self.__roi)
        self.__setEditor(widget, editor)
        return widget
github silx-kit / silx / examples / customHdf5TreeModel.py View on Github external
def createTreeViewConfigurationPanel(self, parent, treeview):
        """Create a configuration panel to allow to play with widget states"""
        panel = qt.QWidget(parent)
        panel.setLayout(qt.QHBoxLayout())

        content = qt.QGroupBox("Create HDF5", panel)
        content.setLayout(qt.QVBoxLayout())
        panel.layout().addWidget(content)

        combo = qt.QComboBox()
        combo.addItem("Containing all types", get_hdf5_with_all_types)
        combo.activated.connect(self.__hdf5ComboChanged)
        content.layout().addWidget(combo)

        button = ThreadPoolPushButton(content, text="Create")
        button.setCallable(combo.itemData(combo.currentIndex()))
        button.succeeded.connect(self.__fileCreated)
        content.layout().addWidget(button)

        self.__hdf5Combo = combo
github silx-kit / silx / examples / findContours.py View on Github external
self.__plot = silx.gui.plot.Plot2D(parent=self)
        dummy = numpy.array([[0]])
        self.__plot.addImage(dummy, legend="image", z=-10, replace=False)
        dummy = numpy.array([[[0, 0, 0, 0]]])
        self.__plot.addImage(dummy, legend="iso-pixels", z=0, replace=False)

        self.__algo = None
        self.__polygons = []
        self.__customPolygons = []
        self.__image = None
        self.__mask = None
        self.__customValue = None

        mainPanel = qt.QWidget(self)
        layout = qt.QHBoxLayout()
        layout.addWidget(self.__createConfigurationPanel(self))
        layout.addWidget(self.__plot)
        mainPanel.setLayout(layout)

        self.setCentralWidget(mainPanel)
github silx-kit / silx / silx / gui / plot / PlotWindow.py View on Github external
gridLayout = qt.QGridLayout()
        gridLayout.setSpacing(0)
        gridLayout.setContentsMargins(0, 0, 0, 0)
        gridLayout.addWidget(self.getWidgetHandle(), 0, 0)
        gridLayout.addWidget(self._colorbar, 0, 1)
        gridLayout.setRowStretch(0, 1)
        gridLayout.setColumnStretch(0, 1)
        centralWidget = qt.QWidget(self)
        centralWidget.setLayout(gridLayout)
        self.setCentralWidget(centralWidget)

        self._positionWidget = None

        if control or position:
            hbox = qt.QHBoxLayout()
            hbox.setContentsMargins(0, 0, 0, 0)

            if control:
                self.controlButton = qt.QToolButton()
                self.controlButton.setText("Options")
                self.controlButton.setToolButtonStyle(qt.Qt.ToolButtonTextBesideIcon)
                self.controlButton.setAutoRaise(True)
                self.controlButton.setPopupMode(qt.QToolButton.InstantPopup)
                menu = qt.QMenu(self)
                menu.aboutToShow.connect(self._customControlButtonMenu)
                self.controlButton.setMenu(menu)

                hbox.addWidget(self.controlButton)

            if position:  # Add PositionInfo widget to the bottom of the plot
                if isinstance(position, abc.Iterable):