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

Do not expose 'auto' for infinite series #501

Merged
merged 2 commits into from
Dec 31, 2019
Merged
Changes from 1 commit
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
27 changes: 21 additions & 6 deletions examples/demo/functionplotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

# Enthought library imports
from enable.api import Component, ComponentEditor
from traits.api import HasTraits, Instance, Int
from traitsui.api import Item, Group, HGroup, View
from traits.api import HasTraits, Instance, Int, Enum
from traitsui.api import Item, Group, HGroup, View, TextEditor

# Chaco imports
from chaco.api import ScatterPlot, DataView, LinePlot
Expand All @@ -22,18 +22,25 @@ class PlotExample(HasTraits):
plot = Instance(Component)
numpoints = Int(500)

low_mode = Enum("value", "track")
high_mode = Enum("value", "track")


traits_view = View(
Group(
Item('plot', editor=ComponentEditor(), show_label=False),
HGroup(
HGroup(
Item('object.plot.x_mapper.range.low_setting', label='Low'),
Item('object.plot.x_mapper.range.high_setting', label='High'),
Item('object.plot.x_mapper.range.low_setting', label='Low', editor=TextEditor(), visible_when='object.low_mode == "value" ', ),
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm probably being very nitpicky and i apologize for it in advance.

Can you conform to the usual line length limits? We probably don't enforce line length limits in the codebase in general, if not the examples scripts specifically but IMO it's always a good idea to maintain standards (because examples is what other will learn from).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right. Will conform to line length for this and future changes.

Item('low_mode', label='Low Mode'),
Item('object.plot.x_mapper.range.high_setting', label='High', editor=TextEditor(), visible_when='object.high_mode == "value" '),
Item('high_mode', label='High Mode'),
Item('object.plot.x_mapper.range.tracking_amount', label='Tracking Amount', editor=TextEditor(read_only=True), visible_when='object.high_mode == "track" or object.low_mode == "track"'),
label='X', show_border=True
),
HGroup(
Item('object.plot.y_mapper.range.low_setting', label='Low'),
Item('object.plot.y_mapper.range.high_setting', label='High'),
Item('object.plot.y_mapper.range.low_setting', label='Low', editor=TextEditor()),
Item('object.plot.y_mapper.range.high_setting', label='High', editor=TextEditor()),
label='Y', show_border=True
),
),
Expand All @@ -51,6 +58,14 @@ def yfunc(self, low, high):
x = self.xfunc(low, high)
return sin(1.0/x)

def _low_mode_changed(self, newvalue):
if newvalue != "value":
self.plot.x_mapper.range.low_setting = newvalue

def _high_mode_changed(self, newvalue):
if newvalue != "value":
self.plot.x_mapper.range.high_setting = newvalue

def _plot_default(self):
container = DataView()

Expand Down