Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def traits_view(self):
led_grp = HGroup(UItem('enabled',
editor=LEDEditor(colors=['red', 'green']),
style='custom',
height=-35),
UItem('enable', editor=ButtonEditor(label_value='enable_label')))
status_grp = HGroup(spring, CustomLabel('status_text',
weight='bold',
use_color_background=False,
# bgcolor='transparent',
color='orange', size=40),
spring)
request_grp = HGroup(Item('requested_power',
style='readonly',
format_str='%0.2f',
width=100),
Spring(springy=False, width=50),
UItem('units', style='readonly'),
spring)
v = View(VGroup(led_grp,
spring,
status_grp,
def _get_path_group(self, label='File', **kw):
path_group = VGroup(self._get_root_item(),
Item('name'),
HGroup(UItem('controller.use_finder_button'), spring),
Item('path', style='readonly'),
label=label, **kw)
return path_group
HGroup(icon_button_editor('append_button', 'add',
tooltip=self._add_tooltip),
icon_button_editor('replace_button', 'arrow_refresh',
tooltip=self._replace_tooltip),
icon_button_editor('clear_button', 'delete',
tooltip=self._clear_tooltip)),
HGroup(Item('auto_group', tooltip='Automatically group by labnumber when'
'"appending" analyses. Note: Does not apply when drag-n-dropping analyses'),
icon_button_editor('configure_filter_button', 'filter',
tooltip='Configure/Apply a filter',
enabled_when='items')),
HGroup(UItem('previous_selection',
editor=EnumEditor(name='previous_selections')),
icon_button_editor('configure_button', 'cog',
tooltip=self.configure_history_tooltip)),
HGroup(spring, CustomLabel('cs_label'), spring),
UItem('items', editor=myTabularEditor(adapter=self.adapter,
operations=['move', 'delete'],
editable=True,
drag_external=True,
selected='selected',
dclicked='dclicked',
refresh='refresh_needed',
multi_select=True,
column_clicked='column_clicked'))),
handler=UnknownsHandler())
return v
columns=det_cols)),
label='IC Factors', show_border=True,
defined_when='ic_factors')
bgrp = HGroup(icon_button_editor('revert_button',
'arrow_undo',
tooltip='Undo changes',
enabled_when='dirty'),
icon_button_editor('revert_original_button',
'arrow_left',
tooltip='Revert to original values'),
icon_button_editor('save_button',
'disk',
enabled_when='dirty',
tooltip='Save changes'),
spring)
flux_grp = HGroup(UItem('object.flux.value'),
Label(PLUSMINUS),
UItem('object.flux.error'),
label='Flux (J)',
defined_when='object.flux',
show_border=True)
v = okcancel_view(VGroup(Group(iso_grp, baseline_grp,
icgrp,
layout='tabbed'),
blank_grp,
flux_grp,
bgrp),
handler=AnalysisEditViewHandler(),
title=self.title,
x=0.05,
y=0.05)
first = Str('My first name')
last = Str('My last name')
# A derived trait set by the handler associated with out dynamic view
# contribution:
derived = Str
ui_person = Group(
Item(label='On this tab, notice how the sub-handler keeps\n'
'the derived value equal to the first name.\n\n'
'On the next tab, change the selection in order to\n'
'control which tabs are visible when the ui is \n'
'displayed for the 2nd time.'
),
spring,
'first', 'last',
spring,
'derived',
label='My Info',
_foo_order=5,
_foo_priority=1,
_foo_handler=MyInfoHandler(),
)
class FatherInfoHandler(Handler):
def object_father_first_name_changed(self, info):
info.object.father_derived = info.object.father_first_name
def traits_view(self):
v = View(HGroup(Readonly('teststr', width=-200),
Readonly('state'),
spring))
return v
def _get_padding_group(self):
return VGroup(HGroup(Spring(springy=False, width=100),
Item('padding_top', label='Top'),
spring, ),
HGroup(Item('padding_left', label='Left'),
Item('padding_right', label='Right')),
HGroup(Spring(springy=False, width=100), Item('padding_bottom', label='Bottom'),
spring),
Item('plot_spacing', label='Spacing', tooltip='Space between plots in pixels'),
enabled_when='not formatting_options',
label='Padding/Spacing', show_border=True)
def get_parameter_group(self):
return Group('walk_x',
'walk_y',
'npoints',
HGroup(spring, Item('regenerate', show_label=False)))
def default_traits_view(self):
view = View(
VGroup(
HGroup(
Item('file_name', label='File name', style='readonly'),
spring,
Item('file_rev', label='rev', style='readonly'),
),
HGroup(
Item('ibis_ver', label='IBIS ver', style='readonly'),
spring,
Item('date', label='Date', style='readonly'),
),
HGroup(
Item('comp', label='Component'),
Item('pin', label='Pin'),
Item('mod', label='Model'),
),
),
resizable=False,
buttons=ModalButtons,
title="PyBERT IBIS Model Selector",
id="pybert.pybert_ami.model_selector",
)
return view
),
Group(Item('set_step', defined_when='set_step is not None',
show_label=False, style='custom'),
),
HGroup(spring,
Item('button_make_snapshots_steps', show_label=False,
enabled_when='has_several_steps == True'),
Item('button_make_animation_steps', show_label=False,
enabled_when='has_several_steps == True'),
spring,
Item('button_make_snapshots_times', show_label=False,
enabled_when='has_several_steps == True'),
Item('button_make_animation_times', show_label=False,
enabled_when='has_several_steps == True'),
spring,),
HGroup(spring,
Item('button_reload', show_label=False),
Item('button_view', show_label=False),
Item('button_quit', show_label=False)),
resizable=True,
buttons=[],
handler=ClosingHandler(),
)
if is_new_scene:
if show:
gui.configure_traits(view=traits_view)
else:
gui.edit_traits(view=traits_view)
return gui