Skip to content

Commit

Permalink
Wrap docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Apr 10, 2022
1 parent 43dbc38 commit fae8839
Showing 1 changed file with 28 additions and 22 deletions.
50 changes: 28 additions & 22 deletions panel/widgets/button.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Defines the Button and button-like widgets which allow triggering events
or merely toggling between on-off states.
Defines the Button and button-like widgets which allow triggering
events or merely toggling between on-off states.
"""
from functools import partial

Expand All @@ -20,8 +20,9 @@
class _ButtonBase(Widget):

button_type = param.ObjectSelector(default='default', objects=BUTTON_TYPES, doc="""
A button theme; should be one of 'default' (white), 'primary' (blue), 'success' (green),
'info' (yellow), 'light' (light), or 'danger' (red).""")
A button theme; should be one of 'default' (white), 'primary'
(blue), 'success' (green), 'info' (yellow), 'light' (light),
or 'danger' (red).""")

_rename = {'name': 'label'}

Expand Down Expand Up @@ -91,13 +92,15 @@ def jscallback(self, args={}, **callbacks):


class Button(_ClickButton):
"""The `Button` widget allows triggering events when the button is clicked.
The Button provides a `value` parameter, which will toggle from `False` to `True`
while the click event is being processed
It also provides an additional `clicks` parameter, that can be watched to subscribe to click
events.
"""
The `Button` widget allows triggering events when the button is
clicked.
The Button provides a `value` parameter, which will toggle from
`False` to `True` while the click event is being processed
It also provides an additional `clicks` parameter, that can be
watched to subscribe to click events.
Reference: https://panel.holoviz.org/reference/widgets/Button.html#widgets-gallery-button
Expand Down Expand Up @@ -137,7 +140,7 @@ def on_click(self, callback):
Register a callback to be executed when the `Button` is clicked.
The callback is given an `Event` argument declaring the number of clicks
Arguments
---------
callback: (callable)
Expand All @@ -148,16 +151,16 @@ def on_click(self, callback):

class Toggle(_ButtonBase):
"""The `Toggle` widget allows toggling a single condition between `True`/`False` states.
This widget is interchangeable with the `Checkbox` widget.
Reference: https://panel.holoviz.org/reference/widgets/Toggle.html
:Example:
>>> Toggle(name='Toggle', button_type='success')
"""

value = param.Boolean(default=False, doc="""
Whether the button is currently toggled.""")

Expand All @@ -173,12 +176,15 @@ def _get_embed_state(self, root, values=None, max_opts=3):


class MenuButton(_ClickButton):
"""The `MenuButton` widget allows specifying a list of menu items to select from triggering
events when the button is clicked.
Unlike other widgets, it does not have a `value` parameter. Instead it has a `clicked` parameter
that can be watched to trigger events and which reports the last clicked menu item.
"""
The `MenuButton` widget allows specifying a list of menu items to
select from triggering events when the button is clicked.
Unlike other widgets, it does not have a `value`
parameter. Instead it has a `clicked` parameter that can be
watched to trigger events and which reports the last clicked menu
item.
Reference: https://panel.holoviz.org/reference/widgets/MenuButton.html
:Example:
Expand Down Expand Up @@ -215,7 +221,7 @@ def on_click(self, callback):
Register a callback to be executed when the button is clicked.
The callback is given an `Event` argument declaring the number of clicks
Arguments
---------
callback: (callable)
Expand Down

0 comments on commit fae8839

Please sign in to comment.