How to use the silx.gui.qt.QPushButton 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 / silx / gui / widgets / FrameBrowser.py View on Github external
def __init__(self, parent=None, n=None):
        qt.QWidget.__init__(self, parent)

        # Use the font size as the icon size to avoid to create bigger buttons
        fontMetric = self.fontMetrics()
        iconSize = qt.QSize(fontMetric.height(), fontMetric.height())

        self.mainLayout = qt.QHBoxLayout(self)
        self.mainLayout.setContentsMargins(0, 0, 0, 0)
        self.mainLayout.setSpacing(0)
        self.firstButton = qt.QPushButton(self)
        self.firstButton.setIcon(icons.getQIcon("first"))
        self.firstButton.setIconSize(iconSize)
        self.previousButton = qt.QPushButton(self)
        self.previousButton.setIcon(icons.getQIcon("previous"))
        self.previousButton.setIconSize(iconSize)
        self._lineEdit = qt.QLineEdit(self)

        self._label = qt.QLabel(self)
        self.nextButton = qt.QPushButton(self)
        self.nextButton.setIcon(icons.getQIcon("next"))
        self.nextButton.setIconSize(iconSize)
        self.lastButton = qt.QPushButton(self)
        self.lastButton.setIcon(icons.getQIcon("last"))
        self.lastButton.setIconSize(iconSize)

        self.mainLayout.addWidget(self.firstButton)
github silx-kit / silx / silx / gui / widgets / FrameBrowser.py View on Github external
self.mainLayout = qt.QHBoxLayout(self)
        self.mainLayout.setContentsMargins(0, 0, 0, 0)
        self.mainLayout.setSpacing(0)
        self.firstButton = qt.QPushButton(self)
        self.firstButton.setIcon(icons.getQIcon("first"))
        self.firstButton.setIconSize(iconSize)
        self.previousButton = qt.QPushButton(self)
        self.previousButton.setIcon(icons.getQIcon("previous"))
        self.previousButton.setIconSize(iconSize)
        self._lineEdit = qt.QLineEdit(self)

        self._label = qt.QLabel(self)
        self.nextButton = qt.QPushButton(self)
        self.nextButton.setIcon(icons.getQIcon("next"))
        self.nextButton.setIconSize(iconSize)
        self.lastButton = qt.QPushButton(self)
        self.lastButton.setIcon(icons.getQIcon("last"))
        self.lastButton.setIconSize(iconSize)

        self.mainLayout.addWidget(self.firstButton)
        self.mainLayout.addWidget(self.previousButton)
        self.mainLayout.addWidget(self._lineEdit)
        self.mainLayout.addWidget(self._label)
        self.mainLayout.addWidget(self.nextButton)
        self.mainLayout.addWidget(self.lastButton)

        if n is None:
            first = qt.QSlider().minimum()
            last = qt.QSlider().maximum()
        else:
            first, last = 0, n
github silx-kit / silx / examples / fileDialog.py View on Github external
centralWidget = qt.QWidget(self)
        layout = qt.QHBoxLayout()
        centralWidget.setLayout(layout)

        options = self.createOptions()
        layout.addWidget(options)

        buttonGroup = qt.QGroupBox()
        buttonGroup.setTitle("Create dialog")
        layout.addWidget(buttonGroup)
        buttonLayout = qt.QVBoxLayout()
        buttonGroup.setLayout(buttonLayout)

        # ImageFileDialog

        b1 = qt.QPushButton(self)
        b1.setMinimumHeight(50)
        b1.setText("Open a dialog")
        b1.clicked.connect(self.openDialog)
        buttonLayout.addWidget(b1)

        b2 = qt.QPushButton(self)
        b2.setMinimumHeight(50)
        b2.setText("Open a dialog with state stored")
        b2.clicked.connect(self.openDialogStoredState)
        buttonLayout.addWidget(b2)

        b3 = qt.QPushButton(self)
        b3.setMinimumHeight(50)
        b3.setText("Open a dialog at home")
        b3.clicked.connect(self.openDialogAtHome)
        buttonLayout.addWidget(b3)
github silx-kit / silx / examples / colormapDialog.py View on Github external
button = qt.QPushButton("Set colormap 1")
        button.clicked.connect(self.setColormap1)
        layout.addWidget(button)
        button = qt.QPushButton("Set colormap 2")
        button.clicked.connect(self.setColormap2)
        layout.addWidget(button)
        button = qt.QPushButton("Create new colormap")
        button.clicked.connect(self.setNewColormap)
        layout.addWidget(button)

        layout.addSpacing(10)

        button = qt.QPushButton("Set no histogram")
        button.clicked.connect(self.setNoHistogram)
        layout.addWidget(button)
        button = qt.QPushButton("Set positive histogram")
        button.clicked.connect(self.setPositiveHistogram)
        layout.addWidget(button)
        button = qt.QPushButton("Set neg-pos histogram")
        button.clicked.connect(self.setNegPosHistogram)
        layout.addWidget(button)
        button = qt.QPushButton("Set negative histogram")
        button.clicked.connect(self.setNegativeHistogram)
        layout.addWidget(button)

        layout.addSpacing(10)

        button = qt.QPushButton("Set no range")
        button.clicked.connect(self.setNoRange)
        layout.addWidget(button)
        button = qt.QPushButton("Set positive range")
        button.clicked.connect(self.setPositiveRange)
github silx-kit / silx / silx / gui / plot / ImageStack.py View on Github external
def __init__(self, parent=None) -> None:
        qt.QWidget.__init__(self, parent)
        self.setLayout(qt.QGridLayout())
        self._toggleButton = qt.QPushButton(parent=self)
        self.layout().addWidget(self._toggleButton, 0, 2, 1, 1)
        self._toggleButton.setSizePolicy(qt.QSizePolicy.Fixed,
                                         qt.QSizePolicy.Fixed)

        self._urlsTable = UrlList(parent=self)
        self.layout().addWidget(self._urlsTable, 1, 1, 1, 2)

        # set up
        self._setButtonIcon(show=True)

        # Signal / slot connection
        self._toggleButton.clicked.connect(self.toggleUrlSelectionTable)
        self._urlsTable.sigCurrentUrlChanged.connect(self._propagateSignal)

        # expose API
        self.setUrls = self._urlsTable.setUrls
github silx-kit / silx / silx / gui / plot / _BaseMaskToolsWidget.py View on Github external
invertBtn = qt.QPushButton('Invert')
        invertBtn.setShortcut(qt.Qt.CTRL + qt.Qt.Key_I)
        invertBtn.setToolTip('Invert current mask <b>%s</b>' %
                             invertBtn.shortcut().toString())
        invertBtn.clicked.connect(self._handleInvertMask)

        clearBtn = qt.QPushButton('Clear')
        clearBtn.setShortcut(qt.QKeySequence.Delete)
        clearBtn.setToolTip('Clear current mask level <b>%s</b>' %
                            clearBtn.shortcut().toString())
        clearBtn.clicked.connect(self._handleClearMask)

        invertClearWidget = self._hboxWidget(
                invertBtn, clearBtn, stretch=False)

        undoBtn = qt.QPushButton('Undo')
        undoBtn.setShortcut(qt.QKeySequence.Undo)
        undoBtn.setToolTip('Undo last mask change <b>%s</b>' %
                           undoBtn.shortcut().toString())
        self._mask.sigUndoable.connect(undoBtn.setEnabled)
        undoBtn.clicked.connect(self._mask.undo)

        redoBtn = qt.QPushButton('Redo')
        redoBtn.setShortcut(qt.QKeySequence.Redo)
        redoBtn.setToolTip('Redo last undone mask change <b>%s</b>' %
                           redoBtn.shortcut().toString())
        self._mask.sigRedoable.connect(redoBtn.setEnabled)
        redoBtn.clicked.connect(self._mask.redo)

        undoRedoWidget = self._hboxWidget(undoBtn, redoBtn, stretch=False)

        self.clearAllBtn = qt.QPushButton('Clear all')
github silx-kit / silx / examples / colormapDialog.py View on Github external
button = qt.QPushButton("Set non-editable")
        button.clicked.connect(self.setNonEditable)
        layout.addWidget(button)

        layout.addSpacing(10)

        button = qt.QPushButton("Set no colormap")
        button.clicked.connect(self.setNoColormap)
        layout.addWidget(button)
        button = qt.QPushButton("Set colormap 1")
        button.clicked.connect(self.setColormap1)
        layout.addWidget(button)
        button = qt.QPushButton("Set colormap 2")
        button.clicked.connect(self.setColormap2)
        layout.addWidget(button)
        button = qt.QPushButton("Create new colormap")
        button.clicked.connect(self.setNewColormap)
        layout.addWidget(button)

        layout.addSpacing(10)

        button = qt.QPushButton("Set no histogram")
        button.clicked.connect(self.setNoHistogram)
        layout.addWidget(button)
        button = qt.QPushButton("Set positive histogram")
        button.clicked.connect(self.setPositiveHistogram)
        layout.addWidget(button)
        button = qt.QPushButton("Set neg-pos histogram")
        button.clicked.connect(self.setNegPosHistogram)
        layout.addWidget(button)
        button = qt.QPushButton("Set negative histogram")
        button.clicked.connect(self.setNegativeHistogram)
github silx-kit / silx / examples / plotProfile.py View on Github external
clearButton.clicked.connect(self._clearData)
        clearButton.setText("Clear")

        imageButton = qt.QPushButton(self)
        imageButton.clicked.connect(self._updateImage)
        imageButton.setText("Intensity image")

        imageRgbButton = qt.QPushButton(self)
        imageRgbButton.clicked.connect(self._updateRgbImage)
        imageRgbButton.setText("RGB image")

        scatterButton = qt.QPushButton(self)
        scatterButton.clicked.connect(self._updateScatter)
        scatterButton.setText("Scatter")

        stackButton = qt.QPushButton(self)
        stackButton.clicked.connect(self._updateStack)
        stackButton.setText("Stack")

        options = qt.QWidget(self)
        layout = qt.QHBoxLayout(options)
        layout.addStretch()
        layout.addWidget(clearButton)
        layout.addWidget(imageButton)
        layout.addWidget(imageRgbButton)
        layout.addWidget(scatterButton)
        layout.addWidget(stackButton)
        layout.addStretch()

        widget = qt.QWidget(self)
        layout = qt.QVBoxLayout(widget)
        layout.addWidget(dataWidget)
github silx-kit / silx / silx / gui / fit / FitConfig.py View on Github external
# layout2.addWidget(self.buttonHelp)

        self.buttonDefault = qt.QPushButton(self)
        self.buttonDefault.setText("Default")
        layout2.addWidget(self.buttonDefault)

        spacer = qt.QSpacerItem(20, 20,
                                qt.QSizePolicy.Expanding,
                                qt.QSizePolicy.Minimum)
        layout2.addItem(spacer)

        self.buttonOk = qt.QPushButton(self)
        self.buttonOk.setText("OK")
        layout2.addWidget(self.buttonOk)

        self.buttonCancel = qt.QPushButton(self)
        self.buttonCancel.setText("Cancel")
        layout2.addWidget(self.buttonCancel)

        layout.addLayout(layout2)

        self.buttonOk.clicked.connect(self.accept)
        self.buttonCancel.clicked.connect(self.reject)
github silx-kit / silx / silx / gui / plot3d / tools / GroupPropertiesWidget.py View on Github external
# Set widgets
        layout = qt.QFormLayout(self)
        self.setLayout(layout)

        # Colormap
        colormapButton = qt.QPushButton('Set...')
        colormapButton.setToolTip("Set colormap for all items")
        colormapButton.clicked.connect(self._colormapButtonClicked)
        layout.addRow('Colormap', colormapButton)

        self._markerComboBox = qt.QComboBox(self)
        self._markerComboBox.addItems(SymbolMixIn.getSupportedSymbolNames())

        # Marker
        markerButton = qt.QPushButton('Set')
        markerButton.setToolTip("Set marker for all items")
        markerButton.clicked.connect(self._markerButtonClicked)

        markerLayout = qt.QHBoxLayout()
        markerLayout.setContentsMargins(0, 0, 0, 0)
        markerLayout.addWidget(self._markerComboBox, 1)
        markerLayout.addWidget(markerButton, 0)

        layout.addRow('Marker', markerLayout)

        # Marker size
        self._markerSizeSlider = qt.QSlider()
        self._markerSizeSlider.setOrientation(qt.Qt.Horizontal)
        self._markerSizeSlider.setSingleStep(1)
        self._markerSizeSlider.setRange(1, self.MAX_MARKER_SIZE)
        self._markerSizeSlider.setValue(1)