|
|
|
|
@ -1,3 +1,6 @@
|
|
|
|
|
import inspect
|
|
|
|
|
import types
|
|
|
|
|
|
|
|
|
|
from base import Widget
|
|
|
|
|
from IPython.utils.traitlets import Unicode, Bool, Int
|
|
|
|
|
|
|
|
|
|
@ -12,12 +15,14 @@ class ButtonWidget(Widget):
|
|
|
|
|
|
|
|
|
|
_click_handlers = []
|
|
|
|
|
|
|
|
|
|
def handle_click(self, callback, remove=False):
|
|
|
|
|
|
|
|
|
|
def on_click(self, callback, remove=False):
|
|
|
|
|
if remove:
|
|
|
|
|
self._click_handlers.remove(callback)
|
|
|
|
|
else:
|
|
|
|
|
self._click_handlers.append(callback)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _clicks_changed(self, name, old, new):
|
|
|
|
|
if new > old:
|
|
|
|
|
for handler in self._click_handlers:
|
|
|
|
|
|