Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@flx.reaction('but2.pointer_click')
def on_opennew(self, *events):
global window
window.open('http://python.org', '_blank')
@flx.reaction('size')
def __on_size(self, *events):
self.ace.resize()
#@+node:ekr.20181110170304.1: ** class LeoMainWindow
@flx.reaction('!children**.value')
def on_slider_change(self, *events):
for ev in events:
self.label.set_text('Slider %s changed to %f' %
(ev.source.id, ev.new_value))
@flx.reaction("!root.add_launch")
def _add_launch(self, *events):
for ev in events:
with self.base_layout:
ROSMonLaunchWidget(ev.topic)
@flx.reaction
def _update_plot(self):
smoothing = self.smoothing.value
yy1 = data[self.month.selected_index]
yy2 = []
sm2 = int(smoothing / 2)
for i in range(len(yy1)):
val = 0
n = 0
for j in range(max(0, i-sm2), min(len(yy1), i+sm2+1)):
val += yy1[j]
n += 1
if n == 0:
yy2.append(yy1[i])
else:
yy2.append(val / n)
@flx.reaction("enable_cont.user_checked")
def _enable_check(self, *events):
self.publish(self.cont_enable_topic, {'data': bool(self.enable_cont.checked)})
@flx.reaction('key_down')
def _handle_highlighting(self, *events):
for ev in events:
if ev.modifiers:
continue
if ev.key == 'Escape':
self.highlight_hide()
elif ev.key == ' ':
if self.max_selected == 0: # space also checks if no selection
self.highlight_toggle_checked()
else:
self.highlight_toggle_selected()
elif ev.key == 'Enter':
self.highlight_toggle_checked()
elif ev.key == 'ArrowRight':
item = self.highlight_get()
if item and item.items:
@flx.reaction('videolist.children*.selected')
def on_select(self, *events):
for ev in events:
if ev.source.selected:
fname = ev.source.text
self.player.set_source(videos[fname])
@flx.reaction
def __handle_show_scale(self):
if self.show_scale:
self.map.addControl(self.scale)
else:
self.map.removeControl(self.scale)