2014-07-19 03:47:33 +08:00
|
|
|
"""Bool class.
|
2013-10-26 02:31:48 +08:00
|
|
|
|
|
|
|
Represents a boolean using a widget.
|
|
|
|
"""
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Copyright (c) 2013, the IPython Development Team.
|
|
|
|
#
|
|
|
|
# Distributed under the terms of the Modified BSD License.
|
|
|
|
#
|
|
|
|
# The full license is in the file COPYING.txt, distributed with this software.
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Imports
|
|
|
|
#-----------------------------------------------------------------------------
|
2014-01-07 20:04:24 +08:00
|
|
|
from .widget import DOMWidget
|
2014-02-26 01:46:27 +08:00
|
|
|
from IPython.utils.traitlets import Unicode, Bool
|
2014-07-19 03:47:33 +08:00
|
|
|
from IPython.utils.warn import DeprecatedClass
|
2013-10-19 02:08:47 +08:00
|
|
|
|
2013-10-26 02:31:48 +08:00
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Classes
|
|
|
|
#-----------------------------------------------------------------------------
|
2014-07-19 03:47:33 +08:00
|
|
|
class _Bool(DOMWidget):
|
2014-01-14 23:15:19 +08:00
|
|
|
value = Bool(False, help="Bool value", sync=True)
|
|
|
|
description = Unicode('', help="Description of the boolean (label).", sync=True)
|
|
|
|
disabled = Bool(False, help="Enable or disable user changes.", sync=True)
|
2014-01-15 00:24:35 +08:00
|
|
|
|
2014-01-16 22:20:04 +08:00
|
|
|
|
2014-07-19 03:47:33 +08:00
|
|
|
class Checkbox(_Bool):
|
2014-01-29 04:51:24 +08:00
|
|
|
_view_name = Unicode('CheckboxView', sync=True)
|
2014-01-22 08:44:57 +08:00
|
|
|
|
|
|
|
|
2014-07-19 03:47:33 +08:00
|
|
|
class ToggleButton(_Bool):
|
2014-01-23 08:21:00 +08:00
|
|
|
_view_name = Unicode('ToggleButtonView', sync=True)
|
2014-04-20 08:06:41 +08:00
|
|
|
|
2014-07-19 03:47:33 +08:00
|
|
|
CheckboxWidget = DeprecatedClass(Checkbox, 'CheckboxWidget')
|
|
|
|
ToggleButtonWidget = DeprecatedClass(ToggleButton, 'ToggleButtonWidget')
|