Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def create_drag_event(self, **kwargs):
""" Creates a DragEvent() with the specified attributes.
"""
event = DragEvent(**kwargs)
return event
def trait_view(self, view):
""" Build the view. The local namespace is
"""
return View(
VGroup(Item('data_file', style='simple', label="HDF file to load"),
HSplit(Item('ts_plot', editor=ComponentEditor(size=(400, 600)),
show_label=False),
VGroup(Item('tool_chooser', show_label = True, label="Choose tool"),
Item('ts1_chooser', label="TS 1"),
Item('ts2_chooser', label="TS 2",
visible_when="tool_chooser in ['%s']" % CORRELATION),
Item('ma_window_size', label="MA window size",
visible_when="tool_chooser in ['%s']" % MA),
Item('ts_analysis_plot', editor=ComponentEditor(size=(400, 600)),
show_label=False),
Item('ts_analysis_details', show_label = False, style = 'readonly',
visible_when=("tool_chooser in ['%s']" % CORRELATION))),),
),
title='Time-series plotter and analyzer',
width=1300, height=800, resizable=True)
label='label',
),
]
editor = TreeEditor(nodes=nodes,
selected='selected',
orientation='vertical')
v = View(
HSplit(
UItem('scene',
editor=editor,
width=0.4
),
UItem('canvas',
style='custom',
editor=ComponentEditor(),
width=0.6
)
)
)
return v
# Color of the label of the x-axis.
x_label_color = black_color_trait
# Label of the y-axis; if None, the **value** name is used.
y_label = Trait(None, None, Str)
# Name of the trait on the object containing the label of the y-axis.
# This takes precedence over **y_label**.
y_label_trait = Trait(None, None, Str)
# Font for the label of the y-axis.
y_label_font = KivaFont("modern 10")
# Color of the label of the y-axis.
y_label_color = black_color_trait
# General plot properties
# Foreground olor of the plot.
color = ColorTrait("blue")
# Background color of the plot.
bgcolor = white_color_trait
# Background color of the plot (deprecated).
bg_color = Property # backwards compatibility; deprecated
# Color of the background padding.
padding_bg_color = ColorTrait("sys_window")
# Border properties
# Width of the plot border
border_width = Int(1)
# Is the border visible?
border_visible = Bool(False)
# Line style of the border.
border_dash = LineStyle
# Color of the border.
#: The data to use for segment width. Used only when self.width_by_data
#: is True.
width_data = Instance(AbstractDataSource, redraw=True)
#: Whether to draw segments using a constant width or mapped width.
width_mapper = Instance(AbstractMapper, redraw=True)
#: Whether or not to shade selected segments.
show_selection = True
#: the plot data metadata name to watch for selection information
selection_metadata_name = Str("selections")
#: The color to use for selected segments. Not used if color by data.
selection_color = ColorTrait('yellow')
#: The alpha fade to use for non-selected segments.
selection_alpha = Float(0.3)
#: The width multiple to use for non-selected segments.
selection_width = Float(1.0)
#: RGBA values for rendering individual segments, in the case where
#: color_by_data is True. This is a length N array with the rgba_dtype
#: and are computed using the current color or color mapper and color_data,
#: with the global 'alpha' mixed in.
effective_colors = Property(
Array,
depends_on=[
'color_by_data', 'alpha', 'color_mapper.updated',
'color_data.data_changed', 'alpha', 'selection_mask',
title = Trait('', Str, Unicode) #May want to add PlotLabel option
# The font of the title.
title_font = KivaFont('modern 12')
# The spacing between the axis line and the title
title_spacing = Trait('auto', 'auto', Float)
# The color of the title.
title_color = ColorTrait("black")
# The thickness (in pixels) of each tick.
tick_weight = Float(1.0)
# The color of the ticks.
tick_color = ColorTrait("black")
# The font of the tick labels.
tick_label_font = KivaFont('modern 10')
# The color of the tick labels.
tick_label_color = ColorTrait("black")
# The rotation of the tick labels.
tick_label_rotate_angle = Float(0)
# Whether to align to corners or edges (corner is better for 45 degree rotation)
tick_label_alignment = Enum('edge', 'corner')
# The margin around the tick labels.
tick_label_margin = Int(2)
y_label_trait = Trait(None, None, Str)
# Font for the label of the y-axis.
y_label_font = KivaFont("modern 10")
# Color of the label of the y-axis.
y_label_color = black_color_trait
# General plot properties
# Foreground olor of the plot.
color = ColorTrait("blue")
# Background color of the plot.
bgcolor = white_color_trait
# Background color of the plot (deprecated).
bg_color = Property # backwards compatibility; deprecated
# Color of the background padding.
padding_bg_color = ColorTrait("sys_window")
# Border properties
# Width of the plot border
border_width = Int(1)
# Is the border visible?
border_visible = Bool(False)
# Line style of the border.
border_dash = LineStyle
# Color of the border.
border_color = black_color_trait
# The type of the plot.
type = Enum("line", "scatter")
# The type of the plot as a string.
type_trait = Str
title_spacing = Trait('auto', 'auto', Float)
# The color of the title.
title_color = ColorTrait("black")
# The thickness (in pixels) of each tick.
tick_weight = Float(1.0)
# The color of the ticks.
tick_color = ColorTrait("black")
# The font of the tick labels.
tick_label_font = KivaFont('modern 10')
# The color of the tick labels.
tick_label_color = ColorTrait("black")
# The rotation of the tick labels.
tick_label_rotate_angle = Float(0)
# Whether to align to corners or edges (corner is better for 45 degree rotation)
tick_label_alignment = Enum('edge', 'corner')
# The margin around the tick labels.
tick_label_margin = Int(2)
# The distance of the tick label from the axis.
tick_label_offset = Float(8.)
# Whether the tick labels appear to the inside or the outside of the plot area
tick_label_position = Enum("outside", "inside")
#### Configuration traits #################################################
# The text to display in the box.
text = Str
# The font to use for the text.
font = KivaFont("modern 12")
# The background color for the box (overrides AbstractOverlay).
bgcolor = ColorTrait("transparent")
# The alpha value to apply to **bgcolor**
alpha = Trait(1.0, None, Float)
# The color of the outside box.
border_color = ColorTrait("dodgerblue")
# The color of the text.
text_color = ColorTrait("black")
# The thickness of box border.
border_size = Int(1)
# The border visibility. Defaults to true to duplicate previous behavior.
border_visible = Bool(True)
# Number of pixels of padding around the text within the box.
padding = Int(5)
# The maximum width of the displayed text. This affects the width of the
# text only, not the text box, which includes margins around the text and
# `padding`.
down_color = ColorTrait("gray")
border_color = ColorTrait((0.4, 0.4, 0.4, 1.0))
# important for rendering rounded buttons properly, since the default for
# the Component parent class is 'white'
bgcolor = "clear"
label = Str
label_font = KivaFont("modern 11 bold")
label_color = ColorTrait("white")
label_shadow = ColorTrait("gray")
shadow_text = Bool(True)
label_padding = Int(5)
height = Int(20)
button_state = Enum("up", "down")
end_radius = Int(10)
# Default size of the button if no label is present
bounds=[32,32]
# Cached value of the measured sizes of self.label
_text_extents = Tuple