Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# `StopShow` class.
################################################################################
class StopShow(HasTraits):
########################################
# Traits
stop = Button('Stop interaction',
desc='if the UI interaction is to be stopped')
# Private traits.
# Stores a reference to the UI object so it can be disposed when the
# interaction is stopped.
_ui = Any
view = View(Group(Item('stop'), show_labels=False),
buttons = [], title='Control Show')
######################################################################
# `object` interface.
######################################################################
def __init__(self, **traits):
super(StopShow, self).__init__(**traits)
self._ui = self.edit_traits()
######################################################################
# Non-public interface.
######################################################################
def _stop_fired(self):
_gui.stop_event_loop()
self._ui.dispose()
def traits_view(self):
v = View(
Group(
Group(Item('peak_center_option', show_label=False, style='custom'),
label='Peak Centers'),
Group(listeditor('calculated_values'), label='Calculated'),
Group(listeditor('measured_values'), label='Measured'),
Group(listeditor('baseline_values'), label='Baseline'),
Group(listeditor('blank_values'), label='Blanks'),
Group(listeditor('background_values'), label='Backgrounds'),
layout='tabbed'
),
buttons=['OK', 'Cancel'],
handler=self.handler_klass,
title='Select Series',
width=500
)
return v
input_info = PipelineInfo(datasets=['any'],
attribute_types=['any'],
attributes=['scalars'])
########################################
# View related code.
_warp_group = Group(Item(name='filter',
style='custom',
editor=\
InstanceEditor(view=
View(Item('scale_factor')))),
show_labels=False)
view = View(Group(Item(name='implicit_plane',
style='custom'),
label='ImplicitPlane',
show_labels=False),
Group(Group(Item(name='enable_contours')),
Group(Item(name='contour',
style='custom',
enabled_when='object.enable_contours'),
show_labels=False),
label='Contours',
show_labels=False),
Group(Item(name='enable_warp_scalar'),
Group(Item(name='warp_scalar',
enabled_when='enable_warp_scalar',
style='custom',
editor=InstanceEditor(view=
View(_warp_group))
width=800, height=600,
resizable=True),
Item('_'),
Group(
Item('curves_renderers', style='custom', editor=ListEditor(
use_notebook=True,
view=_plot_curve_view), show_label=False),
Group(
Item('marker', label='All Markers Type'),
Item('marker_size', label='All Markers Size'),
# Change the chosen_index value according to one of the
# values in index_data_labels
Item('chosen_index',
style='simple',
editor=EnumEditor(name='index_data_labels')),
Group(Item("reset_plot",
editor=ButtonEditor(),
show_label=False)),
orientation='vertical'),
orientation='horizontal'),
orientation='vertical'
),
width=800,
height=600,
resizable=True,
title="Chaco Plot")
# xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# TODO: Ainda nao e usado
def add_index(self, index_label, index_array):
"""Add a new index in the plot.
Overridden here to stop the timer once the window is destroyed.
"""
info.object.timer.Stop()
return
class Demo(HasTraits):
plot = Instance(Component)
controller = Instance(TimerController, ())
timer = Instance(Timer)
traits_view = View(
Group(
Item('plot', editor=ComponentEditor(size=size),
show_label=False),
orientation = "vertical"),
resizable=True, title=title,
width=size[0], height=size[1],
handler=DemoHandler
)
def __init__(self, **traits):
super(Demo, self).__init__(**traits)
self.plot = _create_plot_component(self.controller)
def edit_traits(self, *args, **kws):
# Start up the timer! We should do this only when the demo actually
# starts and not when the demo object is created.
self.timer = Timer(20, self.controller.onTimer)
'sinusoid','rt_analytic',
desc='which image data source to be used')
# Define the trait 'data_source' whose value must be an instance of
# type ImageAlgorithm
data_source = Instance(tvtk.ImageAlgorithm, allow_none=False,
record=True)
# Information about what this object can produce.
output_info = PipelineInfo(datasets=['image_data'],
attribute_types=['any'],
attributes=['any'])
# Create the UI for the traits.
view = View(Group(Item(name='source'),
Item(name='data_source',
style='custom',
resizable=True),
label='Image Source',
show_labels=False),
resizable=True)
########################################
# Private traits.
# A dictionary that maps the source names to instances of the
# image data objects.
_source_dict = Dict(Str,
Instance(tvtk.ImageAlgorithm,
allow_none=False))
# True if we allow save_as requests on the project.
is_save_as_allowed = Bool(True, transient=True)
# The location of this project on the filesystem. The default value
# depends on the runtime environment so we use a traits default method to
# set it.
location = Directory
# The name of this project. This is calculated from the project's current
# location or, if there is no location, from a default value. See the
# property's getter method.
name = Property(Str)
# The UI view to use when creating a new project
traits_view = View(
Group("location"),
title="New Project",
id="envisage.single_project.project.Project",
buttons=["OK", "Cancel"],
width=0.33,
# Ensure closing via the dialog close button is the same
# as clicking cancel.
close_result=False,
# Ensure the user can resize the dialog.
resizable=True,
)
#### protected 'Project' interface #######################################
# A list of editors currently open to visualize our resources
# FIXME: Re-add the ProjectEditor's(if we need them) once they are fixed.
# _editors = Dict(Any, ProjectEditor, transient=True)
),
Group(
Group(Item("save_btn", show_label=False, visible_when="save_callback is not None"),
"brightness", "contrast", "epi_filter",
Item('filter_strength', visible_when="epi_filter is not None"),
"_", "opacity", "_",
Item('colormap',
editor=ImageEnumEditor(values=lut_manager.lut_mode_list(),
cols=6,
path=lut_manager.lut_image_dir)),
"fliplut",
"_", "flip_ud", "flip_lr", "flip_fb",
"_", Item('outline_color', editor=ColorEditor()), 'outline_rep', 'line_width', 'point_size',
'_',
),
Group(
Item('legend', editor=TextEditor(), style='readonly', show_label=False, emphasized=True, dock='vertical'),
show_labels=False,
),
orientation='vertical'
),
),
resizable=True,
title='Aligner'
)
def get_aligner(subject, xfmname, epifile=None, xfm=None, xfmtype="magnet", decimate=False):
from .database import db
dbxfm = None
try:
dbxfm = db.get_xfm(subject, xfmname, xfmtype='magnet')
# Set to True when the particle array is updated with a new property say.
updated = Event
# Private attribute to store old value of visibility in case of empty
# arrays.
_old_visible = Bool(True)
########################################
# View related code.
view = View(
Item(name='name',
show_label=False,
editor=TitleEditor()),
Group(
Group(
Group(
Item(name='visible'),
Item(name='show_legend'),
Item(name='scalar',
editor=EnumEditor(name='scalar_list')),
Item(name='list_all_scalars'),
Item(name='show_time'),
Item(name='component', enabled_when='stride > 1'),
columns=2,
),
Item(name='edit_scalars', show_label=False),
label='Scalars',
),
Group(
Item(name='show_vectors'),
Item(name='vectors'),
Tabbed(
Group(
Group( Item('name', label="Component Name"),
),
#Item('burnup_plot',
# editor=ComponentEditor(),
# resizable=True,
# springy=True,
# show_label=False,
# ),
HGroup( Item('burnup', label="Burnup", width=0.7),
Item('batches', label='Batches', width=0.3),
),
label = "Light Water Reactor"
),
Group(
Group( Item('radius', label="Fuel Region Radius"),
Item('length', label="Pitch"),
),
Group( Item('pincell_plot',
editor=ComponentEditor(),
resizable=True,
springy=True,
show_label=False
),
),
label = "Fuel Pin Cell"
),
Group(
Item('open_slots', label="Open Slots"),
Item('total_slots', label="Total Slots"),
Item('lattice_type', label="Lattice Type"),