Exemplo n.º 1
0
 def testClosedLoop(self):
     # A data different than its default should be restored
     ctiIn = ColorCti('parent', defaultData='#ABCDEF')
     ctiIn.data = '#DEADBE'  # works only if data is set, otherwise ctiOut.data will be None
     ctiOut = self.closedLoop(ctiIn)
     print("ctiIn {}".format(ctiIn.__dict__))
     print("ctiOut {}".format(ctiOut.__dict__))
     self.assertEqual(ctiIn, ctiOut)
Exemplo n.º 2
0
 def testClosedLoop(self):
     # A data different than its default should be restored
     ctiIn  = ColorCti('parent', defaultData='#ABCDEF')
     ctiIn.data='#DEADBE' # works only if data is set, otherwise ctiOut.data will be None
     ctiOut = self.closedLoop(ctiIn)
     print("ctiIn {}".format(ctiIn.__dict__))
     print("ctiOut {}".format(ctiOut.__dict__))
     self.assertEqual(ctiIn, ctiOut)
Exemplo n.º 3
0
    def testColorCti(self):

        colorStr = '#FF33EE'
        cti = ColorCti('color', defaultData=colorStr)
        self.assertEqual(cti.data, QtGui.QColor(colorStr))
        self.assertEqual(cti.data, QtGui.QColor(colorStr))
        self.assertEqual(cti.displayValue, colorStr)
Exemplo n.º 4
0
    def __init__(self, nodeName="pen", defaultData=None, expanded=True):
        """ Constructor.
        """
        super(PgPlotDataItemCti, self).__init__(nodeName,
                                                defaultData=defaultData,
                                                expanded=expanded)
        self.antiAliasCti = self.insertChild(BoolCti("anti-alias", True))

        self.colorCti = self.insertChild(
            ColorCti('color', QtGui.QColor('#FF0066')))
        self.lineCti = self.insertChild(
            BoolCti('line', True, expanded=False, childrenDisabledValue=False))
        self.lineStyleCti = self.lineCti.insertChild(
            createPenStyleCti('style'))
        self.lineWidthCti = self.lineCti.insertChild(
            createPenWidthCti('width'))

        defaultShadowPen = QtGui.QPen(QtGui.QColor('#BFBFBF'))
        defaultShadowPen.setWidth(0)
        self.lineCti.insertChild(
            PenCti("shadow",
                   False,
                   expanded=False,
                   resetTo=QtGui.QPen(defaultShadowPen),
                   includeNoneStyle=True,
                   includeZeroWidth=True))

        self.symbolCti = self.insertChild(
            BoolCti("symbol",
                    False,
                    expanded=False,
                    childrenDisabledValue=False))
        self.symbolShapeCti = self.symbolCti.insertChild(
            ChoiceCti("shape",
                      0,
                      displayValues=[
                          'circle', 'square', 'triangle', 'diamond', 'plus'
                      ],
                      configValues=['o', 's', 't', 'd', '+']))
        self.symbolSizeCti = self.symbolCti.insertChild(
            IntCti('size', 5, minValue=0, maxValue=100, stepSize=1))
Exemplo n.º 5
0
    def __init__(self, tableInspector, nodeName):

        super(TableInspectorCti, self).__init__(nodeName)

        check_class(tableInspector, TableInspector)
        self.tableInspector = tableInspector

        # The defaultRowHeightCti and defaultColWidthCti are initialized with -1; they will get
        # the actual values in the TableInspector constructor.
        self.autoRowHeightCti = self.insertChild(
            BoolCti("auto row heights", False, childrenDisabledValue=True))
        self.defaultRowHeightCti = self.autoRowHeightCti.insertChild(
            IntCti("row height", -1, minValue=20, maxValue=500, stepSize=5))

        self.autoColWidthCti = self.insertChild(
            BoolCti("auto column widths", False, childrenDisabledValue=True))
        self.defaultColWidthCti = self.autoColWidthCti.insertChild(
            IntCti("column width", -1, minValue=20, maxValue=500, stepSize=5))

        self.insertChild(BoolCti("separate fields", True))
        self.insertChild(BoolCti("word wrap", False))

        self.encodingCti = self.insertChild(
            ChoiceCti(
                'encoding',
                editable=True,
                configValues=['utf-8', 'ascii', 'latin-1', 'windows-1252']))

        fmtCti = self.insertChild(GroupCti("format specifiers"))

        # Use '!r' as default for Python 2. This will convert the floats with repr(), which is
        # necessary because str() or an empty format string will only print 2 decimals behind the
        # point. In Python 3 this is not necessary: all relevant decimals are printed.
        numDefaultValue = 6 if six.PY2 else 0

        self.strFormatCti = fmtCti.insertChild(
            ChoiceCti("strings",
                      0,
                      editable=True,
                      completer=None,
                      configValues=[
                          '', 's', '!r', '!a', '10.10s', '_<15s', '_>15s',
                          "'str: {}'"
                      ]))

        self.intFormatCti = fmtCti.insertChild(
            ChoiceCti("integers",
                      0,
                      editable=True,
                      completer=None,
                      configValues=[
                          '', 'd', 'n', 'c', '#b', '#o', '#x', '!r', '8d',
                          '#8.4g', '_<10', '_>10', "'int: {}'"
                      ]))

        self.numFormatCti = fmtCti.insertChild(
            ChoiceCti("other numbers",
                      numDefaultValue,
                      editable=True,
                      completer=None,
                      configValues=[
                          '', 'f', 'g', 'n', '%', '!r', '8.3e', '#8.4g',
                          '_<15', '_>15', "'num: {}'"
                      ]))

        self.otherFormatCti = fmtCti.insertChild(
            ChoiceCti("other types",
                      0,
                      editable=True,
                      completer=None,
                      configValues=['', '!s', '!r', "'other: {}'"]))

        self.maskFormatCti = fmtCti.insertChild(
            ChoiceCti("missing data",
                      2,
                      editable=True,
                      completer=None,
                      configValues=['', "' '", "'--'", "'<masked>'", '!r']))

        self.fontCti = self.insertChild(
            FontCti(self.tableInspector,
                    "font",
                    defaultData=QtGui.QFont(MONO_FONT, FONT_SIZE)))

        self.dataColorCti = self.insertChild(
            ColorCti('text color', QtGui.QColor('#000000')))

        self.missingColorCti = self.insertChild(
            ColorCti('missing data color', QtGui.QColor('#B0B0B0')))

        self.horAlignCti = self.insertChild(
            ChoiceCti(
                'horizontal alignment',
                configValues=[
                    ALIGN_SMART, Qt.AlignLeft, Qt.AlignHCenter, Qt.AlignRight
                ],
                displayValues=['Type-dependent', 'Left', 'Center', 'Right']))
        # Qt.AlignJustify not included, it doesn't seem to do anything,

        self.verAlignCti = self.insertChild(
            ChoiceCti(
                'vertical alignment',
                defaultData=1,
                configValues=[Qt.AlignTop, Qt.AlignVCenter, Qt.AlignBottom],
                displayValues=['Top', 'Center', 'Bottom']))

        # Per pixel scrolling works better for large cells (e.g. containing XML strings).
        self.insertChild(
            ChoiceCti("scroll",
                      displayValues=["Per cell", "Per pixel"],
                      configValues=[
                          QtWidgets.QAbstractItemView.ScrollPerItem,
                          QtWidgets.QAbstractItemView.ScrollPerPixel
                      ]))