Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
description='S. Warp:',
disabled=False,
button_style='info', # 'success', 'info', 'warning', 'danger' or ''
tooltips=['Description of slow', 'Description of regular', 'Description of fast'],
)
dashboard_two.pad = widgets.ToggleButtons(
options=['zeros', 'border', 'reflection'],
value='reflection',
description='Padding:',
disabled=False,
button_style='success', # 'success', 'info', 'warning', 'danger' or ''
tooltips=['Description of slow', 'Description of regular', 'Description of fast'],
)
ui2 = widgets.VBox([dashboard_two.doflip, dashboard_two.dovert])
ui = widgets.HBox([dashboard_two.three, dashboard_two.seven, dashboard_two.four,dashboard_two.five, dashboard_two.six])
ui3 = widgets.VBox([ui2, ui])
ui4 = widgets.VBox([dashboard_two.cut, dashboard_two.jit, dashboard_two.contrast, dashboard_two.bright,
dashboard_two.rotate, dashboard_two.sym_warp])
ui5 = widgets.HBox([ui3, ui4])
ui6 = widgets.VBox([ui5, dashboard_two.pad])
display (ui6)
print ('>> Press button to view augmentations.')
display(button)
def on_choice_button(b):
image_choice()
choice_button.on_click(on_choice_button)
out_aug = widgets.Output()
link((obj, "ss_left_value"), (left, "value"))
link((obj, "ss_right_value"), (right, "value"))
def on_apply_clicked(b):
obj.apply()
apply.on_click(on_apply_clicked)
def on_reset_clicked(b):
obj.reset()
reset.on_click(on_reset_clicked)
box = ipywidgets.VBox([
labelme("vmin", left),
labelme("vmax", right),
help,
ipywidgets.HBox((apply, reset, close))
])
def on_close_clicked(b):
obj.close()
box.close()
close.on_click(on_close_clicked)
return {
"widget": box,
"wdict": wdict,
}
tabs.set_title(tab_idx, 'Substrate Plots'); tab_idx += 1
#tabs.set_title(tab_idx, 'Data');
def tab_cb(b):
global select_output_dir
# print(tabs.selected_index)
if (tabs.selected_index > 2):
select_output_dir.disabled = False
# write_config_row = widgets.HBox([write_config_button, write_config_file, select_output_dir])
else:
select_output_dir.disabled = True
# write_config_row = widgets.HBox([write_config_button, write_config_file])
tabs.observe(tab_cb)
read_config_row = widgets.HBox([read_config_button, read_config, default_config_button])
# tab_file = open("bin/tab_helper.png", "rb")
# image = tab_file.read()
# tab_helper = widgets.Image(
# value=image,
# format='png',
# width=595,
# height=55,
# )
#gui = widgets.VBox(children=[read_config_row, tab_helper, tabs, write_config_row, run_button.w])
#gui = widgets.VBox(children=[read_config_row, tabs, write_config_row, run_button.w])
gui = widgets.VBox(children=[read_config_row, tabs, write_config_row, run_button.w, submit_button.w])
default_config_file_cb(None)
self.items.margin="3%"
descma = str(minora_name+' Columns:')
self.minor_axis = widgets.SelectMultiple(
options=self.minaxis_list,
value=self.minaxis_list,
#description=descma,
width='100%'
)
#self.minor_axis.margin="3%"
self.target = widgets.RadioButtons(
#description='Tooltip axis:',
options={items_name:0, minora_name:1},
value=0
)
self.target.margin="3%"
self.selectors = widgets.HBox(children=[self.target,self.items,
self.minor_axis])
self.widget =widgets.VBox(children=[self.title,self.labelsbar,self.selectors])
overflow_x="scroll", width="600px", height="90%"
)
)
self.tab_widget.observe(
self.tab_widget_onchange, names="selected_index"
)
for controller in self.step_creation_controls:
controller.create_widgets()
controller.submit_step_callback.register_callback(
lambda: self.active_callback.send_callbacks(self.active_step)
)
self.widget = ipywidgets.HBox(
[
self.plot_widget_container,
self.tab_widget,
self.preview_widget_container,
],
layout=ipywidgets.Layout(
display="flex",
align_items="stretch",
width="100%",
height="220px",
),
layout=ipywidgets.Layout(width='6cm'))
level_wid.observe(update_widgets, names='value', type='change')
level_wid.observe(render_function, names='value', type='change')
tmp_children.insert(0, level_wid)
tmp_wid = ipywidgets.HBox(tmp_children)
tmp_wid.layout.align_items = 'center'
experts_box = ipywidgets.VBox([tmp_wid, patch_options_wid])
options_box = ipywidgets.Tab([experts_box, image_options_wid,
shape_options_wid, renderer_options_wid,
info_wid, save_figure_wid])
tab_titles = ['Experts', 'Image', 'Shape', 'Renderer', 'Info', 'Export']
for (k, tl) in enumerate(tab_titles):
options_box.set_title(k, tl)
logo_wid = LogoWidget(style=main_style)
logo_wid.layout.margin = '0px 10px 0px 0px'
wid = ipywidgets.HBox([logo_wid, options_box])
# Set widget's style
wid.box_style = main_style
wid.layout.border = '2px solid ' + map_styles_to_hex_colours(main_style)
# Display final widget
final_box = ipywidgets.Box([wid])
final_box.layout.display = 'flex'
ipydisplay.display(final_box)
# Trigger initial visualization
render_function({})
def contrast_choice():
"""Helper for contrast augmentations"""
contr = dashboard_two.contrast.value
if contr == 'True':
contrast_choice.one = widgets.FloatSlider(min=0,max=10,step=0.1,value=1, description='scale1', orientation='vertical', style=style_green)
contrast_choice.two = widgets.FloatSlider(min=0, max=10, step=0.1, value=1, description='scale2', orientation='vertical', style=style_blue)
ui = widgets.HBox([contrast_choice.one, contrast_choice.two])
print('>> Contrast')
display(ui)
else:
contrast_choice.one = widgets.FloatSlider(value=1)
contrast_choice.two = widgets.FloatSlider(value=1)
description='Max',
disabled=True,
layout = Layout(width = constWidth2),
)
def toggle_field_cmap_fixed_cb(b):
if (toggle_field_cmap_fixed.value):
field_cmap_fixed_min.disabled = False
field_cmap_fixed_max.disabled = False
else:
field_cmap_fixed_min.disabled = True
field_cmap_fixed_max.disabled = True
toggle_field_cmap_fixed.observe(toggle_field_cmap_fixed_cb)
field_cmap_row2 = widgets.HBox([field_cmap, toggle_field_cmap_fixed])
field_cmap_row3 = widgets.HBox([field_cmap_fixed_min,field_cmap_fixed_max])
# mcds_tab = widgets.VBox([mcds_dir, mcds_plot, mcds_play], layout=tab_layout)
mcds_params = widgets.VBox([mcds_field, field_cmap_row2,field_cmap_row3]) # mcds_dir
mcds_tab = widgets.HBox([mcds_params, mcds_plot], layout=tab_layout)
#----------------------
xml_editor = widgets.Textarea(
description="",
layout = widgets.Layout(border='1px solid black', width='900px', height='500px'), #tab_layout, #Layout(min_width = '900px', min_height='300px'),
)
#xml_editor.value = "Mary had a lamb, yada yada...\nfleece was white yada..."
#with open('nanobio_settings.xml') as xml_filep:
# xml_editor.value = xml_filep.read()
#xml_filep.closed
write_xml_button = Button(
description='Save XML config file',
button.layout.width = '10%'
# The callbacks when the button is clicked
encoding.observe(self._update, names='value')
cols.observe(self._update, names='value')
# Making sure we know what row we're in in the callbacks
encoding.row = cols.row = button.row = adv.row = i
# Have the titles so we know what button we're editing
encoding.title = 'encoding'
cols.title = 'field'
button.title = 'button'
adv.title = 'advanced'
return widgets.HBox([cols, encoding, button, adv])
def __init__(self, *args, **kwargs):
self._select = Dropdown(*args,**kwargs)
self._edit = Button(description='...',
layout=Layout(width='15px'))
self._composite = HBox([self._select,self._edit])
super(DropdownWithEdit, self).__init__()
self.layout = self._composite.layout
# so that others looking at this widget's value get the
# dropdown's value
traitlets.link((self._select,'value'),(self,'value'))
self._edit.on_click(lambda _: editor(self._select.value))
self._select.observe(lambda e: self._set_editable(e['new']),'value')
self._set_editable(self._select.value)