2013-10-26 02:31:48 +08:00
|
|
|
"""BoolWidget class.
|
|
|
|
|
|
|
|
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
|
2013-10-19 02:08:47 +08:00
|
|
|
from IPython.utils.traitlets import Unicode, Bool, List
|
|
|
|
|
2013-10-26 02:31:48 +08:00
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Classes
|
|
|
|
#-----------------------------------------------------------------------------
|
2014-01-07 20:04:24 +08:00
|
|
|
class BoolWidget(DOMWidget):
|
2013-10-19 02:08:47 +08:00
|
|
|
target_name = Unicode('BoolWidgetModel')
|
2014-01-07 20:08:15 +08:00
|
|
|
view_name = Unicode('CheckboxView')
|
2013-10-26 02:31:48 +08:00
|
|
|
|
|
|
|
# Model Keys
|
2014-01-07 20:04:24 +08:00
|
|
|
keys = ['value', 'description', 'disabled'] + DOMWidget.keys
|
2013-10-26 02:31:48 +08:00
|
|
|
value = Bool(False, help="Bool value")
|
|
|
|
description = Unicode('', help="Description of the boolean (label).")
|
|
|
|
disabled = Bool(False, help="Enable or disable user changes.")
|
2013-10-19 02:08:47 +08:00
|
|
|
|