wangweimin 3 tahun lalu
induk
melakukan
74d01365fc

+ 159 - 0
README-zh.md

@@ -0,0 +1,159 @@
+<h1 align="center" name="pywebio-zh">PyWebIO</h1>
+<p align="center">
+    <em>Write interactive web app in script way.</em>
+</p>
+<p align="center">
+    <a href="https://percy.io/pywebio/pywebio">
+        <img src="https://percy.io/static/images/percy-badge.svg" alt="Percy visual test">
+    </a>
+    <a href="https://codecov.io/gh/wang0618/PyWebIO">
+        <img src="https://codecov.io/gh/wang0618/PyWebIO/branch/dev/graph/badge.svg" alt="Code coverage"/>
+    </a>
+    <a href="https://www.jsdelivr.com/package/gh/wang0618/PyWebIO-assets">
+        <img src="https://data.jsdelivr.com/v1/package/gh/wang0618/PyWebIO-assets/badge?style=rounded" alt="Jsdelivr hit count"/>
+    <a href="https://pywebio.readthedocs.io/zh_CN/latest/?badge=latest">
+        <img src="https://readthedocs.org/projects/pywebio/badge/?version=latest" alt="Documentation Status">
+    </a>
+    <a href="https://pypi.org/project/PyWebIO/">
+        <img src="https://img.shields.io/pypi/v/pywebio?colorB=brightgreen" alt="Package version">
+    </a>
+    <a href="https://pypi.org/project/PyWebIO/">
+        <img src="https://img.shields.io/badge/python->%3D%203.5.2-brightgreen" alt="Python Version">
+    </a>
+    <br/>
+    <a href="https://lgtm.com/projects/g/wang0618/PyWebIO/context:python">
+        <img src="https://img.shields.io/lgtm/grade/python/github/wang0618/PyWebIO.svg?colorB=brightgreen" alt="Python code quality">
+    </a>
+    <a href="https://lgtm.com/projects/g/wang0618/PyWebIO/context:javascript">
+        <img src="https://img.shields.io/lgtm/grade/javascript/github/wang0618/PyWebIO.svg?colorB=brightgreen" alt="Javascript code quality">
+    </a>
+    <a href="https://github.com/wang0618/PyWebIO/blob/master/LICENSE">
+        <img src="https://img.shields.io/github/license/wang0618/PyWebIO.svg" alt="License">
+    </a>
+    <br/>
+    <a href="https://pywebio.readthedocs.io/zh_CN/latest/">[Document]</a> | <a href="http://pywebio-demos.demo.wangweimin.site/">[Demos]</a> | <a href="https://github.com/wang0618/PyWebIO/wiki/%5B%E4%B8%AD%E6%96%87%5D-Why-PyWebIO%3F">[Why PyWebIO?]</a>
+</p>
+
+[English](README.md) | [中文](README-zh.md)
+
+PyWebIO提供了一系列命令式的交互函数来在浏览器上获取用户输入和进行输出,将浏览器变成了一个“富文本终端”,可以用于构建简单的Web应用或基于浏览器的GUI应用。
+PyWebIO还可以方便地整合进现有的Web服务,让你不需要编写HTML和JS代码,就可以构建出具有良好可用性的应用。
+
+<p align="center">
+    <img src="https://raw.githubusercontent.com/wang0618/PyWebIO/dev/docs/assets/output_demo.gif" alt="PyWebIO output demo" width='609px'/>
+    <img src="https://raw.githubusercontent.com/wang0618/PyWebIO/dev/docs/assets/input_demo.gif" alt="PyWebIO input demo" width='609px'/>
+</p>
+
+
+功能特性:
+
+- 使用同步而不是基于回调的方式获取输入,代码编写逻辑更自然
+- 非声明式布局,布局方式简单高效
+- 代码侵入性小,旧脚本代码仅需修改输入输出逻辑便可改造为Web服务
+- 支持整合到现有的Web服务,目前支持与Flask、Django、Tornado、aiohttp、FastAPI框架集成
+- 同时支持基于线程的执行模型和基于协程的执行模型
+- 支持结合第三方库实现数据可视化
+
+## Installation
+
+稳定版安装:
+
+```bash
+pip3 install -U pywebio
+```
+
+开发版安装:
+```bash
+pip3 install -U https://code.aliyun.com/wang0618/pywebio/repository/archive.zip
+```
+
+**系统要求**: PyWebIO要求 Python 版本在 3.5.2 及以上
+
+## Quickstart
+
+**Hello, world**
+
+这是一个使用PyWebIO计算 [BMI指数](https://en.wikipedia.org/wiki/Body_mass_index) 的脚本:
+
+```python
+from pywebio.input import input, FLOAT
+from pywebio.output import put_text
+
+def bmi():
+    height = input("请输入你的身高(cm):", type=FLOAT)
+    weight = input("请输入你的体重(kg):", type=FLOAT)
+
+    BMI = weight / (height / 100) ** 2
+
+    top_status = [(14.9, '极瘦'), (18.4, '偏瘦'),
+                  (22.9, '正常'), (27.5, '过重'),
+                  (40.0, '肥胖'), (float('inf'), '非常肥胖')]
+
+    for top, status in top_status:
+        if BMI <= top:
+            put_text('你的 BMI 值: %.1f,身体状态:%s' % (BMI, status))
+            break
+
+if __name__ == '__main__':
+    bmi()
+```
+
+
+如果没有使用PyWebIO,这只是一个非常简单的脚本,而通过使用PyWebIO提供的输入输出函数,你可以在浏览器中与代码进行交互 [[demo]](http://pywebio-demos.demo.wangweimin.site/bmi):
+
+<p align="center">
+    <a href="http://pywebio-demos.demo.wangweimin.site/?pywebio_api=bmi">
+        <img src="https://raw.githubusercontent.com/wang0618/PyWebIO/dev/docs/assets/demo_zh.gif" alt="PyWebIO demo" width="400px"/>
+    </a>
+</p>
+
+**作为Web服务提供**
+
+上文BMI程序会在计算完毕后立刻退出,可以使用 [`pywebio.start_server()`](https://pywebio.readthedocs.io/zh_CN/latest/platform.html#pywebio.platform.tornado.start_server) 将 `bmi()` 函数作为Web服务提供:
+
+```python
+from pywebio import start_server
+from pywebio.input import input, FLOAT
+from pywebio.output import put_text
+
+def bmi():  # bmi() 函数内容不变
+    ...  
+
+if __name__ == '__main__':
+    start_server(bmi, port=80)
+```
+
+**与现有Web框架整合**
+
+Tornado应用整合:仅需在现有的Tornado应用中添加一个 `RequestHandler` ,就可以将PyWebIO应用整合进Tornado Web服务中
+
+```python
+import tornado.ioloop
+import tornado.web
+from pywebio.platform.tornado import webio_handler
+
+class MainHandler(tornado.web.RequestHandler):
+    def get(self):
+        self.write("Hello, world")
+
+if __name__ == "__main__":
+    application = tornado.web.Application([
+        (r"/", MainHandler),
+        (r"/bmi", webio_handler(bmi)),  # bmi 即为上文计算BMI指数的函数
+    ])
+    application.listen(port=80, address='localhost')
+    tornado.ioloop.IOLoop.current().start()
+```
+
+在 `http://localhost/bmi` 页面上就可以计算BMI了。
+
+与其他Web框架整合请见[文档](https://pywebio.readthedocs.io/zh_CN/latest/guide.html#web)
+
+## Demos
+
+ - [基本demo](http://pywebio-demos.demo.wangweimin.site/) : 包含PyWebIO基本输入输出演示和使用PyWebIO编写的小应用
+ - [数据可视化demo](http://pywebio-charts.demo.wangweimin.site/) : 使用 bokeh、plotly、pyecharts 等库进行数据可视化
+
+## Document
+
+使用手册和实现文档见 [https://pywebio.readthedocs.io](https://pywebio.readthedocs.io/zh_CN/latest/)

+ 1 - 162
README.md

@@ -35,7 +35,7 @@
     <a href="https://pywebio.readthedocs.io">[Document]</a> | <a href="http://pywebio-demos.demo.wangweimin.site/">[Demos]</a> | <a href="https://github.com/wang0618/PyWebIO/wiki/Why-PyWebIO%3F">[Why PyWebIO?]</a>
 </p>
 
-[English](#pywebio-en) | [中文](#pywebio-zh)
+[English](README.md) | [中文](README-zh.md)
 
 PyWebIO provides a series of imperative functions to obtain user input and output on the browser, turning the browser into a "rich text terminal", and can be used to build simple web applications or browser-based GUI applications without the need to have knowledge of HTML and JS. PyWebIO can also be easily integrated into existing Web services. PyWebIO is very suitable for quickly building applications that do not require complex UI.
 
@@ -156,164 +156,3 @@ For integration with other web frameworks, please refer to [document](https://py
 ## Document
 
 Document is on [https://pywebio.readthedocs.io](https://pywebio.readthedocs.io)
-
-<hr/>
-<h1 align="center" name="pywebio-zh">PyWebIO</h1>
-<p align="center">
-    <em>Write interactive web app in script way.</em>
-</p>
-<p align="center">
-    <a href="https://percy.io/pywebio/pywebio">
-        <img src="https://percy.io/static/images/percy-badge.svg" alt="Percy visual test">
-    </a>
-    <a href="https://codecov.io/gh/wang0618/PyWebIO">
-        <img src="https://codecov.io/gh/wang0618/PyWebIO/branch/dev/graph/badge.svg" alt="Code coverage"/>
-    </a>
-    <a href="https://www.jsdelivr.com/package/gh/wang0618/PyWebIO-assets">
-        <img src="https://data.jsdelivr.com/v1/package/gh/wang0618/PyWebIO-assets/badge?style=rounded" alt="Jsdelivr hit count"/>
-    <a href="https://pywebio.readthedocs.io/zh_CN/latest/?badge=latest">
-        <img src="https://readthedocs.org/projects/pywebio/badge/?version=latest" alt="Documentation Status">
-    </a>
-    <a href="https://pypi.org/project/PyWebIO/">
-        <img src="https://img.shields.io/pypi/v/pywebio?colorB=brightgreen" alt="Package version">
-    </a>
-    <a href="https://pypi.org/project/PyWebIO/">
-        <img src="https://img.shields.io/badge/python->%3D%203.5.2-brightgreen" alt="Python Version">
-    </a>
-    <br/>
-    <a href="https://lgtm.com/projects/g/wang0618/PyWebIO/context:python">
-        <img src="https://img.shields.io/lgtm/grade/python/github/wang0618/PyWebIO.svg?colorB=brightgreen" alt="Python code quality">
-    </a>
-    <a href="https://lgtm.com/projects/g/wang0618/PyWebIO/context:javascript">
-        <img src="https://img.shields.io/lgtm/grade/javascript/github/wang0618/PyWebIO.svg?colorB=brightgreen" alt="Javascript code quality">
-    </a>
-    <a href="https://github.com/wang0618/PyWebIO/blob/master/LICENSE">
-        <img src="https://img.shields.io/github/license/wang0618/PyWebIO.svg" alt="License">
-    </a>
-    <br/>
-    <a href="https://pywebio.readthedocs.io/zh_CN/latest/">[Document]</a> | <a href="http://pywebio-demos.demo.wangweimin.site/">[Demos]</a> | <a href="https://github.com/wang0618/PyWebIO/wiki/%5B%E4%B8%AD%E6%96%87%5D-Why-PyWebIO%3F">[Why PyWebIO?]</a>
-</p>
-
-[English](#pywebio-en) | [中文](#pywebio-zh)
-
-PyWebIO提供了一系列命令式的交互函数来在浏览器上获取用户输入和进行输出,将浏览器变成了一个“富文本终端”,可以用于构建简单的Web应用或基于浏览器的GUI应用。
-PyWebIO还可以方便地整合进现有的Web服务,让你不需要编写HTML和JS代码,就可以构建出具有良好可用性的应用。
-
-<p align="center">
-    <img src="https://raw.githubusercontent.com/wang0618/PyWebIO/dev/docs/assets/output_demo.gif" alt="PyWebIO output demo" width='609px'/>
-    <img src="https://raw.githubusercontent.com/wang0618/PyWebIO/dev/docs/assets/input_demo.gif" alt="PyWebIO input demo" width='609px'/>
-</p>
-
-
-功能特性:
-
-- 使用同步而不是基于回调的方式获取输入,代码编写逻辑更自然
-- 非声明式布局,布局方式简单高效
-- 代码侵入性小,旧脚本代码仅需修改输入输出逻辑便可改造为Web服务
-- 支持整合到现有的Web服务,目前支持与Flask、Django、Tornado、aiohttp、FastAPI框架集成
-- 同时支持基于线程的执行模型和基于协程的执行模型
-- 支持结合第三方库实现数据可视化
-
-## Installation
-
-稳定版安装:
-
-```bash
-pip3 install -U pywebio
-```
-
-开发版安装:
-```bash
-pip3 install -U https://code.aliyun.com/wang0618/pywebio/repository/archive.zip
-```
-
-**系统要求**: PyWebIO要求 Python 版本在 3.5.2 及以上
-
-## Quickstart
-
-**Hello, world**
-
-这是一个使用PyWebIO计算 [BMI指数](https://en.wikipedia.org/wiki/Body_mass_index) 的脚本:
-
-```python
-from pywebio.input import input, FLOAT
-from pywebio.output import put_text
-
-def bmi():
-    height = input("请输入你的身高(cm):", type=FLOAT)
-    weight = input("请输入你的体重(kg):", type=FLOAT)
-
-    BMI = weight / (height / 100) ** 2
-
-    top_status = [(14.9, '极瘦'), (18.4, '偏瘦'),
-                  (22.9, '正常'), (27.5, '过重'),
-                  (40.0, '肥胖'), (float('inf'), '非常肥胖')]
-
-    for top, status in top_status:
-        if BMI <= top:
-            put_text('你的 BMI 值: %.1f,身体状态:%s' % (BMI, status))
-            break
-
-if __name__ == '__main__':
-    bmi()
-```
-
-
-如果没有使用PyWebIO,这只是一个非常简单的脚本,而通过使用PyWebIO提供的输入输出函数,你可以在浏览器中与代码进行交互 [[demo]](http://pywebio-demos.demo.wangweimin.site/bmi):
-
-<p align="center">
-    <a href="http://pywebio-demos.demo.wangweimin.site/?pywebio_api=bmi">
-        <img src="https://raw.githubusercontent.com/wang0618/PyWebIO/dev/docs/assets/demo_zh.gif" alt="PyWebIO demo" width="400px"/>
-    </a>
-</p>
-
-**作为Web服务提供**
-
-上文BMI程序会在计算完毕后立刻退出,可以使用 [`pywebio.start_server()`](https://pywebio.readthedocs.io/zh_CN/latest/platform.html#pywebio.platform.tornado.start_server) 将 `bmi()` 函数作为Web服务提供:
-
-```python
-from pywebio import start_server
-from pywebio.input import input, FLOAT
-from pywebio.output import put_text
-
-def bmi():  # bmi() 函数内容不变
-    ...  
-
-if __name__ == '__main__':
-    start_server(bmi, port=80)
-```
-
-**与现有Web框架整合**
-
-Tornado应用整合:仅需在现有的Tornado应用中添加一个 `RequestHandler` ,就可以将PyWebIO应用整合进Tornado Web服务中
-
-```python
-import tornado.ioloop
-import tornado.web
-from pywebio.platform.tornado import webio_handler
-
-class MainHandler(tornado.web.RequestHandler):
-    def get(self):
-        self.write("Hello, world")
-
-if __name__ == "__main__":
-    application = tornado.web.Application([
-        (r"/", MainHandler),
-        (r"/bmi", webio_handler(bmi)),  # bmi 即为上文计算BMI指数的函数
-    ])
-    application.listen(port=80, address='localhost')
-    tornado.ioloop.IOLoop.current().start()
-```
-
-在 `http://localhost/bmi` 页面上就可以计算BMI了。
-
-与其他Web框架整合请见[文档](https://pywebio.readthedocs.io/zh_CN/latest/guide.html#web)
-
-## Demos
-
- - [基本demo](http://pywebio-demos.demo.wangweimin.site/) : 包含PyWebIO基本输入输出演示和使用PyWebIO编写的小应用
- - [数据可视化demo](http://pywebio-charts.demo.wangweimin.site/) : 使用 bokeh、plotly、pyecharts 等库进行数据可视化
-
-## Document
-
-使用手册和实现文档见 [https://pywebio.readthedocs.io](https://pywebio.readthedocs.io/zh_CN/latest/)

+ 3 - 1
docs/guide.rst

@@ -540,7 +540,7 @@ When performing some continuous output (such as log output), you may want to scr
 
 By default, PyWebIO will use the fade-in animation effect to display the content. You can use `set_env(output_animation=False) <pywebio.session.set_env>` to turn off the animation.
 
-To view the effects of environment settings, please visit :demo_host:`set_env Demo </?pywebio_api=set_env_demo>`
+To view the effects of environment settings, please visit :demo_host:`set_env Demo </set_env_demo>`
 
 Layout
 ^^^^^^^^^^^^^^
@@ -617,6 +617,8 @@ In PyWebIO, there are two modes to run PyWebIO applications: running as a script
 Overview
 ^^^^^^^^^^^^^^
 
+.. _server_mode:
+
 **Server mode**
 
 In server mode, PyWebIO will start a web server to continuously provide services. When the user accesses the service address, PyWebIO will open a new session and run PyWebIO application in it.

+ 1 - 1
docs/index.rst

@@ -61,7 +61,7 @@ This is just a very simple script if you ignore PyWebIO, but after using the inp
    :width: 450px
    :align: center
 
-In the last line of the above code, changing the function call ``bmi()`` to `pywebio.start_server(bmi, port=80) <pywebio.platform.tornado.start_server>` will start a bmi web service on port 80 ( :demo_host:`online Demo </?pywebio_api=bmi>` ).
+In the last line of the above code, changing the function call ``bmi()`` to `pywebio.start_server(bmi, port=80) <pywebio.platform.tornado.start_server>` will start a bmi web service on port 80 ( :demo_host:`online Demo </bmi>` ).
 
 If you want to integrate the ``bmi()`` service into an existing web framework, you can visit :ref:`Integration with a web framework <integration_web_framework>` section of this document.
 

+ 116 - 116
docs/locales/zh_CN/LC_MESSAGES/guide.po

@@ -7,8 +7,8 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PyWebIO 1.1.0\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-05-30 16:42+0800\n"
-"PO-Revision-Date: 2021-05-30 16:42+0800\n"
+"POT-Creation-Date: 2021-06-11 21:51+0800\n"
+"PO-Revision-Date: 2021-06-11 21:53+0800\n"
 "Last-Translator: WangWeimin <wang0.618@qq.com>\n"
 "Language: zh_CN\n"
 "Language-Team: \n"
@@ -833,8 +833,8 @@ msgid ""
 msgstr "PyWebIO在输出内容时默认会使用淡入的动画效果来显示内容,可使用 `set_env(output_animation=False) <pywebio.session.set_env>` 来关闭动画。"
 
 #: ../../guide.rst:543
-msgid "To view the effects of environment settings, please visit :demo_host:`set_env Demo </?pywebio_api=set_env_demo>`"
-msgstr "有关不同环境配置的效果可查看 :demo_host:`set_env Demo </?pywebio_api=set_env_demo>`"
+msgid "To view the effects of environment settings, please visit :demo_host:`set_env Demo </set_env_demo>`"
+msgstr "有关不同环境配置的效果可查看 :demo_host:`set_env Demo </set_env_demo>`"
 
 #: ../../guide.rst:546
 msgid "Layout"
@@ -897,22 +897,22 @@ msgstr "put_row([put_image(…), put_image(…)], size='40% 60%')  # 左右两
 msgid "For more information, please refer to the :ref:`layout functions documentation <style_and_layout>`."
 msgstr "更多布局函数的用法及代码示例请查阅 :ref:`布局函数文档 <style_and_layout>` ."
 
-#: ../../guide.rst:588
+#: ../../guide.rst:590
 msgid "Style"
 msgstr "样式"
 
-#: ../../guide.rst:590
+#: ../../guide.rst:592
 msgid ""
 "If you are familiar with `CSS <https://en.wikipedia.org/wiki/CSS>`_ styles, you can use the ``style()`` method of output return to set a custom "
 "style for the output."
 msgstr ""
 "如果你熟悉 `CSS样式 <https://www.google.com/search?q=CSS%E6%A0%B7%E5%BC%8F>`_ ,你还可以在输出函数后调用 ``style()`` 方法给输出设定自定义样式。"
 
-#: ../../guide.rst:593
+#: ../../guide.rst:595
 msgid "You can set the CSS style for a single ``put_xxx()`` output:"
 msgstr "可以给单个的 ``put_xxx()`` 输出设定CSS样式,也可以配合组合输出使用:"
 
-#: ../../guide.rst:595
+#: ../../guide.rst:597
 msgid ""
 "put_text('hello').style('color: red; font-size: 20px')\n"
 "\n"
@@ -923,11 +923,11 @@ msgid ""
 "]).style('margin-top: 20px')"
 msgstr ""
 
-#: ../../guide.rst:611
+#: ../../guide.rst:613
 msgid "Server mode and Script mode"
 msgstr "Server模式与Script模式"
 
-#: ../../guide.rst:613
+#: ../../guide.rst:615
 msgid ""
 "In PyWebIO, there are two modes to run PyWebIO applications: running as a script and using `start_server() <pywebio.platform.tornado.start_server>` "
 "or `path_deploy() <pywebio.platform.path_deploy>` to run as a web service."
@@ -935,21 +935,21 @@ msgstr ""
 "在PyWebIO中,有两种方式用来运行PyWebIO应用:作为脚本运行和使用 `start_server() <pywebio.platform.tornado.start_server>` 或 `path_deploy() <pywebio."
 "platform.path_deploy>` 来作为Web服务运行。"
 
-#: ../../guide.rst:616
+#: ../../guide.rst:618
 msgid "Overview"
 msgstr ""
 
-#: ../../guide.rst:618 ../../guide.rst:692
+#: ../../guide.rst:620 ../../guide.rst:694
 msgid "**Server mode**"
 msgstr "**Server模式**"
 
-#: ../../guide.rst:620
+#: ../../guide.rst:622
 msgid ""
 "In server mode, PyWebIO will start a web server to continuously provide services. When the user accesses the service address, PyWebIO will open a "
 "new session and run PyWebIO application in it."
 msgstr "在Server模式下,PyWebIO会启动一个Web服务来持续性地提供服务。当用户访问服务地址时,PyWebIO会开启一个新会话并运行PyWebIO应用。"
 
-#: ../../guide.rst:622
+#: ../../guide.rst:624
 msgid ""
 "Use `start_server() <pywebio.platform.tornado.start_server>` to start a web server and serve given PyWebIO applications on it. `start_server() "
 "<pywebio.platform.tornado.start_server>` accepts a function as PyWebIO application. In addition, `start_server() <pywebio.platform.tornado."
@@ -961,7 +961,7 @@ msgstr ""
 "也支持使用函数列表或字典,从而使一个PyWebIO Server下可以有多个不同功能的服务,服务之间可以通过 `go_app() <pywebio.session.go_app>` 或 `put_link() "
 "<pywebio.output.put_link>` 进行跳转::"
 
-#: ../../guide.rst:624
+#: ../../guide.rst:626
 msgid ""
 "def task_1():\n"
 "    put_text('task_1')\n"
@@ -997,7 +997,7 @@ msgstr ""
 "# 等价于 start_server({'index': index, 'task_1': task_1, 'task_2': task_2})\n"
 "start_server([index, task_1, task_2])"
 
-#: ../../guide.rst:642
+#: ../../guide.rst:644
 msgid ""
 "The `start_server() <pywebio.platform.tornado.start_server>` provide a remote access support, when enabled (by passing `remote_access=True` to "
 "`start_server()`), you can get a temporary public network access address for the current application, others can access your application via this "
@@ -1008,7 +1008,7 @@ msgstr ""
 "`remote_access=True` 开启 ),你将会得到一个用于访问当前应用的临时的公网访问地址,其他人任何都可以使用此地址访问你的应用。远程接入可以很方便地将应用"
 "临时分享给其他人。当前远程接入功能由 `localhost.run <https://localhost.run>`_ 提供。"
 
-#: ../../guide.rst:644
+#: ../../guide.rst:646
 msgid ""
 "Use `path_deploy() <pywebio.platform.path_deploy>` to deploy the PyWebIO applications from a directory. The python file under this directory need "
 "contain the ``main`` function to be seen as the PyWebIO application. You can access the application by using the file path as the URL."
@@ -1016,11 +1016,11 @@ msgstr ""
 "使用 `path_deploy() <pywebio.platform.path_deploy>` 可以从一个路径中部署PyWebIO应用。位于该路径下的python文件需要包含名字为 ``main`` 的PyWebIO任务函"
 "数才能被视为PyWebIO应用程序。服务端会根据用户访问的URL来确定需要加载的文件并从中读取PyWebIO应用来运行。"
 
-#: ../../guide.rst:648
+#: ../../guide.rst:650
 msgid "For example, given the following folder structure::"
 msgstr "例如,给定如下文件结构::"
 
-#: ../../guide.rst:650
+#: ../../guide.rst:652
 msgid ""
 ".\n"
 "├── A\n"
@@ -1030,7 +1030,7 @@ msgid ""
 "└── c.py"
 msgstr ""
 
-#: ../../guide.rst:657
+#: ../../guide.rst:659
 msgid ""
 "If you use this directory in `path_deploy() <pywebio.platform.path_deploy>`, you can access the PyWebIO application in ``b.py`` by using URL "
 "``http://<host>:<port>/A/b``. And if the files have been modified after run `path_deploy() <pywebio.platform.path_deploy>`, you can use ``reload`` "
@@ -1040,7 +1040,7 @@ msgstr ""
 "用。当文件在运行 `path_deploy() <pywebio.platform.path_deploy>` 之后被修改,可以使用 ``reload`` URL参数来重载文件: ``http://<host>:<port>/A/b?"
 "reload``"
 
-#: ../../guide.rst:660
+#: ../../guide.rst:662
 msgid ""
 "You can also use the command ``pywebio-path-deploy`` to start a server just like using `path_deploy() <pywebio.platform.path_deploy>`. For more "
 "information, refer ``pywebio-path-deploy --help``"
@@ -1048,7 +1048,7 @@ msgstr ""
 "你还可以使用 ``pywebio-path-deploy`` 命令来启动一个和 `path_deploy() <pywebio.platform.path_deploy>` 效果一样的server。关于命令的更多信息请查阅命令"
 "帮助: ``pywebio-path-deploy --help``"
 
-#: ../../guide.rst:662
+#: ../../guide.rst:664
 msgid ""
 "In Server mode, you can use `pywebio.platform.seo()` to set the `SEO <https://en.wikipedia.org/wiki/Search_engine_optimization>`_ information. If "
 "``seo()`` is not used, the `docstring <https://www.python.org/dev/peps/pep-0257/>`_ of the task function will be regarded as SEO information by "
@@ -1057,13 +1057,13 @@ msgstr ""
 "在Server模式下,可以使用 `pywebio.platform.seo()` 函数来设置任务函数SEO信息(在被搜索引擎索引时提供的网页信息,包含应用标题和应用简介),如果不使用 "
 "``seo()`` 函数,默认条件下,PyWebIO会将任务函数的函数注释作为SEO信息(应用标题和简介之间使用一个空行分隔)。 "
 
-#: ../../guide.rst:666
+#: ../../guide.rst:668
 msgid ""
 "Note that in Server mode, all functions from ``input``, ``output`` and ``session`` modules can only be called in the context of task functions. For "
 "example, the following code is **not allowed**::"
 msgstr "注意,在Server模式下, ``input`` 、 ``output`` 和 ``session`` 模块内的函数仅能在任务函数上下文中进行调用。比如如下调用是 **不被允许的** ::"
 
-#: ../../guide.rst:668
+#: ../../guide.rst:670
 msgid ""
 "import pywebio\n"
 "from pywebio.input import input\n"
@@ -1072,15 +1072,15 @@ msgid ""
 "pywebio.start_server(my_task_func, port=int(port))"
 msgstr ""
 
-#: ../../guide.rst:675 ../../guide.rst:688
+#: ../../guide.rst:677 ../../guide.rst:690
 msgid "**Script mode**"
 msgstr "**Script模式**"
 
-#: ../../guide.rst:677
+#: ../../guide.rst:679
 msgid "In Script mode, PyWebIO input and output functions can be called anywhere."
 msgstr "Script模式下,在任何位置都可以调用PyWebIO的交互函数。"
 
-#: ../../guide.rst:679
+#: ../../guide.rst:681
 msgid ""
 "If the user closes the browser before the end of the session, then calls to PyWebIO input and output functions in the session will cause a "
 "`SessionException <pywebio.exceptions.SessionException>` exception."
@@ -1088,15 +1088,15 @@ msgstr ""
 "如果用户在会话结束之前关闭了浏览器,那么之后会话内对于PyWebIO交互函数的调用将会引发一个 `SessionException <pywebio.exceptions.SessionException>` 异"
 "常。"
 
-#: ../../guide.rst:684
+#: ../../guide.rst:686
 msgid "Concurrent"
 msgstr "并发"
 
-#: ../../guide.rst:686
+#: ../../guide.rst:688
 msgid "PyWebIO can be used in a multi-threading environment."
 msgstr "PyWebIO 支持在多线程环境中使用。"
 
-#: ../../guide.rst:690
+#: ../../guide.rst:692
 msgid ""
 "In Script mode, you can freely start new thread and call PyWebIO interactive functions in it. When all `non-daemonic <https://docs.python.org/3/"
 "library/threading.html#thread-objects>`_ threads finish running, the script exits."
@@ -1104,7 +1104,7 @@ msgstr ""
 "在 Script模式下,你可以自由地启动线程,并在其中调用PyWebIO的交互函数。当所有非 `Daemon线程 <https://docs.python.org/3/library/threading.html#thread-"
 "objects>`_ 运行结束后,脚本退出。"
 
-#: ../../guide.rst:694
+#: ../../guide.rst:696
 msgid ""
 "In Server mode, if you need to use PyWebIO interactive functions in new thread, you need to use `register_thread(thread) <pywebio.session."
 "register_thread>` to register the new thread (so that PyWebIO can know which session the thread belongs to). If the PyWebIO interactive function is "
@@ -1119,11 +1119,11 @@ msgstr ""
 "理,其调用PyWebIO的交互函数将会产生 `SessionNotFoundException <pywebio.exceptions.SessionNotFoundException>` 异常。\n"
 "当会话的任务函数和会话内通过 `register_thread(thread) <pywebio.session.register_thread>` 注册的线程都结束运行时,会话关闭。"
 
-#: ../../guide.rst:696
+#: ../../guide.rst:698
 msgid "Example of using multi-threading in Server mode::"
 msgstr "Server模式下多线程的使用示例::"
 
-#: ../../guide.rst:698
+#: ../../guide.rst:700
 msgid ""
 "def show_time():\n"
 "    while True:\n"
@@ -1146,11 +1146,11 @@ msgid ""
 "start_server(app, port=8080, debug=True)"
 msgstr ""
 
-#: ../../guide.rst:722 ../../guide.rst:1013
+#: ../../guide.rst:724 ../../guide.rst:1015
 msgid "Close of session"
 msgstr "会话的结束"
 
-#: ../../guide.rst:724
+#: ../../guide.rst:726
 msgid ""
 "The close of session may also be caused by the user closing the browser page. After the browser page is closed, PyWebIO input function calls that "
 "have not yet returned in the current session will cause `SessionClosedException <pywebio.exceptions.SessionClosedException>`, and subsequent calls "
@@ -1161,7 +1161,7 @@ msgstr ""
 "SessionClosedException>` 异常,之后对于PyWebIO交互函数的调用将会产生 `SessionNotFoundException <pywebio.exceptions.SessionNotFoundException>` 或 "
 "`SessionClosedException <pywebio.exceptions.SessionClosedException>` 异常。"
 
-#: ../../guide.rst:726
+#: ../../guide.rst:728
 msgid ""
 "You can use `defer_call(func) <pywebio.session.defer_call>` to set the function to be called when the session closes. Whether it is because the "
 "user closes the page or the task finishes to cause session closed, the function set by `defer_call(func) <pywebio.session.defer_call>` will be "
@@ -1173,11 +1173,11 @@ msgstr ""
 "`defer_call(func) <pywebio.session.defer_call>` 可以用于资源清理等工作。在会话中可以多次调用 `defer_call() <pywebio.session.defer_call>` ,会话结束后"
 "将会顺序执行设置的函数。"
 
-#: ../../guide.rst:731
+#: ../../guide.rst:733
 msgid "Integration with web framework"
 msgstr "与Web框架集成"
 
-#: ../../guide.rst:733
+#: ../../guide.rst:735
 msgid ""
 "The PyWebIO application can be integrated into an existing Python Web project, the PyWebIO application and the Web project share a web framework. "
 "PyWebIO currently supports integration with Flask, Tornado, Django, aiohttp and FastAPI(Starlette) web frameworks."
@@ -1185,19 +1185,19 @@ msgstr ""
 "可以将PyWebIO应用集成到现有的Python Web项目中,PyWebIO应用与Web项目共用一个Web框架。目前支持与Flask、Tornado、Django、aiohttp和FastAPI(Starlette) "
 "Web框架的集成。"
 
-#: ../../guide.rst:735
+#: ../../guide.rst:737
 msgid "The integration methods of those web frameworks are as follows:"
 msgstr "不同Web框架的集成方法如下: "
 
-#: ../../guide.rst:739
+#: ../../guide.rst:741
 msgid "Tornado"
 msgstr ""
 
-#: ../../guide.rst:743
+#: ../../guide.rst:745
 msgid "**Tornado**"
 msgstr ""
 
-#: ../../guide.rst:745
+#: ../../guide.rst:747
 msgid ""
 "Use `pywebio.platform.tornado.webio_handler()` to get the `WebSocketHandler <https://www.tornadoweb.org/en/stable/websocket.html#tornado.websocket."
 "WebSocketHandler>`_ class for running PyWebIO applications in Tornado::"
@@ -1205,7 +1205,7 @@ msgstr ""
 "使用 `pywebio.platform.tornado.webio_handler()` 来获取在Tornado中运行PyWebIO应用的 `WebSocketHandler <https://www.tornadoweb.org/en/stable/"
 "websocket.html#tornado.websocket.WebSocketHandler>`_ 类::"
 
-#: ../../guide.rst:747
+#: ../../guide.rst:749
 msgid ""
 "import tornado.ioloop\n"
 "import tornado.web\n"
@@ -1224,13 +1224,13 @@ msgid ""
 "    tornado.ioloop.IOLoop.current().start()"
 msgstr ""
 
-#: ../../guide.rst:764
+#: ../../guide.rst:766
 msgid ""
 "In above code, we add a routing rule to bind the ``WebSocketHandler`` of the PyWebIO application to the ``/tool`` path. After starting the Tornado "
 "server, you can visit ``http://localhost/tool`` to open the PyWebIO application."
 msgstr "以上代码将 PyWebIO 应用的 ``WebSocketHandler`` 绑定到了 ``/tool`` 路径下。 启动Tornado后,访问 ``http://localhost/tool``即可打开PyWebIO应用。"
 
-#: ../../guide.rst:769
+#: ../../guide.rst:771
 msgid ""
 "PyWebIO uses the WebSocket protocol to communicate with the browser in Tornado. If your Tornado application is behind a reverse proxy (such as "
 "Nginx), you may need to configure the reverse proxy to support the WebSocket protocol. :ref:`Here <nginx_ws_config>` is an example of Nginx "
@@ -1239,19 +1239,19 @@ msgstr ""
 "当使用Tornado后端时,PyWebIO使用WebSocket协议和浏览器进行通讯,如果你的Tornado应用处在反向代理(比如Nginx)之后,可能需要特别配置反向代理来支持"
 "WebSocket协议,:ref:`这里 <nginx_ws_config>` 有一个Nginx配置WebSocket的例子。"
 
-#: ../../guide.rst:771
+#: ../../guide.rst:773
 msgid "Flask"
 msgstr ""
 
-#: ../../guide.rst:775
+#: ../../guide.rst:777
 msgid "**Flask**"
 msgstr ""
 
-#: ../../guide.rst:777
+#: ../../guide.rst:779
 msgid "Use `pywebio.platform.flask.webio_view()` to get the view function for running PyWebIO applications in Flask::"
 msgstr "使用 `pywebio.platform.flask.webio_view()` 来获取在Flask中运行PyWebIO应用的视图函数::"
 
-#: ../../guide.rst:779
+#: ../../guide.rst:781
 msgid ""
 "from pywebio.platform.flask import webio_view\n"
 "from flask import Flask\n"
@@ -1265,7 +1265,7 @@ msgid ""
 "app.run(host='localhost', port=80)"
 msgstr ""
 
-#: ../../guide.rst:791
+#: ../../guide.rst:793
 msgid ""
 "In above code, we add a routing rule to bind the view function of the PyWebIO application to the ``/tool`` path. After starting the Flask "
 "application, visit ``http://localhost/tool`` to open the PyWebIO application."
@@ -1273,19 +1273,19 @@ msgstr ""
 "以上代码使用添加了一条路由规则将PyWebIO应用的视图函数绑定到 ``/tool`` 路径下。\n"
 "启动Flask应用后,访问 ``http://localhost/tool`` 即可打开PyWebIO应用"
 
-#: ../../guide.rst:794
+#: ../../guide.rst:796
 msgid "Django"
 msgstr ""
 
-#: ../../guide.rst:798
+#: ../../guide.rst:800
 msgid "**Django**"
 msgstr ""
 
-#: ../../guide.rst:800
+#: ../../guide.rst:802
 msgid "Use `pywebio.platform.django.webio_view()` to get the view function for running PyWebIO applications in Django::"
 msgstr "使用 `pywebio.platform.django.webio_view()` 来获取在Django中运行PyWebIO应用的视图函数::"
 
-#: ../../guide.rst:802
+#: ../../guide.rst:804
 msgid ""
 "# urls.py\n"
 "\n"
@@ -1300,7 +1300,7 @@ msgid ""
 "]"
 msgstr ""
 
-#: ../../guide.rst:815
+#: ../../guide.rst:817
 msgid ""
 "In above code, we add a routing rule to bind the view function of the PyWebIO application to the ``/tool`` path. After starting the Django server, "
 "visit ``http://localhost/tool`` to open the PyWebIO application"
@@ -1308,15 +1308,15 @@ msgstr ""
 "以上代码使用添加了一条路由规则将PyWebIO应用的视图函数绑定到 ``/tool`` 路径下。\n"
 "启动Django应用后,访问 ``http://localhost/tool`` 即可打开PyWebIO应用"
 
-#: ../../guide.rst:818
+#: ../../guide.rst:820
 msgid "aiohttp"
 msgstr ""
 
-#: ../../guide.rst:822
+#: ../../guide.rst:824
 msgid "**aiohttp**"
 msgstr ""
 
-#: ../../guide.rst:824
+#: ../../guide.rst:826
 msgid ""
 "Use `pywebio.platform.aiohttp.webio_handler()` to get the `Request Handler <https://docs.aiohttp.org/en/stable/web_quickstart.html#aiohttp-web-"
 "handler>`_ coroutine for running PyWebIO applications in aiohttp::"
@@ -1324,7 +1324,7 @@ msgstr ""
 "使用 `pywebio.platform.aiohttp.webio_handler()` 来获取在aiohttp中运行PyWebIO应用的 `Request Handler <https://docs.aiohttp.org/en/stable/"
 "web_quickstart.html#aiohttp-web-handler>`_ 协程::"
 
-#: ../../guide.rst:826
+#: ../../guide.rst:828
 msgid ""
 "from aiohttp import web\n"
 "from pywebio.platform.aiohttp import webio_handler\n"
@@ -1336,11 +1336,11 @@ msgid ""
 "web.run_app(app, host='localhost', port=80)"
 msgstr ""
 
-#: ../../guide.rst:835
+#: ../../guide.rst:837
 msgid "After starting the aiohttp server, visit ``http://localhost/tool`` to open the PyWebIO application"
 msgstr "启动aiohttp应用后,访问 ``http://localhost/tool`` 即可打开PyWebIO应用"
 
-#: ../../guide.rst:839
+#: ../../guide.rst:841
 msgid ""
 "PyWebIO uses the WebSocket protocol to communicate with the browser in aiohttp. If your aiohttp server is behind a reverse proxy (such as Nginx), "
 "you may need to configure the reverse proxy to support the WebSocket protocol. :ref:`Here <nginx_ws_config>` is an example of Nginx WebSocket "
@@ -1349,26 +1349,26 @@ msgstr ""
 "当使用aiohttp后端时,PyWebIO使用WebSocket协议和浏览器进行通讯,如果你的aiohttp应用处在反向代理(比如Nginx)之后,\n"
 "可能需要特别配置反向代理来支持WebSocket协议,:ref:`这里 <nginx_ws_config>` 有一个Nginx配置WebSocket的例子。"
 
-#: ../../guide.rst:842
+#: ../../guide.rst:844
 msgid "FastAPI/Starlette"
 msgstr ""
 
-#: ../../guide.rst:846
+#: ../../guide.rst:848
 msgid "**FastAPI/Starlette**"
 msgstr ""
 
-#: ../../guide.rst:848
+#: ../../guide.rst:850
 msgid ""
 "Use `pywebio.platform.fastapi.webio_routes()` to get the FastAPI/Starlette routes for running PyWebIO applications. You can mount the routes to "
 "your FastAPI/Starlette app."
 msgstr ""
 "使用 `pywebio.platform.fastapi.webio_routes()` 来获取在FastAPI/Starlette中运行PyWebIO应用的路由组件,你可以将其挂载在到FastAPI/Starlette应用中。"
 
-#: ../../guide.rst:851
+#: ../../guide.rst:853
 msgid "FastAPI::"
 msgstr ""
 
-#: ../../guide.rst:853
+#: ../../guide.rst:855
 msgid ""
 "from fastapi import FastAPI\n"
 "from pywebio.platform.fastapi import webio_routes\n"
@@ -1383,11 +1383,11 @@ msgid ""
 "app.mount(\"/tool\", FastAPI(routes=webio_routes(task_func)))"
 msgstr ""
 
-#: ../../guide.rst:865
+#: ../../guide.rst:867
 msgid "Starlette::"
 msgstr ""
 
-#: ../../guide.rst:867
+#: ../../guide.rst:869
 msgid ""
 "from starlette.applications import Starlette\n"
 "from starlette.responses import JSONResponse\n"
@@ -1403,17 +1403,17 @@ msgid ""
 "])"
 msgstr ""
 
-#: ../../guide.rst:880
+#: ../../guide.rst:882
 msgid "After starting the server by using ``uvicorn <module>:app`` , visit ``http://localhost:8000/tool/`` to open the PyWebIO application"
 msgstr "使用 ``uvicorn <module>:app` 启动server后,访问 ``http://localhost:8000/tool/`` 即可打开PyWebIO应用"
 
-#: ../../guide.rst:882
+#: ../../guide.rst:884
 msgid ""
 "See also: `FastAPI doc <https://fastapi.tiangolo.com/advanced/sub-applications/>`_ , `Starlette doc <https://www.starlette.io/routing/#submounting-"
 "routes>`_"
 msgstr ""
 
-#: ../../guide.rst:886
+#: ../../guide.rst:888
 msgid ""
 "PyWebIO uses the WebSocket protocol to communicate with the browser in FastAPI/Starlette. If your server is behind a reverse proxy (such as Nginx), "
 "you may need to configure the reverse proxy to support the WebSocket protocol. :ref:`Here <nginx_ws_config>` is an example of Nginx WebSocket "
@@ -1422,15 +1422,15 @@ msgstr ""
 "当使用FastAPI或Starlette后端时,PyWebIO使用WebSocket协议和浏览器进行通讯,如果你的aiohttp应用处在反向代理(比如Nginx)之后,\n"
 "可能需要特别配置反向代理来支持WebSocket协议,:ref:`这里 <nginx_ws_config>` 有一个Nginx配置WebSocket的例子。"
 
-#: ../../guide.rst:892
+#: ../../guide.rst:894
 msgid "Notes"
 msgstr ""
 
-#: ../../guide.rst:893
+#: ../../guide.rst:895
 msgid "**Deployment in production**"
 msgstr "**生产环境部署**"
 
-#: ../../guide.rst:895
+#: ../../guide.rst:897
 msgid ""
 "In your production system, you may want to deploy the web applications with some WSGI/ASGI servers such as uWSGI, Gunicorn, and Uvicorn. Since "
 "PyWebIO applications store session state in memory of process, when you use HTTP-based sessions (Flask and Django) and spawn multiple workers to "
@@ -1441,7 +1441,7 @@ msgstr ""
 "基于 HTTP 的会话(使用Flask 和 Django后端时)并生成多个进程来处理请求时,请求可能会被分发到错误的进程中。因此,在使用基于 HTTP 的会话时,只能启动一"
 "个进程来处理请求。"
 
-#: ../../guide.rst:900
+#: ../../guide.rst:902
 msgid ""
 "If you still want to use multiple processes to increase concurrency, one way is to use Uvicorn+FastAPI, or you can also start multiple Tornado/"
 "aiohttp processes and add external load balancer (such as HAProxy or nginx) before them. Those backends use the WebSocket protocol to communicate "
@@ -1450,11 +1450,11 @@ msgstr ""
 "如果仍然希望使用多进程来提高并发,一种方式是使用 Uvicorn+FastAPI,或者你也可以启动多个Tornado/aiohttp进程,并在它们之前添加外部的负载均衡软件(如 "
 "HAProxy 或 nginx)。这些后端使用 WebSocket 协议与浏览器进行通信,所以不存在上述问题。"
 
-#: ../../guide.rst:903
+#: ../../guide.rst:905
 msgid "**Static resources Hosting**"
 msgstr "**PyWebIO静态资源的托管**"
 
-#: ../../guide.rst:905
+#: ../../guide.rst:907
 msgid ""
 "By default, the front-end of PyWebIO gets required static resources from CDN. If you want to deploy PyWebIO applications in an offline environment, "
 "you need to host static files by yourself, and set the ``cdn`` parameter of ``webio_view()`` or ``webio_handler()`` to ``False``."
@@ -1462,7 +1462,7 @@ msgstr ""
 "PyWebIO默认使用CDN来获取前端的静态资源,如果要将PyWebIO应用部署到离线环境中,需要自行托管静态文件,\n"
 "并将 ``webio_view()`` 或 ``webio_handler()`` 的 ``cdn`` 参数设置为 ``False`` 。"
 
-#: ../../guide.rst:907
+#: ../../guide.rst:909
 msgid ""
 "When setting ``cdn=False`` , you need to host the static resources in the same directory as the PyWebIO application. In addition, you can also pass "
 "a string to ``cdn`` parameter to directly set the URL of PyWebIO static resources directory."
@@ -1470,30 +1470,30 @@ msgstr ""
 "``cdn=False``  时需要将静态资源托管在和PyWebIO应用同级的目录下。\n"
 "同时,也可以通过 ``cdn`` 参数直接设置PyWebIO静态资源的URL目录。"
 
-#: ../../guide.rst:910
+#: ../../guide.rst:912
 msgid ""
 "The path of the static file of PyWebIO is stored in ``pywebio.STATIC_PATH``, you can use the command ``python3 -c \"import pywebio; print(pywebio."
 "STATIC_PATH)\"`` to print it out."
 msgstr ""
 "PyWebIO的静态文件的路径保存在 ``pywebio.STATIC_PATH`` 中,可使用命令 ``python3 -c \"import pywebio; print(pywebio.STATIC_PATH)\"`` 将其打印出来。"
 
-#: ../../guide.rst:912
+#: ../../guide.rst:914
 msgid ""
 "``start_server()`` and ``path_deploy()`` also support ``cdn`` parameter, if it is set to ``False``, the static resource will be hosted in local "
 "server automatically, without manual hosting."
 msgstr "使用 ``start_server()`` 启动的应用,如果将 ``cdn`` 参数设置为 ``False`` ,会自动启动一个本地的静态资源托管服务,无需手动托管。"
 
-#: ../../guide.rst:918
+#: ../../guide.rst:920
 msgid "Coroutine-based session"
 msgstr "基于协程的会话"
 
-#: ../../guide.rst:920
+#: ../../guide.rst:922
 msgid ""
 "This section will introduce the advanced features of PyWebIO --- coroutine-based session. In most cases, you don’t need it. All functions or "
 "methods in PyWebIO that are only used for coroutine sessions are specifically noted in the document."
 msgstr "关于协程内容属于高级特性,您不必使用此部分也可以实现PyWebIO支持的全部功能。PyWebIO中所有仅用于协程会话的函数或方法都在文档中有特别说明。"
 
-#: ../../guide.rst:922
+#: ../../guide.rst:924
 msgid ""
 "PyWebIO's session is based on thread by default. Each time a user opens a session connection to the server, PyWebIO will start a thread to run the "
 "task function. In addition to thread-based sessions, PyWebIO also provides coroutine-based sessions. Coroutine-based sessions accept coroutine "
@@ -1502,7 +1502,7 @@ msgstr ""
 "PyWebIO的会话实现默认是基于线程的,用户每打开一个和服务端的会话连接,PyWebIO会启动一个线程来运行任务函数。\n"
 "除了基于线程的会话,PyWebIO还提供了基于协程的会话。基于协程的会话接受协程函数作为任务函数。"
 
-#: ../../guide.rst:924
+#: ../../guide.rst:926
 msgid ""
 "The session based on the coroutine is a single-thread model, which means that all sessions run in a single thread. For IO-bound tasks, coroutines "
 "take up fewer resources than threads and have performance comparable to threads. In addition, the context switching of the coroutine is "
@@ -1511,17 +1511,17 @@ msgstr ""
 "基于协程的会话为单线程模型,所有会话都运行在一个线程内。对于IO密集型的任务,协程比线程占用更少的资源同时又拥有媲美于线程的性能。\n"
 "另外,协程的上下文切换具有可预测性,能够减少程序同步与加锁的需要,可以有效避免大多数临界区问题。"
 
-#: ../../guide.rst:927
+#: ../../guide.rst:929
 msgid "Using coroutine session"
 msgstr "使用协程会话"
 
-#: ../../guide.rst:929
+#: ../../guide.rst:931
 msgid ""
 "To use coroutine-based session, you need to use the ``async`` keyword to declare the task function as a coroutine function, and use the ``await`` "
 "syntax to call the PyWebIO input function:"
 msgstr "要使用基于协程的会话,需要使用 ``async`` 关键字将任务函数声明为协程函数,并使用 ``await`` 语法调用PyWebIO输入函数:"
 
-#: ../../guide.rst:931
+#: ../../guide.rst:933
 #, python-format
 msgid ""
 " from pywebio.input import *\n"
@@ -1535,7 +1535,7 @@ msgid ""
 " start_server(say_hello, auto_open_webbrowser=True)"
 msgstr ""
 
-#: ../../guide.rst:945
+#: ../../guide.rst:947
 msgid ""
 "In the coroutine task function, you can also use ``await`` to call other coroutines or ( `awaitable objects <https://docs.python.org/3/library/"
 "asyncio-task.html#asyncio-awaitables>`_ ) in the standard library `asyncio <https://docs.python.org/3/library/asyncio.html>`_:"
@@ -1543,7 +1543,7 @@ msgstr ""
 "在协程任务函数中,也可以使用 ``await`` 调用其他协程或标准库 `asyncio <https://docs.python.org/3/library/asyncio.html>`_ 中的可等待对象( `awaitable "
 "objects <https://docs.python.org/3/library/asyncio-task.html#asyncio-awaitables>`_ ):"
 
-#: ../../guide.rst:947
+#: ../../guide.rst:949
 msgid ""
 " import asyncio\n"
 " from pywebio import start_server\n"
@@ -1560,7 +1560,7 @@ msgid ""
 " start_server(main, auto_open_webbrowser=True)"
 msgstr ""
 
-#: ../../guide.rst:966
+#: ../../guide.rst:968
 msgid ""
 "In coroutine-based session, all input functions defined in the :doc:`pywebio.input </input>` module need to use ``await`` syntax to get the return "
 "value. Forgetting to use ``await`` will be a common error when using coroutine-based session."
@@ -1568,47 +1568,47 @@ msgstr ""
 "在基于协程的会话中, :doc:`pywebio.input </input>` 模块中的定义输入函数都需要使用 ``await`` 语法来获取返回值,忘记使用 ``await`` 将会是在使用基于协"
 "程的会话时常出现的错误。"
 
-#: ../../guide.rst:968
+#: ../../guide.rst:970
 msgid "Other functions that need to use ``await`` syntax in the coroutine session are:"
 msgstr "其他在协程会话中也需要使用 ``await`` 语法来进行调用函数有:"
 
-#: ../../guide.rst:970
+#: ../../guide.rst:972
 msgid "`pywebio.session.run_asyncio_coroutine(coro_obj) <pywebio.session.run_asyncio_coroutine>`"
 msgstr ""
 
-#: ../../guide.rst:971
+#: ../../guide.rst:973
 msgid "`pywebio.session.eval_js(expression) <pywebio.session.eval_js>`"
 msgstr ""
 
-#: ../../guide.rst:972
+#: ../../guide.rst:974
 msgid "`pywebio.session.hold() <pywebio.session.hold>`"
 msgstr ""
 
-#: ../../guide.rst:976
+#: ../../guide.rst:978
 msgid ""
 "Although the PyWebIO coroutine session is compatible with the ``awaitable objects`` in the standard library ``asyncio``, the ``asyncio`` library is "
 "not compatible with the ``awaitable objects`` in the PyWebIO coroutine session."
 msgstr "虽然PyWebIO的协程会话兼容标准库 ``asyncio`` 中的 ``awaitable objects`` ,但 ``asyncio`` 库不兼容PyWebIO协程会话中的 ``awaitable objects`` ."
 
-#: ../../guide.rst:978
+#: ../../guide.rst:980
 msgid ""
 "That is to say, you can't pass PyWebIO ``awaitable objects`` to the ``asyncio`` functions that accept ``awaitable objects``. For example, the "
 "following calls are **not supported** ::"
 msgstr ""
 "也就是说,无法将PyWebIO中的 ``awaitable objects`` 传入 ``asyncio`` 中的接受 ``awaitable objects`` 作为参数的函数中,比如如下调用是 **不被支持的** ::"
 
-#: ../../guide.rst:980
+#: ../../guide.rst:982
 msgid ""
 "await asyncio.shield(pywebio.input())\n"
 "await asyncio.gather(asyncio.sleep(1), pywebio.session.eval_js('1+1'))\n"
 "task = asyncio.create_task(pywebio.input())"
 msgstr ""
 
-#: ../../guide.rst:987
+#: ../../guide.rst:989
 msgid "Concurrency in coroutine-based sessions"
 msgstr "协程会话的并发"
 
-#: ../../guide.rst:989
+#: ../../guide.rst:991
 msgid ""
 "In coroutine-based session, you can start new thread, but you cannot call PyWebIO interactive functions in it (`register_thread() <pywebio.session."
 "register_thread>` is not available in coroutine session). But you can use `run_async(coro) <pywebio.session.run_async>` to execute a coroutine "
@@ -1618,7 +1618,7 @@ msgstr ""
 "用)。\n"
 "但你可以使用 `run_async(coro) <pywebio.session.run_async>` 来异步执行一个协程对象,新协程内可以使用PyWebIO交互函数:"
 
-#: ../../guide.rst:991
+#: ../../guide.rst:993
 msgid ""
 " from pywebio import start_server\n"
 " from pywebio.session import run_async\n"
@@ -1636,7 +1636,7 @@ msgid ""
 " start_server(main, auto_open_webbrowser=True)"
 msgstr ""
 
-#: ../../guide.rst:1010
+#: ../../guide.rst:1012
 msgid ""
 "`run_async(coro) <pywebio.session.run_async>` returns a `TaskHandler <pywebio.session.coroutinebased.TaskHandler>`, which can be used to query the "
 "running status of the coroutine or close the coroutine."
@@ -1644,13 +1644,13 @@ msgstr ""
 "`run_async(coro) <pywebio.session.run_async>` 返回一个 `TaskHandler <pywebio.session.coroutinebased.TaskHandler>` ,通过该 `TaskHandler <pywebio."
 "session.coroutinebased.TaskHandler>` 可以查询协程运行状态和关闭协程。"
 
-#: ../../guide.rst:1015
+#: ../../guide.rst:1017
 msgid ""
 "Similar to thread-based session, in coroutine-based session, when the task function and the coroutine running through `run_async() <pywebio.session."
 "run_async>` in the session are all finished, the session is closed."
 msgstr "与基于线程的会话类似,在基于协程的会话中,当任务函数和在会话内通过 `run_async() <pywebio.session.run_async>` 运行的协程全部结束后,会话关闭。"
 
-#: ../../guide.rst:1017
+#: ../../guide.rst:1019
 msgid ""
 "If the close of the session is caused by the user closing the browser, the behavior of PyWebIO is the same as :ref:`Thread-based session "
 "<session_close>`: After the browser page closed, PyWebIO input function calls that have not yet returned in the current session will cause "
@@ -1662,23 +1662,23 @@ msgstr ""
 "的调用将会产生 `SessionNotFoundException <pywebio.exceptions.SessionNotFoundException>` 或 `SessionClosedException <pywebio.exceptions."
 "SessionClosedException>` 异常。"
 
-#: ../../guide.rst:1019
+#: ../../guide.rst:1021
 msgid "`defer_call(func) <pywebio.session.defer_call>` also available in coroutine session."
 msgstr "协程会话也同样支持使用 `defer_call(func) <pywebio.session.defer_call>` 来设置会话结束时需要调用的函数。"
 
-#: ../../guide.rst:1024
+#: ../../guide.rst:1026
 msgid "Integration with Web Framework"
 msgstr "协程会话与Web框架集成"
 
-#: ../../guide.rst:1026
+#: ../../guide.rst:1028
 msgid "The PyWebIO application that using coroutine-based session can also be integrated to the web framework."
 msgstr "基于协程的会话同样可以与Web框架进行集成,只需要在原来传入任务函数的地方改为传入协程函数即可。"
 
-#: ../../guide.rst:1028
+#: ../../guide.rst:1030
 msgid "However, there are some limitations when using coroutine-based sessions to integrate into Flask or Django:"
 msgstr "但当前在使用基于协程的会话集成进Flask或Django时,存在一些限制:"
 
-#: ../../guide.rst:1030
+#: ../../guide.rst:1032
 msgid ""
 "First, when ``await`` the coroutine objects/awaitable objects in the ``asyncio`` module, you need to use `run_asyncio_coroutine() <pywebio.session."
 "run_asyncio_coroutine>` to wrap the coroutine object."
@@ -1686,15 +1686,15 @@ msgstr ""
 "一是协程函数内还无法直接通过 ``await`` 直接等待asyncio库中的协程对象,目前需要使用 `run_asyncio_coroutine() <pywebio.session."
 "run_asyncio_coroutine>` 进行包装。"
 
-#: ../../guide.rst:1032
+#: ../../guide.rst:1034
 msgid "Secondly, you need to start a new thread to run the event loop before starting a Flask/Django server."
 msgstr "二是,在启动Flask/Django这类基于线程的服务器之前需要启动一个单独的线程来运行事件循环。"
 
-#: ../../guide.rst:1034
+#: ../../guide.rst:1036
 msgid "Example of coroutine-based session integration into Flask:"
 msgstr "使用基于协程的会话集成进Flask的示例:"
 
-#: ../../guide.rst:1036
+#: ../../guide.rst:1038
 msgid ""
 " import asyncio\n"
 " import threading\n"
@@ -1719,21 +1719,21 @@ msgid ""
 " app.run(host='localhost', port=80)"
 msgstr ""
 
-#: ../../guide.rst:1061
+#: ../../guide.rst:1063
 msgid ""
 "Finally, coroutine-based session is not available in the script mode. You always need to use ``start_server()`` to run coroutine task function or "
 "integrate it to a web framework."
 msgstr "最后,使用PyWebIO编写的协程函数不支持Script模式,总是需要使用 ``start_server`` 来启动一个服务或者集成进Web框架来调用。"
 
-#: ../../guide.rst:1064
+#: ../../guide.rst:1066
 msgid "Last but not least"
 msgstr ""
 
-#: ../../guide.rst:1066
+#: ../../guide.rst:1068
 msgid "This is all features of PyWebIO, you can continue to read the rest of the documents, or start writing your PyWebIO applications now."
 msgstr "以上就是PyWebIO的全部功能了,你可以继续阅读接下来的文档,或者立即开始PyWebIO应用的编写了。"
 
-#: ../../guide.rst:1068
+#: ../../guide.rst:1070
 msgid ""
 "Finally, please allow me to provide one more suggestion. When you encounter a design problem when using PyWebIO, you can ask yourself a question: "
 "What would I do if it is in a terminal program? If you already have the answer, it can be done in the same way with PyWebIO. If the problem "
@@ -1743,7 +1743,7 @@ msgstr ""
 "如果你已经有答案了,那么在PyWebIO中一样可以使用这样的方式完成。如果问题依然存在或者觉得解决方案不够好,\n"
 "你可以考虑使用 :doc:`pin <./pin>` 模块。"
 
-#: ../../guide.rst:1071
+#: ../../guide.rst:1073
 msgid "OK, Have fun with PyWebIO!"
 msgstr ""
 

+ 4 - 4
docs/locales/zh_CN/LC_MESSAGES/index.po

@@ -7,8 +7,8 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PyWebIO 1.1.0\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-03-27 19:25+0800\n"
-"PO-Revision-Date: 2021-03-27 19:39+0800\n"
+"POT-Creation-Date: 2021-06-11 21:51+0800\n"
+"PO-Revision-Date: 2021-06-11 21:53+0800\n"
 "Last-Translator: WangWeimin <wang0.618@qq.com>\n"
 "Language: zh_CN\n"
 "Language-Team: \n"
@@ -176,11 +176,11 @@ msgstr ""
 msgid ""
 "In the last line of the above code, changing the function call ``bmi()`` to "
 "`pywebio.start_server(bmi, port=80) <pywebio.platform.tornado.start_server>` will "
-"start a bmi web service on port 80 ( :demo_host:`online Demo </?pywebio_api=bmi>` )."
+"start a bmi web service on port 80 ( :demo_host:`online Demo </bmi>` )."
 msgstr ""
 "将上面代码最后一行对 ``bmi()`` 的直接调用改为使用 `pywebio.start_server(bmi, "
 "port=80) <pywebio.platform.tornado.start_server>` 便可以在80端口提供 ``bmi()`` 服务"
-"( :demo_host:`在线Demo </?pywebio_api=bmi>` )。"
+"( :demo_host:`在线Demo </bmi>` )。"
 
 #: ../../index.rst:66
 msgid ""

File diff ditekan karena terlalu besar
+ 296 - 328
docs/locales/zh_CN/LC_MESSAGES/input.po


+ 41 - 12
docs/locales/zh_CN/LC_MESSAGES/output.po

@@ -7,8 +7,8 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PyWebIO 1.1.0\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-05-30 16:47+0800\n"
-"PO-Revision-Date: 2021-05-30 16:48+0800\n"
+"POT-Creation-Date: 2021-06-12 16:04+0800\n"
+"PO-Revision-Date: 2021-06-12 16:04+0800\n"
 "Last-Translator: WangWeimin <wang0.618@qq.com>\n"
 "Language: zh_CN\n"
 "Language-Team: \n"
@@ -268,7 +268,7 @@ msgstr ""
 msgid "Output your own widget"
 msgstr "输出自定义的控件"
 
-#: of pywebio.output:70 pywebio.output:133
+#: of pywebio.output:70 pywebio.output:134
 msgid "Other Interactions"
 msgstr "其他交互"
 
@@ -296,7 +296,7 @@ msgstr ""
 msgid "Close the current popup window."
 msgstr "关闭正在显示的弹窗"
 
-#: of pywebio.output:76 pywebio.output:141
+#: of pywebio.output:76 pywebio.output:142
 msgid "Layout and Style"
 msgstr "布局与样式"
 
@@ -340,7 +340,7 @@ msgstr ""
 msgid "Customize the css style of output content"
 msgstr "自定义输出内容的css样式"
 
-#: of pywebio.output:86 pywebio.output:148
+#: of pywebio.output:86 pywebio.output:149
 msgid "Other"
 msgstr "其他"
 
@@ -362,10 +362,11 @@ msgstr "创建一个新的scope"
 #: pywebio.output.put_file pywebio.output.put_grid pywebio.output.put_html
 #: pywebio.output.put_image pywebio.output.put_link pywebio.output.put_loading
 #: pywebio.output.put_markdown pywebio.output.put_processbar pywebio.output.put_row
-#: pywebio.output.put_scrollable pywebio.output.put_table pywebio.output.put_text
-#: pywebio.output.put_widget pywebio.output.remove pywebio.output.scroll_to
-#: pywebio.output.set_processbar pywebio.output.set_scope pywebio.output.span
-#: pywebio.output.style pywebio.output.toast pywebio.output.use_scope
+#: pywebio.output.put_scrollable pywebio.output.put_table pywebio.output.put_tabs
+#: pywebio.output.put_text pywebio.output.put_widget pywebio.output.remove
+#: pywebio.output.scroll_to pywebio.output.set_processbar pywebio.output.set_scope
+#: pywebio.output.span pywebio.output.style pywebio.output.toast
+#: pywebio.output.use_scope
 msgid "Parameters"
 msgstr ""
 
@@ -635,7 +636,7 @@ msgstr ""
 #: pywebio.output.put_link:7 pywebio.output.put_loading:6
 #: pywebio.output.put_markdown:9 pywebio.output.put_processbar:7
 #: pywebio.output.put_row:18 pywebio.output.put_scrollable:9
-#: pywebio.output.put_table:11 pywebio.output.put_widget:9
+#: pywebio.output.put_table:11 pywebio.output.put_tabs:5 pywebio.output.put_widget:9
 msgid "Those arguments have the same meaning as for `put_text()`"
 msgstr "与 `put_text` 函数的同名参数含义一致"
 
@@ -1225,6 +1226,34 @@ msgstr ""
 msgid "put_file('hello-world.txt', b'hello world!', 'download me')"
 msgstr ""
 
+#: of pywebio.output.put_tabs:1
+msgid "Output tabs."
+msgstr "输出横向标签栏Tabs"
+
+#: of pywebio.output.put_tabs:3
+msgid ""
+"Tab list, each item is a dict: ``{\"title\": \"Title\", \"content\": ...}`` . The "
+"``content`` can be a string, the ``put_xxx()`` calls , or a list of them."
+msgstr ""
+"标签列表,列表项为一个 dict: ``{\"title\": \"Title\", \"content\": ...}`` ,其中 "
+"``content`` 表示标签内容,可以为字符串、 ``put_xxx()`` 调用或由它们组成的列表。"
+
+#: of pywebio.output.put_tabs:7
+msgid ""
+"put_tabs([\n"
+"    {'title': 'Text', 'content': 'Hello world'},\n"
+"    {'title': 'Markdown', 'content': put_markdown('~~Strikethrough~~')},\n"
+"    {'title': 'More content', 'content': [\n"
+"        put_table([\n"
+"            ['Commodity', 'Price'],\n"
+"            ['Apple', '5.5'],\n"
+"            ['Banana', '7'],\n"
+"        ]),\n"
+"        put_link('pywebio', 'https://github.com/wang0618/PyWebIO')\n"
+"    ]},\n"
+"])"
+msgstr ""
+
 #: of pywebio.output.put_collapse:3
 msgid "Title of content"
 msgstr "内容标题"
@@ -1695,8 +1724,8 @@ msgid ""
 msgstr ""
 
 #: of pywebio.output.style:3
-msgid "See `` for how to set css style for output."
-msgstr ""
+msgid "See :ref:`User Guide <style>` for new way to set css style for output."
+msgstr "为输出设置样式的新方式参见 :ref:`User Guide <style>`."
 
 #: of pywebio.output.style:6
 msgid "The output content can be a ``put_xxx()`` call or a list of it."

+ 7 - 6
docs/locales/zh_CN/LC_MESSAGES/pin.po

@@ -7,8 +7,8 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PyWebIO 1.2.3\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-05-29 14:30+0800\n"
-"PO-Revision-Date: 2021-05-29 14:35+0800\n"
+"POT-Creation-Date: 2021-06-12 15:21+0800\n"
+"PO-Revision-Date: 2021-06-12 15:32+0800\n"
 "Last-Translator: WangWeimin <wang0.618@qq.com>\n"
 "Language: zh_CN\n"
 "Language-Team: \n"
@@ -138,9 +138,9 @@ msgstr "以下为两者之间的一些不同:"
 
 #: of pywebio.pin:75
 msgid ""
-"The first parameter of pin widget function is always the name of the widget, and the name needs to be unique "
-"throughout the session."
-msgstr "Pin组件函数的第一个参数始终是Pin组件的 ``name`` ,且 ``name`` 需要在整个会话中保持唯一。"
+"The first parameter of pin widget function is always the name of the widget, and if you output two pin "
+"widgets with the same name, the previous one will expire."
+msgstr "Pin组件函数的第一个参数始终是Pin组件的 ``name`` ,且当输出了同名的pin组件时,旧的pin组件会不可用。"
 
 #: of pywebio.pin:77
 msgid ""
@@ -197,6 +197,7 @@ msgstr "还可以使用 ``pin`` 对象设置pin组件的值:"
 
 #: of pywebio.pin:98
 msgid ""
+"import time  # ..demo-only\n"
 "put_input('counter', type='number', value=0)\n"
 "\n"
 "while True:\n"
@@ -204,7 +205,7 @@ msgid ""
 "    time.sleep(1)"
 msgstr ""
 
-#: of pywebio.pin:108
+#: of pywebio.pin:109
 msgid ""
 "Note: When using :ref:`coroutine-based session <coroutine_based_session>`, you need to use the ``await pin."
 "name`` (or ``await pin['name']``) syntax to get pin widget value."

+ 1 - 0
docs/releases.rst

@@ -4,6 +4,7 @@ Release notes
 .. toctree::
    :maxdepth: 2
 
+   releases/v1.3.0
    releases/v1.2.0
    releases/v1.1.0
    releases/v1.0.0

+ 35 - 20
docs/releases/v1.3.0.rst

@@ -1,36 +1,51 @@
 What's new in PyWebIO 1.3
 ==========================
 
-2021
+2021/6/12
 -----------
 
 Highlights
 ^^^^^^^^^^^
-* New module :doc:`pin <./pin>` to provide persistent input support.
-* Remote access service is added to `start_server()`.
+* New module :doc:`pin </pin>` to provide persistent input support.
+* Add a remote access service to `start_server()`. See :ref:`server mode - User Guide <server_mode>` for detail.
 * Add `input_update() <pywebio.input.input_update>`, add ``onchange`` callback in input functions.
 * Add support for FastAPI and Starlette.
 
-Backwards-incompatible changes
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-[] Stop the compatibility of web framework integration before v1.1.
-
 Detailed changes
 ^^^^^^^^^^^^^^^^^
-* Mark `style() <pywebio.output.style>` as deprecated, see :ref:`User Guide <style>` for new method.
-* Add `wsgi_app()` / `asgi_app()` for Flask/Dgango/FastAPI backend.
-* Add `pywebio.output.put_tabs()` to output tabs.
-* Add promise support in `eval_js() <pywebio.session.eval_js>`.
-* Support config input panel via `set_env()`
-* Add ``max_file_upload``/``payload_size_limit``/``upload_size_limit``/``max_payload_size`` parameters to `start_server()`
-* Add `group` and `outline` parameters in `put_buttons() <pywebio.output.put_buttons>`
+
+* :doc:`input </input>` module
+
+    * Add `input_update() <pywebio.input.input_update>`, add ``onchange`` callback in input functions.
+    * Add `pywebio.input.slider()` to get range input.
+
+* :doc:`output </output>` module
+
+    * Mark `style() <pywebio.output.style>` as deprecated, see :ref:`style - User Guide <style>` for new method.
+    * Add `pywebio.output.put_tabs()` to output tabs.
+    * `put_html() <pywebio.output.put_html>` adds compatibility with ipython rich output.
+    * Add `group` and `outline` parameters in `put_buttons() <pywebio.output.put_buttons>`.
+
+* :doc:`session </session>` module
+
+    * Add promise support in `eval_js() <pywebio.session.eval_js>`.
+    * Support config input panel via `set_env() <pywebio.session.set_env>`.
+
+* :doc:`platform </platform>` module
+
+    * Add support for FastAPI and Starlette.
+    * Add `wsgi_app()` / `asgi_app()` for Flask/Dgango/FastAPI backend.
+    * Add remote access service to `start_server()`
+    * Add ``max_file_upload``/``payload_size_limit``/``upload_size_limit``/``max_payload_size`` parameters to `start_server()`.
+
 * So many other improvements.
 
 Bug fix
 ^^^^^^^^^^^^^^^^^
-* Fix table style
-* Fix large file uploading error
-* Fix server not start when enable `auto_open_webbrowser`
-* Fix: file names overflow in file input
-* Fix: `put_image()` raise 'unknown file extension' error when use PIL Image as `src`
-* Sanitize the returned `filename` of file_upload() to avoid interpreting as path accidentally.
+* Fix table style.
+* Fix large file uploading error.
+* Fix server start error when enabled ``auto_open_webbrowser``.
+* Fix file names overflow in file input.
+* Fix `put_image() <pywebio.output.put_image>` raise 'unknown file extension' error when use PIL Image as ``src``.
+* Sanitize the returned ``filename`` of `file_upload() <pywebio.input.file_upload>` to avoid interpreting as path accidentally.
+* So many other bugs fixed.

+ 4 - 0
pywebio/input.py

@@ -23,6 +23,10 @@ When use `input_group`, you needs to provide the ``name`` parameter in each inpu
 
 By default, the user can submit empty input value. If the user must provide a non-empty input value, you need to pass ``required=True`` to the input function (some input functions do not support the ``required`` parameter)
 
+The input functions in this module is blocking, and the input form will be destroyed after successful submission.
+If you want the form to always be displayed on the page and receive input continuously,
+you can consider the :doc:`pin <./pin>` module.
+
 Functions list
 -----------------
 

+ 11 - 4
pywebio/output.py

@@ -126,6 +126,7 @@ Content Outputting
 .. autofunction:: put_buttons
 .. autofunction:: put_image
 .. autofunction:: put_file
+.. autofunction:: put_tabs
 .. autofunction:: put_collapse
 .. autofunction:: put_scrollable
 .. autofunction:: put_widget
@@ -392,10 +393,12 @@ def put_html(html, sanitize=False, scope=Scope.Current, position=OutputPosition.
     :param bool sanitize: Whether to use `DOMPurify <https://github.com/cure53/DOMPurify>`_ to filter the content to prevent XSS attacks.
     :param int scope, position: Those arguments have the same meaning as for `put_text()`
     """
+
+    # Compatible with ipython rich output
+    # See: https://ipython.readthedocs.io/en/stable/config/integrating.html?highlight=Rich%20display#rich-display
     if hasattr(html, '__html__'):
         html = html.__html__()
-
-    if hasattr(html, '_repr_html_'):
+    elif hasattr(html, '_repr_html_'):
         html = html._repr_html_()
 
     spec = _get_output_spec('html', content=html, sanitize=sanitize, scope=scope, position=position)
@@ -1066,7 +1069,7 @@ def put_scrollable(content=[], height=400, keep_bottom=False, horizon_scroll=Fal
 def put_tabs(tabs, scope=Scope.Current, position=OutputPosition.BOTTOM) -> Output:
     """Output tabs.
 
-    :param list tabs: Tab list, each item is a dict: ``{"title": , "content":}`` .
+    :param list tabs: Tab list, each item is a dict: ``{"title": "Title", "content": ...}`` .
        The ``content`` can be a string, the ``put_xxx()`` calls , or a list of them.
     :param int scope, position: Those arguments have the same meaning as for `put_text()`
 
@@ -1401,7 +1404,7 @@ def style(outputs, css_style) -> Union[Output, OutputList]:
     """Customize the css style of output content
 
     .. deprecated:: 1.3
-        See `` for how to set css style for output.
+        See :ref:`User Guide <style>` for new way to set css style for output.
 
     :param outputs: The output content can be a ``put_xxx()`` call or a list of it.
     :type outputs: list/put_xxx()
@@ -1437,6 +1440,10 @@ def style(outputs, css_style) -> Union[Output, OutputList]:
         ], 'margin-left:20px'))
 
     """
+    import warnings
+    warnings.warn("`pywebio.output.style()` is deprecated since v1.3 and will remove in the future version, "
+                  "use `put_xxx(...).style(...)` instead", DeprecationWarning, stacklevel=2)
+
     if not isinstance(outputs, (list, tuple, OutputList)):
         ol = [outputs]
     else:

+ 2 - 2
pywebio/session/__init__.py

@@ -469,7 +469,7 @@ def data():
     global local
 
     import warnings
-    warnings.warn("`pywebio.session.data()` is deprecated in v1.1 and will remove in the future version, "
+    warnings.warn("`pywebio.session.data()` is deprecated since v1.1 and will remove in the future version, "
                   "use `pywebio.session.local` instead", DeprecationWarning, stacklevel=2)
     return local
 
@@ -534,6 +534,6 @@ def get_info():
     global info
 
     import warnings
-    warnings.warn("`pywebio.session.get_info()` is deprecated in v1.2 and will remove in the future version, "
+    warnings.warn("`pywebio.session.get_info()` is deprecated since v1.2 and will remove in the future version, "
                   "please use `pywebio.session.info` instead", DeprecationWarning, stacklevel=2)
     return info

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini