cb266bbe1ce215ec56cc54ee009ea3a2a055b6d8,superintendent/controls.py,Submitter,_compose,#Submitter#Any#,83
Before Change
def _compose(self, change=None):
if len(self.options) <= self.max_buttons:
control_elements = widgets.HBox(
[
widgets.Button(description=str(option))
for option in self.options
]
)
for button in control_elements.children:
button.on_click(self._when_submitted)
else:
control_elements = widgets.HBox(
[
widgets.Dropdown(
options=[str(option) for option in self.options],
description="Label:",
),
widgets.Button(
description="Submit.",
tooltip="Submit label.",
button_style="success",
),
]
)
widgets.link(
(control_elements.children[0], "value"),
(control_elements.children[1], "description"),
)
control_elements.children[1].on_click(self._when_submitted)
if self.other_option:
other_widget = widgets.Text(
value="",
description="Other:",
placeholder="Hit enter to submit.",
)
other_widget.on_submit(self._when_submitted)
self.children = [control_elements, other_widget]
else:
self.children = [control_elements]
@total_ordering
class Timer:
After Change
self.options = [str(option) for option in self.options]
if len(self.options) <= self.max_buttons:
control_elements = widgets.HBox(
[
widgets.Button(description=str(option))
for option in self.options
]
)
for button in control_elements.children:
button.on_click(self._when_submitted)
else:
control_elements = widgets.HBox(
[
widgets.Dropdown(
options=[str(option) for option in self.options],
description="Label:",
),
widgets.Button(
description="Submit.",
tooltip="Submit label.",
button_style="success",
),
]
)
widgets.link(
(control_elements.children[0], "value"),
(control_elements.children[1], "description"),
)
control_elements.children[1].on_click(self._when_submitted)
sort_button = widgets.Button(description="Sort options", icon="sort")
sort_button.on_click(self._sort_options)
if self.other_option:
other_widget = widgets.Text(
value="",
description="Other:",
placeholder="Hit enter to submit.",
)
other_widget.on_submit(self._when_submitted)
self.children = [
control_elements,
widgets.HBox(
[other_widget, sort_button],
layout=widgets.Layout(
justify_content="space-between"
),
),
]
else:
self.children = [control_elements, widgets.HBox([sort_button])]
@total_ordering
class Timer:
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances
Project Name: janfreyberg/superintendent
Commit Name: cb266bbe1ce215ec56cc54ee009ea3a2a055b6d8
Time: 2018-05-31
Author: janfreyberg@users.noreply.github.com
File Name: superintendent/controls.py
Class Name: Submitter
Method Name: _compose
Project Name: hyperspy/hyperspy
Commit Name: cff0a293372948a288d889eaac5a5dae25eaccf9
Time: 2017-04-11
Author: frandelapena@gmail.com
File Name: hyperspy/gui_ipywidgets/tools.py
Class Name:
Method Name: calibrate_ipy
Project Name: hyperspy/hyperspy
Commit Name: c591d2dc14585544e6fe893d55f8c0f09cf4d3de
Time: 2017-04-14
Author: frandelapena@gmail.com
File Name: hyperspy/gui_ipywidgets/tools.py
Class Name:
Method Name: remove_background_ipy