Skip to content
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
2 changes: 1 addition & 1 deletion chaco/barplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def __init__(self, *args, **kw):
super(BarPlot, self).__init__(*args, **kw)

# Set any keyword Traits that were postponed.
self.set(**postponed)
self.trait_set(**postponed)


def map_screen(self, data_array):
Expand Down
4 changes: 2 additions & 2 deletions chaco/base_1d_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ def _set_screen_bounds(self, new_bounds):
return
if not self.stretch_data:
self._adjust_range((self.low_pos, self.high_pos), new_bounds)
self.set(low_pos = new_bounds[0], trait_change_notify=False)
self.set(high_pos = new_bounds[1], trait_change_notify=False)
self.trait_setq(low_pos = new_bounds[0])
self.trait_setq(high_pos = new_bounds[1])
self._cache_valid = False
self._low_bound_initialized = True
self._high_bound_initialized = True
Expand Down
2 changes: 1 addition & 1 deletion chaco/base_2d_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def __init__(self, **kwargs):
for trait_name in ("index", "value"):
if trait_name in kwargs:
kwargs_tmp[trait_name] = kwargs.pop(trait_name)
self.set(**kwargs_tmp)
self.trait_set(**kwargs_tmp)
super(Base2DPlot, self).__init__(**kwargs)
if self.index is not None:
self.index.on_trait_change(self._update_index_data,
Expand Down
2 changes: 1 addition & 1 deletion chaco/base_xy_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def __init__(self, **kwtraits):
for trait_name in ("index", "value", "index_mapper", "value_mapper"):
if trait_name in kwtraits:
kwargs_tmp[trait_name] = kwtraits.pop(trait_name)
self.set(**kwargs_tmp)
self.trait_set(**kwargs_tmp)
AbstractPlotRenderer.__init__(self, **kwtraits)
if self.index is not None:
self.index.on_trait_change(self._either_data_changed, "data_changed")
Expand Down
6 changes: 3 additions & 3 deletions chaco/color_spaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ def separate_colors(xyz, axis=-1):
axis = n + axis
slices = makeslices(n)
slices[axis] = 0
x = xyz[slices]
x = xyz[tuple(slices)]
slices[axis] = 1
y = xyz[slices]
y = xyz[tuple(slices)]
slices[axis] = 2
z = xyz[slices]
z = xyz[tuple(slices)]

return x, y, z, axis

Expand Down
8 changes: 4 additions & 4 deletions chaco/grid_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,10 @@ def _set_screen_bounds(self, new_bounds):
# TODO: figure out a way to not need to do this check:
if self.screen_bounds == new_bounds:
return
self.set(x_low_pos=new_bounds[0], trait_change_notify=False)
self.set(x_high_pos=new_bounds[1], trait_change_notify=False)
self.set(y_low_pos=new_bounds[2], trait_change_notify=False)
self.set(y_high_pos=new_bounds[3], trait_change_notify=False)
self.trait_setq(x_low_pos=new_bounds[0])
self.trait_setq(x_high_pos=new_bounds[1])
self.trait_setq(y_low_pos=new_bounds[2])
self.trait_setq(y_high_pos=new_bounds[3])
self._update_bounds()

def _get_screen_bounds(self):
Expand Down
2 changes: 1 addition & 1 deletion chaco/plot_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ def _set_component_grid(self, val):
component.container.remove(component)
component.container = self

self.set(shape=grid.shape, trait_change_notify=False)
self.trait_setq(shape=grid.shape)
self._components = list(grid.flatten())

if self._should_compact():
Expand Down
5 changes: 2 additions & 3 deletions chaco/plotscrollbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,8 @@ def _handle_dataspace_update(self):
ticksize = 1
foo = (totalmin, totalmax, view, ticksize)
print("scrollrange:", foo)
self.set(range = foo,
scroll_position = max(min(self.scroll_position, totalmax-view), totalmin),
trait_change_notify=False)
self.trait_setq(range = foo,
scroll_position = max(min(self.scroll_position, totalmax-view), totalmin))
self._scroll_updated = True
self.request_redraw()
return
Expand Down
4 changes: 2 additions & 2 deletions chaco/serializable.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ def _do_setstate(self, state):
because we need Serializable's implementation to call _post_load() after
all the _do_setstate() have returned.)
"""
# Quietly all the attributes
self.set(trait_change_notify=False, **state)
# Quietly set all the attributes
self.trait_setq(**state)
return

#------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions chaco/shell/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ def xaxis(**kwds):
p = curplot()
if p:
if kwds:
p.x_axis.set(**kwds)
p.x_axis.trait_set(**kwds)
else:
p.x_axis.visible ^= True
p.request_redraw()
Expand Down Expand Up @@ -655,7 +655,7 @@ def yaxis(**kwds):
p = curplot()
if p:
if kwds:
p.y_axis.set(**kwds)
p.y_axis.trait_set(**kwds)
else:
p.y_axis.visible ^= True
p.request_redraw()
Expand Down
2 changes: 1 addition & 1 deletion examples/demo/advanced/scalar_image_function_inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def compute_model(self):
self.model_changed = True
self._function = self.function
except:
self.set(function = self._function, trait_change_notify=False)
self.trait_setq(function=self._function)

def _anytrait_changed(self, name, value):
if name in ['function', 'npts_x', 'npts_y',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def compute_model(self):
self.model_changed = True
self._function = self.function
except:
self.set(function = self._function, trait_change_notify=False)
self.trait_setq(function=self._function)

def _anytrait_changed(self, name, value):
if name in ['function', 'npts_x', 'npts_y',
Expand Down
20 changes: 11 additions & 9 deletions examples/demo/basic/bounded_grids.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@ def _create_plot_component():
plot.y_grid.line_color = "black"
xmin, xmax = 1.0, 6.0
ymin, ymax = 0.2, 0.80001
plot.x_grid.set(data_min = xmin, data_max = xmax,
transverse_bounds = (ymin, ymax),
transverse_mapper = plot.y_mapper)
plot.x_grid.data_min = xmin
plot.x_grid.data_max = xmax
plot.x_grid.transverse_bounds = (ymin, ymax)
plot.x_grid.transverse_mapper = plot.y_mapper

plot.y_grid.set(data_min = ymin, data_max = ymax,
transverse_bounds = (xmin, xmax),
transverse_mapper = plot.x_mapper)
plot.y_grid.data_min = ymin
plot.y_grid.data_max = ymax
plot.y_grid.transverse_bounds = (xmin, xmax)
plot.y_grid.transverse_mapper = plot.x_mapper

# Attach some tools to the plot
plot.tools.append(PanTool(plot))
Expand All @@ -58,9 +60,9 @@ def my_bounds_func(ticks):

func_plot = Plot(pd, padding=50, border_visible=True)
func_plot.plot(("index", "y3"), color="red")
func_plot.x_grid.set(transverse_bounds = my_bounds_func,
transverse_mapper = func_plot.y_mapper,
line_color="black")
func_plot.x_grid.transverse_bounds = my_bounds_func
func_plot.x_grid.transverse_mapper = func_plot.y_mapper
func_plot.x_grid.line_color = "black"
func_plot.tools.append(PanTool(func_plot))

container = HPlotContainer()
Expand Down
9 changes: 6 additions & 3 deletions examples/demo/basic/draw_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,24 @@ def _create_plot_component():
y_name = "struve" + str(i)
pd.set_data(y_name, struve(i, x))
renderer = plot.plot(("x", y_name), color="blue", name=y_name, line_width=2)[0]
renderer.set(draw_layer = "struve", unified_draw=True)
renderer.draw_layer = "struve"
renderer.unified_draw = True

# Draw bessels
for i in range(3):
y_name = "bessel" + str(i)
pd.set_data(y_name, jn(i,x))
renderer = plot.plot(("x", y_name), color="green", name=y_name, line_width=2)[0]
renderer.set(draw_layer = "bessel", unified_draw=True)
renderer.draw_layer = "bessel"
renderer.unified_draw = True

# Draw sines
for i in range(3):
y_name = "sine" + str(i)
pd.set_data(y_name, sin(x * (i+1) / 1.5))
renderer = plot.plot(("x", y_name), color="red", name=y_name, line_width=2)[0]
renderer.set(draw_layer="sine", unified_draw=True)
renderer.draw_layer = "sine"
renderer.unified_draw = True

# Attach some tools to the plot
plot.tools.append(PanTool(plot))
Expand Down
6 changes: 4 additions & 2 deletions examples/demo/basic/grid_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,17 @@ def _create_plot_component():
# Set the upper-left plot to only be resizable vertically, and to have a
# fixed horizontal width. This also constrains the width of the first column.
ul_plot = container.components[0]
ul_plot.set(resizable="v", width=200)
ul_plot.resizable = "v"
ul_plot.width = 200
ul_plot.overlays.append(PlotLabel("Not horizontally resizable",
component=ul_plot))

# Set the bottom center plot to have a fixed width and height.
# This also constrains the height of the bottom row and the width of
# the middle column.
cplot = container.components[4]
cplot.set(resizable="", bounds=[400,400])
cplot.resizable = ""
cplot.bounds = [400,400]
cplot.overlays.append(PlotLabel("Not resizable", component=cplot))

container.padding_top = 50
Expand Down
3 changes: 2 additions & 1 deletion examples/demo/basic/horizon_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ class Demo(HasTraits):
if __name__ == "__main__":

filled, horizon = _create_plot_components()
demo.set(horizon=horizon, filled=filled)
demo.horizon = horizon
demo.filled = filled
demo.configure_traits()

#--EOF---
14 changes: 7 additions & 7 deletions examples/demo/basic/inset_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ def _create_plot_component():
# range to the first plot
plot2 = Plot(pd, range2d=plot1.range2d, padding=50)
plot2.plot(('index', 'y3'), type="scatter", color="blue", marker="circle")
plot2.set(resizable = "",
bounds = [250, 250],
position = [550,150],
bgcolor = "white",
border_visible = True,
unified_draw = True
)
plot2.resizable = ""
plot2.bounds = [250, 250]
plot2.position = [550,150]
plot2.bgcolor = "white"
plot2.border_visible = True
plot2.unified_draw = True

plot2.tools.append(PanTool(plot2))
plot2.tools.append(MoveTool(plot2, drag_button="right"))
zoom = ZoomTool(component=plot2, tool_mode="box", always_on=False)
Expand Down
3 changes: 2 additions & 1 deletion examples/demo/basic/scatter_inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ def _create_plot_component():
scatter = plot.plot(("x", "y"), type="scatter", color="lightblue")[0]

# Tweak some of the plot properties
plot.set(title="Scatter Inspector Demo", padding=50)
plot.title = "Scatter Inspector Demo"
plot.padding = 50

# Attach some tools to the plot
plot.tools.append(PanTool(plot))
Expand Down
2 changes: 1 addition & 1 deletion examples/demo/vtk/cmap_scatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def create_plot():
# Set colors
#plot.title_color = "white"
#for axis in plot.x_axis, plot.y_axis:
# axis.set(title_color="white", tick_label_color="white")
# axis.trait_set(title_color="white", tick_label_color="white")

# Right now, some of the tools are a little invasive, and we need the
# actual ColomappedScatterPlot object to give to them
Expand Down
13 changes: 8 additions & 5 deletions examples/demo/vtk/spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,19 @@ def main():
specplot, timeplot, spectrogram = plots

for i, p in enumerate(plots):
p.set(resizable = "", bounds = [200,200], outer_x = 0,
bgcolor = "transparent",
)
p.resizable = ""
p.bgcolor = "transparent"
p.bounds = [200,200]
p.outer_x = 0
p.outer_y = i*250
p.tools.append(MoveTool(p, drag_button="right"))
p.tools.append(PanTool(p))
p.tools.append(ZoomTool(p))

spectrogram.tools[-1].set(tool_mode="range", axis="value")
spectrogram.tools[-2].set(constrain=True, constrain_direction="y")
spectrogram.tools[-1].tool_mode = "range"
spectrogram.tools[-1].axis = "value"
spectrogram.tools[-2].constrain = True
spectrogram.tools[-2].constrain_direction = "y"

container = OverlayPlotContainer(bgcolor = "transparent",
fit_window = True)
Expand Down
4 changes: 2 additions & 2 deletions examples/user_guide/grid_plot_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ def _plot_default(self):
line_width=3.0)

# Set each plot's aspect based on its position in the grid
plot.set(height=((i % 3) + 1) * 50.0,
resizable='h')
plot.height = ((i % 3) + 1) * 50.0
plot.resizable = 'h'

# Add to the grid container
container.add(plot)
Expand Down
9 changes: 4 additions & 5 deletions examples/user_guide/overlay_container_inset.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,10 @@ def _plot_default(self):
# Create a second inset plot, not resizable, not zoom-able
inset_plot = Plot(pd)
inset_plot.plot(('index', 'value'), color='blue')
inset_plot.set(resizable = '',
bounds = [250, 150],
position = [450, 350],
border_visible = True
)
inset_plot.resizable = ''
inset_plot.bounds = [250, 150]
inset_plot.position = [450, 350]
inset_plot.border_visible = True

# Create a container and add our plots
container = OverlayPlotContainer()
Expand Down