Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def add_tool(self, tool):
self.tools[tool.tool_id] = tool
icon = Image.from_file(icon_path(tool.icon, icon_format='svg'), width=ICON_WIDTH)
button = v.Btn(v_on="tooltip.on", icon=True, children=[icon], value=tool.tool_id)
annotated = v.Tooltip(
bottom=True,
v_slots=[{
'name': 'activator',
'variable': 'tooltip',
'children': button}],
children=[tool.tool_tip])
self.children = list(self.children) + [annotated]
def provider_buttons(providers: List[str]) -> wid.VBox:
"""Generate a collection of provider buttons for a backend.
When one of these buttons is clicked, the code to get the particular
provider is copied to the clipboard.
Args:
providers: A list of provider names.
Returns:
A widget with provider buttons.
"""
vbox_buttons = []
for pro in providers:
button = wid.Box(children=[vue.Btn(color='#f5f5f5', small=True,
children=[pro],
style_="font-family: Arial,"
"sans-serif; font-size:10px;")],
layout=wid.Layout(margin="0px 0px 2px 0px",
width='350px'))
button.children[0].on_event('click', _copy_text)
vbox_buttons.append(button)
return wid.VBox(children=vbox_buttons,
layout=wid.Layout(width='350px',
max_width='350px'))
("xor", icon_xor, XorMode),
("remove", icon_andnot, AndNotMode),
]
items = []
for mode in self.modes:
item = v.ListItem(children=[v.ListItemAction(children=[mode[1]]),
v.ListItemTitle(children=[mode[0]])])
items.append(item)
for item in items:
item.on_event('click', self._sync_state_from_ui)
mylist = v.List(children=items)
self.main = v.Btn(icon=True,
children=[self.modes[0][1]], v_on="menu.on")
super().__init__(
v_slots=[{
'name': 'activator',
'variable': 'menu',
'children': self.main
}],
children=[mylist])
self.session.hub.subscribe(self, msg.EditSubsetMessage,
handler=self._on_edit_subset_msg)
self._sync_ui_from_state(self.session.edit_subset_mode.mode)