def __init__(self, map, widgetContainer, overlayContainer): super(map, widgetContainer, overlayContainer) self._saveButton = Button('save_button_CSS', bind(self._save, self)) e_appendChild(self, self._saveButton) e_appendChild(self, BoardWidgetRadio(bind(self._changeMode, self))) e_appendChild(self, self._saveButton) self._mode = -1
def __init__(self, callback): self._callback = callback super('div', 'BoardWidgetRadio_CSS') self._buttons = [ Button('bounds_button_CSS bounds_button_hoverable_CSS', bind(lambda e: self._mousedown(e, 0), self)), Button('path_button_CSS path_button_hoverable_CSS', bind(lambda e: self._mousedown(e, 1), self)), Button('base_button_CSS base_button_hoverable_CSS', bind(lambda e: self._mousedown(e, 2), self)), Button('pellets_button_CSS pellets_button_hoverable_CSS', bind(lambda e: self._mousedown(e, 3), self)), ] self._selectedIndex = -1 self._mousedown(0, 0) for e in self._buttons: e_appendChild(self, e)
def _on(self, name, callback): if not self._event_callbacks_map: self._event_callbacks_map = {} if not self._event_callbacks_map[name]: self._event_callbacks_map[name] = [] self._['on' + name] = bind( lambda e: self._Element_eventCallback(e, name), self) self._event_callbacks_map[name].push(callback)
def __init__(self, callback): self._callback = callback super('div', 'BoardWidgetRadio_CSS') self._buttons = [ Button( 'bounds_button_CSS bounds_button_hoverable_CSS', bind(lambda e: self._mousedown(e, 0), self)), Button( 'path_button_CSS path_button_hoverable_CSS', bind(lambda e: self._mousedown(e, 1), self)), Button( 'base_button_CSS base_button_hoverable_CSS', bind(lambda e: self._mousedown(e, 2), self)), Button( 'pellets_button_CSS pellets_button_hoverable_CSS', bind(lambda e: self._mousedown(e, 3), self)), ] self._selectedIndex = -1 self._mousedown(0, 0) for e in self._buttons: e_appendChild(self, e)
def reduce(arr, f, val, opt_obj): if arr.reduce: if opt_obj: return arr.reduce(bind(f, opt_obj), val) else: return arr.reduce(f, val) rval = val def f(val, index): rval = f.call(opt_obj, rval, val, index, arr) forEach(arr, f) return rval