Skip to content

Commit

Permalink
Various documentation fixes (#6829)
Browse files Browse the repository at this point in the history
* Fix deprecation warning in Accordion docs

* Update ChatInterface docs with ChatAreaInput

* Update Reacton ipyvuetify example

* Readd panel links

* Update ChatInterface.ipynb
  • Loading branch information
philippjfr committed May 13, 2024
1 parent d98bc7d commit 5aeb017
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 30 deletions.
22 changes: 11 additions & 11 deletions examples/reference/chat/ChatInterface.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"You can also use a different type of widget for input, like `TextAreaInput` instead of `TextInput`, by setting `widgets`."
"You can also use a different type of widget for input, like `TextInput` instead of the default `ChatAreaInput`, by setting `widgets`."
]
},
{
Expand All @@ -159,8 +159,8 @@
"\n",
"ChatInterface(\n",
" callback=count_chars,\n",
" widgets=pn.widgets.TextAreaInput(\n",
" placeholder=\"Enter some text to get a count!\", auto_grow=True, max_rows=3\n",
" widgets=pn.widgets.TextInput(\n",
" placeholder=\"Enter some text to get a count!\"\n",
" ),\n",
")"
]
Expand Down Expand Up @@ -188,7 +188,7 @@
"ChatInterface(\n",
" callback=get_num,\n",
" widgets=[\n",
" pn.widgets.TextAreaInput(placeholder=\"Enter some text to get a count!\"),\n",
" pn.chat.ChatAreaInput(placeholder=\"Enter some text to get a count!\"),\n",
" pn.widgets.IntSlider(name=\"Number Input\", end=10)\n",
" ],\n",
")"
Expand All @@ -198,7 +198,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Widgets other than `TextInput` will require the user to manually click the `Send` button, unless the type is specified in `auto_send_types`."
"Widgets other than `TextInput` and `ChatAreaInput` will require the user to manually click the `Send` button, unless the type is specified in `auto_send_types`."
]
},
{
Expand All @@ -210,7 +210,7 @@
"ChatInterface(\n",
" callback=get_num,\n",
" widgets=[\n",
" pn.widgets.TextAreaInput(placeholder=\"Enter some text to get a count!\"),\n",
" pn.chat.ChatAreaInput(placeholder=\"Enter some text to get a count!\"),\n",
" pn.widgets.IntSlider(name=\"Number Input\", end=10)\n",
" ],\n",
" auto_send_types=[pn.widgets.IntSlider],\n",
Expand Down Expand Up @@ -314,7 +314,7 @@
"pn.chat.ChatInterface(\n",
" callback=guided_get_num,\n",
" widgets=[\n",
" pn.widgets.TextAreaInput(placeholder=\"Enter some text to get a count!\"),\n",
" pn.chat.ChatAreaInput(placeholder=\"Enter some text to get a count!\"),\n",
" pn.widgets.IntSlider(name=\"Number Input\", end=10)\n",
" ],\n",
")"
Expand All @@ -339,12 +339,12 @@
" instance.widgets = [widgets[1]] # change to IntSlider\n",
" else:\n",
" num = contents\n",
" instance.widgets = [widgets[0]] # Change to TextAreaInput\n",
" instance.widgets = [widgets[0]] # Change to ChatAreaInput\n",
" return f\"Got {num}.\"\n",
"\n",
"\n",
"widgets = [\n",
" pn.widgets.TextAreaInput(placeholder=\"Enter some text to get a count!\"),\n",
" pn.chat.ChatAreaInput(placeholder=\"Enter some text to get a count!\"),\n",
" pn.widgets.IntSlider(name=\"Number Input\", end=10)\n",
"]\n",
"pn.chat.ChatInterface(\n",
Expand All @@ -367,7 +367,7 @@
"outputs": [],
"source": [
"widgets = [\n",
" pn.widgets.TextAreaInput(placeholder=\"Enter some text to get a count!\"),\n",
" pn.chat.ChatAreaInput(placeholder=\"Enter some text to get a count!\"),\n",
" pn.widgets.IntSlider(name=\"Number Input\", end=10)\n",
"]\n",
"chat_interface = pn.chat.ChatInterface(\n",
Expand All @@ -392,7 +392,7 @@
"outputs": [],
"source": [
"pn.chat.ChatInterface(\n",
" widgets=pn.widgets.TextAreaInput(),\n",
" widgets=pn.chat.ChatAreaInput(),\n",
" reset_on_send=False,\n",
")"
]
Expand Down
2 changes: 1 addition & 1 deletion examples/reference/layouts/Accordion.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"outputs": [],
"source": [
"p3 = figure(width=300, height=300, name='Square', margin=5)\n",
"p3.square([0, 1, 2, 3, 4, 5, 6], [0, 1, 2, 3, 2, 1, 0], size=10)\n",
"p3.scatter([0, 1, 2, 3, 4, 5, 6], [0, 1, 2, 3, 2, 1, 0], marker='square', size=10)\n",
"\n",
"accordion.append(p3)"
]
Expand Down
35 changes: 21 additions & 14 deletions examples/reference/panes/Reacton.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -300,34 +300,41 @@
"\n",
" with w.HBox():\n",
" if state.input:\n",
" v.BtnWithClick(children=\"C\", on_click=lambda: dispatch((\"clear\", None)), dark=True, class_=class_)\n",
" btn = v.Btn(children=\"C\", dark=True, class_=class_)\n",
" v.use_event(btn, 'click', lambda _, __, ___: dispatch((\"clear\", None)))\n",
" else:\n",
" v.BtnWithClick(children=\"AC\", on_click=lambda: dispatch((\"reset\", None)), dark=True, class_=class_)\n",
" v.BtnWithClick(children=\"+/-\", on_click=lambda: dispatch((\"negate\", None)), dark=True, class_=class_)\n",
" v.BtnWithClick(children=\"%\", on_click=lambda: dispatch((\"percent\", None)), dark=True, class_=class_)\n",
" v.BtnWithClick(children=\"/\", color=\"primary\", on_click=lambda: dispatch((\"operator\", operator_map[\"/\"])), class_=class_)\n",
"\n",
" btn = v.Btn(children=\"AC\", dark=True, class_=class_)\n",
" v.use_event(btn, 'click', lambda _, __, ___: dispatch((\"clear\", None)))\n",
" btn = v.Btn(children=\"+/-\", dark=True, class_=class_)\n",
" v.use_event(btn, 'click', lambda _, __, ___: dispatch((\"negate\", None)))\n",
" btn = v.Btn(children=\"%\", dark=True, class_=class_)\n",
" v.use_event(btn, 'click', lambda _, __, ___: dispatch((\"percent\", None)))\n",
" btn = v.Btn(children=\"/\", color=\"primary\", class_=class_)\n",
" v.use_event(btn, 'click', lambda _, __, ___: dispatch((\"operator\", operator_map[\"/\"])))\n",
" column_op = [\"x\", \"-\", \"+\"]\n",
" for i in range(3):\n",
" with w.HBox():\n",
" for j in range(3):\n",
" digit = str(j + (2 - i) * 3 + 1)\n",
" v.BtnWithClick(children=digit, on_click=lambda digit=digit: dispatch((\"digit\", digit)), class_=class_)\n",
" btn = v.Btn(children=digit, class_=class_)\n",
" v.use_event(btn, 'click', lambda _, __, ___, digit=digit: dispatch((\"digit\", digit)))\n",
" op_symbol = column_op[i]\n",
" op = operator_map[op_symbol]\n",
" v.BtnWithClick(children=op_symbol, color=\"primary\", on_click=lambda op=op: dispatch((\"operator\", op)), class_=class_)\n",
" btn = v.Btn(children=op_symbol, color=\"primary\", class_=class_)\n",
" v.use_event(btn, 'click', lambda _, __, ___, op=op: dispatch((\"operator\", op)))\n",
" with w.HBox():\n",
" def boom():\n",
" print(\"boom\")\n",
" raise ValueError(\"boom\")\n",
"\n",
" v.BtnWithClick(children=\"?\", on_click=boom, class_=class_)\n",
"\n",
" v.BtnWithClick(children=\"0\", on_click=lambda: dispatch((\"digit\", \"0\")), class_=class_)\n",
" v.BtnWithClick(children=\".\", on_click=lambda: dispatch((\"digit\", \".\")), class_=class_)\n",
"\n",
" v.BtnWithClick(children=\"=\", color=\"primary\", on_click=lambda: dispatch((\"calculate\", None)), class_=class_)\n",
" v.Btn(children=\"?\", on_click=boom, class_=class_)\n",
"\n",
" btn = v.Btn(children=\"0\", class_=class_)\n",
" v.use_event(btn, 'click', lambda _, __, ___: dispatch((\"digit\", 0)))\n",
" btn = v.Btn(children=\".\", class_=class_)\n",
" v.use_event(btn, 'click', lambda _, __, ___: dispatch((\"digit\", \".\")))\n",
" btn = v.Btn(children=\"=\", color=\"primary\", class_=class_)\n",
" v.use_event(btn, 'click', lambda _, __, ___: dispatch((\"calculate\", None)))\n",
" return main\n",
"\n",
"pn.pane.Reacton(CalculatorVuetify(), width=500, height=420)"
Expand Down
4 changes: 2 additions & 2 deletions panel/_templates/convert_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,9 @@
<body>
<section class="header">
<div class="header-content">
<div>
<a href="https://panel.holoviz.org">
<img id="panel-logo" src="{{ PANEL_CDN }}images/logo_horizontal.png"/>
</div>
</a>
<div class="title-area">
<span id="title">{{ title|default('Panel Applications', true) }}</span>
<span id="subtitle">Running {{ items | length }} apps</span>
Expand Down
4 changes: 2 additions & 2 deletions panel/_templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@
<body>
<section class="header">
<div class="header-content">
<div>
<a href="https://panel.holoviz.org">
<img id="panel-logo" src="{{ PANEL_CDN }}images/logo_horizontal.png"/>
</div>
</a>
<div class="title-area">
<span id="title">Panel Applications</span>
<span id="subtitle">Running {{ len(items) }} apps</span>
Expand Down

0 comments on commit 5aeb017

Please sign in to comment.