How to use the taurus.external.qt.Qt.QVariant 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 / src / sardana / taurus / qt / qtgui / extra_macroexecutor / sequenceeditor / sequenceeditor.py View on Github external
def setProgressForMacro(self, macroId, progress):
        persistentIndex = self._idIndexDict.get(macroId, None)
        if persistentIndex == None: return
        progressIndex = persistentIndex.sibling(persistentIndex.row(), 2)
        index = Qt.QModelIndex(progressIndex)
        self.model().setData(index, Qt.QVariant(progress))
github taurus-org / taurus / taurus / lib / taurus / qt / qtgui / plot / curveprops.py View on Github external
def data(self, index, role=Qt.Qt.DisplayRole):
        if not index.isValid() or not (0 <= index.row() < self.rowCount()):
            return Qt.QVariant()
        row=index.row()
        column = index.column()
        #Display Role
        if role == Qt.Qt.DisplayRole:
            if column == X: return Qt.QVariant(Qt.QString(self.curves[row].x.display))
            elif column == Y: return Qt.QVariant(Qt.QString(self.curves[row].y.display))
            elif column == TITLE: return Qt.QVariant(Qt.QString(self.curves[row].title))
            elif column == VIS: return Qt.QVariant(Qt.QString(self.curves[row].vis))
            else: return Qt.QVariant()
        elif role == Qt.Qt.DecorationRole:
            if column == X: return Qt.QVariant(self.curves[row].x.icon)
            elif column == Y: return Qt.QVariant(self.curves[row].y.icon)
            elif column == TITLE: return Qt.QVariant(Qt.QColor(self.curves[row].properties.lColor or 'black'))
            else: return Qt.QVariant()
        elif role == Qt.Qt.TextColorRole:
            if column == X: Qt.QVariant(Qt.QColor(self.curves[row].x.ok and 'green' or 'red'))
            elif column == Y: Qt.QVariant(Qt.QColor(self.curves[row].y.ok and 'green' or 'red'))
            else: return Qt.QVariant()
        elif role == SRC_ROLE:
            if column == X: return Qt.QVariant(Qt.QString(self.curves[row].x.src))
            elif column == Y: return Qt.QVariant(Qt.QString(self.curves[row].y.src))
            else: return Qt.QVariant()
        elif role == PROPS_ROLE:
            return self.curves[row].properties
        elif role == Qt.Qt.ToolTipRole:
            if column == X: return Qt.QVariant(Qt.QString(self.curves[row].x.src))
            elif column == Y: return Qt.QVariant(Qt.QString(self.curves[row].y.src))
github taurus-org / taurus / taurus / lib / taurus / qt / qtgui / plot / curvesAppearanceChooserDlg.py View on Github external
display
        '''
        if prop is None: prop=self._shownProp
        #set the Style comboboxes
        self.sStyleCB.setCurrentIndex(self.sStyleCB.findText(NamedSymbolStyles[prop.sStyle]))
        self.lStyleCB.setCurrentIndex(self.lStyleCB.findText(NamedLineStyles[prop.lStyle]))
        self.cStyleCB.setCurrentIndex(self.cStyleCB.findText(NamedCurveStyles[prop.cStyle]))
        #set sSize and lWidth spinboxes. if prop.sSize is None, it puts -1 (which is the special value for these switchhboxes)
        self.sSizeSB.setValue(max(prop.sSize,-1)) 
        self.lWidthSB.setValue(max(prop.lWidth,-1))
        #Set the Color combo boxes. The item at index 0 is the empty one in the comboboxes Manage unknown colors by including them
        if prop.sColor is None: index=0 
        else:  index=self.sColorCB.findData(Qt.QVariant(Qt.QColor(prop.sColor)))
        if index==-1: #if the color is not one of the supported colors, add it to the combobox
            index=self.sColorCB.count()  #set the index to what will be the added one
            self.sColorCB.addItem(self._colorIcon(Qt.QColor(prop.sColor)), "", Qt.QVariant(Qt.QColor(prop.sColor)))
        self.sColorCB.setCurrentIndex(index)
        if prop.lColor is None: index=0 
        else:  index=self.lColorCB.findData(Qt.QVariant(Qt.QColor(prop.lColor)))
        if index==-1: #if the color is not one of the supported colors, add it to the combobox
            index=self.lColorCB.count()  #set the index to what will be the added one
            self.lColorCB.addItem(self._colorIcon(Qt.QColor(prop.lColor)), "", Qt.QVariant(Qt.QColor(prop.lColor)))
        self.lColorCB.setCurrentIndex(index)
        #set the Fill Checkbox. The prop.sFill value can be in 3 states: True, False and None
        if prop.sFill is None: checkState=Qt.Qt.PartiallyChecked 
        elif prop.sFill: checkState=Qt.Qt.Checked
        else: checkState=Qt.Qt.Unchecked
        #set the Area Fill Checkbox. The prop.cFill value can be in 3 states: True, False and None
        if prop.cFill is None: checkState=Qt.Qt.PartiallyChecked 
        elif prop.cFill: checkState=Qt.Qt.Checked
        else: checkState=Qt.Qt.Unchecked
        self.cFillCB.setCheckState(checkState)
github taurus-org / taurus / taurus / lib / taurus / qt / qtgui / plot / curveprops.py View on Github external
are blocked while updating them to avoid loops.
        '''
        if blockSignals: self.blockControlsSignals(True)
        #set the Style comboboxes
        self.ui.sStyleCB.setCurrentIndex(self.ui.sStyleCB.findText(NamedSymbolStyles[prop.sStyle]))
        self.ui.lStyleCB.setCurrentIndex(self.ui.lStyleCB.findText(NamedLineStyles[prop.lStyle]))
        self.ui.cStyleCB.setCurrentIndex(self.ui.cStyleCB.findText(NamedCurveStyles[prop.cStyle]))
        #set sSize and lWidth spinboxes. if prop.sSize is None, it puts -1 (which is the special value for these switchhboxes)
        self.ui.sSizeSB.setValue(max(prop.sSize,-1)) 
        self.ui.lWidthSB.setValue(max(prop.lWidth,-1))
        #Set the Color combo boxes. The item at index 0 is the empty one in the comboboxes Manage unknown colors by including them
        if prop.sColor is None: index=0 
        else:  index=self.ui.sColorCB.findData(Qt.QVariant(Qt.QColor(prop.sColor)))
        if index==-1: #if the color is not one of the supported colors, add it to the combobox
            index=self.ui.sColorCB.count()  #set the index to what will be the added one
            self.ui.sColorCB.addItem(self._colorIcon(Qt.QColor(prop.sColor)), "", Qt.QVariant(Qt.QColor(prop.sColor)))
        self.ui.sColorCB.setCurrentIndex(index)
        if prop.lColor is None: index=0 
        else:  index=self.ui.lColorCB.findData(Qt.QVariant(Qt.QColor(prop.lColor)))
        if index==-1: #if the color is not one of the supported colors, add it to the combobox
            index=self.ui.lColorCB.count()  #set the index to what will be the added one
            self.ui.lColorCB.addItem(self._colorIcon(Qt.QColor(prop.lColor)), "", Qt.QVariant(Qt.QColor(prop.lColor)))
        self.ui.lColorCB.setCurrentIndex(index)
        #set the Fill Checkbox. The prop.sFill value can be in 3 states: True, False and None
        if prop.sFill is None: checkState=Qt.Qt.PartiallyChecked 
        elif prop.sFill: checkState=Qt.Qt.Checked
        else: checkState=Qt.Qt.Unchecked
        self.ui.sFillCB.setCheckState(checkState)
        #set the Area Fill Checkbox. The prop.cFill value can be in 3 states: True, False and None
        if prop.cFill is None: checkState=Qt.Qt.PartiallyChecked 
        elif prop.cFill: checkState=Qt.Qt.Checked
        else: checkState=Qt.Qt.Unchecked
github taurus-org / taurus / lib / taurus / qt / qtgui / display / demo / qpixmapwidgetdemo.py View on Github external
halign_widget = Qt.QComboBox()
            valign_widget = Qt.QComboBox()
            control_l.addRow("pixmap:", pixmap_widget)
            control_l.addRow("Aspect ratio mode:", aspect_ratio_widget)
            control_l.addRow("Transformation mode:", transformation_widget)
            control_l.addRow("Horiz. alignment:", halign_widget)
            control_l.addRow("Vert. alignment:", valign_widget)

            panel_l.addWidget(display_panel, 1)
            panel_l.addWidget(control_panel, 0)

            aspect_ratio_widget.addItems(
                ["Ignore", "Keep", "Keep by expanding"])
            transformation_widget.addItems(["Fast", "Smooth"])
            halign_widget.addItem("Left", Qt.QVariant(Qt.Qt.AlignLeft))
            halign_widget.addItem("Center", Qt.QVariant(Qt.Qt.AlignHCenter))
            halign_widget.addItem("Right", Qt.QVariant(Qt.Qt.AlignRight))
            valign_widget.addItem("Top", Qt.QVariant(Qt.Qt.AlignTop))
            valign_widget.addItem("Center", Qt.QVariant(Qt.Qt.AlignVCenter))
            valign_widget.addItem("Bottom", Qt.QVariant(Qt.Qt.AlignBottom))

            pixmap_widget.textChanged.connect(self.changePixmap)
            aspect_ratio_widget.currentIndexChanged.connect(self.changeAspectRatio)
            transformation_widget.currentIndexChanged.connect(self.changeTransformationMode)
            halign_widget.currentIndexChanged.connect(self.changeAlignment)
            valign_widget.currentIndexChanged.connect(self.changeAlignment)

            self.w = w
            self.w_pixmap = pixmap_widget
            self.w_aspect_ratio = aspect_ratio_widget
            self.w_transformation = transformation_widget
            self.w_halign = halign_widget
github taurus-org / taurus / lib / taurus / qt / qtgui / panel / taurusmodellist.py View on Github external
def data(self, index, role=Qt.Qt.DisplayRole):
        '''reimplemented from :class:`Qt.QAbstractListModel`'''
        if not index.isValid() or not (0 <= index.row() < self.rowCount()):
            return Qt.QVariant()
        row = index.row()
        #Display Role
        if role == Qt.Qt.DisplayRole:
            return Qt.QVariant(Qt.QString(self.items[row].display))
        elif role == Qt.Qt.DecorationRole:
            return Qt.QVariant(self.items[row].icon)
        elif role == Qt.Qt.TextColorRole:
            if not self.items[row].src:
                return Qt.QVariant(Qt.QColor('gray'))
            return Qt.QVariant(Qt.QColor(self.items[row].ok and 'green' or 'red'))
        elif role == SRC_ROLE:
            return Qt.QVariant(Qt.QString(self.items[row].src))
        elif role == Qt.Qt.ToolTipRole:
            return Qt.QVariant(Qt.QString(self.items[row].src))
        if role == Qt.Qt.EditRole:
            return Qt.QVariant(Qt.QString(self.items[row].src))
        return Qt.QVariant()
github taurus-org / taurus / taurus / lib / taurus / qt / qtgui / table / qlogtable.py View on Github external
return Qt.QVariant(Qt.Qt.AlignLeft|Qt.Qt.AlignVCenter)
            return Qt.QVariant(Qt.Qt.AlignRight|Qt.Qt.AlignVCenter)
        elif role == Qt.Qt.BackgroundRole:
            if column == LEVEL:
                return Qt.QVariant(getBrushForLevel(record.levelno)[0])
        elif role == Qt.Qt.ForegroundRole:
            if column == LEVEL:
                return Qt.QVariant(getBrushForLevel(record.levelno)[1])
        elif role == Qt.Qt.ToolTipRole:
            return Qt.QVariant(_get_record_origin_tooltip(record))
        elif role == Qt.Qt.SizeHintRole:
            return self._getSizeHint(column)
        #elif role == Qt.Qt.StatusTipRole:
        #elif role == Qt.Qt.CheckStateRole:
        elif role == Qt.Qt.FontRole:
            return Qt.QVariant(self.DftFont)
        return Qt.QVariant()
github taurus-org / taurus / lib / taurus / qt / qtgui / display / demo / qpixmapwidgetdemo.py View on Github external
control_l.addRow("pixmap:", pixmap_widget)
            control_l.addRow("Aspect ratio mode:", aspect_ratio_widget)
            control_l.addRow("Transformation mode:", transformation_widget)
            control_l.addRow("Horiz. alignment:", halign_widget)
            control_l.addRow("Vert. alignment:", valign_widget)

            panel_l.addWidget(display_panel, 1)
            panel_l.addWidget(control_panel, 0)

            aspect_ratio_widget.addItems(
                ["Ignore", "Keep", "Keep by expanding"])
            transformation_widget.addItems(["Fast", "Smooth"])
            halign_widget.addItem("Left", Qt.QVariant(Qt.Qt.AlignLeft))
            halign_widget.addItem("Center", Qt.QVariant(Qt.Qt.AlignHCenter))
            halign_widget.addItem("Right", Qt.QVariant(Qt.Qt.AlignRight))
            valign_widget.addItem("Top", Qt.QVariant(Qt.Qt.AlignTop))
            valign_widget.addItem("Center", Qt.QVariant(Qt.Qt.AlignVCenter))
            valign_widget.addItem("Bottom", Qt.QVariant(Qt.Qt.AlignBottom))

            pixmap_widget.textChanged.connect(self.changePixmap)
            aspect_ratio_widget.currentIndexChanged.connect(self.changeAspectRatio)
            transformation_widget.currentIndexChanged.connect(self.changeTransformationMode)
            halign_widget.currentIndexChanged.connect(self.changeAlignment)
            valign_widget.currentIndexChanged.connect(self.changeAlignment)

            self.w = w
            self.w_pixmap = pixmap_widget
            self.w_aspect_ratio = aspect_ratio_widget
            self.w_transformation = transformation_widget
            self.w_halign = halign_widget
            self.w_valign = valign_widget
github taurus-org / taurus / taurus / lib / taurus / qt / qtgui / plot / curveprops.py View on Github external
elif column == Y: return Qt.QVariant(Qt.QString(self.curves[row].y.display))
            elif column == TITLE: return Qt.QVariant(Qt.QString(self.curves[row].title))
            elif column == VIS: return Qt.QVariant(Qt.QString(self.curves[row].vis))
            else: return Qt.QVariant()
        elif role == Qt.Qt.DecorationRole:
            if column == X: return Qt.QVariant(self.curves[row].x.icon)
            elif column == Y: return Qt.QVariant(self.curves[row].y.icon)
            elif column == TITLE: return Qt.QVariant(Qt.QColor(self.curves[row].properties.lColor or 'black'))
            else: return Qt.QVariant()
        elif role == Qt.Qt.TextColorRole:
            if column == X: Qt.QVariant(Qt.QColor(self.curves[row].x.ok and 'green' or 'red'))
            elif column == Y: Qt.QVariant(Qt.QColor(self.curves[row].y.ok and 'green' or 'red'))
            else: return Qt.QVariant()
        elif role == SRC_ROLE:
            if column == X: return Qt.QVariant(Qt.QString(self.curves[row].x.src))
            elif column == Y: return Qt.QVariant(Qt.QString(self.curves[row].y.src))
            else: return Qt.QVariant()
        elif role == PROPS_ROLE:
            return self.curves[row].properties
        elif role == Qt.Qt.ToolTipRole:
            if column == X: return Qt.QVariant(Qt.QString(self.curves[row].x.src))
            elif column == Y: return Qt.QVariant(Qt.QString(self.curves[row].y.src))
            else: return Qt.QVariant()
        if role == Qt.Qt.EditRole:
            if column == X: return Qt.QVariant(Qt.QString(self.curves[row].x.src))
            elif column == Y: return Qt.QVariant(Qt.QString(self.curves[row].y.src))
            elif column == TITLE: return Qt.QVariant(Qt.QString(self.curves[row].title))
            else: return Qt.QVariant()
        #Alignment 
#         elif role == Qt.Qt.TextAlignmentRole:
#             return QVariant(int(Qt.AlignHCenter|Qt.AlignVCenter))
        #Text Color
github taurus-org / taurus / src / sardana / taurus / qt / qtgui / extra_sardana / measurementgroup.py View on Github external
ctrlname = ch_data['_controller_name']
            if ctrlname.startswith("__"):
                return Qt.QVariant()
            ch_info = self.getAvailableChannels()[ch_name]
            if ch_info['type'] in ('CTExpChannel', 'OneDExpChannel', 'TwoDExpChannel'):
                unitdict = self.getPyData(ctrlname=ctrlname, unitid=ch_data['_unit_id'])
                key = self.data_keys_map[taurus_role]
                master_full_name = unitdict.get(key, None)
            else:
                key = taurus_role == ChannelView.Timer and 'timer' or 'monitor'
                master_full_name = self._mgconfig.get(key, None)
            if master_full_name is None:
                return Qt.QVariant()
            else:
                master_info = self.getAvailableChannels()[master_full_name]
                return Qt.QVariant(master_info['name'])

        return Qt.QVariant()