# Path: argos/qt/bindings.py
# API_PYSIDE2 = 'pyside2'
# API_PYQT5 = 'pyqt5'
# ALL_API = [API_PYQT5, API_PYSIDE2]
# QT_API_NAME = os.environ.get('QT_API')
#     QT_API_NAME = None
#         QT_API_NAME = API_PYQT5
#         QT_API_NAME = API_PYSIDE2
#         QT_API_NAME = API_PYQT5
#         QT_API_NAME = API_PYSIDE2
# 
# Path: argos/config/untypedcti.py
# class UntypedCti(AbstractCti):
#     """ Config Tree Item to store a any type of data as long as it can be edited with a QLineEdit.
# 
#         Typically it's better to use 'typed' CTIs, where the data is always internally stored in
#         the same type (enforced by _enforceDataType).
# 
#         This item is non-editable and can, for instance, be used for introspection.
#     """
#     def __init__(self, nodeName, defaultData='', doc=''):
#         """ Constructor. For the parameters see the AbstractCti constructor documentation.
#         """
#         super(UntypedCti, self).__init__(nodeName, defaultData)
#         self.doc = doc
# 
#     def _enforceDataType(self, value):
#         """ Since UntypedCti can store any type of data no conversion will be done.
#         """
#         return value
# 
#     def createEditor(self, delegate, parent, option):
#         """ Creates an UntypedCtiEditor.
#             For the parameters see the AbstractCti constructor documentation.
#             Note: since the item is not editable this will never be called.
#         """
#         return UntypedCtiEditor(self, delegate, parent=parent)
# 
#     @property
#     def valueColumnItemFlags(self):
#         """ Returns the flags determine how the user can interact with the value column.
#             Returns Qt.NoItemFlags so that the item is not editable
#         """
#         return Qt.NoItemFlags
# 
# Path: argos/config/qtctis.py
# class ColorCti(AbstractCti):
#     """ Config Tree Item to store a color.
#     """
#     def __init__(self, nodeName, defaultData=''):
#         """ Constructor.
#             For the (other) parameters see the AbstractCti constructor documentation.
#         """
#         super(ColorCti, self).__init__(nodeName, defaultData)
# 
#     def _enforceDataType(self, data):
#         """ Converts to str so that this CTI always stores that type.
#         """
#         qColor = QtGui.QColor(data)
#         if not qColor.isValid():
#             raise ValueError("Invalid color specification: {!r}".format(data))
#         return qColor
# 
#     def _dataToString(self, data):
#         """ Conversion function used to convert the (default)data to the display value.
#         """
#         return data.name().upper()
# 
#     @property
#     def decoration(self):
#         """ Returns the data (QColor) to be displayed as decoration
#         """
#         return self.data
# 
# 
#     def _nodeMarshall(self):
#         """ Returns the non-recursive marshalled value of this CTI. Is called by marshall()
#         """
#         return self.data.name()
# 
# 
#     def _nodeUnmarshall(self, data):
#         """ Initializes itself non-recursively from data. Is called by unmarshall()
#         """
#         self.data = QtGui.QColor(data)
# 
# 
#     def createEditor(self, delegate, parent, option):
#         """ Creates a ColorCtiEditor.
#             For the parameters see the AbstractCti constructor documentation.
#         """
#         return ColorCtiEditor(self, delegate, parent=parent)


import unittest, copy
from json import loads, dumps
from argos.qt import QtWidgets, QtGui
from argos.config.untypedcti import UntypedCti
from argos.config.qtctis import ColorCti
        ctiIn.insertChild(UntypedCti('kid', defaultData=23))
        self.assertNotEqual(ctiIn, ctiOut)

        ctiOut.insertChild(UntypedCti('kid', defaultData=23))
        self.assertEqual(ctiIn, ctiOut)

        ctiIn.childItems[0].data = 99
        self.assertNotEqual(ctiIn, ctiOut)


    def tearDown(self):
        pass



class TestSimpleCtis(unittest.TestCase):

    def setUp(self):
        self.invisibleRootItem = UntypedCti(nodeName='<invisible-root>', defaultData=0.123456789012345678901234567890)
        self.invisibleRootItem.insertChild(UntypedCti(nodeName='kid', defaultData=-7))

    def tearDown(self):
        pass


    def testColorCti(self):

        colorStr = '#FF33EE'
        cti = ColorCti('color', defaultData=colorStr)
        self.assertEqual(cti.data, QtGui.QColor(colorStr))

# Path: argos/qt/bindings.py
# API_PYSIDE2 = 'pyside2'
# API_PYQT5 = 'pyqt5'
# ALL_API = [API_PYQT5, API_PYSIDE2]
# QT_API_NAME = os.environ.get('QT_API')
#     QT_API_NAME = None
#         QT_API_NAME = API_PYQT5
#         QT_API_NAME = API_PYSIDE2
#         QT_API_NAME = API_PYQT5
#         QT_API_NAME = API_PYSIDE2
# 
# Path: argos/config/untypedcti.py
# class UntypedCti(AbstractCti):
#     """ Config Tree Item to store a any type of data as long as it can be edited with a QLineEdit.
# 
#         Typically it's better to use 'typed' CTIs, where the data is always internally stored in
#         the same type (enforced by _enforceDataType).
# 
#         This item is non-editable and can, for instance, be used for introspection.
#     """
#     def __init__(self, nodeName, defaultData='', doc=''):
#         """ Constructor. For the parameters see the AbstractCti constructor documentation.
#         """
#         super(UntypedCti, self).__init__(nodeName, defaultData)
#         self.doc = doc
# 
#     def _enforceDataType(self, value):
#         """ Since UntypedCti can store any type of data no conversion will be done.
#         """
#         return value
# 
#     def createEditor(self, delegate, parent, option):
#         """ Creates an UntypedCtiEditor.
#             For the parameters see the AbstractCti constructor documentation.
#             Note: since the item is not editable this will never be called.
#         """
#         return UntypedCtiEditor(self, delegate, parent=parent)
# 
#     @property
#     def valueColumnItemFlags(self):
#         """ Returns the flags determine how the user can interact with the value column.
#             Returns Qt.NoItemFlags so that the item is not editable
#         """
#         return Qt.NoItemFlags
# 
# Path: argos/config/qtctis.py
# class ColorCti(AbstractCti):
#     """ Config Tree Item to store a color.
#     """
#     def __init__(self, nodeName, defaultData=''):
#         """ Constructor.
#             For the (other) parameters see the AbstractCti constructor documentation.
#         """
#         super(ColorCti, self).__init__(nodeName, defaultData)
# 
#     def _enforceDataType(self, data):
#         """ Converts to str so that this CTI always stores that type.
#         """
#         qColor = QtGui.QColor(data)
#         if not qColor.isValid():
#             raise ValueError("Invalid color specification: {!r}".format(data))
#         return qColor
# 
#     def _dataToString(self, data):
#         """ Conversion function used to convert the (default)data to the display value.
#         """
#         return data.name().upper()
# 
#     @property
#     def decoration(self):
#         """ Returns the data (QColor) to be displayed as decoration
#         """
#         return self.data
# 
# 
#     def _nodeMarshall(self):
#         """ Returns the non-recursive marshalled value of this CTI. Is called by marshall()
#         """
#         return self.data.name()
# 
# 
#     def _nodeUnmarshall(self, data):
#         """ Initializes itself non-recursively from data. Is called by unmarshall()
#         """
#         self.data = QtGui.QColor(data)
# 
# 
#     def createEditor(self, delegate, parent, option):
#         """ Creates a ColorCtiEditor.
#             For the parameters see the AbstractCti constructor documentation.
#         """
#         return ColorCtiEditor(self, delegate, parent=parent)


# Path: tests/test_cti.py
import unittest, copy
from json import loads, dumps
from argos.qt import QtWidgets, QtGui
from argos.config.untypedcti import UntypedCti
from argos.config.qtctis import ColorCti

        ctiIn.insertChild(UntypedCti('kid', defaultData=23))
        self.assertNotEqual(ctiIn, ctiOut)

        ctiOut.insertChild(UntypedCti('kid', defaultData=23))
        self.assertEqual(ctiIn, ctiOut)

        ctiIn.childItems[0].data = 99
        self.assertNotEqual(ctiIn, ctiOut)


    def tearDown(self):
        pass



class TestSimpleCtis(unittest.TestCase):

    def setUp(self):
        self.invisibleRootItem = UntypedCti(nodeName='<invisible-root>', defaultData=0.123456789012345678901234567890)
        self.invisibleRootItem.insertChild(UntypedCti(nodeName='kid', defaultData=-7))

    def tearDown(self):
        pass


    def testColorCti(self):

        colorStr = '#FF33EE'
        cti = ColorCti('color', defaultData=colorStr)
        self.assertEqual(cti.data, QtGui.QColor(colorStr))

        self.assertEqual(cti.data, QtGui.QColor(colorStr))