Skip to content

Commit

Permalink
Remove deprecated Color, RGBColor and Font traits (#1737)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdickinson committed Mar 27, 2023
1 parent 92ecd7e commit 4ab75a3
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 97 deletions.
6 changes: 0 additions & 6 deletions docs/source/traits_api_reference/traits.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ Functions

.. autofunction:: Property

.. autofunction:: Color

.. autofunction:: RGBColor

.. autofunction:: Font


Private Classes
---------------
Expand Down
3 changes: 0 additions & 3 deletions traits/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@
Trait,
Property,
Default,
Color,
RGBColor,
Font,
)

from .trait_types import (
Expand Down
3 changes: 0 additions & 3 deletions traits/api.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,8 @@ from .trait_errors import (
)

from .traits import (
Color as Color,
Default as Default,
Font as Font,
Property as Property,
RGBColor as RGBColor,
Trait as Trait
)

Expand Down
21 changes: 0 additions & 21 deletions traits/tests/test_traits.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,13 @@
CFloat,
CInt,
ComparisonMode,
Color,
Delegate,
Float,
Font,
HasTraits,
Instance,
Int,
List,
Range,
RGBColor,
Str,
This,
Trait,
Expand All @@ -37,7 +34,6 @@
pop_exception_handler,
push_exception_handler,
)
from traits.testing.optional_dependencies import requires_traitsui

# Base unit test classes:

Expand Down Expand Up @@ -1075,20 +1071,3 @@ class HasComparisonMode(HasTraits):
self.assertEqual(len(events), 1)
old_compare.bar = [4, 5, 6]
self.assertEqual(len(events), 2)


@requires_traitsui
class TestDeprecatedTraits(unittest.TestCase):

def test_color_deprecated(self):
with self.assertWarnsRegex(DeprecationWarning, "'Color' in 'traits'"):
Color()

def test_rgb_color_deprecated(self):
with self.assertWarnsRegex(DeprecationWarning,
"'RGBColor' in 'traits'"):
RGBColor()

def test_font_deprecated(self):
with self.assertWarnsRegex(DeprecationWarning, "'Font' in 'traits'"):
Font()
55 changes: 0 additions & 55 deletions traits/traits.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
from .trait_factory import (
TraitFactory,
)
from .util.deprecated import deprecated

# Constants

Expand Down Expand Up @@ -635,57 +634,3 @@ def __init__(self, metadata, validate=None, handler=None):

# Generic trait with 'object' behavior:
generic_trait = CTrait(TraitKind.generic)


# User interface related color and font traits

@deprecated("'Color' in 'traits' package has been deprecated. "
"Use 'Color' from 'traitsui' package instead.")
def Color(*args, **metadata):
""" Returns a trait whose value must be a GUI toolkit-specific color.
.. deprecated:: 6.1.0
``Color`` trait in this package will be removed in the future. It is
replaced by ``Color`` trait in TraitsUI package.
"""
from traitsui.toolkit_traits import ColorTrait

return ColorTrait(*args, **metadata)


Color = TraitFactory(Color)


@deprecated("'RGBColor' in 'traits' package has been deprecated. "
"Use 'RGBColor' from 'traitsui' package instead.")
def RGBColor(*args, **metadata):
""" Returns a trait whose value must be a GUI toolkit-specific RGB-based
color.
.. deprecated:: 6.1.0
``RGBColor`` trait in this package will be removed in the future. It is
replaced by ``RGBColor`` trait in TraitsUI package.
"""
from traitsui.toolkit_traits import RGBColorTrait

return RGBColorTrait(*args, **metadata)


RGBColor = TraitFactory(RGBColor)


@deprecated("'Font' in 'traits' package has been deprecated. "
"Use 'Font' from 'traitsui' package instead.")
def Font(*args, **metadata):
""" Returns a trait whose value must be a GUI toolkit-specific font.
.. deprecated:: 6.1.0
``Font`` trait in this package will be removed in the future. It is
replaced by ``Font`` trait in TraitsUI package.
"""
from traitsui.toolkit_traits import FontTrait

return FontTrait(*args, **metadata)


Font = TraitFactory(Font)
9 changes: 0 additions & 9 deletions traits/traits.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,3 @@ class ForwardProperty:


generic_trait: _Any


def Color(*args: _Any, **metadata: _DictType[str, _Any]): ...


def RGBColor(*args: _Any, **metadata: _DictType[str, _Any]): ...


def Font(*args: _Any, **metadata: _DictType[str, _Any]): ...

0 comments on commit 4ab75a3

Please sign in to comment.