How to use the taurus.external.qt.Qt.QIcon function in taurus

To help you get started, we’ve selected a few taurus 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 taurus-org / taurus / taurus / lib / taurus / qt / qtgui / panel / taurusfilterpanel.py View on Github external
from taurus.core.util import argparse
    import sys
    
    parser = argparse.get_taurus_parser()
    parser.usage = "%prog [options] [hostname]"
    
    app = TaurusApplication(cmd_line_parser=parser)
    args = app.get_command_line_args()
    
    if len(args)>0: 
        host=args[0]
    else: 
        host = taurus.Database().getNormalName()
    
    w = TaurusFilterPanel()
    w.setWindowIcon(Qt.QIcon(":/actions/system-shutdown.svg"))
    w.setWindowTitle("A Taurus Filter Example")
    w.setModel(host)
    w.show()

    sys.exit(app.exec_())
github sardana-org / sardana / src / sardana / taurus / qt / qtgui / extra_sardana / expdescription.py View on Github external
self.onChooseScanDirButtonClicked)

        self.__plotManager = None
        tooltip = None

        # TODO: Disable show scan button since scan plot have to be
        # adapted to support QT5
        # --------------------------------------------------------------------
        from taurus.external.qt import PYQT4, API
        if not PYQT4:
            self.debug('Show plots is only supported with PyQt4 for now')
            plotsButton = False
            tooltip = "Show/Hide plots is not ready for %s" % API
        # --------------------------------------------------------------------

        icon = Qt.QIcon("actions:view.svg")
        measGrpTab = self.ui.tabWidget.widget(0)
        self.togglePlotsAction = Qt.QAction(icon, "Show/Hide plots", self)
        if tooltip is not None:
            self.togglePlotsAction.setToolTip(tooltip)
        self.togglePlotsAction.setCheckable(True)
        self.togglePlotsAction.setChecked(False)
        self.togglePlotsAction.setEnabled(plotsButton)
        measGrpTab.addAction(self.togglePlotsAction)
        measGrpTab.setContextMenuPolicy(Qt.Qt.ActionsContextMenu)
        self.togglePlotsAction.toggled.connect(self.onPlotsButtonToggled)
        self.ui.plotsButton.setDefaultAction(self.togglePlotsAction)

        if door is not None:
            self.setModel(door)

        self.ui.buttonBox.clicked.connect(self.onDialogButtonClicked)
github taurus-org / taurus / taurus / lib / taurus / qt / qtgui / tree / taurusdevicetree.py View on Github external
def setStateIcon(self,child,color):
        if icons_dev_tree is None: 
            self.debug('In setStateIcon(...): Icons for states not available!')
            return
        if color=="#00ff00" or color in 'ON,OPEN,EXTRACT':
            icon = Qt.QIcon(":/ICON_GREEN")
            child.setIcon(0,icon)
        elif color=="#ff0000" or color in 'OFF,FAULT':
            icon = Qt.QIcon(":/ICON_RED")
            child.setIcon(0,icon)
        elif color=="#ff8c00" or color in 'ALARM':
            icon = Qt.QIcon(":/ICON_ORANGE")
            child.setIcon(0,icon)
        elif color=="#ffffff" or color in 'CLOSE,INSERT':
            icon = Qt.QIcon(":/ICON_WHITE")
            child.setIcon(0,icon)
        elif color=="#80a0ff" or color in 'MOVING,RUNNING':
            icon = Qt.QIcon(":/ICON_BLUE")
            child.setIcon(0,icon)
        elif color=="#ffff00" or color in 'STANDBY':
            icon = Qt.QIcon(":/ICON_YELLOW")
            child.setIcon(0,icon)
        elif color=="#cccc7a" or color in 'INIT':
            icon = Qt.QIcon(":/ICON_BRAWN")
            child.setIcon(0,icon)
        elif color=="#ff00ff" or color in 'DISABLE':
            icon = Qt.QIcon(":/ICON_PINK")
            child.setIcon(0,icon)
github sardana-org / sardana / src / sardana / taurus / qt / qtgui / macrolistener / macrolistener.py View on Github external
self.__doorResult = DoorResult(mainwindow)
        SDM.connectReader("doorResultChanged",
                          self.__doorResult.onDoorResultChanged)
        mainwindow.createPanel(self.__doorResult, 'DoorResult',
                               registerconfig=False, permanent=True)

        # puts sardanaEditor
        # self.__sardanaEditor = SardanaEditor()
        # SDM.connectReader("macroserverName", self.__sardanaEditor.setModel)
        # mainwindow.createPanel(self.__sardanaEditor, 'SardanaEditor',
        #                        registerconfig=False, permanent=True)

        # add panic button for aborting the door
        text = "Panic Button: stops the pool (double-click for abort)"
        self.doorAbortAction = mainwindow.jorgsBar.addAction(
            Qt.QIcon("actions:process-stop.svg"),
            text, self.__onDoorAbort)

        # store beginning of times as a datetime
        self.__lastAbortTime = datetime.datetime(1, 1, 1)

        # store doubleclick interval as a timedelta
        td = datetime.timedelta(0, 0, 1000 * Qt.qApp.doubleClickInterval())
        self.__doubleclickInterval = td
github taurus-org / taurus / lib / taurus / qt / qtgui / taurusgui / taurusgui.py View on Github external
def _loadCustomLogo(self, conf, xmlroot):
        custom_logo = getattr(conf, 'CUSTOM_LOGO', getattr(
            conf, 'LOGO', self.__getVarFromXML(xmlroot, "CUSTOM_LOGO", 'logos:taurus.png')))
        if Qt.QFile.exists(custom_logo):
            custom_icon = Qt.QIcon(custom_logo)
        else:
            custom_icon = Qt.QIcon(os.path.join(
                self._confDirectory, custom_logo))
        self.setWindowIcon(custom_icon)
        if self.APPLETS_TOOLBAR_ENABLED:
            self.jorgsBar.addAction(custom_icon, Qt.qApp.applicationName())
github taurus-org / taurus / lib / taurus / qt / qtgui / input / choicedlg.py View on Github external
sets the option for a given row,column coordinate in the grid

        :param row: (int) row in the grid for this option
        :param col: (int) column in the grid for this option
        :param text: (str) name for this option
        :param pixmap: (QPixmap or None) If no valid pixmap is provided for
                        a given choice, the default one will be used
        :param tooltip: (str) tooltip for this option (if None given, the `text` is used)
        '''
        if not pixmap or pixmap is None or pixmap.isNull():
            pixmap = self._defaultPixmap
        if tooltip is None:
            tooltip = text
        button = Qt.QToolButton()
        button.setText(text)
        button.setIcon(Qt.QIcon(pixmap))
        button.setIconSize(Qt.QSize(self._iconSize, self._iconSize))
        button.setToolTip(tooltip)
        button.clicked.connect(self.onClick)
        self.gridLayout.addWidget(button, row, col, Qt.Qt.AlignCenter)
github taurus-org / taurus / src / sardana / taurus / qt / qtgui / extra_macroexecutor / sequenceeditor / model.py View on Github external
def data(self, index, role):
        if role == Qt.Qt.DisplayRole:
            node = self.nodeFromIndex(index)
            if index.column() == 0:
                return Qt.QVariant(node.name())
            elif index.column() == 1:
                return Qt.QVariant(node.value())
            elif index.column() == 2:
                if isinstance(node, macro.MacroNode):
                    return Qt.QVariant(node.progress())
        elif role == Qt.Qt.DecorationRole:
            node = self.nodeFromIndex(index)
            if index.column() == 3:
                if isinstance(node, macro.MacroNode):
                    if node.isPause():
                        return Qt.QVariant(Qt.QIcon(":/actions/media-playback-pause.svg"))
        return Qt.QVariant()
github taurus-org / taurus / lib / taurus / qt / qtgui / util / taurusactionfactory.py View on Github external
def createAction(self, parent, text, shortcut=None, icon=None, tip=None,
                     toggled=None, triggered=None, data=None,
                     context=Qt.Qt.WindowShortcut):
        """Create a QAction"""
        action = Qt.QAction(text, parent)
        if triggered is not None:
            action.triggered.connect(triggered)
        if toggled is not None:
            action.toggled.connect(toggled)
            action.setCheckable(True)
        if icon is not None:
            if isinstance(icon, (str, unicode)):
                icon = Qt.QIcon.fromTheme(icon)
            action.setIcon(icon)
        if shortcut is not None:
            action.setShortcut(shortcut)
        if tip is not None:
            action.setToolTip(tip)
            action.setStatusTip(tip)
        if data is not None:
            action.setData(data)
        # TODO: Hard-code all shortcuts and choose context=Qt.WidgetShortcut
        # (this will avoid calling shortcuts from another dockwidget
        #  since the context thing doesn't work quite well with these widgets)
        action.setShortcutContext(context)
        return action
github taurus-org / taurus / taurus / lib / taurus / qt / qtgui / tree / taurusdevicetree.py View on Github external
icon = Qt.QIcon(":/ICON_WHITE")
            child.setIcon(0,icon)
        elif color=="#80a0ff" or color in 'MOVING,RUNNING':
            icon = Qt.QIcon(":/ICON_BLUE")
            child.setIcon(0,icon)
        elif color=="#ffff00" or color in 'STANDBY':
            icon = Qt.QIcon(":/ICON_YELLOW")
            child.setIcon(0,icon)
        elif color=="#cccc7a" or color in 'INIT':
            icon = Qt.QIcon(":/ICON_BRAWN")
            child.setIcon(0,icon)
        elif color=="#ff00ff" or color in 'DISABLE':
            icon = Qt.QIcon(":/ICON_PINK")
            child.setIcon(0,icon)
        elif color=="#808080f" or color in 'UNKNOWN':
            icon = Qt.QIcon(":/ICON_GREY")
            child.setIcon(0,icon)
        else:
            icon = Qt.QIcon(":/ICON_WHITE")
            child.setIcon(0,icon)