Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove old style trait #837

Merged
merged 8 commits into from
Oct 13, 2022
Merged

remove old style trait #837

merged 8 commits into from
Oct 13, 2022

Conversation

ctangell
Copy link
Contributor

Closes #829. Closes #828. Removes all instances of Trait and Either trait types.

Copy link
Contributor

@corranwebster corranwebster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good - haven't checked that you've tracked down all of the Trait instances, but it looks relatively comprehensive.

A couple of nit-picky suggestions, but nothing major.

chaco/axis.py Outdated
@@ -79,13 +80,13 @@ class PlotAxis(AbstractOverlay):
origin = Enum("bottom left", "top left", "bottom right", "top right")

#: The text of the axis title.
title = Trait("", Str, Unicode) # May want to add PlotLabel option
title = Str("") # May want to add PlotLabel option
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Str() is preferable (the default is "" already)

@@ -484,7 +484,7 @@ def _render(self, gc, line_points, selected_points=None):
# Existence of self.color_func overrides self.color.
color_func = self.color_func
else:
color_func = lambda k: self.color_
def color_func(k): return self.color_
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like an unrelated change, but put a line break after the : for the function body.

@@ -36,14 +36,14 @@ class PlotScrollBar(NativeScrollBar):

# The value of the override plot to use, if any. If None, then uses
# self.component.
_plot = Trait(None, Any)
_plot = Any(None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Any defaults to None so you can just do Any().

@@ -42,7 +42,7 @@ class ImageInspectorTool(BaseTool):

# Stores the value of self.visible when the mouse leaves the tool,
# so that it can be restored when the mouse enters again.
_old_visible = Enum(None, True, False) # Trait(None, Bool(True))
_old_visible = Enum(None, True, False)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could also be Union(None, Bool) - I don't care which, it's whatever you think is best.

@ctangell ctangell merged commit e3ddc53 into main Oct 13, 2022
@corranwebster corranwebster added the needs backport Needs to be backported to current maint/* label Oct 13, 2022
@corranwebster corranwebster deleted the 829-remove-old-style-trait branch January 24, 2023 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs backport Needs to be backported to current maint/*
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove uses of old-style traits constructors ScatterInspectorOverlay incompatible with enable v5.3.0
2 participants