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

Replace "depends_on" in "Property" traits with "observe" #400

Merged
merged 1 commit into from
Apr 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Henon(HasTraits):
steps = Int(10000)

# Iteration results.
points = Property(Array, depends_on="a, b, initial_point, steps")
points = Property(Array, observe="a, b, initial_point, steps")

# Configuration view.
view = View(
Expand All @@ -49,8 +49,8 @@ class Henon(HasTraits):

name = Str("Henon Map")
plot_type = Str("scatter")
x_data = Property(Array, depends_on="points")
y_data = Property(Array, depends_on="points")
x_data = Property(Array, observe="points")
y_data = Property(Array, observe="points")
x_label = Str("x")
y_label = Str("y")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class IModel3dIPlottable2dMixin(HasTraits):

name = DelegatesTo("adaptee")

x_data = Property(Array, depends_on="adaptee.points, x_label")
y_data = Property(Array, depends_on="adaptee.points, y_label")
x_data = Property(Array, observe="adaptee.points, x_label")
y_data = Property(Array, observe="adaptee.points, y_label")

x_label = Trait("x", {"x": 0, "y": 1, "z": 2})
y_label = Trait("y", {"x": 0, "y": 1, "z": 2})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ class Lorenz(HasTraits):

name = Str("Lorenz Attractor")
points = Property(
Array,
depends_on=["prandtl", "rayleigh", "beta", "initial_point", "times"],
Array, observe="prandtl, rayleigh, beta, initial_point, times"
)

#### 'Lorenz' interface ###################################################
Expand All @@ -47,7 +46,7 @@ class Lorenz(HasTraits):
time_start = Float(0.0)
time_stop = Float(100.0)
time_step = Float(0.01)
times = Property(Array, depends_on="time_start, time_stop, time_step")
times = Property(Array, observe="time_start, time_stop, time_step")

# Configuration view.
view = View(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Rossler(HasTraits):
#### 'IModel3d' interface #################################################

name = Str("Rossler Attractor")
points = Property(Array, depends_on=["a, b, c, initial_point, times"])
points = Property(Array, observe="a, b, c, initial_point, times")

#### 'Rossler' interface ##################################################

Expand All @@ -44,7 +44,7 @@ class Rossler(HasTraits):
time_start = Float(0.0)
time_stop = Float(100.0)
time_step = Float(0.01)
times = Property(Array, depends_on="time_start, time_stop, time_step")
times = Property(Array, observe="time_start, time_stop, time_step")

# Configuration view.
view = View(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ModelHelpPane(TraitsDockPane):

model = Instance(HasTraits)

html = Property(Str, depends_on="model")
html = Property(Str, observe="model")

view = View(
Item(
Expand Down
12 changes: 6 additions & 6 deletions envisage/examples/demo/plugins/tasks/attractors/plot_2d_pane.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ class Plot2dPane(TraitsTaskPane):
active_model = Instance(IPlottable2d)
models = List(IPlottable2d)

plot_type = Property(Str, depends_on="active_model.plot_type")
title = Property(Str, depends_on="active_model.name")
x_data = Property(depends_on="active_model.x_data")
y_data = Property(depends_on="active_model.y_data")
x_label = Property(Str, depends_on="active_model.x_label")
y_label = Property(Str, depends_on="active_model.y_label")
plot_type = Property(Str, observe="active_model.plot_type")
title = Property(Str, observe="active_model.name")
x_data = Property(observe="active_model.x_data")
y_data = Property(observe="active_model.y_data")
x_label = Property(Str, observe="active_model.x_label")
y_label = Property(Str, observe="active_model.y_label")

view = View(
HGroup(
Expand Down
2 changes: 1 addition & 1 deletion envisage/plugins/python_shell/view/namespace_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class NamespaceView(View):

# The bindings in the namespace. This is a list of HasTraits objects with
# 'name', 'type' and 'module' string attributes.
bindings = Property(List, depends_on=["namespace"])
bindings = Property(List, observe="namespace")

shell_view = Instance(PythonShellView)

Expand Down
2 changes: 1 addition & 1 deletion envisage/ui/tasks/action/task_window_toggle_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class TaskWindowToggleAction(Action):

#### 'Action' interface ###################################################

name = Property(Str, depends_on="window.active_task.name")
name = Property(Str, observe="window.active_task.name")
style = "toggle"

#### 'TaskWindowToggleAction' interface ###################################
Expand Down
2 changes: 1 addition & 1 deletion envisage/ui/tasks/task_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class TaskWindow(PyfaceTaskWindow):

#: The window's icon. We override it so it can delegate to the application
#: icon if the window's icon is not set.
icon = Property(Instance(ImageResource), depends_on="_icon")
icon = Property(Instance(ImageResource), observe="_icon")

#### Protected interface ##################################################

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ExampleTask(Task):
name = "Multi-Tab Editor"

active_editor = Property(
Instance(IEditor), depends_on="editor_area.active_editor"
Instance(IEditor), observe="editor_area.active_editor"
)

editor_area = Instance(IEditorAreaPane)
Expand Down
4 changes: 2 additions & 2 deletions examples/legacy/plugins/tasks/ipython_kernel/python_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ class PythonEditor(Editor):

dirty = Bool(False)

name = Property(Str, depends_on="path")
name = Property(Str, observe="path")

tooltip = Property(Str, depends_on="path")
tooltip = Property(Str, observe="path")

show_line_numbers = Bool(True)

Expand Down