wangweimin %!s(int64=4) %!d(string=hai) anos
pai
achega
1fde03242f

+ 3 - 1
demos/__main__.py

@@ -8,6 +8,7 @@ from demos.output_usage import main as output_usage
 from demos.config import charts_demo_host
 from demos.doc_demo import get_app as get_doc_demo_app
 from demos.set_env_demo import main as set_env_demo
+from demos.markdown_previewer import main as markdown_previewer
 
 from pywebio import STATIC_PATH
 from pywebio.output import put_markdown, put_row, put_html, style
@@ -19,7 +20,7 @@ index_md = r"""### Basic demo
 
  - [BMI calculation](./bmi): Calculating Body Mass Index based on height and weight
  - [Online chat room](./chat_room): Chat with everyone currently online
- - [Online chat room](./markdown_previewer): The online markdown editor with live preview
+ - [Markdown live preview](./markdown_previewer): The online markdown editor with live preview
  - [Input demo](./input_usage): Demonstrate various input usage supported by PyWebIO
  - [Output demo](./output_usage): Demonstrate various output usage supported by PyWebIO
 
@@ -128,6 +129,7 @@ if __name__ == "__main__":
         (r"/output_usage", webio_handler(output_usage, cdn=False)),
         (r"/doc_demo", webio_handler(get_doc_demo_app(), cdn=False)),
         (r"/set_env_demo", webio_handler(set_env_demo, cdn=False)),
+        (r"/markdown_previewer", webio_handler(markdown_previewer, cdn=False)),
         (r"/(.*)", tornado.web.StaticFileHandler, {"path": STATIC_PATH, 'default_filename': 'index.html'})
     ])
     application.listen(port=options.port)

+ 1 - 1
demos/bmi.py

@@ -4,7 +4,7 @@ BMI calculation
 
 Simple application for calculating `Body Mass Index <https://en.wikipedia.org/wiki/Body_mass_index>`_
 
-:demo_host:`Demo </?pywebio_api=bmi>`  `Source code <https://github.com/wang0618/PyWebIO/blob/dev/demos/bmi.py>`_
+:demo_host:`Demo </bmi>`, `Source code <https://github.com/wang0618/PyWebIO/blob/dev/demos/bmi.py>`_
 """
 from pywebio import start_server
 from pywebio.input import *

+ 1 - 1
demos/chat_room.py

@@ -3,7 +3,7 @@ Online chat room
 ^^^^^^^^^^^^^^^^^^^
 Chat with everyone currently online
 
-:demo_host:`Demo </?pywebio_api=chat_room>`  `Source code <https://github.com/wang0618/PyWebIO/blob/dev/demos/chat_room.py>`_
+:demo_host:`Demo </chat_room>`, `Source code <https://github.com/wang0618/PyWebIO/blob/dev/demos/chat_room.py>`_
 
 * Use coroutine-based sessions
 * Use `run_async() <pywebio.session.run_async>` to start background coroutine

+ 0 - 1
demos/doc_demo.py

@@ -1,5 +1,4 @@
 """
-文档中示例代码在线运行
 Run the example code in the documentation online
 """
 from functools import partial

+ 1 - 1
demos/input_usage.py

@@ -3,7 +3,7 @@ Input demo
 ^^^^^^^^^^^^^^^
 Demonstrate various input usage supported by PyWebIO
 
-:demo_host:`Demo </?pywebio_api=input_usage>`  `Source code <https://github.com/wang0618/PyWebIO/blob/dev/demos/input_usage.py>`_
+:demo_host:`Demo </input_usage>`, `Source code <https://github.com/wang0618/PyWebIO/blob/dev/demos/input_usage.py>`_
 """
 import json
 

+ 1 - 1
demos/output_usage.py

@@ -3,7 +3,7 @@ Output demo
 ^^^^^^^^^^^^^^
 Demonstrate various output usage supported by PyWebIO
 
-:demo_host:`Demo </?pywebio_api=output_usage>`  `Source code <https://github.com/wang0618/PyWebIO/blob/dev/demos/output_usage.py>`_
+:demo_host:`Demo </output_usage>`, `Source code <https://github.com/wang0618/PyWebIO/blob/dev/demos/output_usage.py>`_
 """
 from pywebio import start_server
 from pywebio.output import *

+ 1 - 1
docs/FAQ.rst

@@ -7,7 +7,7 @@ FAQ
 How to make the input form not disappear after submission, and can continue to receive input?
 ----------------------------------------------------------------------------------------------
 
-The design of PyWebIO is that the input form is destroyed after successful submission. The input function of PyWebIO is blocking. Once the form is submitted, the input function returns. So it is meaningless to leave the form on the page after submission of form. If you want to make continuous input, you can put input and subsequent operations into a ``while`` loop.
+You can consider the :doc:`pin <./pin>` module. It achieves persistent input by pinning input widgets to the page.
 
 
 How to output an input widget such as a search bar?

+ 8 - 24
docs/guide.rst

@@ -587,7 +587,8 @@ For more information, please refer to the :ref:`layout functions documentation <
 Style
 ^^^^^^^^^^^^^^
 
-If you are familiar with `CSS <https://en.wikipedia.org/wiki/CSS>`_ styles, you can use the `style() <pywebio.output.style>` function to set a custom style for the output.
+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.
 
 You can set the CSS style for a single ``put_xxx()`` output:
 
@@ -595,30 +596,13 @@ You can set the CSS style for a single ``put_xxx()`` output:
     :name: style
     :summary: style of output
 
-    style(put_text('Red'), 'color: red')
+    put_text('hello').style('color: red; font-size: 20px')
 
     ## ----
-    put_table([
-        ['A', 'B'],
-        ['C', style(put_text('Red'), 'color: red')],
-    ])
-
-`style() <pywebio.output.style>` also accepts a list of output calls, `style() <pywebio.output.style>` will set the CSS style for each item of the list:
-
-.. exportable-codeblock::
-    :name: style-list
-    :summary: style a list of output
-
-    style([
-        put_text('Red'),
-        put_markdown('~~del~~')
-    ], 'color: red')
-
-    ## ----
-    put_collapse('title', style([
-        put_text('text'),
-        put_markdown('~~del~~'),
-    ], 'margin-left: 20px'))
+    put_row([
+        put_text('hello').style('color: red'),
+        put_markdown('markdown')
+    ]).style('margin-top: 20px')
 
 
 .. _server_and_script_mode:
@@ -921,7 +905,7 @@ Those backends use the WebSocket protocol to communicate with the browser in PyW
 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``.
 
 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 deployment directory of PyWebIO static resources.
+In addition, you can also pass a string to ``cdn`` parameter to directly set the URL of PyWebIO static resources directory.
 
 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.
 

+ 53 - 50
docs/locales/zh_CN/LC_MESSAGES/FAQ.po

@@ -7,15 +7,16 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PyWebIO 1.1.0\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-02-17 17:38+0800\n"
-"PO-Revision-Date: 2021-02-17 22:54+0800\n"
+"POT-Creation-Date: 2021-05-29 14:48+0800\n"
+"PO-Revision-Date: 2021-05-29 14:48+0800\n"
+"Last-Translator: WangWeimin <wang0.618@qq.com>\n"
+"Language: zh_CN\n"
+"Language-Team: \n"
+"Plural-Forms: nplurals=1; plural=0;\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=utf-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 "Generated-By: Babel 2.8.0\n"
-"Last-Translator: WangWeimin <wang0.618@qq.com>\n"
-"Language-Team: \n"
-"Language: zh_CN\n"
 "X-Generator: Poedit 2.4.2\n"
 
 #: ../../FAQ.rst:2
@@ -24,23 +25,15 @@ msgstr "常见问题"
 
 #: ../../FAQ.rst:8
 msgid ""
-"How to make the input form not disappear after submission, and can "
-"continue to receive input?"
+"How to make the input form not disappear after submission, and can continue "
+"to receive input?"
 msgstr "如何让输入框在提交后不消失,并可以持续性地输入"
 
 #: ../../FAQ.rst:10
 msgid ""
-"The design of PyWebIO is that the input form is destroyed after "
-"successful submission. The input function of PyWebIO is blocking. Once "
-"the form is submitted, the input function returns. So it is meaningless "
-"to leave the form on the page after submission of form. If you want to "
-"make continuous input, you can put input and subsequent operations into "
-"a ``while`` loop."
-msgstr ""
-"PyWebIO 的设计就是输入表单在成功提交后就销毁,因为 PyWebIO 的输入是阻塞式"
-"的,一旦提交表单,输入函数就返回了,此时表单还留在界面上是没有意义的。如"
-"果想实现持续性的输入,可以将接收输入以及后续操作放到一个 ``while`` 循环"
-"中。"
+"You can consider the :doc:`pin <./pin>` module. It achieves persistent "
+"input by pinning input widgets to the page."
+msgstr "考虑使用 :doc:`pin <./pin>` 模块。"
 
 #: ../../FAQ.rst:14
 msgid "How to output an input widget such as a search bar?"
@@ -48,23 +41,22 @@ msgstr "如何输出一个诸如搜索栏的输入框"
 
 #: ../../FAQ.rst:16
 msgid ""
-"Unfortunately, PyWebIO does not support outputting input widget to the "
-"page as general output widget. Because this will make the input "
-"asynchronous, which is exactly what PyWebIO strives to avoid. Callbacks "
-"will increase the complexity of application development. PyWebIO does "
-"not recommend relying too much on the callback mechanism, so it only "
-"provides a little support. However, there is a compromise way to achieve "
-"similar behavior: just put a button (`put_buttons() <pywebio.output."
-"put_buttons>`) where the input widget needs to be displayed, and in the "
-"button's callback function, you can call the input function to get input "
-"and perform subsequent operations."
+"Unfortunately, PyWebIO does not support outputting input widget to the page "
+"as general output widget. Because this will make the input asynchronous, "
+"which is exactly what PyWebIO strives to avoid. Callbacks will increase the "
+"complexity of application development. PyWebIO does not recommend relying "
+"too much on the callback mechanism, so it only provides a little support. "
+"However, there is a compromise way to achieve similar behavior: just put a "
+"button (`put_buttons() <pywebio.output.put_buttons>`) where the input "
+"widget needs to be displayed, and in the button's callback function, you "
+"can call the input function to get input and perform subsequent operations."
 msgstr ""
-"很遗憾,PyWebIO并不支持将输入框作为一般性的内容输出到页面。因为这样就相当"
-"又回到了基于回调获取输入的方式了,会导致应用开发的复杂性提高,PyWebIO不"
-"太推荐过多依赖回调机制,所以对此仅提供了非常少的支持。\n"
-"不过也可以使用另一种方式实现近似的效果:只需要在需要显示输入框的地方放置"
-"一个button( `put_buttons() <pywebio.output.put_buttons>` ),然后在button"
-"的回调函数中调用输入函数来获取输入并进行后续操作。"
+"很遗憾,PyWebIO并不支持将输入框作为一般性的内容输出到页面。因为这样就相当"
+"又回到了基于回调获取输入的方式了,会导致应用开发的复杂性提高,PyWebIO不太推"
+"荐过多依赖回调机制,所以对此仅提供了非常少的支持。\n"
+"不过也可以使用另一种方式实现近似的效果:只需要在需要显示输入框的地方放置一个"
+"button( `put_buttons() <pywebio.output.put_buttons>` ),然后在button的回调函"
+"数中调用输入函数来获取输入并进行后续操作。"
 
 #: ../../FAQ.rst:22
 msgid "Why the callback of ``put_buttons()`` does not work?"
@@ -73,16 +65,15 @@ msgstr "为什么 ``put_buttons()`` 的回调不起作用"
 #: ../../FAQ.rst:24
 msgid ""
 "In general, in Server mode, once the task function returns (or in Script "
-"mode, the script exits), the session closes. After this, the event "
-"callback will not work. You can call the `pywebio.session.hold()` "
-"function at the end of the task function (or script) to hold the "
-"session, so that the event callback will always be available before the "
-"browser page is closed by user."
+"mode, the script exits), the session closes. After this, the event callback "
+"will not work. You can call the `pywebio.session.hold()` function at the "
+"end of the task function (or script) to hold the session, so that the event "
+"callback will always be available before the browser page is closed by user."
 msgstr ""
 "一般情况下,在Server模式下,任务函数一旦返回(或在Script模式下,脚本运行结"
-"束),会话就结束了,此时事件回调也将不起作用,可以在任务函数(或脚本)末尾处"
-"使用 `pywebio.session.hold()` 函数来将会话保持,这样在用户关闭浏览器页面"
-"前,事件回调将一直可用。 参见 :ref:`Server模式与Script模式 "
+"束),会话就结束了,此时事件回调也将不起作用,可以在任务函数(或脚本)末尾处使"
+"用 `pywebio.session.hold()` 函数来将会话保持,这样在用户关闭浏览器页面前,事"
+"件回调将一直可用。 参见 :ref:`Server模式与Script模式 "
 "<server_and_script_mode>`"
 
 #: ../../FAQ.rst:28
@@ -91,12 +82,24 @@ msgstr "为什么 ``put_file()`` 无法下载文件"
 
 #: ../../FAQ.rst:30
 msgid ""
-"The reason is the same as above. The page needs to request server for "
-"data when the download button is clicked, so the download link will be "
-"unavailable after the session is closed. You can use the `pywebio."
-"session.hold()` function at the end of the task function to hold the "
-"session."
+"The reason is the same as above. The page needs to request server for data "
+"when the download button is clicked, so the download link will be "
+"unavailable after the session is closed. You can use the `pywebio.session."
+"hold()` function at the end of the task function to hold the session."
 msgstr ""
-"原因同上。 ``put_file()`` 的文件链接被点击后,也是需要和服务端通信获取文"
-"件数据的,所以会话关闭后下载链接会不可用。可以在任务函数末尾处使用 "
-"`pywebio.session.hold()` 函数来将会话保持。"
+"原因同上。 ``put_file()`` 的文件链接被点击后,也是需要和服务端通信获取文件数"
+"据的,所以会话关闭后下载链接会不可用。可以在任务函数末尾处使用 `pywebio."
+"session.hold()` 函数来将会话保持。"
+
+#~ msgid ""
+#~ "The design of PyWebIO is that the input form is destroyed after "
+#~ "successful submission. The input function of PyWebIO is blocking. Once "
+#~ "the form is submitted, the input function returns. So it is meaningless "
+#~ "to leave the form on the page after submission of form. If you want to "
+#~ "make continuous input, you can put input and subsequent operations into "
+#~ "a ``while`` loop."
+#~ msgstr ""
+#~ "PyWebIO 的设计就是输入表单在成功提交后就销毁,因为 PyWebIO 的输入是阻塞式"
+#~ "的,一旦提交表单,输入函数就返回了,此时表单还留在界面上是没有意义的。如"
+#~ "果想实现持续性的输入,可以将接收输入以及后续操作放到一个 ``while`` 循环"
+#~ "中。"

+ 42 - 34
docs/locales/zh_CN/LC_MESSAGES/demos.po

@@ -7,15 +7,16 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PyWebIO 1.1.0\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-02-17 17:38+0800\n"
-"PO-Revision-Date: 2021-02-17 22:51+0800\n"
+"POT-Creation-Date: 2021-05-29 14:01+0800\n"
+"PO-Revision-Date: 2021-05-29 14:46+0800\n"
+"Last-Translator: WangWeimin <wang0.618@qq.com>\n"
+"Language: zh_CN\n"
+"Language-Team: \n"
+"Plural-Forms: nplurals=1; plural=0;\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=utf-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 "Generated-By: Babel 2.8.0\n"
-"Last-Translator: WangWeimin <wang0.618@qq.com>\n"
-"Language-Team: \n"
-"Language: zh_CN\n"
 "X-Generator: Poedit 2.4.2\n"
 
 #: ../../demos.rst:2
@@ -36,19 +37,17 @@ msgstr "BMI指数计算"
 
 #: demos.bmi:4 of
 msgid ""
-"Simple application for calculating `Body Mass Index <https://en."
-"wikipedia.org/wiki/Body_mass_index>`_"
-msgstr ""
-"计算 `BMI指数 <https://en.wikipedia.org/wiki/Body_mass_index>`_ 的简单"
-"应用"
+"Simple application for calculating `Body Mass Index <https://en.wikipedia.org/"
+"wiki/Body_mass_index>`_"
+msgstr "计算 `BMI指数 <https://en.wikipedia.org/wiki/Body_mass_index>`_ 的简单应用"
 
 #: demos.bmi:6 of
 msgid ""
-":demo_host:`Demo </?pywebio_api=bmi>`  `Source code <https://github."
-"com/wang0618/PyWebIO/blob/dev/demos/bmi.py>`_"
+":demo_host:`Demo </bmi>`, `Source code <https://github.com/wang0618/PyWebIO/blob/"
+"dev/demos/bmi.py>`_"
 msgstr ""
-":demo_host:`Demo地址 </?pywebio_api=bmi>`  `源码 <https://github.com/"
-"wang0618/PyWebIO/blob/dev/demos/bmi.py>`_"
+":demo_host:`Demo地址 </bmi>`, `源码 <https://github.com/wang0618/PyWebIO/blob/"
+"dev/demos/bmi.py>`_"
 
 #: demos.input_usage:2 of
 msgid "Input demo"
@@ -60,11 +59,11 @@ msgstr "演示PyWebIO输入模块的使用"
 
 #: demos.input_usage:5 of
 msgid ""
-":demo_host:`Demo </?pywebio_api=input_usage>`  `Source code <https://"
-"github.com/wang0618/PyWebIO/blob/dev/demos/input_usage.py>`_"
+":demo_host:`Demo </input_usage>`, `Source code <https://github.com/wang0618/"
+"PyWebIO/blob/dev/demos/input_usage.py>`_"
 msgstr ""
-":demo_host:`Demo地址 </?pywebio_api=input_usage>`  `源码 <https://"
-"github.com/wang0618/PyWebIO/blob/dev/demos/input_usage.py>`_"
+":demo_host:`Demo地址 </input_usage>`, `源码 <https://github.com/wang0618/PyWebIO/"
+"blob/dev/demos/input_usage.py>`_"
 
 #: demos.output_usage:2 of
 msgid "Output demo"
@@ -76,11 +75,11 @@ msgstr "演示PyWebIO输出模块的使用"
 
 #: demos.output_usage:5 of
 msgid ""
-":demo_host:`Demo </?pywebio_api=output_usage>`  `Source code <https://"
-"github.com/wang0618/PyWebIO/blob/dev/demos/output_usage.py>`_"
+":demo_host:`Demo </output_usage>`, `Source code <https://github.com/wang0618/"
+"PyWebIO/blob/dev/demos/output_usage.py>`_"
 msgstr ""
-":demo_host:`Demo地址 </?pywebio_api=output_usage>`  `源码 <https://"
-"github.com/wang0618/PyWebIO/blob/dev/demos/output_usage.py>`_"
+":demo_host:`Demo地址 </output_usage>`, `源码 <https://github.com/wang0618/"
+"PyWebIO/blob/dev/demos/output_usage.py>`_"
 
 #: demos.chat_room:2 of
 msgid "Online chat room"
@@ -92,31 +91,40 @@ msgstr "和当前所有在线的人聊天"
 
 #: demos.chat_room:5 of
 msgid ""
-":demo_host:`Demo </?pywebio_api=chat_room>`  `Source code <https://"
-"github.com/wang0618/PyWebIO/blob/dev/demos/chat_room.py>`_"
+":demo_host:`Demo </chat_room>`, `Source code <https://github.com/wang0618/"
+"PyWebIO/blob/dev/demos/chat_room.py>`_"
 msgstr ""
-":demo_host:`Demo地址 </?pywebio_api=chat_room>`  `源码 <https://github."
-"com/wang0618/PyWebIO/blob/dev/demos/chat_room.py>`_"
+":demo_host:`Demo地址 </chat_room>`, `源码 <https://github.com/wang0618/PyWebIO/"
+"blob/dev/demos/chat_room.py>`_"
 
 #: demos.chat_room:7 of
 msgid "Use coroutine-based sessions"
 msgstr "使用基于协程的会话"
 
 #: demos.chat_room:8 of
-msgid ""
-"Use `run_async() <pywebio.session.run_async>` to start background "
-"coroutine"
+msgid "Use `run_async() <pywebio.session.run_async>` to start background coroutine"
 msgstr "使用 `run_async() <pywebio.session.run_async>` 启动后台协程"
 
+#: demos.markdown_previewer:2 of
+msgid "Markdown Live Preview"
+msgstr ""
+
+#: demos.markdown_previewer:4 of
+msgid ""
+":demo_host:`Demo </markdown_previewer>`, `Source code <https://github.com/"
+"wang0618/PyWebIO/blob/dev/demos/markdown_previewer.py>`_"
+msgstr ""
+":demo_host:`Demo地址 </markdown_previewer>`, `源码 <https://github.com/wang0618/"
+"PyWebIO/blob/dev/demos/bmi.py>`_"
+
 #: ../../demos.rst:11
 msgid "Data visualization demos"
 msgstr "数据可视化demo"
 
 #: ../../demos.rst:13
 msgid ""
-"PyWebIO supports data visualization by using of third-party libraries. "
-"For details, see :ref:`Use PyWebIO for data visualization "
-"<visualization>`"
+"PyWebIO supports data visualization by using of third-party libraries. For "
+"details, see :ref:`Use PyWebIO for data visualization <visualization>`"
 msgstr ""
-"PyWebIO支持使用第三方库进行数据可视化,详情见 :ref:`使用PyWebIO进行数据"
-"可视化 <visualization>`"
+"PyWebIO支持使用第三方库进行数据可视化,详情见 :ref:`使用PyWebIO进行数据可视化 "
+"<visualization>`"

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 237 - 348
docs/locales/zh_CN/LC_MESSAGES/guide.po


+ 126 - 16
docs/locales/zh_CN/LC_MESSAGES/input.po

@@ -7,8 +7,8 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PyWebIO 1.1.0\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-04-14 21:12+0800\n"
-"PO-Revision-Date: 2021-04-14 21:19+0800\n"
+"POT-Creation-Date: 2021-05-29 14:26+0800\n"
+"PO-Revision-Date: 2021-05-29 14:27+0800\n"
 "Last-Translator: WangWeimin <wang0.618@qq.com>\n"
 "Language: zh_CN\n"
 "Language-Team: \n"
@@ -132,35 +132,52 @@ msgid "Radio"
 msgstr "单选选项"
 
 #: of pywebio.input:47
+msgid "`slider <pywebio.input.slider>`"
+msgstr ""
+
+#: of pywebio.input:48
+msgid "Slider"
+msgstr "滑块输入"
+
+#: of pywebio.input:50
 msgid "`actions <pywebio.input.actions>`"
 msgstr ""
 
-#: of pywebio.input:48 pywebio.input.actions:1
+#: of pywebio.input:51 pywebio.input.actions:1
 msgid "Actions selection"
 msgstr "按钮选项"
 
-#: of pywebio.input:50
+#: of pywebio.input:53
 msgid "`file_upload <pywebio.input.file_upload>`"
 msgstr ""
 
-#: of pywebio.input:51 pywebio.input.file_upload:1
+#: of pywebio.input:54 pywebio.input.file_upload:1
 msgid "File uploading"
 msgstr "文件上传"
 
-#: of pywebio.input:53
+#: of pywebio.input:56
 msgid "`input_group <pywebio.input.input_group>`"
 msgstr ""
 
-#: of pywebio.input:54
+#: of pywebio.input:57
 msgid "Input group"
 msgstr "输入组"
 
-#: of pywebio.input:58
+#: of pywebio.input:59
+msgid "`input_update <pywebio.input.input_update>`"
+msgstr ""
+
+#: of pywebio.input:60
+msgid "Update input item"
+msgstr "更新输入项"
+
+#: of pywebio.input:64
 msgid "Functions doc"
 msgstr "函数文档"
 
 #: of pywebio.input.actions pywebio.input.checkbox pywebio.input.file_upload pywebio.input.input
-#: pywebio.input.input_group pywebio.input.radio pywebio.input.select pywebio.input.textarea
+#: pywebio.input.input_group pywebio.input.input_update pywebio.input.radio pywebio.input.select
+#: pywebio.input.slider pywebio.input.textarea
 msgid "Parameters"
 msgstr ""
 
@@ -365,19 +382,38 @@ msgstr ""
 
 #: of pywebio.input.input:66
 msgid ""
+"A callback function which will be called when the value of this input field changed.  The "
+"``onchange`` callback is invoked with one argument, the current value of input field. "
+"``onchange`` can return a dict to update other input field when in input group: A typical "
+"usage scenario of ``onchange`` is to update other input item by using `input_update()`"
+msgstr ""
+
+#: of pywebio.input.input:66
+msgid "A callback function which will be called when the value of this input field changed."
+msgstr ""
+
+#: of pywebio.input.input:68
+msgid ""
+"The ``onchange`` callback is invoked with one argument, the current value of input field. "
+"``onchange`` can return a dict to update other input field when in input group: A typical "
+"usage scenario of ``onchange`` is to update other input item by using `input_update()`"
+msgstr ""
+
+#: of pywebio.input.input:72
+msgid ""
 "A hint to the user of what can be entered in the input. It will appear in the input field "
 "when it has no value set."
 msgstr "输入框的提示内容。提示内容会在输入框未输入值时以浅色字体显示在输入框中"
 
-#: of pywebio.input.input:67
+#: of pywebio.input.input:73
 msgid "Whether a value is required for the input to be submittable, default is ``False``"
 msgstr "当前输入是否为必填项,默认为 ``False``"
 
-#: of pywebio.input.input:68
+#: of pywebio.input.input:74
 msgid "Whether the value is readonly(not editable)"
 msgstr "输入框是否为只读"
 
-#: of pywebio.input.input:69
+#: of pywebio.input.input:75
 msgid ""
 "A list of predefined values to suggest to the user for this input. Can only be used when "
 "``type=TEXT``"
@@ -385,12 +421,12 @@ msgstr ""
 "输入建议内容列表,在页面上的显示效果为下拉候选列表,用户可以忽略建议内容列表而输入其他内容。仅"
 "当输入类型 ``type`` 为 `TEXT` 时可用"
 
-#: of pywebio.input.input:70
+#: of pywebio.input.input:76
 msgid ""
 "Help text for the input. The text will be displayed below the input field with small font"
 msgstr "输入框的帮助文本。帮助文本会以小号字体显示在输入框下方"
 
-#: of pywebio.input.input:71
+#: of pywebio.input.input:77
 #, python-format
 msgid ""
 "Additional html attributes added to the input element. reference: https://developer.mozilla."
@@ -404,7 +440,7 @@ msgstr ""
 msgid "Returns"
 msgstr ""
 
-#: of pywebio.input.input:72
+#: of pywebio.input.input:78
 msgid "The value that user input."
 msgstr "用户输入的值"
 
@@ -462,7 +498,8 @@ msgid "Some commonly used Codemirror options are listed :ref:`here <codemirror_o
 msgstr ":ref:`这里 <codemirror_options>` 列举了一些常用的Codemirror选项"
 
 #: of pywebio.input.actions:29 pywebio.input.checkbox:7 pywebio.input.file_upload:20
-#: pywebio.input.radio:8 pywebio.input.select:29 pywebio.input.textarea:22
+#: pywebio.input.radio:8 pywebio.input.select:29 pywebio.input.slider:8
+#: pywebio.input.textarea:22
 msgid "Those arguments have the same meaning as for `input()`"
 msgstr "与 `input` 输入函数的同名参数含义一致"
 
@@ -904,6 +941,40 @@ msgstr ""
 "PyWebIO应用时,\n"
 "可通过 `max_payload_size` 参数设置Web框架允许上传的最大文件大小"
 
+#: of pywebio.input.slider:1
+msgid "Range input."
+msgstr "滑块输入"
+
+#: of pywebio.input.slider:3
+msgid "The initial value of the slider."
+msgstr "滑块的初始值"
+
+#: of pywebio.input.slider:4
+msgid "The minimum permitted value."
+msgstr "滑块最小允许的值"
+
+#: of pywebio.input.slider:5
+msgid "The maximum permitted value."
+msgstr "滑块最大允许的值"
+
+#: of pywebio.input.slider:6
+msgid ""
+"The stepping interval. Only available when ``value``, ``min_value`` and ``max_value`` are all "
+"integer."
+msgstr "滑动的步长。仅当 ``value``、 ``min_value`` 和 ``max_value`` 全为int时有效"
+
+#: of pywebio.input.slider
+msgid "return int/float"
+msgstr ""
+
+#: of pywebio.input.slider:9
+msgid ""
+"If one of ``value``, ``min_value`` and ``max_value`` is float, the return value is a float, "
+"otherwise an int is returned."
+msgstr ""
+"若 ``value``, ``min_value`` 和 ``max_value`` 中含有float类型,则返回值为float,否则返回值为int"
+"类型"
+
 #: of pywebio.input.input_group:1
 msgid "Input group. Request a set of inputs from the user at once."
 msgstr "输入组。向页面上展示一组输入"
@@ -986,3 +1057,42 @@ msgid ""
 msgstr ""
 "若用户取消表单,返回 ``None`` ,否则返回一个 ``dict`` , 其键为输入项的 ``name`` 值,字典值为输"
 "入项的值"
+
+#: of pywebio.input.input_update:1
+msgid ""
+"Update attributes of input field. This function can only be called in ``onchange`` callback "
+"of input functions."
+msgstr "更新输入项的属性。本函数仅能在输入函数的 ``onchange``  回调中使用。"
+
+#: of pywebio.input.input_update:4
+msgid ""
+"The ``name`` of the target input item. Optional, default is the name of input field which "
+"triggers ``onchange``"
+msgstr "目标输入项的  ``name`` 。可选,默认为当前触发 ``onchange`` 回调的输入项"
+
+#: of pywebio.input.input_update:6
+msgid ""
+"The input parameters need to be updated. Note that those parameters can not be updated: "
+"``type``, ``name``, ``validate``, ``action``, ``code``, ``onchange``, ``multiple``"
+msgstr ""
+"需要更新的输入项参数。注意一下参数无法被更新:``type``, ``name``, ``validate``, ``action``, "
+"``code``, ``onchange``, ``multiple``"
+
+#: of pywebio.input.input_update:10
+msgid "An example of implementing dependent input items in an input group:"
+msgstr "一个具有依赖关系的输入项的示例:"
+
+#: of pywebio.input.input_update:12
+msgid ""
+"country2city = {\n"
+"    'China': ['Beijing', 'Shanghai', 'Hong Kong'],\n"
+"    'USA': ['New York', 'Los Angeles', 'San Francisco'],\n"
+"}\n"
+"countries = list(country2city.keys())\n"
+"location = input_group(\"Select a location\", [\n"
+"    select('Country', options=countries, name='country',\n"
+"           onchange=lambda c: input_update('city', options=country2city[c])),\n"
+"    select('City', options=country2city[countries[0]], name='city'),\n"
+"])\n"
+"put_text(location)  # ..demo-only"
+msgstr ""

+ 20 - 16
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-04-14 21:12+0800\n"
-"PO-Revision-Date: 2021-04-14 21:41+0800\n"
+"POT-Creation-Date: 2021-05-28 17:01+0800\n"
+"PO-Revision-Date: 2021-05-29 14:26+0800\n"
 "Last-Translator: WangWeimin <wang0.618@qq.com>\n"
 "Language: zh_CN\n"
 "Language-Team: \n"
@@ -54,7 +54,7 @@ msgstr "**函数**"
 
 #: of pywebio.output:17
 msgid "**Description**"
-msgstr "**简介**  "
+msgstr "**简介**   "
 
 #: of pywebio.output:19 pywebio.output:90
 msgid "Output Scope"
@@ -629,7 +629,7 @@ msgstr ""
 "是否使用 `DOMPurify <https://github.com/cure53/DOMPurify>`_ 对内容进行过滤来防止XSS"
 "攻击。"
 
-#: of pywebio.output:113 pywebio.output.put_buttons:39 pywebio.output.put_code:6
+#: of pywebio.output:113 pywebio.output.put_buttons:40 pywebio.output.put_code:6
 #: pywebio.output.put_collapse:7 pywebio.output.put_column:6 pywebio.output.put_file:8
 #: pywebio.output.put_grid:17 pywebio.output.put_html:5 pywebio.output.put_image:9
 #: pywebio.output.put_link:7 pywebio.output.put_loading:6
@@ -735,7 +735,7 @@ msgstr "进度条显示的标签. 默认为当前进度的百分比"
 msgid "Whether to remove the progress bar after the progress is completed"
 msgstr "是否在进度完成后关闭进度条"
 
-#: of pywebio.output.put_buttons:13 pywebio.output.put_buttons:50
+#: of pywebio.output.put_buttons:13 pywebio.output.put_buttons:51
 #: pywebio.output.put_collapse:9 pywebio.output.put_file:14
 #: pywebio.output.put_image:11 pywebio.output.put_processbar:9
 #: pywebio.output.put_scrollable:11 pywebio.output.put_table:13
@@ -943,7 +943,7 @@ msgid ""
 "`info`, `light`, `dark`. The `outline-` prefix can be added to those color values "
 "to enable outline buttons.  Example:  .. exportable-codeblock::     :name: "
 "put_buttons-btn_class     :summary: `put_buttons()`      "
-"put_buttons([dict(label='primary', value='p', color='outline-success')], "
+"put_buttons([dict(label='success', value='s', color='outline-success')], "
 "onclick=...)  # ..doc-only     put_buttons([  # ..demo-only         dict(label=i, "
 "value=i, color=i)  # ..demo-only         for i in ['primary', 'secondary', "
 "'success', 'danger', 'warning', 'info', 'light', 'dark',   # ..demo-"
@@ -986,7 +986,7 @@ msgstr ""
 
 #: of pywebio.output.put_buttons:15
 msgid ""
-"put_buttons([dict(label='primary', value='p', color='outline-success')], "
+"put_buttons([dict(label='success', value='s', color='outline-success')], "
 "onclick=...)  # ..doc-only\n"
 "put_buttons([  # ..demo-only\n"
 "    dict(label=i, value=i, color=i)  # ..demo-only\n"
@@ -1054,7 +1054,11 @@ msgstr "是否使用小号按钮,默认为False"
 msgid "Whether to use link style button. Default is False"
 msgstr "是否将按钮显示为链接样式,默认为False"
 
-#: of pywebio.output.put_buttons:40
+#: of pywebio.output.put_buttons:39
+msgid "Whether to group the buttons together"
+msgstr ""
+
+#: of pywebio.output.put_buttons:41
 msgid ""
 "Other options of the ``onclick`` callback. There are different options according to "
 "the session implementation  When in Coroutine-based Session:     * mutex_mode: "
@@ -1070,17 +1074,17 @@ msgid ""
 "``serial_mode`` to improve performance."
 msgstr ""
 
-#: of pywebio.output.put_buttons:40
+#: of pywebio.output.put_buttons:41
 msgid ""
 "Other options of the ``onclick`` callback. There are different options according to "
 "the session implementation"
 msgstr "回调函数的其他参数。根据选用的 session 实现有不同参数"
 
-#: of pywebio.output.put_buttons:43
+#: of pywebio.output.put_buttons:44
 msgid "When in Coroutine-based Session:"
 msgstr "CoroutineBasedSession 实现"
 
-#: of pywebio.output.put_buttons:43
+#: of pywebio.output.put_buttons:44
 msgid ""
 "mutex_mode: Default is ``False``. If set to ``True``, new click event will be "
 "ignored when the current callback is running. This option is available only when "
@@ -1089,11 +1093,11 @@ msgstr ""
 "mutex_mode: 互斥模式。默认为 ``False`` 。若为 ``True`` ,则在运行回调函数过程中,无"
 "法响应当前按钮组的新点击事件,仅当 ``onclick`` 为协程函数时有效"
 
-#: of pywebio.output.put_buttons:48
+#: of pywebio.output.put_buttons:49
 msgid "When in Thread-based Session:"
 msgstr "ThreadBasedSession 实现"
 
-#: of pywebio.output.put_buttons:46
+#: of pywebio.output.put_buttons:47
 msgid ""
 "serial_mode: Default is ``False``, and every time a callback is triggered, the "
 "callback function will be executed immediately in a new thread."
@@ -1101,7 +1105,7 @@ msgstr ""
 "serial_mode: 串行模式模式。默认为 ``False`` ,此时每次触发回调,回调函数会在新线程中"
 "立即执行。"
 
-#: of pywebio.output.put_buttons:47
+#: of pywebio.output.put_buttons:48
 msgid ""
 "If set ``serial_mode`` to ``True`` After enabling serial_mode, the button's "
 "callback will be executed serially in a resident thread in the session, and all "
@@ -1113,7 +1117,7 @@ msgstr ""
 "击事件的回调(包括 ``serial_mode=False`` 的回调)都将排队等待当前点击事件运行完成。如"
 "果回调函数运行时间很短,可以开启 ``serial_mode`` 来提高性能。"
 
-#: of pywebio.output.put_buttons:52
+#: of pywebio.output.put_buttons:53
 #, python-format
 msgid ""
 "from functools import partial\n"
@@ -1132,7 +1136,7 @@ msgid ""
 "put_buttons(['edit', 'delete'], onclick=[edit, delete])"
 msgstr ""
 
-#: of pywebio.output.put_buttons:73
+#: of pywebio.output.put_buttons:74
 msgid ""
 "After the PyWebIO session (see :ref:`Server and script mode "
 "<server_and_script_mode>` for more information about session) closed, the event "

+ 34 - 10
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-28 18:47+0800\n"
-"PO-Revision-Date: 2021-05-28 18:47+0800\n"
+"POT-Creation-Date: 2021-05-29 14:30+0800\n"
+"PO-Revision-Date: 2021-05-29 14:35+0800\n"
 "Last-Translator: WangWeimin <wang0.618@qq.com>\n"
 "Language: zh_CN\n"
 "Language-Team: \n"
@@ -171,15 +171,19 @@ msgstr "输出一个多选框组件。参见 `pywebio.input.checkbox()`"
 msgid "Output a radio widget. Refer to: `pywebio.input.radio()`"
 msgstr "输出一个单选按钮组件。参见 `pywebio.input.radio()`"
 
-#: of pywebio.pin:87
+#: of pywebio.pin.put_slider:1
+msgid "Output a slide widget. Refer to: `pywebio.input.slider()`"
+msgstr "输出一个滑块输入组件。参见 `pywebio.input.slider()`"
+
+#: of pywebio.pin:88
 msgid "Pin utils"
 msgstr ""
 
-#: of pywebio.pin:90
+#: of pywebio.pin:91
 msgid "Pin widgets value getter and setter."
 msgstr "获取与设置Pin组件的值"
 
-#: of pywebio.pin:92
+#: of pywebio.pin:93
 msgid ""
 "You can use attribute or key index of ``pin`` object to get the current value of a pin widget. When accessing "
 "the value of a widget that does not exist, it returns ``None`` instead of throwing an exception."
@@ -187,11 +191,11 @@ msgstr ""
 "你可以使用属性或索引来从 ``pin`` 对象上获取pin组件的当前值。当访问不存在的pin组件时,会得到 ``None`` 而不会抛"
 "出异常。"
 
-#: of pywebio.pin:95
+#: of pywebio.pin:96
 msgid "You can also use the ``pin`` object to set the value of pin widget:"
-msgstr "``pin`` 对象还支持设置pin组件的值:"
+msgstr "还可以使用 ``pin`` 对象设置pin组件的值:"
 
-#: of pywebio.pin:97
+#: of pywebio.pin:98
 msgid ""
 "put_input('counter', type='number', value=0)\n"
 "\n"
@@ -200,6 +204,14 @@ msgid ""
 "    time.sleep(1)"
 msgstr ""
 
+#: of pywebio.pin:108
+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."
+msgstr ""
+"注:当使用 :ref:`基于协程的会话 <coroutine_based_session>` 时,你需要使用 ``await pin.name`` (或 ``await "
+"pin['name']``) 语法来获取pin组件的值。"
+
 #: of pywebio.pin.pin_wait_change:1
 msgid ""
 "``pin_wait_change()`` listens to a list of pin widgets, when the value of any widgets changes, the function "
@@ -219,6 +231,10 @@ msgstr "Pin组件 ``name`` 列表"
 msgid "return dict"
 msgstr ""
 
+#: of pywebio.pin.pin_wait_change:5
+msgid "``{\"name\": name of the changed widget, \"value\": current value of the changed widget }``"
+msgstr "``{\"name\": 发生变化的pin组件的name, \"value\": 发生变化的pin组件的当前值}``"
+
 #: of pywebio.pin.pin_wait_change:7
 msgid ""
 ":demo_host:`Here </markdown_previewer>` is an demo of using `pin_wait_change()` to make a markdown previewer."
@@ -227,9 +243,17 @@ msgstr ":demo_host:`这里 </markdown_previewer>` 有一个使用 `pin_wait_chan
 #: of pywebio.pin.pin_wait_change:9
 msgid ""
 "Note that: updating value with the :data:`pin` object or `pin_update()` does not trigger `pin_wait_change()` "
-"to return"
+"to return."
 msgstr "注:使用 :data:`pin` 对象或 `pin_update()` 更新pin组件的值不会引发 `pin_wait_change()` 返回"
 
+#: of pywebio.pin.pin_wait_change:12
+msgid ""
+"When using :ref:`coroutine-based session <coroutine_based_session>`, you need to use the ``await "
+"pin_wait_change()`` syntax to invoke this function."
+msgstr ""
+"当使用 :ref:`基于协程的会话 <coroutine_based_session>` 时,你需要使用 ``await pin_wait_change()`` 语法来调用此"
+"函数。"
+
 #: of pywebio.pin.pin_update:1
 msgid "Update attributes of pin widgets."
 msgstr "更新pin组件的输出属性。"
@@ -242,4 +266,4 @@ msgstr "目标pin组件的 ``name`` 。"
 msgid ""
 "The pin widget parameters need to be updated. Note that those parameters can not be updated: ``type``, "
 "``name``, ``code``, ``multiple``"
-msgstr "需要被更新的pin组件的参数。注意这些参数无法被更新: ``type``, ``name``, ``code``, ``multiple``"
+msgstr "需要被更新的pin组件的参数。注意以下参数无法被更新: ``type``, ``name``, ``code``, ``multiple``"

+ 164 - 40
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-04-14 21:12+0800\n"
-"PO-Revision-Date: 2021-04-14 21:32+0800\n"
+"POT-Creation-Date: 2021-05-29 14:26+0800\n"
+"PO-Revision-Date: 2021-05-29 14:45+0800\n"
 "Last-Translator: WangWeimin <wang0.618@qq.com>\n"
 "Language: zh_CN\n"
 "Language-Team: \n"
@@ -123,7 +123,7 @@ msgstr ""
 "<port>/static/A/B.jpg``。"
 
 #: of pywebio.platform.path_deploy.path_deploy:16
-#: pywebio.platform.tornado.start_server:31
+#: pywebio.platform.tornado.start_server:43
 msgid ""
 "The client can reconnect to server within ``reconnect_timeout`` seconds after an "
 "unexpected disconnection. If set to 0 (default), once the client disconnects, the "
@@ -178,27 +178,44 @@ msgstr ""
 "``webio_handler()`` 和 ``webio_view()`` 函数用于将PyWebIO应用整合到现有的Python Web"
 "项目中。"
 
-#: of pywebio.platform:29
+#: of pywebio.platform:27
+msgid ""
+"The ``wsgi_app()`` and ``asgi_app()`` is used to get the WSGI or ASGI app for "
+"running PyWebIO applications. This is helpful when you don't want to start server "
+"with the Web framework built-in's. For example, you want to use other WSGI server, "
+"or you are deploying app in a cloud environment. Note that only Flask, Django and "
+"FastApi backend support it."
+msgstr ""
+"``wsgi_app()`` 和 ``asgi_app()`` 用于获取运行PyWebIO应用的 WSGI 或 ASGI app。很适合"
+"当你不想使用Web框架内置的server来启动服务的情况。比如,你想使用其他WSGI server来启"
+"动应用,或者你正在将应用部署到一些云环境中。目前仅在Flask、Django 和 FastApi后端中"
+"支持 ``wsgi_app()`` / ``asgi_app()``"
+
+#: of pywebio.platform:34
 msgid ""
 "Added the ``cdn`` parameter in ``start_server()``, ``webio_handler()`` and "
 "``webio_view()``."
 msgstr ""
 
-#: of pywebio.platform:33
+#: of pywebio.platform:38
 msgid "Added the ``static_dir`` parameter in ``start_server()``."
 msgstr ""
 
-#: of pywebio.platform:36
+#: of pywebio.platform:42
+msgid "Added the ``wsgi_app()`` and ``asgi_app()``."
+msgstr ""
+
+#: of pywebio.platform:45
 msgid "Tornado support"
 msgstr "Tornado相关"
 
-#: of pywebio.platform:38
+#: of pywebio.platform:47
 msgid ""
 "There are two protocols (WebSocket and HTTP) can be used to communicates with the "
 "browser:"
 msgstr "服务端可以通过两种协议(WebSocket 和 HTTP)来与用户浏览器通信。"
 
-#: of pywebio.platform:41
+#: of pywebio.platform:50
 msgid "WebSocket"
 msgstr ""
 
@@ -314,7 +331,60 @@ msgstr ""
 "例如 ``http_static_dir`` 路径下存在文件 ``A/B.jpg`` ,则其URL为 ``http://<host>:"
 "<port>/static/A/B.jpg``。"
 
-#: of pywebio.platform.tornado.start_server:33
+#: of pywebio.platform.tornado.start_server:31
+msgid ""
+"Whether to enable remote access, when enabled, you can get a temporary public "
+"network access address for the current application, others can access your "
+"application via this address. Using remote access makes it easy to temporarily "
+"share the application with others. The remote access service is provided by "
+"`localhost.run <https://localhost.run/>`_. You can use a dict to config remote "
+"access service, the following configurations are currently supported:  - "
+"``ssh_key_path``: Use a custom ssh key, the default key path is ``~/.ssh/id_xxx``. "
+"Note that only rsa and ed25519 keys are supported. - ``custom_domain``: Use a "
+"custom domain for your remote access address. This need a subscription to "
+"localhost.run.   See also: `Custom Domains - localhost.run <https://localhost.run/"
+"docs/custom-domains/>`_"
+msgstr ""
+
+#: of pywebio.platform.tornado.start_server:31
+msgid ""
+"Whether to enable remote access, when enabled, you can get a temporary public "
+"network access address for the current application, others can access your "
+"application via this address. Using remote access makes it easy to temporarily "
+"share the application with others. The remote access service is provided by "
+"`localhost.run <https://localhost.run/>`_. You can use a dict to config remote "
+"access service, the following configurations are currently supported:"
+msgstr ""
+"是否开启远程接入的功能。开启后,你将得到一个你当前应用的临时公网访问地址,其他人可"
+"以通过此地址访问你的应用。使用远程接入可以很方便地将应用临时分享给其他人来体验。目"
+"前远程接入功能由 `localhost.run <https://localhost.run/>`_ 提供,你可以传入一个dict"
+"来配置远程接入服务,目前支持以下配置:"
+
+#: of pywebio.platform.tornado.start_server:38
+msgid ""
+"``ssh_key_path``: Use a custom ssh key, the default key path is ``~/.ssh/id_xxx``. "
+"Note that only rsa and ed25519 keys are supported."
+msgstr ""
+"``ssh_key_path``: 自定义ssh密钥的路径, 默认使用 ``~/.ssh/id_xxx``. 注意目前仅支持"
+"rsa 和 ed25519 类型的密钥。"
+
+#: of pywebio.platform.tornado.start_server:39
+msgid ""
+"``custom_domain``: Use a custom domain for your remote access address. This need a "
+"subscription to localhost.run. See also: `Custom Domains - localhost.run <https://"
+"localhost.run/docs/custom-domains/>`_"
+msgstr ""
+"``custom_domain``: 使用自定义域名。这项功能需要localhost.run订阅版。参见: `Custom "
+"Domains - localhost.run <https://localhost.run/docs/custom-domains/>`_"
+
+#: of pywebio.platform.tornado.start_server:42
+#: pywebio.platform.tornado.start_server:60
+msgid ""
+"Whether or not auto open web browser when server is started (if the operating "
+"system allows it) ."
+msgstr "当服务启动后,是否自动打开浏览器来访问服务。(该操作需要操作系统支持)"
+
+#: of pywebio.platform.tornado.start_server:45
 msgid ""
 "The allowed request source list. (The current server host is always allowed) The "
 "source contains the protocol, domain name, and port part. Can use Unix shell-style "
@@ -324,7 +394,7 @@ msgid ""
 "detail, see `Python Doc <https://docs.python.org/zh-tw/3/library/fnmatch.html>`_"
 msgstr ""
 
-#: of pywebio.platform.tornado.start_server:33
+#: of pywebio.platform.tornado.start_server:45
 msgid ""
 "The allowed request source list. (The current server host is always allowed) The "
 "source contains the protocol, domain name, and port part. Can use Unix shell-style "
@@ -333,34 +403,34 @@ msgstr ""
 "除当前域名外,服务器还允许的请求的来源列表。来源包含协议、域名和端口部分,允许使用 "
 "Unix shell 风格的匹配模式:"
 
-#: of pywebio.platform.tornado.start_server:37
+#: of pywebio.platform.tornado.start_server:49
 msgid "``*`` matches everything"
 msgstr "``*`` 为通配符"
 
-#: of pywebio.platform.tornado.start_server:38
+#: of pywebio.platform.tornado.start_server:50
 msgid "``?`` matches any single character"
 msgstr "``?`` 匹配单个字符"
 
-#: of pywebio.platform.tornado.start_server:39
+#: of pywebio.platform.tornado.start_server:51
 msgid "``[seq]`` matches any character in *seq*"
 msgstr "``[seq]`` 匹配seq中的任何字符"
 
-#: of pywebio.platform.tornado.start_server:40
+#: of pywebio.platform.tornado.start_server:52
 msgid "``[!seq]`` matches any character not in *seq*"
 msgstr "``[!seq]`` 匹配任何不在seq中的字符"
 
-#: of pywebio.platform.tornado.start_server:42
+#: of pywebio.platform.tornado.start_server:54
 msgid "Such as: ``https://*.example.com`` 、 ``*://*.example.com``"
 msgstr "比如 ``https://*.example.com`` 、 ``*://*.example.com``"
 
-#: of pywebio.platform.tornado.start_server:44
+#: of pywebio.platform.tornado.start_server:56
 msgid ""
 "For detail, see `Python Doc <https://docs.python.org/zh-tw/3/library/fnmatch."
 "html>`_"
 msgstr ""
 "全部规则参见 `Python文档 <https://docs.python.org/zh-tw/3/library/fnmatch.html>`_ "
 
-#: of pywebio.platform.tornado.start_server:45
+#: of pywebio.platform.tornado.start_server:57
 msgid ""
 "The validation function for request source. It receives the source string (which "
 "contains protocol, host, and port parts) as parameter and return ``True/False`` to "
@@ -371,13 +441,7 @@ msgstr ""
 "返回 ``True/False`` 指示服务器接受/拒绝该请求。若设置了 ``check_origin`` , "
 "``allowed_origins`` 参数将被忽略"
 
-#: of pywebio.platform.tornado.start_server:48
-msgid ""
-"Whether or not auto open web browser when server is started (if the operating "
-"system allows it) ."
-msgstr "当服务启动后,是否自动打开浏览器来访问服务。(该操作需要操作系统支持)"
-
-#: of pywebio.platform.tornado.start_server:49
+#: of pywebio.platform.tornado.start_server:61
 msgid ""
 "Max size of a websocket message which Tornado can accept. Messages larger than the "
 "``max_payload_size`` (default 200MB) will not be accepted. ``max_payload_size`` "
@@ -389,7 +453,7 @@ msgstr ""
 "200MB) 的消息会被拒绝接受。 ``max_payload_size`` 可以是整形表示的字节数或以 `K` / "
 "`M` / `G` 结尾的字符串,比如: ``500``, ``'40K'``, ``'3M'`` "
 
-#: of pywebio.platform.tornado.start_server:54
+#: of pywebio.platform.tornado.start_server:66
 msgid ""
 "Additional keyword arguments passed to the constructor of ``tornado.web."
 "Application``. For details, please refer: https://www.tornadoweb.org/en/stable/web."
@@ -414,7 +478,7 @@ msgid ""
 msgstr ""
 "关于各参数的详细说明见 :func:`pywebio.platform.tornado.start_server` 的同名参数。"
 
-#: of pywebio.platform:47
+#: of pywebio.platform:56
 msgid "HTTP"
 msgstr ""
 
@@ -466,11 +530,11 @@ msgstr ""
 "关于各参数的详细说明见 :func:`pywebio.platform.tornado_http.start_server` 的同名参"
 "数。"
 
-#: of pywebio.platform:54
+#: of pywebio.platform:63
 msgid "Flask support"
 msgstr ""
 
-#: of pywebio.platform:56
+#: of pywebio.platform:65
 msgid ""
 "When using the Flask as PyWebIO backend server, you need to install Flask by "
 "yourself and make sure the version is not less than ``0.10``. You can install it "
@@ -480,7 +544,7 @@ msgstr ""
 "``0.10`` 。\n"
 "可通过以下命令安装::"
 
-#: of pywebio.platform:59
+#: of pywebio.platform:68
 msgid "pip3 install -U flask>=0.10"
 msgstr ""
 
@@ -497,6 +561,17 @@ msgid ""
 msgstr ""
 "关于各参数的详细说明见 :func:`pywebio.platform.flask.start_server` 的同名参数。"
 
+#: of pywebio.platform.flask.wsgi_app:1
+msgid "Get the Flask WSGI app for running PyWebIO applications."
+msgstr "将PyWebIO应用转换为Flask WSGI 应用"
+
+#: of pywebio.platform.flask.wsgi_app:3
+msgid ""
+"The arguments of ``wsgi_app()`` have the same meaning as for :func:`pywebio."
+"platform.flask.start_server`"
+msgstr ""
+"关于各参数的详细说明见 :func:`pywebio.platform.flask.start_server` 的同名参数。"
+
 #: of pywebio.platform.flask.start_server:1
 msgid "Start a Flask server to provide the PyWebIO application as a web service."
 msgstr "启动一个 Flask server 将PyWebIO应用作为Web服务提供。"
@@ -542,11 +617,11 @@ msgid ""
 msgstr ""
 "关于各参数的详细说明见 :func:`pywebio.platform.tornado.start_server` 的同名参数"
 
-#: of pywebio.platform:66
+#: of pywebio.platform:76
 msgid "Django support"
 msgstr ""
 
-#: of pywebio.platform:68
+#: of pywebio.platform:78
 msgid ""
 "When using the Django as PyWebIO backend server, you need to install Django by "
 "yourself and make sure the version is not less than ``2.2``. You can install it "
@@ -556,7 +631,7 @@ msgstr ""
 "``2.2`` 。\n"
 "可通过以下命令安装::"
 
-#: of pywebio.platform:71
+#: of pywebio.platform:81
 msgid "pip3 install -U django>=2.2"
 msgstr ""
 
@@ -573,6 +648,17 @@ msgid ""
 msgstr ""
 "关于各参数的详细说明见 :func:`pywebio.platform.flask.webio_view` 的同名参数。"
 
+#: of pywebio.platform.django.wsgi_app:1
+msgid "Get the Django WSGI app for running PyWebIO applications."
+msgstr "将PyWebIO应用转换为Django WSGI 应用"
+
+#: of pywebio.platform.django.wsgi_app:3
+msgid ""
+"The arguments of ``wsgi_app()`` have the same meaning as for :func:`pywebio."
+"platform.django.start_server`"
+msgstr ""
+"关于各参数的详细说明见 :func:`pywebio.platform.django.start_server` 的同名参数。"
+
 #: of pywebio.platform.django.start_server:1
 msgid "Start a Django server to provide the PyWebIO application as a web service."
 msgstr "启动一个 Django server 将PyWebIO应用作为Web服务提供。"
@@ -603,11 +689,11 @@ msgid ""
 msgstr ""
 "剩余参数的详细说明见 :func:`pywebio.platform.flask.start_server` 的同名参数。"
 
-#: of pywebio.platform:77
+#: of pywebio.platform:88
 msgid "aiohttp support"
 msgstr ""
 
-#: of pywebio.platform:79
+#: of pywebio.platform:90
 msgid ""
 "When using the aiohttp as PyWebIO backend server, you need to install aiohttp by "
 "yourself and make sure the version is not less than ``3.1``. You can install it "
@@ -617,7 +703,7 @@ msgstr ""
 "``3.1`` 。\n"
 "可通过以下命令安装::"
 
-#: of pywebio.platform:82
+#: of pywebio.platform:93
 msgid "pip3 install -U aiohttp>=3.1"
 msgstr ""
 
@@ -639,7 +725,8 @@ msgstr ""
 "关于 ``applications`` 、 ``allowed_origins`` 、 ``check_origin`` 参数的详细说明见 :"
 "func:`pywebio.platform.aiohttp.start_server` 的同名参数。"
 
-#: of pywebio.platform.aiohttp.webio_handler pywebio.platform.fastapi.webio_routes
+#: of pywebio.platform.aiohttp.webio_handler pywebio.platform.fastapi.asgi_app
+#: pywebio.platform.fastapi.webio_routes
 msgid "Returns"
 msgstr ""
 
@@ -669,11 +756,11 @@ msgstr ""
 "需要传给 aiohttp Application 的参数。可用参数见 https://docs.aiohttp.org/en/stable/"
 "web_reference.html#application"
 
-#: of pywebio.platform:88
+#: of pywebio.platform:99
 msgid "FastAPI/Starlette support"
 msgstr ""
 
-#: of pywebio.platform:90
+#: of pywebio.platform:101
 msgid ""
 "When using the FastAPI/Starlette as PyWebIO backend server, you need to install "
 "``fastapi`` or ``starlette`` by yourself. Also other dependency packages are "
@@ -682,7 +769,7 @@ msgstr ""
 "当使用FastAPI/Starlette作为PyWebIO的后端server时,你需要手动安装 ``fastapi`` 或 "
 "``starlette`` ,另外还需要安装一些其他的依赖库,可以使用以下命令安装::"
 
-#: of pywebio.platform:93
+#: of pywebio.platform:104
 msgid "pip3 install -U fastapi starlette uvicorn aiofiles websockets"
 msgstr ""
 
@@ -705,6 +792,40 @@ msgstr ""
 msgid "FastAPI/Starlette routes"
 msgstr ""
 
+#: of pywebio.platform.fastapi.asgi_app:1
+msgid "Get the starlette/Fastapi ASGI app for running PyWebIO applications."
+msgstr "将PyWebIO应用转换为starlette/Fastapi ASGI应用"
+
+#: of pywebio.platform.fastapi.asgi_app:3
+msgid ""
+"Use :func:`pywebio.platform.fastapi.webio_routes` if you prefer handling static "
+"files yourself. same arguments for :func:`pywebio.platform.fastapi.webio_routes`"
+msgstr ""
+
+#: of pywebio.platform.fastapi.asgi_app
+msgid "Example"
+msgstr ""
+
+#: of pywebio.platform.fastapi.asgi_app:8
+msgid ""
+"To be used with ``FastAPI.mount()`` to include pywebio as a subapp into an "
+"existing Starlette/FastAPI application::"
+msgstr ""
+
+#: of pywebio.platform.fastapi.asgi_app:10
+msgid ""
+"from fastapi import FastAPI\n"
+"from pywebio.platform.fastapi import asgi_app\n"
+"from pywebio.output import put_text\n"
+"app = FastAPI()\n"
+"subapp = asgi_app(lambda: put_text(\"hello from pywebio\"))\n"
+"app.mount(\"/pywebio\", subapp)"
+msgstr ""
+
+#: of pywebio.platform.fastapi.asgi_app:17
+msgid "Starlette/Fastapi ASGI app"
+msgstr ""
+
 #: of pywebio.platform.fastapi.start_server:1
 msgid ""
 "Start a FastAPI/Starlette server using uvicorn to provide the PyWebIO application "
@@ -723,7 +844,7 @@ msgstr ""
 "传递给 ``uvicorn.run()`` 的额外关键字参数\n"
 "可设置项参考: https://www.uvicorn.org/settings/"
 
-#: of pywebio.platform:99
+#: of pywebio.platform:111
 msgid "Other"
 msgstr "其他"
 
@@ -894,3 +1015,6 @@ msgstr ""
 #~ "``websocket_ping_timeout`` 秒\n"
 #~ "内收到'pong'消息,应用会将连接关闭。默认的超时时间为 "
 #~ "``websocket_ping_interval`` 的三倍。"
+
+#~ msgid "Get the WSGI app for running PyWebIO applications in Django."
+#~ msgstr "将PyWebIO应用转换为Django WSGI 应用"

+ 35 - 6
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-04-14 21:12+0800\n"
+"POT-Creation-Date: 2021-05-28 17:01+0800\n"
 "PO-Revision-Date: 2021-04-03 22:47+0800\n"
 "Last-Translator: WangWeimin <wang0.618@qq.com>\n"
 "Language: zh_CN\n"
@@ -79,7 +79,7 @@ msgid "Coroutine object in `asyncio`"
 msgstr "`asyncio` 库中的协程对象"
 
 #: of pywebio.session.run_asyncio_coroutine:7 pywebio.session.run_js:8
-#: pywebio.session.set_env:12
+#: pywebio.session.set_env:14
 msgid "Example::"
 msgstr ""
 
@@ -408,18 +408,33 @@ msgstr ""
 "HTTP轮询后端消息的周期(单位为毫秒,默认1000ms),仅在基于HTTP连接的会话(使用Flask或Django后端)中可用"
 
 #: of pywebio.session.set_env:9
+#, fuzzy
+msgid ""
+"``input_panel_fixed`` (bool): Whether to make input panel fixed at bottom, "
+"enabled by default"
+msgstr "``output_animation`` (bool): 是否启用输出动画(在输出内容时,使用过渡动画),默认启用"
+
+#: of pywebio.session.set_env:10
 msgid ""
 "``input_panel_min_height`` (int): The minimum height of input panel (in "
-"pixel, default 300px), it should be larger than 75px."
+"pixel, default 300px), it should be larger than 75px. Available only when "
+"``input_panel_fixed=True``"
 msgstr ""
 
-#: of pywebio.session.set_env:10
+#: of pywebio.session.set_env:11
 msgid ""
 "``input_panel_init_height`` (int): The initial height of input panel (in "
-"pixel, default 300px), it should be larger than 175px."
+"pixel, default 300px), it should be larger than 175px. Available only when "
+"``input_panel_fixed=True``"
+msgstr ""
+
+#: of pywebio.session.set_env:12
+msgid ""
+"``input_auto_focus`` (bool): Whether to focus on input automatically after "
+"showing input panel, default is ``True``"
 msgstr ""
 
-#: of pywebio.session.set_env:14
+#: of pywebio.session.set_env:16
 msgid "set_env(title='Awesome PyWebIO!!', output_animation=False)"
 msgstr ""
 
@@ -670,3 +685,17 @@ msgstr "任务是否关闭"
 #~ "}, indent=4), 'json')"
 #~ msgstr ""
 
+#~ msgid ""
+#~ "``input_panel_min_height`` (int): The minimum "
+#~ "height of input panel (in pixel, "
+#~ "default 300px), it should be larger "
+#~ "than 75px."
+#~ msgstr ""
+
+#~ msgid ""
+#~ "``input_panel_init_height`` (int): The initial "
+#~ "height of input panel (in pixel, "
+#~ "default 300px), it should be larger "
+#~ "than 175px."
+#~ msgstr ""
+

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 296 - 191
docs/locales/zh_CN/LC_MESSAGES/spec.po


+ 1 - 1
pywebio/input.py

@@ -588,7 +588,7 @@ def slider(label='', *, name=None, value=0, min_value=0, max_value=100, step=1,
     :param int/float min_value: The minimum permitted value.
     :param int/float max_value: The maximum permitted value.
     :param int step: The stepping interval.
-       Only available when ```value``, ``min_value`` and ``max_value`` are all integer.
+       Only available when ``value``, ``min_value`` and ``max_value`` are all integer.
     :param - label, name, validate, onchange, required, help_text, other_html_attrs: Those arguments have the same meaning as for `input()`
     :return int/float: If one of ``value``, ``min_value`` and ``max_value`` is float,
        the return value is a float, otherwise an int is returned.

+ 2 - 2
pywebio/pin.py

@@ -189,7 +189,7 @@ def put_radio(name, options=None, *, label='', inline=None, value=None, help_tex
 
 def put_slider(name, *, label='', value=0, min_value=0, max_value=100, step=1, required=None, help_text=None,
                scope=Scope.Current, position=OutputPosition.BOTTOM) -> Output:
-    """Output a slide widget. Refer to: `pywebio.input.slide()`"""
+    """Output a slide widget. Refer to: `pywebio.input.slider()`"""
     check_name(name)
     single_input_return = slider(name=name, label=label, value=value, min_value=min_value, max_value=max_value,
                                  step=step, required=required, help_text=help_text)
@@ -235,7 +235,7 @@ def pin_wait_change(*names):
     the function returns with the name and value of the changed widget.
 
     :param str names: List of names of pin widget
-    :return dict:
+    :return dict: ``{"name": name of the changed widget, "value": current value of the changed widget }``
 
     :demo_host:`Here </markdown_previewer>` is an demo of using `pin_wait_change()` to make a markdown previewer.
 

+ 1 - 1
pywebio/platform/django.py

@@ -105,7 +105,7 @@ def wsgi_app(applications, cdn=True,
                  session_expire_seconds=None,
                  session_cleanup_interval=None,
                  debug=False, max_payload_size='200M', **django_options):
-    """Get the WSGI app for running PyWebIO applications in Django.
+    """Get the Django WSGI app for running PyWebIO applications.
 
     The arguments of ``wsgi_app()`` have the same meaning as for :func:`pywebio.platform.django.start_server`
     """

+ 2 - 2
pywebio/platform/fastapi.py

@@ -173,7 +173,7 @@ def start_server(applications, port=0, host='', cdn=True,
 
 
 def asgi_app(applications, cdn=True, static_dir=None, debug=False, allowed_origins=None, check_origin=None):
-    """Build a starlette app exposing a PyWebIO application including static files.
+    """Get the starlette/Fastapi ASGI app for running PyWebIO applications.
 
     Use :func:`pywebio.platform.fastapi.webio_routes` if you prefer handling static files yourself.
     same arguments for :func:`pywebio.platform.fastapi.webio_routes`
@@ -189,7 +189,7 @@ def asgi_app(applications, cdn=True, static_dir=None, debug=False, allowed_origi
         subapp = asgi_app(lambda: put_text("hello from pywebio"))
         app.mount("/pywebio", subapp)
 
-    :Returns: Starlette ASGI app
+    :Returns: Starlette/Fastapi ASGI app
 
     .. versionadded:: 1.3
     """

+ 1 - 1
pywebio/platform/flask.py

@@ -104,7 +104,7 @@ def wsgi_app(applications, cdn=True,
              session_expire_seconds=None,
              session_cleanup_interval=None,
              max_payload_size='200M'):
-    """Get the WSGI app for running PyWebIO applications in Flask.
+    """Get the Flask WSGI app for running PyWebIO applications.
 
     The arguments of ``wsgi_app()`` have the same meaning as for :func:`pywebio.platform.flask.start_server`
     """

+ 4 - 1
pywebio/session/coroutinebased.py

@@ -197,7 +197,10 @@ class CoroutineBasedSession(Session):
 
         cls = type(self)
         callback_task = Task(callback_coro(), cls.get_current_session())
-        callback_task.coro.send(None)  # 激活,Non't callback.step() ,导致嵌套调用step  todo 与inactive_coro_instances整合
+        # Activate task
+        # Don't callback.step(), it will result in recursive calls to step()
+        # todo: integrate with inactive_coro_instances
+        callback_task.coro.send(None)
         cls.get_current_session().coros[callback_task.coro_id] = callback_task
 
         return callback_task.coro_id

+ 2 - 2
webiojs/src/i18n.ts

@@ -14,7 +14,7 @@ const translations: { [lang: string]: { [msgid: string]: string } } = {
         "submit": "Submit",
         "reset": "Reset",
         "cancel": "Cancel",
-        "duplicated_pin_name": "App Error: Duplicated pin widget name %1",
+        "duplicated_pin_name": "App Error: Duplicated pin widget name '%1'",
     },
     "zh": {
         "disconnected_with_server": "与服务器连接已断开,请刷新页面重新操作",
@@ -25,7 +25,7 @@ const translations: { [lang: string]: { [msgid: string]: string } } = {
         "submit": "提交",
         "reset": "重置",
         "cancel": "取消",
-        "duplicated_pin_name": "应用错误: 输出了相同name的pin widget %1",
+        "duplicated_pin_name": "应用错误: 输出了相同name的pin widget '%1'",
     },
 };
 

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio