Ejemplo n.º 1
0
def updateLabelBackground(ctrl, widget):
    """Helper method to setup background of taurus labels and lcds"""
    bgRole = widget.bgRole

    if ctrl.usePalette():
        widget.setAutoFillBackground(True)
        if bgRole in ('', 'none', 'None'):
            transparentBrush = Qt.QBrush(Qt.Qt.transparent)
            frameBrush = transparentBrush
            bgBrush, fgBrush = transparentBrush, Qt.QBrush(Qt.Qt.black)
        else:
            frameBrush = Qt.QBrush(Qt.QColor(255, 255, 255, 128))
            bgItem, palette = None, QT_DEVICE_STATE_PALETTE
            if bgRole == 'quality':
                palette = QT_ATTRIBUTE_QUALITY_PALETTE
                bgItem = ctrl.quality()
            elif bgRole == 'state':
                try:
                    bgItem = ctrl.state()
                except AttributeError:
                    pass  # protect against calls with state not instantiated
            elif bgRole == 'value':
                bgItem = ctrl.value()
            else:
                # TODO: this is an *experimental* extension of the bgRole API
                # added in v 4.1.2-alpha. It may change in future versions
                modelObj = widget.getModelObj()
                try:
                    bgItem = modelObj.getFragmentObj(bgRole)
                except:
                    widget.warning('Invalid bgRole "%s"', bgRole)
            bgBrush, fgBrush = palette.qbrush(bgItem)
        _updatePaletteColors(widget, bgBrush, fgBrush, frameBrush)
    else:
        if bgRole in ('', 'none', 'None'):
            ss = StyleSheetTemplate.format("rgba(0,0,0,0)", "")
        else:
            bgItem, palette = None, QT_DEVICE_STATE_PALETTE
            if bgRole == 'quality':
                palette = QT_ATTRIBUTE_QUALITY_PALETTE
                bgItem = ctrl.quality()
            elif bgRole == 'state':
                bgItem = ctrl.state()
            elif bgRole == 'value':
                bgItem = ctrl.value()
            else:
                # TODO: this is an *experimental* extension of the bgRole API
                # added in v 4.1.2-alpha. It may change in future versions
                modelObj = widget.getModelObj()
                try:
                    bgItem = modelObj.getFragmentObj(bgRole)
                except:
                    widget.warning('Invalid bgRole "%s"', bgRole)
            color_ss = palette.qtStyleSheet(bgItem)
            ss = StyleSheetTemplate.format("rgba(255,255,255,128)", color_ss)
        widget.setStyleSheet(ss)
    widget.update()  # necessary in pyqt <= 4.4
Ejemplo n.º 2
0
 def update_node(node, key, dct):
     if hasattr(node, 'CustomForeground'):
         node.setForeground(
             0, Qt.QBrush(Qt.QColor(node.CustomForeground)))
     if hasattr(node, 'CustomBackground'):
         node.setBackground(
             0, Qt.QBrush(Qt.QColor(node.CustomBackground)))
     elif hasattr(node, 'StateBackground'):
         node.setBackground(0, Qt.QBrush(state2color(dct[key])))
     if hasattr(node, 'CustomIcon'):
         node.setIcon(0, Qt.QIcon(node.CustomIcon))
     else:
         if key.count('/') == 2:
             self.setStateIcon(node, dct and dct[key] or '')
     return
Ejemplo n.º 3
0
    def qbrush(self, stoq):
        # print stoq
        """Returns the brush for the specified state or quality"""
        name = self._decoder(stoq)

        f = self._qbrush_cache_fg
        b = self._qbrush_cache_bg
        if not f.has_key(name):
            f[name] = Qt.QBrush(self.qcolor(stoq)[1])

        if not b.has_key(name):
            b[name] = Qt.QBrush(self.qcolor(stoq)[0])
            if name == 'None':
                b[name].setStyle(Qt.Qt.BDiagPattern)

        return (b[name], f[name])
Ejemplo n.º 4
0
    def build_table(self, values):
        """
        This is a builder. For all the elements in widgets matrix,
        just set the corresponding cells of the QTableWidget.
        """
        self.trace('In TaurusGrid.build_table(%s)' % values)
        widgets_matrix = self.build_widgets(values, self.showLabels)
        rows = len(widgets_matrix)
        cols = rows and len(widgets_matrix[0]) or 0

        table = QtGui.QTableWidget()
        table.setItemDelegate(Delegate(table))
        # This example replaces the blue background of selected cells in tables
        palette = Qt.QPalette()
        palette.setBrush(palette.Active, palette.Highlight,
                         Qt.QBrush(Qt.Qt.white))
        table.setPalette(palette)

        table.setRowCount(rows)
        table.setColumnCount(cols)
        for row in range(len(widgets_matrix)):
            for col in range(len(widgets_matrix[row])):
                table.setCellWidget(row, col, widgets_matrix[row][col])

        # table.resizeColumnsToContents()
        # table.resizeRowsToContents()
        table.horizontalHeader().setResizeMode(QtGui.QHeaderView.Stretch)
        # table.verticalHeader().setResizeMode(QtGui.QHeaderView.Stretch)
        # table.horizontalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
        table.verticalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)

        return table
Ejemplo n.º 5
0
 def __init__(self, plot):
     Qt.QGraphicsScene.__init__(self, Qt.QGraphicsScene())
     gv = self
     self.plot = plot
     gv.setBackgroundBrush(Qt.QBrush(Qt.QColor('white')))
     self.legend = pg.LegendItem(None, offset=(0, 0))
     gv.scene().addItem(self.legend)
Ejemplo n.º 6
0
 def _updateDisplay(self, widget):
     key = None
     try:
         key = self.value()
     except Exception:
         pass
     ledMap = self.LedMap
     if widget.fgRole == 'quality':
         ledMap = self.LedQualityMap
     try:
         status, color, trouble = ledMap[key]
     except:
         status, color, trouble = False, "red", True
     if self.usePreferedColor(widget):
         if status:
             color = widget.onColor
         else:
             color = widget.offColor
     widget.ledStatus = status
     widget.ledColor = color
     if trouble:
         widget.setAutoFillBackground(True)
         bg_brush = Qt.QBrush(Qt.Qt.BDiagPattern)
         palette = widget.palette()
         palette.setBrush(Qt.QPalette.Window, bg_brush)
         palette.setBrush(Qt.QPalette.Base, bg_brush)
         widget.setPalette(palette)
     else:
         widget.setAutoFillBackground(False)
Ejemplo n.º 7
0
 def setStateBackground(self, child, color):
     if not isinstance(color, Qt.QColor):
         if DEVICE_STATE_PALETTE.has(color):
             qc = Qt.QColor(*DEVICE_STATE_PALETTE.rgb(color))
         else:
             qc = Qt.QColor(
                 color) if not fandango.isSequence(color) else Qt.QColor(
                     *color)
     child.setBackground(0, Qt.QBrush(qc))
Ejemplo n.º 8
0
 def _setProblemsBackground(self, doIt=True):
     if doIt:
         self.setAutoFillBackground(True)
         bg_brush = Qt.QBrush()
         bg_brush.setStyle(Qt.Qt.BDiagPattern)
         palette = self.palette()
         palette.setBrush(Qt.QPalette.Window, bg_brush)
         palette.setBrush(Qt.QPalette.Base, bg_brush)
     else:
         self.setAutoFillBackground(False)
Ejemplo n.º 9
0
def get_White_palette():
    palette = Qt.QPalette()

    brush = Qt.QBrush(Qt.QColor(255, 255, 255))
    brush.setStyle(Qt.Qt.SolidPattern)
    palette.setBrush(Qt.QPalette.Active, Qt.QPalette.Base, brush)

    brush = Qt.QBrush(Qt.QColor(255, 255, 255))
    brush.setStyle(Qt.Qt.SolidPattern)
    palette.setBrush(Qt.QPalette.Active, Qt.QPalette.Window, brush)

    brush = Qt.QBrush(Qt.QColor(255, 255, 255))
    brush.setStyle(Qt.Qt.SolidPattern)
    palette.setBrush(Qt.QPalette.Inactive, Qt.QPalette.Base, brush)

    brush = Qt.QBrush(Qt.QColor(255, 255, 255))
    brush.setStyle(Qt.Qt.SolidPattern)
    palette.setBrush(Qt.QPalette.Inactive, Qt.QPalette.Window, brush)

    brush = Qt.QBrush(Qt.QColor(255, 255, 255))
    brush.setStyle(Qt.Qt.SolidPattern)
    palette.setBrush(Qt.QPalette.Disabled, Qt.QPalette.Base, brush)

    brush = Qt.QBrush(Qt.QColor(255, 255, 255))
    brush.setStyle(Qt.Qt.SolidPattern)
    palette.setBrush(Qt.QPalette.Disabled, Qt.QPalette.Window, brush)
    return palette
Ejemplo n.º 10
0
 def _updatePensAndBrushes(self):
     pon = Qt.QPen(self._ledOnPenColor, self._ledPenWidth, Qt.Qt.SolidLine,
                   Qt.Qt.RoundCap, Qt.Qt.RoundJoin)
     poff = Qt.QPen(self._ledOffPenColor, self._ledPenWidth,
                    Qt.Qt.SolidLine, Qt.Qt.RoundCap, Qt.Qt.RoundJoin)
     bon = Qt.QBrush(self._ledOnBgColor, Qt.Qt.SolidPattern)
     boff = Qt.QBrush(self._ledOffBgColor, Qt.Qt.SolidPattern)
     pens, brushes = [], []
     for nLeds in Q7SegDigit.Leds:
         nPens = []
         nBrushes = []
         for onoff in nLeds:
             if onoff:
                 pen, brush = pon, bon
             else:
                 pen, brush = poff, boff
             nPens.append(pen)
             nBrushes.append(brush)
         pens.append(nPens)
         brushes.append(nBrushes)
     self._pens, self._brushes = pens, brushes
     self.update()
Ejemplo n.º 11
0
def updateLabelBackground(ctrl, widget):
    """Helper method to setup background of taurus labels and lcds"""
    bgRole = widget.bgRole

    if ctrl.usePalette():
        widget.setAutoFillBackground(True)
        if bgRole in ('', 'none'):
            transparentBrush = Qt.QBrush(Qt.Qt.transparent)
            frameBrush = transparentBrush
            bgBrush, fgBrush = transparentBrush, Qt.QBrush(Qt.Qt.black)
        else:
            frameBrush = Qt.QBrush(Qt.QColor(255, 255, 255, 128))
            bgItem, palette = None, QT_DEVICE_STATE_PALETTE
            if bgRole == 'quality':
                palette = QT_ATTRIBUTE_QUALITY_PALETTE
                bgItem = ctrl.quality()
            elif bgRole == 'state':
                bgItem = ctrl.state()
            elif bgRole == 'value':
                bgItem = ctrl.value()
            bgBrush, fgBrush = palette.qbrush(bgItem)
        _updatePaletteColors(widget, bgBrush, fgBrush, frameBrush)
    else:
        if bgRole in ('', 'none'):
            ss = StyleSheetTemplate.format("rgba(0,0,0,0)", "")
        else:
            bgItem, palette = None, QT_DEVICE_STATE_PALETTE
            if bgRole == 'quality':
                palette = QT_ATTRIBUTE_QUALITY_PALETTE
                bgItem = ctrl.quality()
            elif bgRole == 'state':
                bgItem = ctrl.state()
            elif bgRole == 'value':
                bgItem = ctrl.value()
            color_ss = palette.qtStyleSheet(bgItem)
            ss = StyleSheetTemplate.format("rgba(255,255,255,128)", color_ss)
        widget.setStyleSheet(ss)
    widget.update()  # necessary in pyqt <= 4.4
Ejemplo n.º 12
0
    def __init(self):
        l = Qt.QHBoxLayout()
        l.setSpacing(10)
        l.setMargin(5)
        self.setLayout(l)

        self._digits = []
        for i in xrange(5):
            d = Q7SegDigit()
            d.setUseFrame(False)
            d.setValue(i)
            l.addWidget(d, 0)
            self._digits.append(d)
        self.setAutoFillBackground(True)
        palette = Qt.QPalette()
        brush = Qt.QBrush(Qt.Qt.black)
        palette.setBrush(Qt.QPalette.Active, Qt.QPalette.Window, brush)
        self.setPalette(palette)
Ejemplo n.º 13
0
def run():
    # Simplify TaurusGui
    TaurusGui.TAURUS_MENU_ENABLED = False
    TaurusGui.TOOLS_MENU_ENABLED = False
    TaurusGui.HELP_MENU_ENABLED = False
    TaurusGui.FULLSCREEN_TOOLBAR_ENABLED = False
    TaurusGui.PANELS_MENU_ENABLED = False
    TaurusGui.APPLETS_TOOLBAR_ENABLED = False
    TaurusGui.QUICK_ACCESS_TOOLBAR_ENABLED = False

    app = TaurusApplication(app_name='tpgArchiving')
    gui = TaurusGui()
    gui.setWindowTitle('Taurus Archiving Plot')
    plot = TaurusPlot()

    #class MyPlot(TaurusPlot):
    #pass

    ##def dropEvent(self, event):
    ##print('In dropEvent(%s)' % str(dir(event)))
    ##def dragMoveEvent(self,event):
    ##print('Dragging ...')
    ##event.acceptProposedAction()
    ##def dragEnterEvent(self,event):
    ##print('Entering ...')
    ##event.acceptProposedAction()

    #plot = MyPlot()
    #plot.setAcceptDrops(True)
    #plot = fandango.qt.Dropable(TaurusPlot)()
    #plot.setDropLogger(fandango.printf)
    #plot.setSupportedMimeTypes(fandango.qt.MIMETYPES)

    plot.setBackgroundBrush(Qt.QColor('white'))
    axis = DateAxisItem(orientation='bottom')
    plot_items = plot.getPlotItem()

    axis.attachToPlotItem(plot_items)
    # TODO (cleanup menu actions)
    if plot_items.legend is not None:
        plot_items.legend.hide()

    msi = TangoArchivingModelSelectorItem()
    # hide time stamp selector
    msi.ui.ts_checkBox.setVisible(False)
    # hide add single Y model
    msi._addSelectedAction.setVisible(False)
    msi.setModel(msi.default_model)
    # progress bar
    pb = Qt.QProgressBar()
    pb.setGeometry(0, 0, 300, 25)

    def updateProgressBar(stop=True):
        if stop is True:
            final = 1
        else:
            final = 0
        pb.setRange(0, final)

    updateProgressBar()

    ###########################################################################
    # Update t0 and t1 based on sigXRangeChanged
    ###########################################################################
    def onUpdateXViewRange():
        x, _ = plot.viewRange()
        t0, t1 = x
        t0s = str2localtime(t0)
        t1s = str2localtime(t1)
        msi.time_selector.ui.comboBox_begin.setItemText(5, t0s)
        msi.time_selector.ui.comboBox_end.setItemText(7, t1s)
        msi.time_selector.ui.comboBox_begin.setItemText(5, t0s)
        msi.time_selector.ui.comboBox_end.setItemText(7, t1s)
        msi.time_selector.ui.comboBox_begin.setCurrentIndex(5)
        msi.time_selector.ui.comboBox_end.setCurrentIndex(7)

    vb = plot.getPlotItem().getViewBox()
    vb.sigXRangeChanged.connect(onUpdateXViewRange)

    ###########################################################################
    # Legend
    ###########################################################################
    gv = Qt.QGraphicsView(Qt.QGraphicsScene())
    gv.setBackgroundBrush(Qt.QBrush(Qt.QColor('white')))
    l = pg.LegendItem(None, offset=(0, 0))
    gv.scene().addItem(l)

    def updateExternalLegend():
        for dataitem in plot_items.listDataItems():
            l.removeItem(dataitem.name())

        for dataitem in plot_items.listDataItems():
            if dataitem.name():
                l.addItem(dataitem, dataitem.name())

    ###########################################################################
    # Connect CurvesAppearanceChooser to external legend
    ###########################################################################
    from taurus_pyqtgraph.curveproperties import (CurvesAppearanceChooser,
                                                  CurveAppearanceProperties)

    def onApply(self):
        names = self.getSelectedCurveNames()
        prop = self.getShownProperties()
        # Update self.curvePropDict for selected properties
        for n in names:
            self.curvePropDict[n] = CurveAppearanceProperties.merge(
                [self.curvePropDict[n], prop],
                conflict=CurveAppearanceProperties.inConflict_update_a)
        # emit a (PyQt) signal telling what properties (first argument) need to
        # be applied to which curves (second argument)
        # self.curveAppearanceChanged.emit(prop, names)
        # return both values

        self.curvePropAdapter.setCurveProperties(self.curvePropDict, names)
        # Update legend
        updateExternalLegend()

        return prop, names

    # Override CurvesAppearanceChooser.onApply
    CurvesAppearanceChooser.onApply = onApply

    ###########################################################################
    # Helper
    ###########################################################################
    def updateAll(legend=True):
        # Update legend
        if legend is True:
            updateExternalLegend()
        # run plot auto range
        time.sleep(0.2)  # Wait till models are loading
        plot_items.getViewBox().menu.autoRange()
        # Stop progress bar
        updateProgressBar()

    ###########################################################################
    # onAddXYModel
    ###########################################################################

    def onAddXYModel(models=None):
        # Update progress bar
        # updateProgressBar(False)
        print('onAddXYModel(%s)' % models)
        if not isSequenceType(models):
            print('Overriding models ...')
            models = msi.getSelectedModels()

        c = msi.cursor()
        msi.setCursor(Qt.Qt.WaitCursor)
        current = plot._model_chooser_tool.getModelNames()
        print('current: %s' % str(current))
        models = [m for m in models if m not in current]
        print('new models: %s' % str(models))
        plot.addModels(models)
        updateAll()
        msi.setCursor(c)

    # Connect button
    msi.modelsAdded.connect(onAddXYModel)

    #plot.setDropEventCallback(onAddXYModel)

    ###########################################################################
    # Override TaurusGui close event
    ###########################################################################
    def closeEvent(self, event):
        try:
            self.__macroBroker.removeTemporaryPanels()
        except:
            pass
        TaurusMainWindow.closeEvent(self, event)
        for n, panel in self._TaurusGui__panels.items():
            panel.closeEvent(event)
            panel.widget().closeEvent(event)
            if not event.isAccepted():
                result = Qt.QMessageBox.question(
                    self, 'Closing error',
                    "Panel '%s' cannot be closed. Proceed closing?" % n,
                    Qt.QMessageBox.Yes | Qt.QMessageBox.No)
                if result == Qt.QMessageBox.Yes:
                    event.accept()
                else:
                    break

        for curve in plot_items.listDataItems():
            plot.removeItem(curve)
            l.removeItem(curve.name())
        gui.saveSettings()

    # Override TaurusGui close event
    TaurusGui.closeEvent = closeEvent

    ###########################################################################
    # Create tgarch tool bar
    ###########################################################################
    def _onRefresh():
        t0, t1 = msi.time_selector.getTimes()
        # Validate models
        v = TangoArchivingAttributeNameValidator()
        query = "{0};t0={1};t1={2}"
        for curve in plot.getPlotItem().listDataItems():

            if isinstance(curve, TaurusPlotDataItem):
                ymodel = curve.getModel()
                # tgarch attr
                if v.getUriGroups(ymodel).get('scheme') != 'tgarch':
                    continue
                fullname, _, _ = v.getNames(ymodel)
                bmodel, current_query = fullname.split('?')
                db = current_query.split(';')[0]
                q = query.format(db, t0, t1)
                model = "{0}?{1}".format(bmodel, q)
                xmodel = "{};ts".format(model)
                curve.setModel(None)
                curve.setXModel(None)
                curve.setModel(model)
                curve.setXModel(xmodel)
        updateAll(legend=False)

    def onRefresh():
        # Update progress bar
        updateProgressBar(False)
        t1 = threading.Thread(target=_onRefresh)
        t1.start()

    tgarchToolBar = gui.addToolBar("TgArch")
    tgarchToolBar.addAction(Qt.QIcon.fromTheme("view-refresh"),
                            "refresh tgarch curves", onRefresh)

    ###########################################################################
    # Create panels
    ###########################################################################
    gui.createPanel(plot, 'Plot')
    gui.createPanel(msi, 'Chooser')
    gui.createPanel(pb, 'Progress bar')
    gui.createPanel(gv, 'Legend')
    # Load configuration
    gui.loadSettings()
    gui.show()

    app.exec_()
Ejemplo n.º 14
0
 def _setBgBrush(self, bgBrush):
     if isinstance(bgBrush, Qt.QColor):
         bgBrush = Qt.QBrush(bgBrush, Qt.Qt.SolidPattern)
     self._bgBrush = bgBrush
Ejemplo n.º 15
0
class Q7SegDigit(Qt.QWidget):
    """
    A widget representing a single seven segment digit. The style can be
    configured through the widget properties. For example, a typical LCD would
    have the following style:

        - bgColor 170, 170, 127
        - ledOnPenColor 30,30,30
        - ledOnBgColor 0,0,0
        - ledOffPenColor 160, 160, 120
        - ledOffbgColor 150, 150, 112
    """
    Leds = (
        (1, 1, 1, 0, 1, 1, 1),  # 0
        (0, 0, 1, 0, 0, 1, 0),  # 1
        (1, 0, 1, 1, 1, 0, 1),  # 2
        (1, 0, 1, 1, 0, 1, 1),  # 3
        (0, 1, 1, 1, 0, 1, 0),  # 4
        (1, 1, 0, 1, 0, 1, 1),  # 5
        (1, 1, 0, 1, 1, 1, 1),  # 6
        (1, 0, 1, 0, 0, 1, 0),  # 7
        (1, 1, 1, 1, 1, 1, 1),  # 8
        (1, 1, 1, 1, 0, 1, 0),  # 9
        (0, 0, 0, 0, 0, 0, 0),  # 10 'nothing'
        (0, 0, 0, 1, 0, 0, 0),  # 11 -
        (1, 0, 1, 1, 1, 1, 1),  # 12 a
        (0, 0, 0, 1, 1, 1, 0),  # 13 n
    )

    #    LedGeometries = (
    #        POLY([P(67, 60), P(283, 60), P(253, 90), P(97, 90), P(67, 60)]),
    #        POLY([P(60, 67), P(90, 97), P(90, 178), P(60, 193), P(60, 67)]),
    #        POLY([P(290, 67), P(260, 97), P(260, 178), P(290, 193), P(290, 67)]),
    #        POLY([P(67, 200), P(97, 185), P(253, 185), P(283, 200), P(253, 215), P(97, 215), P(67, 200)]),
    #        POLY([P(60, 207), P(90, 222), P(90, 303), P(60, 333), P(60, 207)]),
    #        POLY([P(290, 207), P(260, 222), P(260, 303), P(290, 333), P(290, 207)]),
    #        POLY([P(67, 340), P(283, 340), P(253, 310), P(97, 310), P(67, 340)]),
    #    )

    LedGeometriesWithFrame300x400 = (
        POLY([P(37, 30),
              P(263, 30),
              P(233, 60),
              P(67, 60),
              P(37, 30)]),
        POLY([P(30, 37),
              P(60, 67),
              P(60, 178),
              P(30, 193),
              P(30, 37)]),
        POLY([P(270, 37),
              P(240, 67),
              P(240, 178),
              P(270, 193),
              P(270, 37)]),
        POLY([
            P(37, 200),
            P(67, 185),
            P(233, 185),
            P(263, 200),
            P(233, 215),
            P(67, 215),
            P(37, 200)
        ]),
        POLY([P(30, 207),
              P(60, 222),
              P(60, 333),
              P(30, 363),
              P(30, 207)]),
        POLY([P(270, 207),
              P(240, 222),
              P(240, 333),
              P(270, 363),
              P(270, 207)]),
        POLY([P(37, 370),
              P(263, 370),
              P(233, 340),
              P(67, 340),
              P(37, 370)]),
    )

    LedGeometriesWithoutFrame300x400 = (
        POLY([P(7, 0), P(293, 0),
              P(263, 30), P(37, 30),
              P(7, 0)]),
        POLY([P(0, 7), P(30, 37),
              P(30, 178), P(0, 193),
              P(0, 7)]),
        POLY([P(300, 7),
              P(270, 37),
              P(270, 178),
              P(300, 193),
              P(300, 7)]),
        POLY([
            P(7, 200),
            P(37, 185),
            P(263, 185),
            P(293, 200),
            P(263, 215),
            P(37, 215),
            P(7, 200)
        ]),
        POLY([P(0, 207),
              P(30, 222),
              P(30, 363),
              P(0, 393),
              P(0, 207)]),
        POLY([P(300, 207),
              P(270, 222),
              P(270, 363),
              P(300, 393),
              P(300, 207)]),
        POLY([P(7, 400),
              P(293, 400),
              P(263, 370),
              P(37, 370),
              P(7, 400)]),
    )

    LedGeometriesWithFrame300x300 = (
        POLY([P(37, 30),
              P(263, 30),
              P(233, 60),
              P(67, 60),
              P(37, 30)]),
        POLY([P(30, 37),
              P(60, 67),
              P(60, 128),
              P(30, 143),
              P(30, 37)]),
        POLY([P(270, 37),
              P(240, 67),
              P(240, 128),
              P(270, 143),
              P(270, 37)]),
        POLY([
            P(37, 150),
            P(67, 135),
            P(233, 135),
            P(263, 150),
            P(233, 165),
            P(67, 165),
            P(37, 150)
        ]),
        POLY([P(30, 157),
              P(60, 172),
              P(60, 233),
              P(30, 263),
              P(30, 157)]),
        POLY([P(270, 157),
              P(240, 172),
              P(240, 233),
              P(270, 263),
              P(270, 157)]),
        POLY([P(37, 270),
              P(263, 270),
              P(233, 240),
              P(67, 240),
              P(37, 270)]),
    )

    LedGeometriesWithoutFrame300x300 = (
        POLY([P(7, 0), P(293, 0),
              P(263, 30), P(37, 30),
              P(7, 0)]),
        POLY([P(0, 7), P(30, 37),
              P(30, 128), P(0, 143),
              P(0, 7)]),
        POLY([P(300, 7),
              P(270, 37),
              P(270, 128),
              P(300, 143),
              P(300, 7)]),
        POLY([
            P(7, 150),
            P(37, 135),
            P(263, 135),
            P(293, 150),
            P(263, 165),
            P(37, 165),
            P(7, 150)
        ]),
        POLY([P(0, 157),
              P(30, 172),
              P(30, 263),
              P(0, 293),
              P(0, 157)]),
        POLY([P(300, 157),
              P(270, 172),
              P(270, 263),
              P(300, 293),
              P(300, 157)]),
        POLY([P(7, 300),
              P(293, 300),
              P(263, 270),
              P(37, 270),
              P(7, 300)]),
    )

    DftLedOnPenColor = Qt.QColor(193, 0, 0, 255)
    DftLedOnBgColor = Qt.Qt.red

    DftLedOffPenColor = Qt.QColor(30, 30, 30, 255)
    DftLedOffBgColor = Qt.QColor(40, 40, 40, 255)

    DftBgBrush = Qt.QBrush(Qt.Qt.black, Qt.Qt.SolidPattern)

    DftLedPenWidth = 5
    DftValue = ''

    DftWidth = 300
    DftHeight = 300
    DftAspectRatio = DftWidth / DftHeight
    DftUseFrame = True

    def __init__(self, parent=None, **kwargs):
        Qt.QWidget.__init__(self, parent)

        self._setLedPenWidth(Q7SegDigit.DftLedPenWidth)
        self._setValue(Q7SegDigit.DftValue)
        self._setLedOnPenColor(Q7SegDigit.DftLedOnPenColor)
        self._setLedOnBgColor(Q7SegDigit.DftLedOnBgColor)
        self._setLedOffPenColor(Q7SegDigit.DftLedOffPenColor)
        self._setLedOffBgColor(Q7SegDigit.DftLedOffBgColor)
        self._setBgBrush(Q7SegDigit.DftBgBrush)
        self._setAspectRatio(Q7SegDigit.DftAspectRatio)
        self._setUseFrame(Q7SegDigit.DftUseFrame)
        self._updatePensAndBrushes()

    def minimumSizeHint(self):
        return Qt.QSize(4, 5.9)

    def sizeHint(self):
        # return Qt.QSize(Q7SegDigit.DftWidth, Q7SegDigit.DftHeight)
        return Qt.QSize(40, 50)

    def _updatePensAndBrushes(self):
        pon = Qt.QPen(self._ledOnPenColor, self._ledPenWidth, Qt.Qt.SolidLine,
                      Qt.Qt.RoundCap, Qt.Qt.RoundJoin)
        poff = Qt.QPen(self._ledOffPenColor, self._ledPenWidth,
                       Qt.Qt.SolidLine, Qt.Qt.RoundCap, Qt.Qt.RoundJoin)
        bon = Qt.QBrush(self._ledOnBgColor, Qt.Qt.SolidPattern)
        boff = Qt.QBrush(self._ledOffBgColor, Qt.Qt.SolidPattern)
        pens, brushes = [], []
        for nLeds in Q7SegDigit.Leds:
            nPens = []
            nBrushes = []
            for onoff in nLeds:
                if onoff:
                    pen, brush = pon, bon
                else:
                    pen, brush = poff, boff
                nPens.append(pen)
                nBrushes.append(brush)
            pens.append(nPens)
            brushes.append(nBrushes)
        self._pens, self._brushes = pens, brushes
        self.update()

    def __valueStrToLedIndex(self, s):
        if s is None:
            s = 10
        elif s == '-':
            s = 11
        elif s == 'a':
            s = 12
        elif s == 'n':
            s = 13
        else:
            try:
                s = int(s)
            except:
                s = 10
        return s

    def paintEvent(self, evt):
        painter = Qt.QPainter(self)
        painter.setRenderHint(Qt.QPainter.Antialiasing)
        painter.setWindow(0, 0, self.DftWidth, self.DftHeight)
        w, h = float(self.width()), float(self.height())
        aspect = w / h
        if aspect > 0.75:
            w = h * aspect
        else:
            h = w / aspect
        painter.setViewport(0, 0, w, h)
        self._paintBorder(painter)
        self._paintSegment(painter)

    def _paintBorder(self, painter):
        if self.getUseFrame():
            painter.setPen(
                Qt.QPen(Qt.Qt.black, 2, Qt.Qt.SolidLine, Qt.Qt.RoundCap,
                        Qt.Qt.RoundJoin))
            linGrad = Qt.QLinearGradient(30, 200, 200, 150)
            linGrad.setColorAt(0, Qt.Qt.darkGray)
            linGrad.setColorAt(1, Qt.Qt.white)
            linGrad.setSpread(Qt.QGradient.ReflectSpread)
            painter.setBrush(linGrad)
            border2 = Qt.QRectF(0, 0, self.DftWidth, self.DftHeight)
            painter.drawRoundRect(border2, 10, 10)
            painter.setBrush(self.getBgBrush())
            dist = 20
            border1 = Qt.QRectF(dist, dist, self.DftWidth - 2 * dist,
                                self.DftHeight - 2 * dist)
            painter.drawRoundRect(border1, 5, 5)
        else:
            painter.setBrush(self.getBgBrush())
            border1 = Qt.QRectF(0, 0, self.DftWidth, self.DftHeight)
            painter.drawRect(border1)

    def _paintSegment(self, painter):
        idx = self.__valueStrToLedIndex(self._value)

        if self.getUseFrame():
            if self.DftHeight == 300:
                geom = self.LedGeometriesWithFrame300x300
            else:
                geom = self.LedGeometriesWithFrame300x400
        else:
            if self.DftHeight == 300:
                geom = self.LedGeometriesWithoutFrame300x300
            else:
                geom = self.LedGeometriesWithoutFrame300x400

        pens, brushes = self._pens[idx], self._brushes[idx]

        for i in xrange(7):
            seg = Qt.QPainterPath()
            seg.addPolygon(geom[i])
            painter.setPen(pens[i])
            painter.setBrush(brushes[i])
            painter.drawPath(seg)

    def __str__(self):
        _, idx = '', self.__valueStrToLedIndex(self._value)
        leds = self.Leds[idx]

        # line 0
        c = ' '
        if leds[0]:
            c = '_'
        ret = ' %c \n' % c

        # line 1
        c1, c2, c3 = ' ', ' ', ' '
        if leds[1]:
            c1 = '|'
        if leds[3]:
            c2 = '_'
        if leds[2]:
            c3 = '|'
        ret += '%c%c%c\n' % (c1, c2, c3)

        # line 2
        c1, c2, c3 = ' ', ' ', ' '
        if leds[4]:
            c1 = '|'
        if leds[6]:
            c2 = '_'
        if leds[5]:
            c3 = '|'
        ret += '%c%c%c' % (c1, c2, c3)
        return ret

    def _setValue(self, n):
        if n is None:
            self._value = n
        else:
            self._value = str(n)

    def _setLedPenWidth(self, w):
        self._ledPenWidth = w

    def _setLedOnPenColor(self, penColor):
        self._ledOnPenColor = penColor

    def _setLedOnBgColor(self, bgColor):
        self._ledOnBgColor = bgColor

    def _setLedOffPenColor(self, penColor):
        self._ledOffPenColor = penColor

    def _setLedOffBgColor(self, bgColor):
        self._ledOffBgColor = bgColor

    def _setAspectRatio(self, aspectRatio):
        self._aspectRatio = aspectRatio

    def _setBgBrush(self, bgBrush):
        if isinstance(bgBrush, Qt.QColor):
            bgBrush = Qt.QBrush(bgBrush, Qt.Qt.SolidPattern)
        self._bgBrush = bgBrush

    def _setUseFrame(self, useFrame):
        self._useFrame = useFrame

    def getLedOnPenColor(self):
        return self._ledOnPenColor

    def setLedOnPenColor(self, penColor):
        self._setLedOnPenColor(penColor)
        self._updatePensAndBrushes()

    def resetLedOnPenColor(self):
        self.setLenOnPenColor(Q7SegDigit.DftLedOnPenColor)

    def getLedOnBgColor(self):
        return self._ledOnBgColor

    def setLedOnBgColor(self, bgColor):
        self._setLedOnBgColor(bgColor)
        self._updatePensAndBrushes()

    def resetLedOnBgColor(self):
        self.setLedOnBgColor(Q7SegDigit.DftLedOnBgColor)

    def getLedOffPenColor(self):
        return self._ledOffPenColor

    def setLedOffPenColor(self, penColor):
        self._setLedOffPenColor(penColor)
        self._updatePensAndBrushes()

    def resetLedOffPenColor(self):
        self.setLenOffPenColor(Q7SegDigit.DftLedOffPenColor)

    def getLedOffBgColor(self):
        return self._ledOffBgColor

    def setLedOffBgColor(self, bgColor):
        self._setLedOffBgColor(bgColor)
        self._updatePensAndBrushes()

    def resetLedOffBgColor(self):
        self.setLedOffBgColor(Q7SegDigit.DftLedOffBgColor)

    def getBgBrush(self):
        return self._bgBrush

    def setBgBrush(self, bgBrush):
        self._setBgBrush(bgBrush)
        self.update()

    def resetBgBrush(self):
        self.setBgBrush(Q7SegDigit.DftBgBrush)

    def setValue(self, n):
        self._setValue(n)
        self.update()

    def getValue(self):
        return self._value

    def resetValue(self):
        self.setValue(Q7SegDigit.DftValue)

    def setLedPenWidth(self, w):
        self._setLedPenWidth(w)
        self._updatePensAndBrushes()

    def getLedPenWidth(self):
        return self._ledPenWidth

    def resetLedPenWidth(self):
        self.setLedPenWidth(Q7SegDigit.DftLenPenWidth)

    def setAspectRatio(self, apectRatio):
        self._setAspectRatio(apectRatio)
        self.update()

    def getAspectRatio(self):
        return self._aspectRatio

    def resetAspectRatio(self):
        self.setAspectRatio(Q7SegDigit.DftAspectRatio)

    def setUseFrame(self, useFrame):
        self._setUseFrame(useFrame)

    def getUseFrame(self):
        return self._useFrame

    def resetUseFrame(self):
        self.setUseFrame(Q7SegDigit.DftUseFrame)

    #: This property holds the led pen color when the led is light ON
    #:
    #: **Access functions:**
    #:
    #:     * :meth:`taurus.qt.qtgui.display.Q7SegDigit.getLedOnPenColor`
    #:     * :meth:`taurus.qt.qtgui.display.Q7SegDigit.setLedOnPenColor`
    #:     * :meth:`taurus.qt.qtgui.display.Q7SegDigit.resetLedOnPenColor`
    #:
    ledOnPenColor = Qt.pyqtProperty("QColor", getLedOnPenColor,
                                    setLedOnPenColor, resetLedOnPenColor)

    #: This property holds the led background color when the led is light ON
    #:
    #: **Access functions:**
    #:
    #:     * :meth:`taurus.qt.qtgui.display.Q7SegDigit.getLedOnBgColor`
    #:     * :meth:`taurus.qt.qtgui.display.Q7SegDigit.setLedOnBgColor`
    #:     * :meth:`taurus.qt.qtgui.display.Q7SegDigit.resetLedOnBgColor`
    #:
    ledOnBgColor = Qt.pyqtProperty("QColor", getLedOnBgColor, setLedOnBgColor,
                                   resetLedOnBgColor)

    #: This property holds the led pen color when the led is light OFF
    #:
    #: **Access functions:**
    #:
    #:     * :meth:`taurus.qt.qtgui.display.Q7SegDigit.getLedOffPenColor`
    #:     * :meth:`taurus.qt.qtgui.display.Q7SegDigit.setLedOffPenColor`
    #:     * :meth:`taurus.qt.qtgui.display.Q7SegDigit.resetLedOffPenColor`
    #:
    ledOffPenColor = Qt.pyqtProperty("QColor", getLedOffPenColor,
                                     setLedOffPenColor, resetLedOffPenColor)

    #: This property holds the led background color when the led is light OFF
    #:
    #: **Access functions:**
    #:
    #:     * :meth:`taurus.qt.qtgui.display.Q7SegDigit.getLedOffBgColor`
    #:     * :meth:`taurus.qt.qtgui.display.Q7SegDigit.setLedOffBgColor`
    #:     * :meth:`taurus.qt.qtgui.display.Q7SegDigit.resetLedOffBgColor`
    #:
    ledOffBgColor = Qt.pyqtProperty("QColor", getLedOffBgColor,
                                    setLedOffBgColor, resetLedOffBgColor)

    #: This property holds the background brush
    #:
    #: **Access functions:**
    #:
    #:     * :meth:`taurus.qt.qtgui.display.Q7SegDigit.getBgBrush`
    #:     * :meth:`taurus.qt.qtgui.display.Q7SegDigit.setBgBrush`
    #:     * :meth:`taurus.qt.qtgui.display.Q7SegDigit.resetBgBrush`
    #:
    bgBrush = Qt.pyqtProperty("QBrush", getBgBrush, setBgBrush, resetBgBrush)

    #: This property holds the pen width
    #:
    #: **Access functions:**
    #:
    #:     * :meth:`taurus.qt.qtgui.display.Q7SegDigit.getLedPenWidth`
    #:     * :meth:`taurus.qt.qtgui.display.Q7SegDigit.setLedPenWidth`
    #:     * :meth:`taurus.qt.qtgui.display.Q7SegDigit.resetLedPenWidth`
    #:
    ledPenWidth = Qt.pyqtProperty("int", getLedPenWidth, setLedPenWidth,
                                  resetLedPenWidth)

    #: This property holds wheater of not to draw a frame
    #:
    #: **Access functions:**
    #:
    #:     * :meth:`taurus.qt.qtgui.display.Q7SegDigit.getUseFrame`
    #:     * :meth:`taurus.qt.qtgui.display.Q7SegDigit.setUseFrame`
    #:     * :meth:`taurus.qt.qtgui.display.Q7SegDigit.resetUseFrame`
    #:
    useFrame = Qt.pyqtProperty("bool", getUseFrame, setUseFrame, resetUseFrame)

    #: This property holds the widget value
    #:
    #: **Access functions:**
    #:
    #:     * :meth:`taurus.qt.qtgui.display.Q7SegDigit.getValue`
    #:     * :meth:`taurus.qt.qtgui.display.Q7SegDigit.setValue`
    #:     * :meth:`taurus.qt.qtgui.display.Q7SegDigit.resetValue`
    #:
    value = Qt.pyqtProperty("QString", getValue, setValue, resetValue)
Ejemplo n.º 16
0
    def set_common_params(self, item, params):
        if not item:
            return
        item._params = params
        name = params.get('name')

        if name.lower() == "ignorerepaint":
            name = ""
            if not 'extensions' in params:
                params['extensions'] = {}
            params.get('extensions')["ignoreRepaint"] = "true"

        if self.alias:
            for k, v in self.alias.items():
                name = str(name).replace(k, v)

        # Forcing not-Taurus items to have a name and be able to trigger events
        setattr(item, '_name', name)
        if name and not self._delayed:
            if isinstance(item, TaurusGraphicsItem):
                #self.debug('TaurusJDrawGraphicsFactory.set_common_params(): %s.setModel(%s)'%(item,name))
                item.setModel(name)
            else:
                self.debug(
                    'TaurusJDrawGraphicsFactory.set_common_params(%s): %s is not a TaurusGraphicsItem'
                    % (name, type(item).__name__))

        visibilitymapper = params.get('visibilitymapper')
        if not visibilitymapper is None:
            mapping_type = visibilitymapper['mapping_type']
            mode = visibilitymapper['mode']
            default = visibilitymapper['default']
            item._default = default
            item._map = visibilitymapper['map']

        visible = params.get('visible')
        if not visible is None:
            item.setVisible(visible)

        extensions = params.get('extensions')
        if extensions:
            item._extensions = extensions

        try:
            getattr(item, 'setPen')
            fg = params.get("foreground", (0, 0, 0))
            lineWidth = params.get("lineWidth", 1)
            if lineWidth == 0:
                pen = Qt.QPen(Qt.Qt.NoPen)
            else:
                pen = Qt.QPen(Qt.QColor(fg[0], fg[1], fg[2]))
                pen.setWidth(lineWidth)
                pen.setStyle(LINESTYLE_JDW2QT[params.get("lineStyle", 0)])
            item.setPen(pen)
        except AttributeError as ae:
            pass
        except Exception as e:
            self.warning(
                'jdraw.set_common_params(%s(%s)).(foreground,width,style) failed!: \n\t%s'
                % (type(item).__name__, name, traceback.format_exc()))

        fillStyle = FILLSTYLE_JDW2QT[params.get('fillStyle', 0)]
        item._fillStyle = fillStyle

        if hasattr(item, 'brush'):
            brush = Qt.QBrush()
            if fillStyle == Qt.Qt.LinearGradientPattern:
                ox, oy = params.get('origin', (0, 0))
                gradient = Qt.QLinearGradient(ox + params.get('gradX1', 0),
                                              oy + params.get('gradY1', 0),
                                              ox + params.get('gradX2', 0),
                                              oy + params.get('gradY2', 0))
                c = params.get('gradC1', (0, 0, 0))
                gradient.setColorAt(0, Qt.QColor(c[0], c[1], c[2]))
                c = params.get('gradC2', (255, 255, 255))
                gradient.setColorAt(1, Qt.QColor(c[0], c[1], c[2]))

                gradCyclic = params.get('gradCyclic', False)
                if gradCyclic:
                    gradient.setSpread(Qt.QGradient.ReflectSpread)

                brush = Qt.QBrush(gradient)
            else:
                brush.setStyle(fillStyle)

            bg = params.get('background', (255, 255, 255))
            brush.setColor(Qt.QColor(bg[0], bg[1], bg[2]))
            item.setBrush(brush)
Ejemplo n.º 17
0
                pen = Qt.QPen(Qt.QColor(fg[0], fg[1], fg[2]))
                pen.setWidth(lineWidth)
                pen.setStyle(LINESTYLE_JDW2QT[params.get("lineStyle", 0)])
            item.setPen(pen)
        except AttributeError, ae:
            pass
        except Exception, e:
            self.warning(
                'jdraw.set_common_params(%s(%s)).(foreground,width,style) failed!: \n\t%s'
                % (type(item).__name__, name, traceback.format_exc()))

        fillStyle = FILLSTYLE_JDW2QT[params.get('fillStyle', 0)]
        item._fillStyle = fillStyle

        if hasattr(item, 'brush'):
            brush = Qt.QBrush()
            if fillStyle == Qt.Qt.LinearGradientPattern:
                ox, oy = params.get('origin', (0, 0))
                gradient = Qt.QLinearGradient(ox + params.get('gradX1', 0),
                                              oy + params.get('gradY1', 0),
                                              ox + params.get('gradX2', 0),
                                              oy + params.get('gradY2', 0))
                c = params.get('gradC1', (0, 0, 0))
                gradient.setColorAt(0, Qt.QColor(c[0], c[1], c[2]))
                c = params.get('gradC2', (255, 255, 255))
                gradient.setColorAt(1, Qt.QColor(c[0], c[1], c[2]))

                gradCyclic = params.get('gradCyclic', False)
                if gradCyclic:
                    gradient.setSpread(Qt.QGradient.ReflectSpread)
Ejemplo n.º 18
0
    def __init__(self, parent=None):
        Qt.QWidget.__init__(self, parent)
        self.loadUi()

        self._controllers = []

        # construct the layout for controllers container
        self.ctrlLayout = Qt.QHBoxLayout(self.controllersContainer)
        self.ctrlLayout.setContentsMargins(5, 0, 5, 0)
        self.ctrlLayout.setSpacing(1)

        # implement scroll bars for the controllers container
        self.scrollArea = Qt.QScrollArea(self)
        self.scrollArea.setWidget(self.controllersContainer)
        self.scrollArea.setVerticalScrollBarPolicy(Qt.Qt.ScrollBarAlwaysOff)
        self.scrollArea.setWidgetResizable(True)
        self.cpointsGroupBox.layout().insertWidget(0, self.scrollArea)

        # initialize data
        cpoints = 2
        self.x = numpy.arange(256, dtype='double')
        self.y = numpy.zeros(256, dtype='double')
        self.xp = numpy.linspace(self.x[0], self.x[-1], cpoints)
        self.corrp = numpy.zeros(cpoints)
        self.yp = numpy.interp(self.xp, self.x, self.y)
        self.corr = numpy.zeros(self.x.size)

        # markers
        self.markerPos = self.xp[0]
        self.marker1 = Qwt5.QwtPlotMarker()
        self.marker1.setSymbol(
            Qwt5.QwtSymbol(Qwt5.QwtSymbol.Rect, Qt.QBrush(Qt.Qt.NoBrush),
                           Qt.QPen(Qt.Qt.green), Qt.QSize(8, 8)))
        self.marker1.attach(self.plot1)
        self.marker2 = Qwt5.QwtPlotMarker()
        self.marker2.setSymbol(
            Qwt5.QwtSymbol(Qwt5.QwtSymbol.Rect, Qt.QBrush(Qt.Qt.NoBrush),
                           Qt.QPen(Qt.Qt.green), Qt.QSize(8, 8)))
        self.marker2.attach(self.plot2)

        # cpointsPickers
        self._cpointMovingIndex = None
        self._cpointsPicker1 = Qwt5.QwtPicker(self.plot1.canvas())
        self._cpointsPicker1.setSelectionFlags(Qwt5.QwtPicker.PointSelection)
        self._cpointsPicker2 = Qwt5.QwtPicker(self.plot2.canvas())
        self._cpointsPicker2.setSelectionFlags(Qwt5.QwtPicker.PointSelection)
        self._cpointsPicker1.widgetMousePressEvent = self.plot1MousePressEvent
        self._cpointsPicker1.widgetMouseReleaseEvent = self.plot1MouseReleaseEvent
        self._cpointsPicker2.widgetMousePressEvent = self.plot2MousePressEvent
        self._cpointsPicker2.widgetMouseReleaseEvent = self.plot2MouseReleaseEvent
        self._cpointsPicker1.widgetMouseDoubleClickEvent = self.plot1MouseDoubleClickEvent
        self._cpointsPicker2.widgetMouseDoubleClickEvent = self.plot2MouseDoubleClickEvent
        self._populatePlots()
        self.resetCorrection()
        self._selectedController = self._controllers[0]

        self._addCPointsDialog = AddCPointsDialog(self)

        # Launch low-priority initializations (to speed up load time)
        # Qt.QTimer.singleShot(0, <method>)

        # connections
        self.addCPointsBT.clicked.connect(self._addCPointsDialog.show)
        self._addCPointsDialog.editBT.clicked.connect(
            self.showEditCPointsDialog)
        self._addCPointsDialog.cleanBT.clicked.connect(self.resetCorrection)
        self._addCPointsDialog.addSingleCPointBT.clicked.connect(
            self.onAddSingleCPointBT)
        self._addCPointsDialog.addRegEspCPointsBT.clicked.connect(
            self.onAddRegEspCPointsBT)
Ejemplo n.º 19
0
    def fillTaurusConfig(self, item, configdict):
        '''
        Fills the non-top nodes of the dictionary recursively.

        :param item: (Qt.QStandardItem) parent item
        :param configdict: (dict) a configuration dictionary.  See :class:`BaseConfigurableClass`
        '''
        if not BaseConfigurableClass.isTaurusConfig(configdict):
            return
        # fill the registered keys
        registeredkeys = configdict.get('__orderedConfigNames__', [])
        valuesdict = configdict.get('__itemConfigurations__', {})
        for k in registeredkeys:
            value = valuesdict[k]
            child = Qt.QStandardItem(k)
            if BaseConfigurableClass.isTaurusConfig(value):
                child.setEditable(False)
                item.appendRow(child)

                txt = Qt.from_qvariant(item.data(Qt.Qt.UserRole), str)
                path = Qt.QVariant(txt + ";__itemConfigurations__;" + k)
                child.setData(path, Qt.Qt.UserRole)
                # recursive call to fill all nodes
                self.fillTaurusConfig(child, value)
            else:
                typeV = Qt.QStandardItem(repr(type(value)))
                valueV = Qt.QStandardItem(repr(value))

                typeV.setForeground(Qt.QBrush(Qt.QColor('gray')))
                child.setForeground(Qt.QBrush(Qt.QColor('gray')))

                item.appendRow([child, typeV, valueV])

                txt = Qt.from_qvariant(item.data(Qt.Qt.UserRole), str)
                path = Qt.QVariant(txt + ";__itemConfigurations__;" + k)
                child.setEditable(False)
                typeV.setEditable(False)

                child.setData(path, Qt.Qt.UserRole)
                typeV.setData(path, Qt.Qt.UserRole)
                valueV.setData(path, Qt.Qt.UserRole)

        customkeys = [k for k in configdict if k not in (
            '__orderedConfigNames__', '__itemConfigurations__', 'ConfigVersion', '__pickable__')]
        if len(customkeys) > 0:

            custom = Qt.QStandardItem('[custom]')
            item.appendRow(custom)
            custom.setEditable(False)
            # custom.setSelectable(False)
            custom.setBackground(Qt.QBrush(Qt.QColor('gray')))
            for k in customkeys:
                value = configdict[k]
                child = Qt.QStandardItem(str(k))
                # item.appendRow(child)

                if BaseConfigurableClass.isTaurusConfig(value):
                    child.setEditable(False)
                    item.appendRow(child)
                    txt = Qt.from_qvariant(item.data(Qt.Qt.UserRole), str)
                    path = Qt.QVariant(txt + ";" + k)
                    child.setData(path, Qt.Qt.UserRole)
                    # recursive call to fill all nodes
                    self.fillTaurusConfig(child, value)
                else:
                    typeV = Qt.QStandardItem(repr(type(value)))
                    valueV = Qt.QStandardItem(repr(value))
                    typeV.setForeground(Qt.QBrush(Qt.QColor('gray')))
                    child.setForeground(Qt.QBrush(Qt.QColor('gray')))
                    item.appendRow([child, typeV, valueV])
                    txt = Qt.from_qvariant(item.data(Qt.Qt.UserRole), str)
                    path = Qt.QVariant(txt + ";" + k)

                    child.setData(path, Qt.Qt.UserRole)
                    child.setEditable(False)
                    typeV.setEditable(False)
                    typeV.setData(path, Qt.Qt.UserRole)
                    valueV.setData(path, Qt.Qt.UserRole)