Esempio n. 1
0
                (value & 0xFF) / 255.0)
    raise TraitError


convert_to_color.info = (
    'a tuple of the form (r,g,b), where r, g, and b '
    'are floats in the range from 0.0 to 1.0, or an integer which in hex is of '
    'the form 0xRRGGBB, where RR is red, GG is green, and BB is blue')

#-------------------------------------------------------------------------
#  Standard colors:
#-------------------------------------------------------------------------

# RGB versions of standard colors:
rgb_standard_colors = {}
for name, color in list(standard_colors.items()):
    rgb_standard_colors[name] = (color.redF(), color.greenF(), color.blueF())

#-------------------------------------------------------------------------
#  Define wxPython specific color traits:
#-------------------------------------------------------------------------

### Note: Declare the editor to be a function which returns the RGBColorEditor
# class from traits ui to avoid circular import issues. For backwards
# compatibility with previous Traits versions, the 'editors' folder in Traits
# project declares 'from api import *' in its __init__.py. The 'api' in turn
# can contain classes that have a RGBColor trait which lead to this file getting
# imported. This will lead to a circular import when declaring a RGBColor
# trait.

Esempio n. 2
0
        return ((value / 0x10000)        / 255.0,
                ((value / 0x100) & 0xFF) / 255.0,
                (value & 0xFF)           / 255.0)
    raise TraitError

convert_to_color.info = ('a tuple of the form (r,g,b), where r, g, and b '
    'are floats in the range from 0.0 to 1.0, or an integer which in hex is of '
    'the form 0xRRGGBB, where RR is red, GG is green, and BB is blue')

#-------------------------------------------------------------------------------
#  Standard colors:
#-------------------------------------------------------------------------------

# RGB versions of standard colors:
rgb_standard_colors = {}
for name, color in standard_colors.items():
    rgb_standard_colors[name] = (color.redF(),
                                 color.greenF(),
                                 color.blueF())

#-------------------------------------------------------------------------------
#  Define wxPython specific color traits:
#-------------------------------------------------------------------------------

### Note: Declare the editor to be a function which returns the RGBColorEditor
# class from traits ui to avoid circular import issues. For backwards
# compatibility with previous Traits versions, the 'editors' folder in Traits
# project declares 'from api import *' in its __init__.py. The 'api' in turn
# can contain classes that have a RGBColor trait which lead to this file getting
# imported. This will lead to a circular import when declaring a RGBColor trait.
def get_rgb_color_editor(*args, **traits):
Esempio n. 3
0
        )
    raise TraitError


convert_to_color.info = (
    "a tuple of the form (r,g,b), where r, g, and b "
    "are floats in the range from 0.0 to 1.0, or an integer which in hex is of "
    "the form 0xRRGGBB, where RR is red, GG is green, and BB is blue")

# -------------------------------------------------------------------------
#  Standard colors:
# -------------------------------------------------------------------------

# RGB versions of standard colors:
rgb_standard_colors = {}
for name, color in standard_colors.items():
    rgb_standard_colors[name] = (color.redF(), color.greenF(), color.blueF())

# -------------------------------------------------------------------------
#  Define wxPython specific color traits:
# -------------------------------------------------------------------------

### Note: Declare the editor to be a function which returns the RGBColorEditor
# class from traits ui to avoid circular import issues. For backwards
# compatibility with previous Traits versions, the 'editors' folder in Traits
# project declares 'from api import *' in its __init__.py. The 'api' in turn
# can contain classes that have a RGBColor trait which lead to this file getting
# imported. This will lead to a circular import when declaring a RGBColor
# trait.