How to use the silx.gui.icons.getQIcon 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
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

        self._lineEdit.setFixedWidth(self._lineEdit.fontMetrics().boundingRect('%05d' % last).width())
github silx-kit / pyFAI / pyFAI / gui / tasks / PeakPickingTask.py View on Github external
self._extract.addDefaultAction(action)

        action = qt.QAction(self)
        action.setText("Extract more rings")
        action.setToolTip("Extract new rings after the last picked one")
        action.setIcon(icons.getQIcon("pyfai:gui/icons/extract-more-rings"))
        action.triggered.connect(self.__autoExtractMoreRings)
        selectAction = self._extract.addDefaultAction(action)
        selectAction.triggered.connect(self.__updateOptionToExtractMoreRings)
        self.__updateOptionToExtractMoreRings()
        moreAction = action

        action = qt.QAction(self)
        action.setText("Merge rings and sort")
        action.setToolTip("Merge the groups using the same ring number and sort them")
        action.setIcon(icons.getQIcon("silx:gui/icons/draw-brush"))
        action.triggered.connect(self.__cleanUpRings)
        self._extract.addAction(action)

        self._extract.setEnabled(False)
        self._extract.setDefaultAction(moreAction)

        validator = validators.DoubleValidator(self)
        self._numberOfPeakPerDegree.lineEdit().setValidator(validator)
        locale = qt.QLocale(qt.QLocale.C)
        self._numberOfPeakPerDegree.setLocale(locale)

        self.__synchronizeRawView = SynchronizeRawView()
        self.__synchronizeRawView.registerTask(self)
        self.__synchronizeRawView.registerPlot(self.__plot)

        self.__ringSelection = None
github silx-kit / silx / silx / gui / plot / tools / profile / manager.py View on Github external
def createProfileAction(self, profileRoiClass, parent=None):
        """Create an action from a class of ProfileRoi

        :param core.ProfileRoiMixIn profileRoiClass: A class of a profile ROI
        :param qt.QObject parent: The parent of the created action.
        :rtype: qt.QAction
        """
        if not issubclass(profileRoiClass, core.ProfileRoiMixIn):
            raise TypeError("Type %s not expected" % type(profileRoiClass))
        roiManager = self.getRoiManager()
        action = CreateRoiModeAction(parent, roiManager, profileRoiClass)
        if hasattr(profileRoiClass, "ICON"):
            action.setIcon(icons.getQIcon(profileRoiClass.ICON))
        if hasattr(profileRoiClass, "NAME"):
            def articulify(word):
                """Add an an/a article in the front of the word"""
                first = word[1] if word[0] == 'h' else word[0]
                if first in "aeiou":
                    return "an " + word
                return "a " + word
            action.setText('Define %s' % articulify(profileRoiClass.NAME))
            action.setToolTip('Enables %s selection mode' % profileRoiClass.NAME)
        action.setSingleShot(True)
        return action
github silx-kit / pyFAI / pyFAI / gui / tasks / PeakPickingTask.py View on Github external
action.setToolTip("Extract contiguous peaks")
        toolBar.addAction(action)
        self.__peakSelectionMode = action

        toolBar.addSeparator()

        action = qt.QAction(self)
        action.setIcon(icons.getQIcon("silx:gui/icons/draw-brush"))
        action.setText("Brush")
        action.setCheckable(True)
        action.setToolTip("Change the ring number to a set of already identified peaks")
        toolBar.addAction(action)
        self.__brushMode = action

        action = qt.QAction(self)
        action.setIcon(icons.getQIcon("silx:gui/icons/draw-rubber"))
        action.setText("Rubber")
        action.setCheckable(True)
        action.setToolTip("Remove a set of already identified peaks")
        toolBar.addAction(action)
        self.__erasorMode = action

        toolBar.addSeparator()

        action = qt.QAction(self)
        action.setIcon(icons.getQIcon("pyfai:gui/icons/new-ring"))
        action.setText("+")
        action.setCheckable(True)
        action.setChecked(True)
        action.setToolTip("Create always a new ring when a peak is picked")
        toolBar.addAction(action)
        self.__createNewRingOption = action
github silx-kit / silx / silx / gui / plot / CompareImages.py View on Github external
self.addAction(self.__visualizationAction)
        self.__visualizationGroup = qt.QActionGroup(self)
        self.__visualizationGroup.setExclusive(True)
        self.__visualizationGroup.triggered.connect(self.__visualizationModeChanged)

        icon = icons.getQIcon("compare-mode-a")
        action = qt.QAction(icon, "Display the first image only", self)
        action.setIconVisibleInMenu(True)
        action.setCheckable(True)
        action.setShortcut(qt.QKeySequence(qt.Qt.Key_A))
        action.setProperty("mode", VisualizationMode.ONLY_A)
        menu.addAction(action)
        self.__aModeAction = action
        self.__visualizationGroup.addAction(action)

        icon = icons.getQIcon("compare-mode-b")
        action = qt.QAction(icon, "Display the second image only", self)
        action.setIconVisibleInMenu(True)
        action.setCheckable(True)
        action.setShortcut(qt.QKeySequence(qt.Qt.Key_B))
        action.setProperty("mode", VisualizationMode.ONLY_B)
        menu.addAction(action)
        self.__bModeAction = action
        self.__visualizationGroup.addAction(action)

        icon = icons.getQIcon("compare-mode-vline")
        action = qt.QAction(icon, "Vertical compare mode", self)
        action.setIconVisibleInMenu(True)
        action.setCheckable(True)
        action.setShortcut(qt.QKeySequence(qt.Qt.Key_V))
        action.setProperty("mode", VisualizationMode.VERTICAL_LINE)
        menu.addAction(action)
github silx-kit / silx / qtdesigner_plugins / plot1dplugin.py View on Github external
def icon(self):
        return icons.getQIcon('plot-window')
github silx-kit / silx / silx / gui / plot / ComplexImageView.py View on Github external
def _modeChanged(self, mode):
        """Handle change of visualization modes"""
        icon, text = self._MODES[mode]
        self.setIcon(icons.getQIcon(icon))
        self.setToolTip('Display the ' + text.lower())
        self._rangeDialogAction.setEnabled(
            mode == ImageComplexData.ComplexMode.LOG10_AMPLITUDE_PHASE)
github silx-kit / silx / silx / gui / widgets / RangeSlider.py View on Github external
def __init__(self, parent=None):
        self.__pixmap = None
        self.__positionCount = None
        self.__firstValue = 0.
        self.__secondValue = 1.
        self.__minValue = 0.
        self.__maxValue = 1.
        self.__hoverRect = qt.QRect()
        self.__hoverControl = None

        self.__focus = None
        self.__moving = None

        self.__icons = {
            'first': icons.getQIcon('previous'),
            'second': icons.getQIcon('next')
        }

        # call the super constructor AFTER defining all members that
        # are used in the "paint" method
        super(RangeSlider, self).__init__(parent)

        self.setFocusPolicy(qt.Qt.ClickFocus)
        self.setAttribute(qt.Qt.WA_Hover)

        self.setMinimumSize(qt.QSize(50, 20))
        self.setMaximumHeight(20)

        # Broadcast value changed signal
        self.sigValueChanged.connect(self.__emitPositionChanged)
github vasole / pymca / PyMca5 / PyMcaGui / io / hdf5 / Hdf5NodeView.py View on Github external
def __init__(self, parent):
        super(NXdataViewWithPlugins, self).__init__(
            parent=parent,
            label="NXdata",
            icon=icons.getQIcon("view-nexus"))

        if silx.version >= "0.7.0":
            self.addView(DataViews._InvalidNXdataView(parent))
        self.addView(DataViews._NXdataScalarView(parent))
        self.addView(NXdataCurveViewWithPlugins(parent))
        self.addView(DataViews._NXdataXYVScatterView(parent))
        self.addView(DataViews._NXdataImageView(parent))
        self.addView(DataViews._NXdataStackView(parent))
github silx-kit / silx / silx / gui / hdf5 / Hdf5TreeModel.py View on Github external
self.__fileDropEnabled = True
        self.__fileMoveEnabled = True
        self.__datasetDragEnabled = False

        self.__animatedIcon = icons.getWaitIcon()
        self.__animatedIcon.iconChanged.connect(self.__updateLoadingItems)
        self.__runnerSet = set([])

        # store used icons to avoid the cache to release it
        self.__icons = []
        self.__icons.append(icons.getQIcon("item-none"))
        self.__icons.append(icons.getQIcon("item-0dim"))
        self.__icons.append(icons.getQIcon("item-1dim"))
        self.__icons.append(icons.getQIcon("item-2dim"))
        self.__icons.append(icons.getQIcon("item-3dim"))
        self.__icons.append(icons.getQIcon("item-ndim"))

        self.__ownFiles = ownFiles
        self.__openedFiles = []
        """Store the list of files opened by the model itself."""
        # FIXME: It should be managed one by one by Hdf5Item itself

        # It is not possible to override the QObject destructor nor
        # to access to the content of the Python object with the `destroyed`
        # signal cause the Python method was already removed with the QWidget,
        # while the QObject still exists.
        # We use a static method plus explicit references to objects to
        # release. The callback do not use any ref to self.
        onDestroy = functools.partial(self._closeFileList, self.__openedFiles)
        self.destroyed.connect(onDestroy)