1
0
Эх сурвалжийг харах

update doc & reformat code

wangweimin 4 жил өмнө
parent
commit
03841a19fa

+ 8 - 8
demos/__main__.py

@@ -34,19 +34,19 @@ PyWebIO supports for data visualization with the third-party libraries.
 **Screenshots**
 
 <a href="{charts_demo_host}/?app=bokeh">
-    <img src="https://cdn.jsdelivr.net/gh/wang0618/pywebio-chart-gallery@master/assets/bokeh.png" alt="bokeh demo">
+    <img src="https://cdn.jsdelivr.net/gh/wang0618/pywebio-chart-gallery/assets/bokeh.png" alt="bokeh demo">
 </a>
 
 <a href="{charts_demo_host}/?app=plotly">
-    <img src="https://cdn.jsdelivr.net/gh/wang0618/pywebio-chart-gallery@master/assets/plotly.png" alt="plotly demo">
+    <img src="https://cdn.jsdelivr.net/gh/wang0618/pywebio-chart-gallery/assets/plotly.png" alt="plotly demo">
 </a>
 
 <a href="{charts_demo_host}/?app=pyecharts">
-    <img src="https://cdn.jsdelivr.net/gh/wang0618/pywebio-chart-gallery@master/assets/pyecharts.gif" alt="pyecharts demo">
+    <img src="https://cdn.jsdelivr.net/gh/wang0618/pywebio-chart-gallery/assets/pyecharts.gif" alt="pyecharts demo">
 </a>
 
 <a href="{charts_demo_host}/?app=cutecharts">
-    <img src="https://cdn.jsdelivr.net/gh/wang0618/pywebio-chart-gallery@master/assets/cutecharts.png" alt="cutecharts demo">
+    <img src="https://cdn.jsdelivr.net/gh/wang0618/pywebio-chart-gallery/assets/cutecharts.png" alt="cutecharts demo">
 </a>
 
 ### Links
@@ -76,19 +76,19 @@ PyWebIO还支持使用第三方库进行数据可视化
 **数据可视化demo截图**
 
 <a href="{charts_demo_host}/?app=bokeh">
-    <img src="https://cdn.jsdelivr.net/gh/wang0618/pywebio-chart-gallery@master/assets/bokeh.png" alt="bokeh demo">
+    <img src="https://cdn.jsdelivr.net/gh/wang0618/pywebio-chart-gallery/assets/bokeh.png" alt="bokeh demo">
 </a>
 
 <a href="{charts_demo_host}/?app=plotly">
-    <img src="https://cdn.jsdelivr.net/gh/wang0618/pywebio-chart-gallery@master/assets/plotly.png" alt="plotly demo">
+    <img src="https://cdn.jsdelivr.net/gh/wang0618/pywebio-chart-gallery/assets/plotly.png" alt="plotly demo">
 </a>
 
 <a href="{charts_demo_host}/?app=pyecharts">
-    <img src="https://cdn.jsdelivr.net/gh/wang0618/pywebio-chart-gallery@master/assets/pyecharts.gif" alt="pyecharts demo">
+    <img src="https://cdn.jsdelivr.net/gh/wang0618/pywebio-chart-gallery/assets/pyecharts.gif" alt="pyecharts demo">
 </a>
 
 <a href="{charts_demo_host}/?app=cutecharts">
-    <img src="https://cdn.jsdelivr.net/gh/wang0618/pywebio-chart-gallery@master/assets/cutecharts.png" alt="cutecharts demo">
+    <img src="https://cdn.jsdelivr.net/gh/wang0618/pywebio-chart-gallery/assets/cutecharts.png" alt="cutecharts demo">
 </a>
 
 ### Links

+ 2 - 2
docs/locales/zh_CN/LC_MESSAGES/input.po

@@ -8,7 +8,7 @@ msgstr ""
 "Project-Id-Version: PyWebIO 1.1.0\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2021-03-18 19:30+0800\n"
-"PO-Revision-Date: 2021-03-18 19:47+0800\n"
+"PO-Revision-Date: 2021-03-19 22:07+0800\n"
 "Last-Translator: WangWeimin <wang0.618@qq.com>\n"
 "Language: zh_CN\n"
 "Language-Team: \n"
@@ -969,7 +969,7 @@ msgstr ""
 msgid ""
 "Whether the form can be cancelled. Default is False. If ``cancelable=True``, a \"Cancel\" "
 "button will be displayed at the bottom of the form."
-msgstr "表单是否可以取消。若 ``cancelable=True`` 则会在表单底部显示一个取消”按钮。"
+msgstr "表单是否可以取消。若 ``cancelable=True`` 则会在表单底部显示一个取消”按钮。"
 
 #: of pywebio.input.input_group:30
 msgid ""

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

@@ -8,7 +8,7 @@ msgstr ""
 "Project-Id-Version: PyWebIO 1.1.0\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2021-03-14 23:25+0800\n"
-"PO-Revision-Date: 2021-03-14 23:27+0800\n"
+"PO-Revision-Date: 2021-03-19 22:18+0800\n"
 "Last-Translator: WangWeimin <wang0.618@qq.com>\n"
 "Language: zh_CN\n"
 "Language-Team: \n"
@@ -57,7 +57,7 @@ msgstr "你需要将 ``app.py`` 替换成你PyWebIO应用的文件名。"
 
 #: ../../libraries_support.rst:16
 msgid "Edit the spec file, change the ``datas`` parameter of ``Analysis``::"
-msgstr "编辑生成的spec文件,将其中 `` Analysis`` 的 ``data`` 参数修改为::"
+msgstr "编辑生成的spec文件,将其中 ``Analysis`` 的 ``data`` 参数修改为::"
 
 #: ../../libraries_support.rst:18
 msgid ""
@@ -83,7 +83,7 @@ msgid ""
 "If you want to create a one-file bundled executable, you need pass ``--"
 "onefile`` option in first step."
 msgstr ""
-"如果你希望生成一个单独的可执行文件而不是文件夹,你需要在第一步时传入 ``"
+"如果你希望生成一个单独的可执行文件而不是文件夹,你需要在第一步时传入 ``--"
 "onefile`` 选项。"
 
 #: ../../libraries_support.rst:32
@@ -254,7 +254,7 @@ msgstr ""
 
 #: ../../libraries_support.rst:108
 msgid "See related demo on :charts_demo_host:`plotly demo </?app=pyg2plot>`"
-msgstr "相应demo见 :charts_demo_host: `plotly demo </?app=pyg2plot>`"
+msgstr "相应demo见 :charts_demo_host:`plotly demo </?app=pyg2plot>`"
 
 #: ../../libraries_support.rst:111
 msgid "cutecharts.py"

+ 18 - 18
docs/locales/zh_CN/LC_MESSAGES/output.po

@@ -8,7 +8,7 @@ msgstr ""
 "Project-Id-Version: PyWebIO 1.1.0\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2021-03-18 14:41+0800\n"
-"PO-Revision-Date: 2021-03-18 15:23+0800\n"
+"PO-Revision-Date: 2021-03-19 22:04+0800\n"
 "Last-Translator: WangWeimin <wang0.618@qq.com>\n"
 "Language: zh_CN\n"
 "Language-Team: \n"
@@ -123,11 +123,11 @@ msgstr "输出文本"
 
 #: of pywebio.output:33
 msgid "`put_markdown`"
-msgstr "输出Markdown"
+msgstr ""
 
 #: of pywebio.output:33 pywebio.output.put_markdown:1
 msgid "Output Markdown"
-msgstr ""
+msgstr "输出Markdown"
 
 #: of pywebio.output
 msgid "`put_info`:sup:`*†`"
@@ -405,12 +405,12 @@ msgstr "`None` 表示不进行任何操作"
 
 #: of pywebio.output.set_scope:11
 msgid "`'remove'`: Remove the old scope first and then create a new one"
-msgstr "`’remove’` 表示先移除旧scope再创建新scope"
+msgstr "`'remove'` 表示先移除旧scope再创建新scope"
 
 #: of pywebio.output.set_scope:12
 msgid ""
 "`'clear'`: Just clear the contents of the old scope, but don't create a new scope"
-msgstr "`’clear’` 表示将旧scope的内容清除,不创建新scope"
+msgstr "`'clear'` 表示将旧scope的内容清除,不创建新scope"
 
 #: of pywebio.output.set_scope:14
 msgid "Default is `None`"
@@ -490,15 +490,15 @@ msgstr "将Scope置于屏幕可视区域的位置。可用值:"
 
 #: of pywebio.output.scroll_to:6
 msgid "``'top'`` : Keep the scope at the top of the visible area of the page"
-msgstr "``’top’`` : 滚动页面,让Scope位于屏幕可视区域顶部"
+msgstr "``'top'`` : 滚动页面,让Scope位于屏幕可视区域顶部"
 
 #: of pywebio.output.scroll_to:7
 msgid "``'middle'`` : Keep the scope at the middle of the visible area of the page"
-msgstr "``’middle’`` : 滚动页面,让Scope位于屏幕可视区域中间"
+msgstr "``'middle'`` : 滚动页面,让Scope位于屏幕可视区域中间"
 
 #: of pywebio.output.scroll_to:8
 msgid "``'bottom'`` : Keep the scope at the bottom of the visible area of the page"
-msgstr "``’bottom’`` : 滚动页面,让Scope位于屏幕可视区域底部"
+msgstr "``'bottom'`` : 滚动页面,让Scope位于屏幕可视区域底部"
 
 #: of pywebio.output.use_scope:1
 msgid "Open or enter a scope. Can be used as context manager and decorator."
@@ -772,7 +772,7 @@ msgid ""
 "The shape of loading prompt. The available values are: `'border'` (default)、 "
 "`'grow'`"
 msgstr ""
-"加载提示的形状, 可选值: `’border’` (默认,旋转的圆环)、 `’grow’` (大小渐变的圆点)"
+"加载提示的形状, 可选值: `'border'` (默认,旋转的圆环)、 `'grow'` (大小渐变的圆点)"
 
 #: of pywebio.output.put_loading:4
 msgid ""
@@ -780,8 +780,8 @@ msgid ""
 "`'secondary'` 、 `'success'` 、 `'danger'` 、 `'warning'` 、`'info'`  、"
 "`'light'`  、 `'dark'` (default)"
 msgstr ""
-"加载提示的颜色, 可选值: `’primary’` 、 `’secondary’` 、 `’success’` 、 "
-"`’danger’` 、 `’warning’` 、`’info’`  、`’light’`  、 `’dark’` (默认)"
+"加载提示的颜色, 可选值: `'primary'` 、 `'secondary'` 、 `'success'` 、 "
+"`'danger'` 、 `'warning'` 、`'info'`  、`'light'`  、 `'dark'` (默认)"
 
 #: of pywebio.output.put_loading:8
 msgid "`put_loading()` can be used in 2 ways: direct call and context manager:"
@@ -1375,15 +1375,15 @@ msgstr ""
 msgid ""
 "Where to display the notification message. Available values are `'left'`, "
 "`'center'` and `'right'`."
-msgstr "通知消息显示的位置,可以为 `’left’` / `’center’` / `’right’`"
+msgstr "通知消息显示的位置,可以为 `'left'` / `'center'` / `'right'`"
 
 #: of pywebio.output.toast:6
 msgid ""
 "Background color of the notification. Available values are `'info'`, `'error'`, "
 "`'warn'`, `'success'` or hexadecimal color value starting with `'#'`"
 msgstr ""
-"通知消息的背景颜色,可以为 `’info’` / `’error’` / `’warn’` / `’success’` 或以 "
-"`’#’` 开始的十六进制颜色值"
+"通知消息的背景颜色,可以为 `'info'` / `'error'` / `'warn'` / `'success'` 或以 "
+"`'#'` 开始的十六进制颜色值"
 
 #: of pywebio.output.toast:7
 msgid ""
@@ -1443,7 +1443,7 @@ msgstr ""
 msgid ""
 "The size of popup window. Available values are: ``'large'``, ``'normal'`` and "
 "``'small'``."
-msgstr "弹窗窗口大小,可选值: ``’large’``, ``’normal’`` and ``’small’``."
+msgstr "弹窗窗口大小,可选值: ``'large'``, ``'normal'`` and ``'small'``."
 
 #: of pywebio.output.popup:9
 msgid ""
@@ -1668,15 +1668,15 @@ msgstr ""
 msgid ""
 "Controls how auto-placed items get inserted in the grid. Can be "
 "``'row'``(default) or ``'column'`` ."
-msgstr "排列方向. 为 ``’row’`` 或 ``’column’`` ."
+msgstr "排列方向. 为 ``'row'`` 或 ``'column'`` ."
 
 #: of pywebio.output.put_grid
 msgid "``'row'`` : Places items by filling each row"
-msgstr "``’row’`` 时表示,content中的每一个子数组代表网格的一行;"
+msgstr "``'row'`` 时表示,content中的每一个子数组代表网格的一行;"
 
 #: of pywebio.output.put_grid
 msgid "``'column'`` : Places items by filling each column"
-msgstr "``’column’`` 时表示,content中的每一个子数组代表网格的一列."
+msgstr "``'column'`` 时表示,content中的每一个子数组代表网格的一列."
 
 #: of pywebio.output.put_grid:19
 msgid ""

+ 5 - 6
docs/locales/zh_CN/LC_MESSAGES/platform.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-16 22:45+0800\n"
-"PO-Revision-Date: 2021-03-16 23:55+0800\n"
+"POT-Creation-Date: 2021-03-19 22:41+0800\n"
+"PO-Revision-Date: 2021-03-19 22:46+0800\n"
 "Last-Translator: WangWeimin <wang0.618@qq.com>\n"
 "Language: zh_CN\n"
 "Language-Team: \n"
@@ -138,11 +138,10 @@ msgstr "服务端使用HTTP协议与浏览器进行通讯。"
 msgid ""
 "The ``base``, ``port``, ``host``, ``index``, ``static_dir`` arguments of "
 "``path_deploy_http()`` have the same meaning as for :func:`pywebio.platform."
-"path_deploy.path_deploy`"
+"path_deploy`"
 msgstr ""
 "关于 ``path_deploy_http()`` 的 ``base``, ``port``, ``host``, ``index``, "
-"``static_dir`` 参数的详细说明见 :func:`pywebio.platform.path_deploy.path_deploy` 的"
-"同名参数。"
+"``static_dir`` 参数的详细说明见 :func:`pywebio.platform.path_deploy` 的同名参数。"
 
 #: of pywebio.platform.path_deploy_http:8
 msgid ""
@@ -755,7 +754,7 @@ msgstr "运行 asyncio 事件循环"
 
 #: of pywebio.platform.run_event_loop:3
 msgid ""
-"..seealso:: :ref:`Integration coroutine-based session with Web framework "
+"See also: :ref:`Integration coroutine-based session with Web framework "
 "<coroutine_web_integration>`"
 msgstr ""
 

+ 113 - 128
docs/locales/zh_CN/LC_MESSAGES/session.po

@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PyWebIO 1.1.0\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-03-14 21:34+0800\n"
+"POT-Creation-Date: 2021-03-19 22:41+0800\n"
 "PO-Revision-Date: 2021-02-24 09:37+0800\n"
 "Last-Translator: WangWeimin <wang0.618@qq.com>\n"
 "Language: zh_CN\n"
@@ -24,8 +24,8 @@ msgstr "``pywebio.session`` — 会话相关"
 
 #: of pywebio.session.run_async:1
 msgid ""
-"Run the coroutine object asynchronously. PyWebIO interactive functions "
-"are also available in the coroutine."
+"Run the coroutine object asynchronously. PyWebIO interactive functions are "
+"also available in the coroutine."
 msgstr "异步运行协程对象。协程中依然可以调用 PyWebIO 交互函数。 "
 
 #: of pywebio.session.run_async:3
@@ -50,12 +50,12 @@ msgstr ""
 
 #: of pywebio.session.run_async:6
 msgid ""
-"`TaskHandle <pywebio.session.coroutinebased.TaskHandle>` instance, which "
-"can be used to query the running status of the coroutine or close the "
+"`TaskHandle <pywebio.session.coroutinebased.TaskHandle>` instance, which can"
+" be used to query the running status of the coroutine or close the "
 "coroutine."
 msgstr ""
-"`TaskHandle <pywebio.session.coroutinebased.TaskHandle>` 实例。 通过 "
-"TaskHandle 可以查询协程运行状态和关闭协程。"
+"`TaskHandle <pywebio.session.coroutinebased.TaskHandle>` 实例。 通过 TaskHandle "
+"可以查询协程运行状态和关闭协程。"
 
 #: of pywebio.session.run_async:8
 msgid ""
@@ -65,17 +65,13 @@ msgstr "参见::ref:`协程会话的并发 <coroutine_based_concurrency>`"
 
 #: of pywebio.session.run_asyncio_coroutine:1
 msgid ""
-"If the thread running sessions are not the same as the thread running the"
-" asyncio event loop, you need to wrap ``run_asyncio_coroutine()`` to run "
-"the coroutine in asyncio."
-msgstr ""
-"若会话线程和运行asyncio事件循环的线程不是同一个线程,需要用 `run_asyncio_coroutine()` "
-"来运行asyncio中的协程。"
+"If the thread running sessions are not the same as the thread running the "
+"asyncio event loop, you need to wrap ``run_asyncio_coroutine()`` to run the "
+"coroutine in asyncio."
+msgstr "若会话线程和运行asyncio事件循环的线程不是同一个线程,需要用 `run_asyncio_coroutine()` 来运行asyncio中的协程。"
 
 #: of pywebio.session.run_asyncio_coroutine:3
-msgid ""
-"Can only be used in :ref:`coroutine-based session "
-"<coroutine_based_session>`."
+msgid "Can only be used in :ref:`coroutine-based session <coroutine_based_session>`."
 msgstr "仅能在 :ref:`基于协程 <coroutine_based_session>` 的会话上下文中调用。"
 
 #: of pywebio.session.run_asyncio_coroutine:5
@@ -98,9 +94,7 @@ msgid ""
 msgstr ""
 
 #: of pywebio.session.download:1
-msgid ""
-"Send file to user, and the user browser will download the file to the "
-"local"
+msgid "Send file to user, and the user browser will download the file to the local"
 msgstr "向用户推送文件,用户浏览器会将文件下载到本地"
 
 #: of pywebio.session.download:3
@@ -111,7 +105,7 @@ msgstr "下载保存为的文件名"
 msgid "File content. It is a bytes-like object"
 msgstr "文件内容. 类型为 bytes-like object"
 
-#: of pywebio.session:131 pywebio.session.download:6 pywebio.session.eval_js:9
+#: of pywebio.session:130 pywebio.session.download:6 pywebio.session.eval_js:9
 msgid "Example:"
 msgstr ""
 
@@ -143,8 +137,8 @@ msgstr ""
 
 #: of pywebio.session.eval_js:1
 msgid ""
-"Execute JavaScript expression in the user's browser and get the value of "
-"the expression"
+"Execute JavaScript expression in the user's browser and get the value of the"
+" expression"
 msgstr "在用户浏览器中执行JavaScript表达式,并获取表达式的值"
 
 #: of pywebio.session.eval_js:3
@@ -159,9 +153,9 @@ msgstr "js表达式的值"
 
 #: of pywebio.session.eval_js:7
 msgid ""
-"Note: When using :ref:`coroutine-based session "
-"<coroutine_based_session>`, you need to use the ``await "
-"eval_js(expression)`` syntax to call the function."
+"Note: When using :ref:`coroutine-based session <coroutine_based_session>`, "
+"you need to use the ``await eval_js(expression)`` syntax to call the "
+"function."
 msgstr ""
 "注意⚠️:在 :ref:`基于协程 <coroutine_based_session>` 的会话上下文中,需要使用 ``await "
 "eval_js(expression)`` 语法来进行调用。"
@@ -182,8 +176,8 @@ msgstr ""
 
 #: of pywebio.session.register_thread:1
 msgid ""
-"Register the thread so that PyWebIO interactive functions are available "
-"in the thread."
+"Register the thread so that PyWebIO interactive functions are available in "
+"the thread."
 msgstr "注册线程,以便在线程内调用 PyWebIO 交互函数。"
 
 #: of pywebio.session.register_thread:3
@@ -204,15 +198,15 @@ msgstr "设置会话结束时调用的函数。"
 
 #: of pywebio.session.defer_call:3
 msgid ""
-"Whether it is because the user closes the page or the task finishes to "
-"cause session closed, the function set by ``defer_call(func)`` will be "
-"executed. Can be used for resource cleaning."
+"Whether it is because the user closes the page or the task finishes to cause"
+" session closed, the function set by ``defer_call(func)`` will be executed. "
+"Can be used for resource cleaning."
 msgstr "无论是用户主动关闭会话还是任务结束会话关闭,设置的函数都会被运行。"
 
 #: of pywebio.session.defer_call:5
 msgid ""
-"You can call ``defer_call(func)`` multiple times in the session, and the "
-"set functions will be executed sequentially after the session closes."
+"You can call ``defer_call(func)`` multiple times in the session, and the set"
+" functions will be executed sequentially after the session closes."
 msgstr "在会话中可以多次调用 `defer_call()` ,会话结束后将会顺序执行设置的函数。"
 
 #: of pywebio.session.defer_call:7
@@ -227,9 +221,7 @@ msgid ""
 msgstr ""
 
 #: of pywebio.session.defer_call:13
-msgid ""
-"PyWebIO interactive functions cannot be called inside the function "
-"``func``."
+msgid "PyWebIO interactive functions cannot be called inside the function ``func``."
 msgstr "通过 `defer_call()` 设置的函数被调用时会话已经关闭,所以在函数体内不可以调用 PyWebIO 的交互函数"
 
 #: of pywebio.session.hold:1
@@ -238,12 +230,12 @@ msgstr "保持会话,直到用户关闭浏览器。"
 
 #: of pywebio.session.hold:5
 msgid ""
-"After the PyWebIO session closed, the functions that need communicate "
-"with the PyWebIO server (such as the event callback of `put_buttons()` "
-"and download link of `put_file()`) will not work. You can call the "
-"``hold()`` function at the end of the task function to hold the session, "
-"so that the event callback and download link will always be available "
-"before the browser page is closed by user."
+"After the PyWebIO session closed, the functions that need communicate with "
+"the PyWebIO server (such as the event callback of `put_buttons()` and "
+"download link of `put_file()`) will not work. You can call the ``hold()`` "
+"function at the end of the task function to hold the session, so that the "
+"event callback and download link will always be available before the browser"
+" page is closed by user."
 msgstr ""
 "在PyWebIO会话结束后,页面和服务端的连接便会断开,\n"
 "页面上需要和服务端通信才可实现的功能(比如:下载通过 `put_file() <pywebio.output.put_file>` 输出的文件,\n"
@@ -252,12 +244,11 @@ msgstr ""
 
 #: of pywebio.session.hold:7
 msgid ""
-"Note: When using :ref:`coroutine-based session "
-"<coroutine_based_session>`, you need to use the ``await hold()`` syntax "
-"to call the function."
+"Note: When using :ref:`coroutine-based session <coroutine_based_session>`, "
+"you need to use the ``await hold()`` syntax to call the function."
 msgstr ""
-"注意⚠️:在 :ref:`基于协程 <coroutine_based_session>` 的会话上下文中,需要使用 ``await "
-"hold()`` 语法来进行调用。"
+"注意⚠️:在 :ref:`基于协程 <coroutine_based_session>` 的会话上下文中,需要使用 ``await hold()`` "
+"语法来进行调用。"
 
 #: of pywebio.session:12
 msgid "The session-local object for current session."
@@ -267,10 +258,10 @@ msgstr "当前会话的数据对象(session-local object)。"
 msgid ""
 "``local`` is a dictionary that can be accessed through attributes. When "
 "accessing a property that does not exist in the data object, it returns "
-"``None`` instead of throwing an exception. The method of dictionary is "
-"not supported in ``local``. It supports the ``in`` operator to determine "
-"whether the key exists. You can use ``local._dict`` to get the underlying"
-" dictionary data."
+"``None`` instead of throwing an exception. The method of dictionary is not "
+"supported in ``local``. It supports the ``in`` operator to determine whether"
+" the key exists. You can use ``local._dict`` to get the underlying "
+"dictionary data."
 msgstr ""
 "``local`` 是一个可以通过属性访问的字典,访问不存在的属性时会返回 ``None`` 而不是抛出异常。``local`` "
 "不支持字典的方法,支持使用 ``in`` 操作符来判断键是否存在,可以使用 ``local._dict`` 获取底层的字典表示。"
@@ -282,8 +273,8 @@ msgstr "使用场景"
 #: of pywebio.session:20
 msgid ""
 "When you need to share some session-independent data with multiple "
-"functions, it is more convenient to use session-local objects to save "
-"state than to use function parameters."
+"functions, it is more convenient to use session-local objects to save state "
+"than to use function parameters."
 msgstr "当需要在多个函数中保存一些会话独立的数据时,使用session-local对象保存状态会比通过函数参数传递更方便。"
 
 #: of pywebio.session:22
@@ -364,14 +355,6 @@ msgid ""
 "print(local._dict)"
 msgstr ""
 
-#: of pywebio.session.data:1
-msgid "Get the session-local object of current session."
-msgstr "获取当前会话的数据对象(session-local object)。"
-
-#: of pywebio.session.data:4
-msgid "Use `local <pywebio.session.local>` instead."
-msgstr ""
-
 #: of pywebio.session.set_env:1
 msgid "Config the environment of current session."
 msgstr "当前会话的环境设置"
@@ -386,16 +369,15 @@ msgstr "``title`` (str): 当前页面的标题"
 
 #: of pywebio.session.set_env:6
 msgid ""
-"``output_animation`` (bool): Whether to enable output animation, enabled "
-"by default"
+"``output_animation`` (bool): Whether to enable output animation, enabled by "
+"default"
 msgstr "``output_animation`` (bool): 是否启用输出动画(在输出内容时,使用过渡动画),默认启用"
 
 #: of pywebio.session.set_env:7
 msgid ""
-"``auto_scroll_bottom`` (bool): Whether to automatically scroll the page "
-"to the bottom after output content, it is closed by default.  Note that "
-"after enabled, only outputting to ROOT scope can trigger automatic "
-"scrolling."
+"``auto_scroll_bottom`` (bool): Whether to automatically scroll the page to "
+"the bottom after output content, it is closed by default.  Note that after "
+"enabled, only outputting to ROOT scope can trigger automatic scrolling."
 msgstr ""
 "``auto_scroll_bottom`` (bool): 是否在内容输出时将页面自动滚动到底部,默认关闭。注意,开启后,只有输出到ROOT "
 "Scope才可以触发自动滚动。"
@@ -431,126 +413,126 @@ msgstr "是否在新窗口打开,默认为 `True`"
 msgid "See also: :ref:`Server mode <server_and_script_mode>`"
 msgstr "参见: :ref:`Server 模式 <server_and_script_mode>`"
 
-#: of pywebio.session:89
+#: of pywebio.session:88
 msgid "The session information data object, whose attributes are:"
 msgstr "表示会话信息的对象,属性有:"
 
-#: of pywebio.session:91
+#: of pywebio.session:90
 msgid ""
 "``user_agent`` : The Object of the user browser information, whose "
 "attributes are"
 msgstr "``user_agent`` : 表示用户浏览器信息的对象,属性有"
 
-#: of pywebio.session:93
+#: of pywebio.session:92
 msgid ""
 "``is_mobile`` (bool): whether user agent is identified as a mobile phone "
 "(iPhone, Android phones, Blackberry, Windows Phone devices etc)"
 msgstr ""
-"``is_mobile`` (bool): 用户使用的设备是否为手机 (比如 iPhone, Android phones, "
-"Blackberry, Windows Phone 等设备)"
+"``is_mobile`` (bool): 用户使用的设备是否为手机 (比如 iPhone, Android phones, Blackberry, "
+"Windows Phone 等设备)"
 
-#: of pywebio.session:94
+#: of pywebio.session:93
 msgid ""
-"``is_tablet`` (bool): whether user agent is identified as a tablet device"
-" (iPad, Kindle Fire, Nexus 7 etc)"
+"``is_tablet`` (bool): whether user agent is identified as a tablet device "
+"(iPad, Kindle Fire, Nexus 7 etc)"
 msgstr "``is_tablet`` (bool): 用户使用的设备是否为平板 (比如 iPad, Kindle Fire, Nexus 7 等设备)"
 
-#: of pywebio.session:95
+#: of pywebio.session:94
 msgid ""
 "``is_pc`` (bool): whether user agent is identified to be running a "
 "traditional \"desktop\" OS (Windows, OS X, Linux)"
 msgstr "``is_pc`` (bool): 用户使用的设备是否为桌面电脑 (比如运行 Windows, OS X, Linux 的设备)"
 
-#: of pywebio.session:96
+#: of pywebio.session:95
 msgid "``is_touch_capable`` (bool): whether user agent has touch capabilities"
 msgstr "``is_touch_capable`` (bool): 用户使用的设备是否支持触控"
 
-#: of pywebio.session:98
+#: of pywebio.session:97
 msgid "``browser.family`` (str): Browser family. such as 'Mobile Safari'"
 msgstr "``browser.family`` (str): 浏览器家族. 比如 'Mobile Safari'"
 
-#: of pywebio.session:99
+#: of pywebio.session:98
 msgid "``browser.version`` (tuple): Browser version. such as (5, 1)"
 msgstr "``browser.version`` (tuple): 浏览器版本元组. 比如 (5, 1)"
 
-#: of pywebio.session:100
+#: of pywebio.session:99
 msgid "``browser.version_string`` (str): Browser version string. such as '5.1'"
 msgstr "``browser.version_string`` (str): 浏览器版本字符串. 比如  '5.1'"
 
-#: of pywebio.session:102
+#: of pywebio.session:101
 msgid "``os.family`` (str): User OS family. such as 'iOS'"
 msgstr "``os.family`` (str): 操作系统家族. 比如 'iOS'"
 
-#: of pywebio.session:103
+#: of pywebio.session:102
 msgid "``os.version`` (tuple): User OS version. such as (5, 1)"
 msgstr "``os.version`` (tuple): 操作系统版本元组. 比如 (5, 1)"
 
-#: of pywebio.session:104
+#: of pywebio.session:103
 msgid "``os.version_string`` (str): User OS version string. such as '5.1'"
 msgstr "``os.version_string`` (str): 操作系统版本字符串. 比如 '5.1'"
 
-#: of pywebio.session:106
+#: of pywebio.session:105
 msgid "``device.family`` (str): User agent's device family. such as 'iPhone'"
 msgstr "``device.family`` (str): 设备家族. 比如 'iPhone'"
 
-#: of pywebio.session:107
+#: of pywebio.session:106
 msgid "``device.brand`` (str): Device brand. such as 'Apple'"
 msgstr "``device.brand`` (str): 设备品牌. 比如 'Apple'"
 
-#: of pywebio.session:108
+#: of pywebio.session:107
 msgid "``device.model`` (str): Device model. such as 'iPhone'"
 msgstr "``device.model`` (str): 设备型号. 比如 'iPhone'"
 
-#: of pywebio.session:110
+#: of pywebio.session:109
 msgid ""
 "``user_language`` (str): Language used by the user's operating system. "
 "(e.g., ``'zh-CN'``)"
 msgstr "``user_language`` (str): 用户操作系统使用的语言. 比如 ``'zh-CN'``"
 
-#: of pywebio.session:111
+#: of pywebio.session:110
 msgid ""
-"``server_host`` (str): PyWebIO server host, including domain and port, "
-"the port can be omitted when 80."
+"``server_host`` (str): PyWebIO server host, including domain and port, the "
+"port can be omitted when 80."
 msgstr "``server_host`` (str): 当前会话的服务器host,包含域名和端口,端口为80时可以被省略"
 
-#: of pywebio.session:112
+#: of pywebio.session:111
 msgid ""
-"``origin`` (str): Indicate where the user from. Including protocol, host,"
-" and port parts. Such as ``'http://localhost:8080'`` . It may be empty, "
-"but it is guaranteed to have a value when the user's page address is not "
-"under the server host. (that is, the host, port part are inconsistent "
-"with ``server_host``)."
+"``origin`` (str): Indicate where the user from. Including protocol, host, "
+"and port parts. Such as ``'http://localhost:8080'`` . It may be empty, but "
+"it is guaranteed to have a value when the user's page address is not under "
+"the server host. (that is, the host, port part are inconsistent with "
+"``server_host``)."
 msgstr ""
-"``origin`` (str): 当前用户的页面地址. 包含 协议、主机、端口 部分. 比如 "
-"``'http://localhost:8080'`` .\n"
+"``origin`` (str): 当前用户的页面地址. 包含 协议、主机、端口 部分. 比如 ``'http://localhost:8080'`` "
+".\n"
 "可能为空,但保证当用户的页面地址不在当前服务器下(即 主机、端口部分和 ``server_host`` 不一致)时有值."
 
-#: of pywebio.session:114
+#: of pywebio.session:113
 msgid "``user_ip`` (str): User's ip address."
 msgstr "用户的ip地址."
 
-#: of pywebio.session:115
+#: of pywebio.session:114
 msgid ""
-"``backend`` (str): The current PyWebIO backend server implementation. The"
-" possible values are ``'tornado'``, ``'flask'``, ``'django'`` , "
+"``backend`` (str): The current PyWebIO backend server implementation. The "
+"possible values are ``'tornado'``, ``'flask'``, ``'django'`` , "
 "``'aiohttp'``."
 msgstr ""
-"当前PyWebIO使用的后端Server实现. 可能出现的值有 ``'tornado'`` , ``'flask'`` , "
-"``'django'`` , ``'aiohttp'``."
+"当前PyWebIO使用的后端Server实现. 可能出现的值有 ``'tornado'`` , ``'flask'`` , ``'django'`` ,"
+" ``'aiohttp'``."
 
-#: of pywebio.session:116
+#: of pywebio.session:115
 msgid ""
-"``protocol`` (str): The communication protocol between PyWebIO server and"
-" browser. The possible values are ``'websocket'``, ``'http'``"
+"``protocol`` (str): The communication protocol between PyWebIO server and "
+"browser. The possible values are ``'websocket'``, ``'http'``"
 msgstr ""
 
-#: of pywebio.session:117
+#: of pywebio.session:116
 msgid ""
-"``request`` (object): The request object when creating the current "
-"session. Depending on the backend server, the type of ``request`` can be:"
+"``request`` (object): The request object when creating the current session. "
+"Depending on the backend server, the type of ``request`` can be:"
 msgstr "创建当前会话时的Web请求对象. 根据PyWebIO使用的后端Server不同,``request`` 的类型也不同:"
 
-#: of pywebio.session:119
+#: of pywebio.session:118
 msgid ""
 "When using Tornado, ``request`` is instance of "
 "`tornado.httputil.HTTPServerRequest "
@@ -560,16 +542,15 @@ msgstr ""
 "<https://www.tornadoweb.org/en/stable/httputil.html#tornado.httputil.HTTPServerRequest>`_"
 " 实例"
 
-#: of pywebio.session:121
+#: of pywebio.session:120
 msgid ""
 "When using Flask, ``request`` is instance of `flask.Request "
 "<https://flask.palletsprojects.com/en/1.1.x/api/#incoming-request-data>`_"
 msgstr ""
 "使用Flask后端时, ``request`` 为 `flask.Request "
-"<https://flask.palletsprojects.com/en/1.1.x/api/#incoming-request-data>`_"
-" 实例"
+"<https://flask.palletsprojects.com/en/1.1.x/api/#incoming-request-data>`_ 实例"
 
-#: of pywebio.session:122
+#: of pywebio.session:121
 msgid ""
 "When using Django, ``request`` is instance of `django.http.HttpRequest "
 "<https://docs.djangoproject.com/en/3.0/ref/request-"
@@ -579,7 +560,7 @@ msgstr ""
 "<https://docs.djangoproject.com/en/3.0/ref/request-"
 "response/#django.http.HttpRequest>`_ 实例"
 
-#: of pywebio.session:123
+#: of pywebio.session:122
 msgid ""
 "When using aiohttp, ``request`` is instance of `aiohttp.web.BaseRequest "
 "<https://docs.aiohttp.org/en/stable/web_reference.html#aiohttp.web.BaseRequest>`_"
@@ -588,20 +569,20 @@ msgstr ""
 "<https://docs.aiohttp.org/en/stable/web_reference.html#aiohttp.web.BaseRequest>`_"
 " 实例"
 
-#: of pywebio.session:125
+#: of pywebio.session:124
 msgid ""
-"The ``user_agent`` attribute of the session information object is parsed "
-"by the user-agents library. See https://github.com/selwin/python-user-"
+"The ``user_agent`` attribute of the session information object is parsed by "
+"the user-agents library. See https://github.com/selwin/python-user-"
 "agents#usage"
 msgstr ""
 "会话信息对象的 ``user_agent`` 属性是通过 user-agents 库进行解析生成的。参见 "
 "https://github.com/selwin/python-user-agents#usage"
 
-#: of pywebio.session:129
+#: of pywebio.session:128
 msgid "Added the ``protocol`` attribute."
 msgstr ""
 
-#: of pywebio.session:133
+#: of pywebio.session:132
 msgid ""
 "import json\n"
 "from pywebio.session import info as session_info\n"
@@ -613,14 +594,6 @@ msgid ""
 "}, indent=4), 'json')"
 msgstr ""
 
-#: of pywebio.session.get_info:1
-msgid "Get information about the current session"
-msgstr "获取当前会话的相关信息"
-
-#: of pywebio.session.get_info:3
-msgid "Use `info <pywebio.session.info>` instead."
-msgstr ""
-
 #: of pywebio.session.coroutinebased.TaskHandler:1
 msgid "The handler of coroutine task"
 msgstr "协程任务句柄"
@@ -648,3 +621,15 @@ msgstr "任务是否关闭"
 #~ "}, indent=4), 'json')"
 #~ msgstr ""
 
+#~ msgid "Get the session-local object of current session."
+#~ msgstr "获取当前会话的数据对象(session-local object)。"
+
+#~ msgid "Use `local <pywebio.session.local>` instead."
+#~ msgstr ""
+
+#~ msgid "Get information about the current session"
+#~ msgstr "获取当前会话的相关信息"
+
+#~ msgid "Use `info <pywebio.session.info>` instead."
+#~ msgstr ""
+

+ 2 - 0
pywebio/output.py

@@ -104,6 +104,8 @@ Content Outputting
                  put_warning(*contents, closable=False, scope=-1, position=-1) -> Output:
                  put_error(*contents, closable=False, scope=-1, position=-1) -> Output:
 
+    Output Messages.
+
     :param contents: Message contents.
        The item is ``put_xxx()`` call, and any other type will be coverted to ``put_text(content)``.
     :param bool closable: Whether to show a dismiss button on the right of the message.

+ 1 - 1
pywebio/platform/httpbased.py

@@ -281,7 +281,7 @@ class HttpHandler:
 def run_event_loop(debug=False):
     """run asyncio event loop
 
-    ..seealso:: :ref:`Integration coroutine-based session with Web framework <coroutine_web_integration>`
+    See also: :ref:`Integration coroutine-based session with Web framework <coroutine_web_integration>`
 
     :param debug: Set the debug mode of the event loop.
        See also: https://docs.python.org/3/library/asyncio-dev.html#asyncio-debug-mode

+ 1 - 1
pywebio/platform/path_deploy.py

@@ -243,7 +243,7 @@ def path_deploy_http(base, port=0, host='',
     The server communicates with the browser using HTTP protocol.
 
     The ``base``, ``port``, ``host``, ``index``, ``static_dir`` arguments of ``path_deploy_http()``
-    have the same meaning as for :func:`pywebio.platform.path_deploy.path_deploy`
+    have the same meaning as for :func:`pywebio.platform.path_deploy`
 
     The rest arguments of ``path_deploy_http()`` have the same meaning as for :func:`pywebio.platform.tornado_http.start_server`
     """

+ 0 - 3
pywebio/session/__init__.py

@@ -82,7 +82,6 @@ r"""
 
     .. versionadded:: 1.1
 
-.. autofunction:: data
 .. autofunction:: set_env
 .. autofunction:: go_app
 
@@ -145,8 +144,6 @@ r"""
                       'origin', 'user_ip', 'backend', 'request']
         }, indent=4), 'json')
 
-.. autofunction:: get_info
-
 .. autoclass:: pywebio.session.coroutinebased.TaskHandler
    :members:
 """

+ 1 - 1
webiojs/src/main.ts

@@ -21,7 +21,7 @@ function set_up_session(webio_session: Session, output_container_elem: JQuery, i
     webio_session.on_session_create(function () {
         $('#favicon32').attr('href', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAwklEQVQ4T63TvU5CQRCG4WcwMfEuqOgNtQ2Nd4CxV2LHtVhJ0N7AHdjQUBtrrLwLA4ks2Rx+/Qucw3Y78807M7sz4ft5dq6mI7RQX7o/JCNzfdfetkNifRk6k9wLN9jYdxMkyZPQ1faZXYUwB/OCix8V/W4Y4zJDCsBAX7jdM7iQJY+udELu+cTrP2X/xU2+NMPAg3B3UPaVOOmFoQkapQC8Z8AUpyUBs6MAKrZQ+RErf2PlQTrKKK8gpZdpewgOXOcFTTxEjYwMoIkAAAAASUVORK5CYII=');
         $('#favicon16').attr('href', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAABmUlEQVRYR82XK0wDQRCGv21TUUUJGBwGDBggGCSGBIcAWnBAgsNAgkKhSMDgCA8HtEXgSDBIDC9DDRgcpoSiKo52yea49DiutMttsz27M/98N7s7OyNo9tujgxSTwDiCIaAXSH27l4AXJA/AFSUuWOajGWnR0ChLP3HWkWSAZEN716CM4JQKW6R5+sunPkCeJJJNBCtAosnAQTMHyS6CDWYoh2mEAxzTR4JzYOCfgYNuBRymmOc5uPAbIMswMS6BbkPBPZkiVSZIc+/X/Qng/vl1C4LXIBzG/JmoAag9hxuDaa+XwAIw6p2JGkCObQSrhtMeLifZYZY1tegCqKsW4zHCadfldqgyqK6oC3DGIZIFXZVI9oIjplkUqArXyatGkYkU1+dc5p0eQY4MghNTqlo6kjkFsI9gScvRlLHkQJDnFhgxpampc6cAikCXpqMp8zcF8AnETSlq6lTaAsD6Flg+hNavofVCZL0UW3+M2uI5VhBWGxIFYL0lUxBWm1KviFttyz0Iq4OJB2F1NPO/qdaG0+DD3qLx/AuMVJFhmC8dSgAAAABJRU5ErkJggg==');
-    })
+    });
     webio_session.on_session_close(function () {
         $('#favicon32').attr('href', 'data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAByElEQVRYR82XLUzDUBDH/9emYoouYHAYMGCAYJAYEhxiW2EOSOYwkKBQKBIwuIUPN2g7gSPBIDF8GWbA4DAjG2qitEfesi6lbGxlXd5q393/fr333t07QpdfPp8f0nV9CcACEU0DGAOgN9yrAN6Y+QnATbVavcrlcp/dSFMnI9M0J1RV3WHmFQCJTvaN9RoRXbiuu28YxstfPm0BbNtOMPMeEW0C0LoMHDZzmPmIiHbT6XStlUZLgEKhMK5p2iWAyX8GDruVHMdZzmazr+GFXwCmac4oinINYCSm4L5M2fO8RcMwHoO6PwAaf37bh+BNCMdx5oOZaAKIPQdwF2Pa2yWwBGDOPxNNAMuyDohoK+a0t5Rj5sNMJrMtFusA4qopivLcw2mPyu14njclrmgdoFgsnjLzWlSVXuyJ6CyVSq2TqHDJZPI9QpHpJW7Qt1apVEbJsqwVIjqPSzWKDjOvCoBjItqI4hiXLTOfkG3b9wBm4xKNqPMgAMoAhiM6xmX+IQC+AKhxKUbUcQcCQPoWyD2E0q+h9EIkvRRLb0YD0Y4FhNQHiQCQ/iQTEFIfpX4Nl/os9yGkDiY+hNTRLNhSpQ2n4b7er/H8G7N6BRSbHvW5AAAAAElFTkSuQmCC');
         $('#favicon16').attr('href', 'data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA0ElEQVQ4T62TPQrCQBCF30tA8BZW9mJtY+MNEtKr2HkWK0Xtw+4NbGysxVorbyEKyZMNRiSgmJ/tZufNNzO7M0ThxHHc8zxvSnIIoPNyXyXt0zRdR1F0+gxhblhr25IWJMcA3vcFviRtSc6DILg5XyZ0wQB2AAbFir7YBwAjB8kAxpg1ycmfwZlM0iYMwyldz77vH3+U/Y2rJEn6NMYsSc7KZM+1kla01p4BdKsAAFwc4A6gVRHwaARQr4Xaj1j7G2sPUiOjnEMqL9PnDJRd5ycpJXsd2f2NIAAAAABJRU5ErkJggg==');

+ 6 - 2
webiojs/src/session.ts

@@ -56,7 +56,8 @@ export class WebSocketSession implements Session {
         this.debug = false;
         this._closed = false;
     }
-    set_ws_api(){
+
+    set_ws_api() {
         let url = new URL(this.ws_api);
         if (url.protocol !== 'wss:' && url.protocol !== 'ws:') {
             let protocol = url.protocol || window.location.protocol;
@@ -65,6 +66,7 @@ export class WebSocketSession implements Session {
         url.search = `?app=${this.app_name}&session=${this.webio_session_id}`;
         this.ws_api = url.href;
     }
+
     on_session_create(callback: () => any): void {
         this._on_session_create = callback;
     };
@@ -88,8 +90,10 @@ export class WebSocketSession implements Session {
         this.ws.onopen = this._on_session_create;
 
         this.ws.onclose = function (evt) {
+            $('#markdown-body').append('Session closed at '+new Date() + '<br/>');  // todo
+
             that._on_session_close.apply(that, evt);
-            if (!that._closed && that.webio_session_id!='NEW') {  // not receive `close_session` command && enabled reconnection
+            if (!that._closed && that.webio_session_id != 'NEW') {  // not receive `close_session` command && enabled reconnection
                 const session_create_interval = 5000;
                 if (Date.now() - that._session_create_ts > session_create_interval)
                     that.start_session(that.debug);