Browse Source

doc update

wangweimin 4 năm trước cách đây
mục cha
commit
c7ab650e07

+ 1 - 6
docs/guide.rst

@@ -745,7 +745,6 @@ The integration methods of those web frameworks are as follows:
             import tornado.ioloop
             import tornado.ioloop
             import tornado.web
             import tornado.web
             from pywebio.platform.tornado import webio_handler
             from pywebio.platform.tornado import webio_handler
-            from pywebio import STATIC_PATH
 
 
             class MainHandler(tornado.web.RequestHandler):
             class MainHandler(tornado.web.RequestHandler):
                 def get(self):
                 def get(self):
@@ -775,8 +774,7 @@ The integration methods of those web frameworks are as follows:
         Use `pywebio.platform.flask.webio_view()` to get the view function for running PyWebIO applications in Flask::
         Use `pywebio.platform.flask.webio_view()` to get the view function for running PyWebIO applications in Flask::
 
 
             from pywebio.platform.flask import webio_view
             from pywebio.platform.flask import webio_view
-            from pywebio import STATIC_PATH
-            from flask import Flask, send_from_directory
+            from flask import Flask
 
 
             app = Flask(__name__)
             app = Flask(__name__)
 
 
@@ -799,10 +797,7 @@ The integration methods of those web frameworks are as follows:
 
 
             # urls.py
             # urls.py
 
 
-            from functools import partial
             from django.urls import path
             from django.urls import path
-            from django.views.static import serve
-            from pywebio import STATIC_PATH
             from pywebio.platform.django import webio_view
             from pywebio.platform.django import webio_view
 
 
             # `task_func` is PyWebIO task function
             # `task_func` is PyWebIO task function

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 353 - 194
docs/locales/zh_CN/LC_MESSAGES/guide.po


+ 11 - 9
docs/locales/zh_CN/LC_MESSAGES/input.po

@@ -7,8 +7,8 @@ msgid ""
 msgstr ""
 msgstr ""
 "Project-Id-Version: PyWebIO 1.1.0\n"
 "Project-Id-Version: PyWebIO 1.1.0\n"
 "Report-Msgid-Bugs-To: \n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-03-23 20:40+0800\n"
-"PO-Revision-Date: 2021-03-23 20:40+0800\n"
+"POT-Creation-Date: 2021-04-14 21:12+0800\n"
+"PO-Revision-Date: 2021-04-14 21:19+0800\n"
 "Last-Translator: WangWeimin <wang0.618@qq.com>\n"
 "Last-Translator: WangWeimin <wang0.618@qq.com>\n"
 "Language: zh_CN\n"
 "Language: zh_CN\n"
 "Language-Team: \n"
 "Language-Team: \n"
@@ -894,13 +894,15 @@ msgstr ""
 #: of pywebio.input.file_upload:36
 #: of pywebio.input.file_upload:36
 msgid ""
 msgid ""
 "If uploading large files, please pay attention to the file upload size limit setting of the "
 "If uploading large files, please pay attention to the file upload size limit setting of the "
-"web framework. When using :func:`start_server <pywebio.platform.start_server>` to start the "
-"PyWebIO application, the maximum file size to be uploaded allowed by the web framework can be "
-"set through the `websocket_max_message_size` parameter"
-msgstr ""
-"若上传大文件请留意Web框架的文件上传大小限制设置。在使用 :func:`start_server <pywebio.platform."
-"start_server>` 启动PyWebIO应用时,\n"
-"可通过 `websocket_max_message_size` 参数设置允许上传的最大文件大小"
+"web framework. When using :func:`start_server() <pywebio.platform.tornado.start_server>`/:"
+"func:`path_deploy() <pywebio.platform.path_deploy>` to start the PyWebIO application, the "
+"maximum file size to be uploaded allowed by the web framework can be set through the "
+"``max_payload_size`` parameter."
+msgstr ""
+"若上传大文件请留意Web框架的文件上传大小限制设置。在使用 :func:`start_server() <pywebio."
+"platform.tornado.start_server>`/:func:`path_deploy() <pywebio.platform.path_deploy>` 启动"
+"PyWebIO应用时,\n"
+"可通过 `max_payload_size` 参数设置Web框架允许上传的最大文件大小"
 
 
 #: of pywebio.input.input_group:1
 #: of pywebio.input.input_group:1
 msgid "Input group. Request a set of inputs from the user at once."
 msgid "Input group. Request a set of inputs from the user at once."

+ 31 - 20
docs/locales/zh_CN/LC_MESSAGES/misc.po

@@ -7,15 +7,16 @@ msgid ""
 msgstr ""
 msgstr ""
 "Project-Id-Version: PyWebIO 1.1.0\n"
 "Project-Id-Version: PyWebIO 1.1.0\n"
 "Report-Msgid-Bugs-To: \n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-02-17 17:57+0800\n"
-"PO-Revision-Date: 2021-02-18 11:25+0800\n"
+"POT-Creation-Date: 2021-04-14 21:17+0800\n"
+"PO-Revision-Date: 2021-04-14 21:17+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"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=utf-8\n"
 "Content-Type: text/plain; charset=utf-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 "Content-Transfer-Encoding: 8bit\n"
 "Generated-By: Babel 2.8.0\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"
 "X-Generator: Poedit 2.4.2\n"
 
 
 #: ../../misc.rst:2
 #: ../../misc.rst:2
@@ -76,12 +77,12 @@ msgstr "Nginx WebSocket配置示例"
 
 
 #: ../../misc.rst:23
 #: ../../misc.rst:23
 msgid ""
 msgid ""
-"Assuming that the backend server is running at the ``localhost:5000`` "
-"address, and the backend API of PyWebIO is bind to the ``/tool`` path, the "
-"configuration of Nginx is as follows::"
+"Assuming that the PyWebIO application is running at the ``localhost:5000`` "
+"address, if you want to access your PyWebIO application via ``http://"
+"server_ip/some_path/tool``, a sample Nginx configuration is as follows::"
 msgstr ""
 msgstr ""
-"假设后端服务器运行在 ``localhost:5000`` 地址,并将PyWebIO的后端接口绑定到 ``/"
-"tool`` 路径上,则通过Nginx访问PyWebIO服务的配置如下::"
+"假设PyWebIO应用运行在 ``localhost:5000`` 地址,如果你想通过 ``http://"
+"server_ip/some_path/tool`` 来访问应用,需要的Nginx配置如下::"
 
 
 #: ../../misc.rst:25
 #: ../../misc.rst:25
 msgid ""
 msgid ""
@@ -93,29 +94,31 @@ msgid ""
 "server {\n"
 "server {\n"
 "    listen 80;\n"
 "    listen 80;\n"
 "\n"
 "\n"
-"    location / {\n"
+"    location /some_path/ {\n"
 "        alias /path/to/pywebio/static/dir/;\n"
 "        alias /path/to/pywebio/static/dir/;\n"
 "    }\n"
 "    }\n"
-"    location /tool {\n"
+"    location /some_path/tool {\n"
 "         proxy_read_timeout 300s;\n"
 "         proxy_read_timeout 300s;\n"
 "         proxy_send_timeout 300s;\n"
 "         proxy_send_timeout 300s;\n"
 "         proxy_http_version 1.1;\n"
 "         proxy_http_version 1.1;\n"
+"         proxy_set_header Host $host:$server_port;\n"
 "         proxy_set_header Upgrade $http_upgrade;\n"
 "         proxy_set_header Upgrade $http_upgrade;\n"
 "         proxy_set_header Connection $connection_upgrade;\n"
 "         proxy_set_header Connection $connection_upgrade;\n"
-"         proxy_pass http://localhost:5000;\n"
+"         proxy_pass http://localhost:5000/;\n"
 "    }\n"
 "    }\n"
 "}"
 "}"
 msgstr ""
 msgstr ""
 
 
-#: ../../misc.rst:47
+#: ../../misc.rst:48
 msgid ""
 msgid ""
-"The above configuration file hosts the static files of PyWebIO on the ``/`` "
-"path, and reverse proxy ``/tool`` to ``localhost:5000/tool``"
+"The above configuration file hosts the static files of PyWebIO on the ``/"
+"some_path/`` path, and reverse proxy ``/some_path/tool`` to "
+"``localhost:5000``."
 msgstr ""
 msgstr ""
-"以上配置文件将PyWebIO的静态文件托管到 ``/`` 目录下, 并将 ``/tool`` 反向代理"
-"到 ``localhost:5000``"
+"以上配置文件将PyWebIO的静态文件托管到 ``/some_path/`` 目录下, 并将 ``/"
+"some_path/tool`` 反向代理到 ``localhost:5000``"
 
 
-#: ../../misc.rst:49
+#: ../../misc.rst:50
 msgid ""
 msgid ""
 "The path of the static file of PyWebIO can be obtained with the command "
 "The path of the static file of PyWebIO can be obtained with the command "
 "``python3 -c \"import pywebio; print(pywebio.STATIC_PATH)\"``, you can also "
 "``python3 -c \"import pywebio; print(pywebio.STATIC_PATH)\"``, you can also "
@@ -124,6 +127,14 @@ msgstr ""
 "PyWebIO的静态文件的路径可使用命令 ``python3 -c \"import pywebio; "
 "PyWebIO的静态文件的路径可使用命令 ``python3 -c \"import pywebio; "
 "print(pywebio.STATIC_PATH)\"`` 获得,你也可以将静态文件复制到其他目录下::"
 "print(pywebio.STATIC_PATH)\"`` 获得,你也可以将静态文件复制到其他目录下::"
 
 
-#: ../../misc.rst:51
+#: ../../misc.rst:52
 msgid "cp -r `python3 -c \"import pywebio; print(pywebio.STATIC_PATH)\"` ~/web"
 msgid "cp -r `python3 -c \"import pywebio; print(pywebio.STATIC_PATH)\"` ~/web"
 msgstr ""
 msgstr ""
+
+#~ msgid ""
+#~ "Assuming that the backend server is running at the ``localhost:5000`` "
+#~ "address, and the backend API of PyWebIO is bind to the ``/tool`` path, "
+#~ "the configuration of Nginx is as follows::"
+#~ msgstr ""
+#~ "假设后端服务器运行在 ``localhost:5000`` 地址,并将PyWebIO的后端接口绑定到 "
+#~ "``/tool`` 路径上,则通过Nginx访问PyWebIO服务的配置如下::"

+ 81 - 64
docs/locales/zh_CN/LC_MESSAGES/output.po

@@ -7,8 +7,8 @@ msgid ""
 msgstr ""
 msgstr ""
 "Project-Id-Version: PyWebIO 1.1.0\n"
 "Project-Id-Version: PyWebIO 1.1.0\n"
 "Report-Msgid-Bugs-To: \n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-03-23 20:35+0800\n"
-"PO-Revision-Date: 2021-03-23 20:37+0800\n"
+"POT-Creation-Date: 2021-04-14 21:12+0800\n"
+"PO-Revision-Date: 2021-04-14 21:41+0800\n"
 "Last-Translator: WangWeimin <wang0.618@qq.com>\n"
 "Last-Translator: WangWeimin <wang0.618@qq.com>\n"
 "Language: zh_CN\n"
 "Language: zh_CN\n"
 "Language-Team: \n"
 "Language-Team: \n"
@@ -56,7 +56,7 @@ msgstr "**函数**"
 msgid "**Description**"
 msgid "**Description**"
 msgstr "**简介**  "
 msgstr "**简介**  "
 
 
-#: of pywebio.output:19 pywebio.output:88
+#: of pywebio.output:19 pywebio.output:90
 msgid "Output Scope"
 msgid "Output Scope"
 msgstr "输出域Scope"
 msgstr "输出域Scope"
 
 
@@ -108,7 +108,7 @@ msgstr ""
 msgid "Open or enter a scope"
 msgid "Open or enter a scope"
 msgstr "开启/进入输出域"
 msgstr "开启/进入输出域"
 
 
-#: of pywebio.output:31 pywebio.output:97
+#: of pywebio.output:31 pywebio.output:99
 msgid "Content Outputting"
 msgid "Content Outputting"
 msgstr "内容输出"
 msgstr "内容输出"
 
 
@@ -144,7 +144,7 @@ msgstr ""
 msgid "`put_error`:sup:`*†`"
 msgid "`put_error`:sup:`*†`"
 msgstr ""
 msgstr ""
 
 
-#: of pywebio.output:35 pywebio.output:106
+#: of pywebio.output:35 pywebio.output:108
 msgid "Output Messages."
 msgid "Output Messages."
 msgstr "输出通知消息"
 msgstr "输出通知消息"
 
 
@@ -229,14 +229,22 @@ msgid "Output a link to download a file"
 msgstr "显示一个文件下载链接"
 msgstr "显示一个文件下载链接"
 
 
 #: of pywebio.output:60
 #: of pywebio.output:60
+msgid "`put_tabs`:sup:`*`"
+msgstr ""
+
+#: of pywebio.output:60
+msgid "Output tabs"
+msgstr "输出横向标签栏Tabs"
+
+#: of pywebio.output:62
 msgid "`put_collapse`:sup:`*†`"
 msgid "`put_collapse`:sup:`*†`"
 msgstr ""
 msgstr ""
 
 
-#: of pywebio.output:60 pywebio.output.put_collapse:1
+#: of pywebio.output:62 pywebio.output.put_collapse:1
 msgid "Output collapsible content"
 msgid "Output collapsible content"
 msgstr "输出可折叠的内容"
 msgstr "输出可折叠的内容"
 
 
-#: of pywebio.output:62
+#: of pywebio.output:64
 msgid "`put_scrollable`:sup:`*†`"
 msgid "`put_scrollable`:sup:`*†`"
 msgstr ""
 msgstr ""
 
 
@@ -252,95 +260,95 @@ msgstr "内容超出则显示滚动条"
 msgid "exceeds the limit"
 msgid "exceeds the limit"
 msgstr "."
 msgstr "."
 
 
-#: of pywebio.output:66
+#: of pywebio.output:68
 msgid "`put_widget`:sup:`*`"
 msgid "`put_widget`:sup:`*`"
 msgstr ""
 msgstr ""
 
 
-#: of pywebio.output:66 pywebio.output.put_widget:1
+#: of pywebio.output:68 pywebio.output.put_widget:1
 msgid "Output your own widget"
 msgid "Output your own widget"
 msgstr "输出自定义的控件"
 msgstr "输出自定义的控件"
 
 
-#: of pywebio.output:68 pywebio.output:131
+#: of pywebio.output:70 pywebio.output:133
 msgid "Other Interactions"
 msgid "Other Interactions"
 msgstr "其他交互"
 msgstr "其他交互"
 
 
-#: of pywebio.output:68
+#: of pywebio.output:70
 msgid "`toast`"
 msgid "`toast`"
 msgstr ""
 msgstr ""
 
 
-#: of pywebio.output:68
+#: of pywebio.output:70
 msgid "Show a notification message"
 msgid "Show a notification message"
 msgstr "显示一条通知消息"
 msgstr "显示一条通知消息"
 
 
-#: of pywebio.output:70
+#: of pywebio.output:72
 msgid "`popup`:sup:`*†`"
 msgid "`popup`:sup:`*†`"
 msgstr ""
 msgstr ""
 
 
-#: of pywebio.output:70
+#: of pywebio.output:72
 msgid "Show popup"
 msgid "Show popup"
 msgstr "显示弹窗"
 msgstr "显示弹窗"
 
 
-#: of pywebio.output:72
+#: of pywebio.output:74
 msgid "`close_popup`"
 msgid "`close_popup`"
 msgstr ""
 msgstr ""
 
 
-#: of pywebio.output:72 pywebio.output.close_popup:1
+#: of pywebio.output:74 pywebio.output.close_popup:1
 msgid "Close the current popup window."
 msgid "Close the current popup window."
 msgstr "关闭正在显示的弹窗"
 msgstr "关闭正在显示的弹窗"
 
 
-#: of pywebio.output:74 pywebio.output:139
+#: of pywebio.output:76 pywebio.output:141
 msgid "Layout and Style"
 msgid "Layout and Style"
 msgstr "布局与样式"
 msgstr "布局与样式"
 
 
-#: of pywebio.output:74
+#: of pywebio.output:76
 msgid "`put_row`:sup:`*†`"
 msgid "`put_row`:sup:`*†`"
 msgstr ""
 msgstr ""
 
 
-#: of pywebio.output:74
+#: of pywebio.output:76
 msgid "Use row layout to output content"
 msgid "Use row layout to output content"
 msgstr "使用行布局输出内容"
 msgstr "使用行布局输出内容"
 
 
-#: of pywebio.output:76
+#: of pywebio.output:78
 msgid "`put_column`:sup:`*†`"
 msgid "`put_column`:sup:`*†`"
 msgstr ""
 msgstr ""
 
 
-#: of pywebio.output:76
+#: of pywebio.output:78
 msgid "Use column layout to output content"
 msgid "Use column layout to output content"
 msgstr "使用列布局输出内容"
 msgstr "使用列布局输出内容"
 
 
-#: of pywebio.output:78
+#: of pywebio.output:80
 msgid "`put_grid`:sup:`*`"
 msgid "`put_grid`:sup:`*`"
 msgstr ""
 msgstr ""
 
 
-#: of pywebio.output:78 pywebio.output.put_grid:1
+#: of pywebio.output:80 pywebio.output.put_grid:1
 msgid "Output content using grid layout"
 msgid "Output content using grid layout"
 msgstr "使用网格布局输出内容"
 msgstr "使用网格布局输出内容"
 
 
-#: of pywebio.output:80
+#: of pywebio.output:82
 msgid "`span`"
 msgid "`span`"
 msgstr ""
 msgstr ""
 
 
-#: of pywebio.output:80
+#: of pywebio.output:82
 msgid "Cross-cell content"
 msgid "Cross-cell content"
 msgstr "在 `put_table()` 和 `put_grid()` 中设置内容跨单元格"
 msgstr "在 `put_table()` 和 `put_grid()` 中设置内容跨单元格"
 
 
-#: of pywebio.output:82
+#: of pywebio.output:84
 msgid "`style`:sup:`*`"
 msgid "`style`:sup:`*`"
 msgstr ""
 msgstr ""
 
 
-#: of pywebio.output:82 pywebio.output.style:1
+#: of pywebio.output:84 pywebio.output.style:1
 msgid "Customize the css style of output content"
 msgid "Customize the css style of output content"
 msgstr "自定义输出内容的css样式"
 msgstr "自定义输出内容的css样式"
 
 
-#: of pywebio.output:84 pywebio.output:146
+#: of pywebio.output:86 pywebio.output:148
 msgid "Other"
 msgid "Other"
 msgstr "其他"
 msgstr "其他"
 
 
-#: of pywebio.output:84
+#: of pywebio.output:86
 msgid "`output`:sup:`*`"
 msgid "`output`:sup:`*`"
 msgstr ""
 msgstr ""
 
 
-#: of pywebio.output:84 pywebio.output.output:1
+#: of pywebio.output:86 pywebio.output.output:1
 msgid "Placeholder of output"
 msgid "Placeholder of output"
 msgstr "内容占位符"
 msgstr "内容占位符"
 
 
@@ -621,7 +629,7 @@ msgstr ""
 "是否使用 `DOMPurify <https://github.com/cure53/DOMPurify>`_ 对内容进行过滤来防止XSS"
 "是否使用 `DOMPurify <https://github.com/cure53/DOMPurify>`_ 对内容进行过滤来防止XSS"
 "攻击。"
 "攻击。"
 
 
-#: of pywebio.output:111 pywebio.output.put_buttons:36 pywebio.output.put_code:6
+#: of pywebio.output:113 pywebio.output.put_buttons:39 pywebio.output.put_code:6
 #: pywebio.output.put_collapse:7 pywebio.output.put_column:6 pywebio.output.put_file:8
 #: 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_grid:17 pywebio.output.put_html:5 pywebio.output.put_image:9
 #: pywebio.output.put_link:7 pywebio.output.put_loading:6
 #: pywebio.output.put_link:7 pywebio.output.put_loading:6
@@ -664,13 +672,13 @@ msgid ""
 "    \"\"\", strip_indent=4)"
 "    \"\"\", strip_indent=4)"
 msgstr ""
 msgstr ""
 
 
-#: of pywebio.output:108
+#: of pywebio.output:110
 msgid ""
 msgid ""
 "Message contents. The item is ``put_xxx()`` call, and any other type will be "
 "Message contents. The item is ``put_xxx()`` call, and any other type will be "
 "coverted to ``put_text(content)``."
 "coverted to ``put_text(content)``."
 msgstr "消息内容. 元素为 ``put_xxx()`` 调用,其他类型会被转换成 ``put_text(content)``"
 msgstr "消息内容. 元素为 ``put_xxx()`` 调用,其他类型会被转换成 ``put_text(content)``"
 
 
-#: of pywebio.output:110
+#: of pywebio.output:112
 msgid "Whether to show a dismiss button on the right of the message."
 msgid "Whether to show a dismiss button on the right of the message."
 msgstr ""
 msgstr ""
 
 
@@ -727,7 +735,7 @@ msgstr "进度条显示的标签. 默认为当前进度的百分比"
 msgid "Whether to remove the progress bar after the progress is completed"
 msgid "Whether to remove the progress bar after the progress is completed"
 msgstr "是否在进度完成后关闭进度条"
 msgstr "是否在进度完成后关闭进度条"
 
 
-#: of pywebio.output.put_buttons:12 pywebio.output.put_buttons:47
+#: of pywebio.output.put_buttons:13 pywebio.output.put_buttons:50
 #: pywebio.output.put_collapse:9 pywebio.output.put_file:14
 #: pywebio.output.put_collapse:9 pywebio.output.put_file:14
 #: pywebio.output.put_image:11 pywebio.output.put_processbar:9
 #: pywebio.output.put_image:11 pywebio.output.put_processbar:9
 #: pywebio.output.put_scrollable:11 pywebio.output.put_table:13
 #: pywebio.output.put_scrollable:11 pywebio.output.put_table:13
@@ -932,13 +940,17 @@ msgid ""
 "list: ``(label, value)`` * single value: label and value of option use the same "
 "list: ``(label, value)`` * single value: label and value of option use the same "
 "value  The ``value`` of button can be any JSON serializable object. The ``color`` "
 "value  The ``value`` of button can be any JSON serializable object. The ``color`` "
 "of button can be one of: `primary`, `secondary`, `success`, `danger`, `warning`, "
 "of button can be one of: `primary`, `secondary`, `success`, `danger`, `warning`, "
-"`info`, `light`, `dark`.  Example:  .. exportable-codeblock::     :name: "
+"`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-btn_class     :summary: `put_buttons()`      "
-"put_buttons([dict(label='primary', value='p', color='primary')], 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-only     ], onclick=put_text)  # .."
-"demo-only"
+"put_buttons([dict(label='primary', value='p', 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-"
+"only                   'outline-primary', 'outline-secondary', 'outline-success', "
+"'outline-danger', 'outline-warning',  # ..demo-only                   'outline-"
+"info', 'outline-light', 'outline-dark']  # ..demo-only     ], onclick=put_text)  "
+"# ..demo-only"
 msgstr ""
 msgstr ""
 
 
 #: of pywebio.output.put_buttons:3
 #: of pywebio.output.put_buttons:3
@@ -964,24 +976,29 @@ msgstr "单值: 此时label和value使用相同的值"
 msgid ""
 msgid ""
 "The ``value`` of button can be any JSON serializable object. The ``color`` of "
 "The ``value`` of button can be any JSON serializable object. The ``color`` of "
 "button can be one of: `primary`, `secondary`, `success`, `danger`, `warning`, "
 "button can be one of: `primary`, `secondary`, `success`, `danger`, `warning`, "
-"`info`, `light`, `dark`."
+"`info`, `light`, `dark`. The `outline-` prefix can be added to those color values "
+"to enable outline buttons."
 msgstr ""
 msgstr ""
 "其中, ``value`` 可以为任意可json序列化的对象。使用dict类型的列表项时,支持使用 "
 "其中, ``value`` 可以为任意可json序列化的对象。使用dict类型的列表项时,支持使用 "
 "``color`` key设置按钮颜色,可选值为 `primary` 、\n"
 "``color`` key设置按钮颜色,可选值为 `primary` 、\n"
-"`secondary` 、 `success` 、 `danger` 、 `warning` 、 `info` 、 `light` 、 `dark`"
+"`secondary` 、 `success` 、 `danger` 、 `warning` 、 `info` 、 `light` 、 `dark`  ,"
+"此外,还可以在这些值前面加上 `outline-` 前缀来启用镂空按钮样式。"
 
 
-#: of pywebio.output.put_buttons:14
+#: of pywebio.output.put_buttons:15
 msgid ""
 msgid ""
-"put_buttons([dict(label='primary', value='p', color='primary')], onclick=...)  # .."
-"doc-only\n"
+"put_buttons([dict(label='primary', value='p', color='outline-success')], "
+"onclick=...)  # ..doc-only\n"
 "put_buttons([  # ..demo-only\n"
 "put_buttons([  # ..demo-only\n"
 "    dict(label=i, value=i, color=i)  # ..demo-only\n"
 "    dict(label=i, value=i, color=i)  # ..demo-only\n"
-"    for i in ['primary' , 'secondary' , 'success' , 'danger' , 'warning' , 'info' , "
-"'light' , 'dark']  # ..demo-only\n"
+"    for i in ['primary', 'secondary', 'success', 'danger', 'warning', 'info', "
+"'light', 'dark',   # ..demo-only\n"
+"              'outline-primary', 'outline-secondary', 'outline-success', 'outline-"
+"danger', 'outline-warning',  # ..demo-only\n"
+"              'outline-info', 'outline-light', 'outline-dark']  # ..demo-only\n"
 "], onclick=put_text)  # ..demo-only"
 "], onclick=put_text)  # ..demo-only"
 msgstr ""
 msgstr ""
 
 
-#: of pywebio.output.put_buttons:25
+#: of pywebio.output.put_buttons:28
 msgid ""
 msgid ""
 "Callback which will be called when button is clicked. ``onclick`` can be a callable "
 "Callback which will be called when button is clicked. ``onclick`` can be a callable "
 "object or a list of it.  If ``onclick`` is callable object, its signature is "
 "object or a list of it.  If ``onclick`` is callable object, its signature is "
@@ -993,13 +1010,13 @@ msgid ""
 "coroutine function."
 "coroutine function."
 msgstr ""
 msgstr ""
 
 
-#: of pywebio.output.put_buttons:25
+#: of pywebio.output.put_buttons:28
 msgid ""
 msgid ""
 "Callback which will be called when button is clicked. ``onclick`` can be a callable "
 "Callback which will be called when button is clicked. ``onclick`` can be a callable "
 "object or a list of it."
 "object or a list of it."
 msgstr "按钮点击回调函数. ``onclick`` 可以是函数或者函数组成的列表."
 msgstr "按钮点击回调函数. ``onclick`` 可以是函数或者函数组成的列表."
 
 
-#: of pywebio.output.put_buttons:27
+#: of pywebio.output.put_buttons:30
 msgid ""
 msgid ""
 "If ``onclick`` is callable object, its signature is ``onclick(btn_value)``. "
 "If ``onclick`` is callable object, its signature is ``onclick(btn_value)``. "
 "``btn_value`` is ``value`` of the button that is clicked."
 "``btn_value`` is ``value`` of the button that is clicked."
@@ -1007,7 +1024,7 @@ msgstr ""
 "``onclick`` 为函数时, 签名为 ``onclick(btn_value)``. ``btn_value`` 为被点击的按钮"
 "``onclick`` 为函数时, 签名为 ``onclick(btn_value)``. ``btn_value`` 为被点击的按钮"
 "的 ``value`` 值"
 "的 ``value`` 值"
 
 
-#: of pywebio.output.put_buttons:29
+#: of pywebio.output.put_buttons:32
 msgid ""
 msgid ""
 "If ``onclick`` is a list, the item receives no parameter. In this case, each item "
 "If ``onclick`` is a list, the item receives no parameter. In this case, each item "
 "in the list corresponds to the buttons one-to-one."
 "in the list corresponds to the buttons one-to-one."
@@ -1015,13 +1032,13 @@ msgstr ""
 "``onclick`` 为列表时,列表内函数的签名为 ``func()``. 此时,回调函数与 ``buttons`` 一"
 "``onclick`` 为列表时,列表内函数的签名为 ``func()``. 此时,回调函数与 ``buttons`` 一"
 "一对应"
 "一对应"
 
 
-#: of pywebio.output.put_buttons:31
+#: of pywebio.output.put_buttons:34
 msgid ""
 msgid ""
 "Tip: You can use ``functools.partial`` to save more context information in "
 "Tip: You can use ``functools.partial`` to save more context information in "
 "``onclick``."
 "``onclick``."
 msgstr "Tip: 可以使用 ``functools.partial`` 来在 ``onclick`` 中保存更多上下文信息."
 msgstr "Tip: 可以使用 ``functools.partial`` 来在 ``onclick`` 中保存更多上下文信息."
 
 
-#: of pywebio.output.put_buttons:33
+#: of pywebio.output.put_buttons:36
 msgid ""
 msgid ""
 "Note: When in :ref:`Coroutine-based session  <coroutine_based_session>`, the "
 "Note: When in :ref:`Coroutine-based session  <coroutine_based_session>`, the "
 "callback can be a coroutine function."
 "callback can be a coroutine function."
@@ -1029,15 +1046,15 @@ msgstr ""
 "Note: 当使用 :ref:`基于协程的会话实现 <coroutine_based_session>` 时,回调函数可以为"
 "Note: 当使用 :ref:`基于协程的会话实现 <coroutine_based_session>` 时,回调函数可以为"
 "协程函数."
 "协程函数."
 
 
-#: of pywebio.output.put_buttons:34
+#: of pywebio.output.put_buttons:37
 msgid "Whether to use small size button. Default is False."
 msgid "Whether to use small size button. Default is False."
 msgstr "是否使用小号按钮,默认为False"
 msgstr "是否使用小号按钮,默认为False"
 
 
-#: of pywebio.output.put_buttons:35
+#: of pywebio.output.put_buttons:38
 msgid "Whether to use link style button. Default is False"
 msgid "Whether to use link style button. Default is False"
 msgstr "是否将按钮显示为链接样式,默认为False"
 msgstr "是否将按钮显示为链接样式,默认为False"
 
 
-#: of pywebio.output.put_buttons:37
+#: of pywebio.output.put_buttons:40
 msgid ""
 msgid ""
 "Other options of the ``onclick`` callback. There are different options according to "
 "Other options of the ``onclick`` callback. There are different options according to "
 "the session implementation  When in Coroutine-based Session:     * mutex_mode: "
 "the session implementation  When in Coroutine-based Session:     * mutex_mode: "
@@ -1053,17 +1070,17 @@ msgid ""
 "``serial_mode`` to improve performance."
 "``serial_mode`` to improve performance."
 msgstr ""
 msgstr ""
 
 
-#: of pywebio.output.put_buttons:37
+#: of pywebio.output.put_buttons:40
 msgid ""
 msgid ""
 "Other options of the ``onclick`` callback. There are different options according to "
 "Other options of the ``onclick`` callback. There are different options according to "
 "the session implementation"
 "the session implementation"
 msgstr "回调函数的其他参数。根据选用的 session 实现有不同参数"
 msgstr "回调函数的其他参数。根据选用的 session 实现有不同参数"
 
 
-#: of pywebio.output.put_buttons:40
+#: of pywebio.output.put_buttons:43
 msgid "When in Coroutine-based Session:"
 msgid "When in Coroutine-based Session:"
 msgstr "CoroutineBasedSession 实现"
 msgstr "CoroutineBasedSession 实现"
 
 
-#: of pywebio.output.put_buttons:40
+#: of pywebio.output.put_buttons:43
 msgid ""
 msgid ""
 "mutex_mode: Default is ``False``. If set to ``True``, new click event will be "
 "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 "
 "ignored when the current callback is running. This option is available only when "
@@ -1072,11 +1089,11 @@ msgstr ""
 "mutex_mode: 互斥模式。默认为 ``False`` 。若为 ``True`` ,则在运行回调函数过程中,无"
 "mutex_mode: 互斥模式。默认为 ``False`` 。若为 ``True`` ,则在运行回调函数过程中,无"
 "法响应当前按钮组的新点击事件,仅当 ``onclick`` 为协程函数时有效"
 "法响应当前按钮组的新点击事件,仅当 ``onclick`` 为协程函数时有效"
 
 
-#: of pywebio.output.put_buttons:45
+#: of pywebio.output.put_buttons:48
 msgid "When in Thread-based Session:"
 msgid "When in Thread-based Session:"
 msgstr "ThreadBasedSession 实现"
 msgstr "ThreadBasedSession 实现"
 
 
-#: of pywebio.output.put_buttons:43
+#: of pywebio.output.put_buttons:46
 msgid ""
 msgid ""
 "serial_mode: Default is ``False``, and every time a callback is triggered, the "
 "serial_mode: Default is ``False``, and every time a callback is triggered, the "
 "callback function will be executed immediately in a new thread."
 "callback function will be executed immediately in a new thread."
@@ -1084,7 +1101,7 @@ msgstr ""
 "serial_mode: 串行模式模式。默认为 ``False`` ,此时每次触发回调,回调函数会在新线程中"
 "serial_mode: 串行模式模式。默认为 ``False`` ,此时每次触发回调,回调函数会在新线程中"
 "立即执行。"
 "立即执行。"
 
 
-#: of pywebio.output.put_buttons:44
+#: of pywebio.output.put_buttons:47
 msgid ""
 msgid ""
 "If set ``serial_mode`` to ``True`` After enabling serial_mode, the button's "
 "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 "
 "callback will be executed serially in a resident thread in the session, and all "
@@ -1096,7 +1113,7 @@ msgstr ""
 "击事件的回调(包括 ``serial_mode=False`` 的回调)都将排队等待当前点击事件运行完成。如"
 "击事件的回调(包括 ``serial_mode=False`` 的回调)都将排队等待当前点击事件运行完成。如"
 "果回调函数运行时间很短,可以开启 ``serial_mode`` 来提高性能。"
 "果回调函数运行时间很短,可以开启 ``serial_mode`` 来提高性能。"
 
 
-#: of pywebio.output.put_buttons:49
+#: of pywebio.output.put_buttons:52
 #, python-format
 #, python-format
 msgid ""
 msgid ""
 "from functools import partial\n"
 "from functools import partial\n"
@@ -1115,7 +1132,7 @@ msgid ""
 "put_buttons(['edit', 'delete'], onclick=[edit, delete])"
 "put_buttons(['edit', 'delete'], onclick=[edit, delete])"
 msgstr ""
 msgstr ""
 
 
-#: of pywebio.output.put_buttons:70
+#: of pywebio.output.put_buttons:73
 msgid ""
 msgid ""
 "After the PyWebIO session (see :ref:`Server and script mode "
 "After the PyWebIO session (see :ref:`Server and script mode "
 "<server_and_script_mode>` for more information about session) closed, the event "
 "<server_and_script_mode>` for more information about session) closed, the event "

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 350 - 280
docs/locales/zh_CN/LC_MESSAGES/platform.po


+ 166 - 146
docs/locales/zh_CN/LC_MESSAGES/session.po

@@ -7,17 +7,16 @@ msgid ""
 msgstr ""
 msgstr ""
 "Project-Id-Version: PyWebIO 1.1.0\n"
 "Project-Id-Version: PyWebIO 1.1.0\n"
 "Report-Msgid-Bugs-To: \n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-03-27 19:25+0800\n"
-"PO-Revision-Date: 2021-03-27 19:33+0800\n"
+"POT-Creation-Date: 2021-04-14 21:12+0800\n"
+"PO-Revision-Date: 2021-04-03 22:47+0800\n"
 "Last-Translator: WangWeimin <wang0.618@qq.com>\n"
 "Last-Translator: WangWeimin <wang0.618@qq.com>\n"
 "Language: zh_CN\n"
 "Language: zh_CN\n"
 "Language-Team: \n"
 "Language-Team: \n"
-"Plural-Forms: nplurals=1; plural=0;\n"
+"Plural-Forms: nplurals=1; plural=0\n"
 "MIME-Version: 1.0\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=utf-8\n"
 "Content-Type: text/plain; charset=utf-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 "Content-Transfer-Encoding: 8bit\n"
 "Generated-By: Babel 2.8.0\n"
 "Generated-By: Babel 2.8.0\n"
-"X-Generator: Poedit 2.4.2\n"
 
 
 #: ../../session.rst:2
 #: ../../session.rst:2
 msgid "``pywebio.session`` --- More control to session"
 msgid "``pywebio.session`` --- More control to session"
@@ -25,16 +24,15 @@ msgstr "``pywebio.session`` — 会话相关"
 
 
 #: of pywebio.session.run_async:1
 #: of pywebio.session.run_async:1
 msgid ""
 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 交互函数。 "
 msgstr "异步运行协程对象。协程中依然可以调用 PyWebIO 交互函数。 "
 
 
 #: of pywebio.session.run_async:3
 #: of pywebio.session.run_async:3
 msgid ""
 msgid ""
 "``run_async()`` can only be used in :ref:`coroutine-based session "
 "``run_async()`` can only be used in :ref:`coroutine-based session "
 "<coroutine_based_session>`."
 "<coroutine_based_session>`."
-msgstr ""
-"``run_async()`` 仅能在 :ref:`基于协程 <coroutine_based_session>` 的会话上下文中调用"
+msgstr "``run_async()`` 仅能在 :ref:`基于协程 <coroutine_based_session>` 的会话上下文中调用"
 
 
 #: of pywebio.session.download pywebio.session.eval_js pywebio.session.go_app
 #: of pywebio.session.download pywebio.session.eval_js pywebio.session.go_app
 #: pywebio.session.register_thread pywebio.session.run_async
 #: pywebio.session.register_thread pywebio.session.run_async
@@ -52,11 +50,12 @@ msgstr ""
 
 
 #: of pywebio.session.run_async:6
 #: of pywebio.session.run_async:6
 msgid ""
 msgid ""
-"`TaskHandle <pywebio.session.coroutinebased.TaskHandle>` instance, which can be "
-"used to query the running status of the coroutine or close the coroutine."
+"`TaskHandle <pywebio.session.coroutinebased.TaskHandle>` instance, which can"
+" be used to query the running status of the coroutine or close the "
+"coroutine."
 msgstr ""
 msgstr ""
-"`TaskHandle <pywebio.session.coroutinebased.TaskHandle>` 实例。 通过 TaskHandle "
-"以查询协程运行状态和关闭协程。"
+"`TaskHandle <pywebio.session.coroutinebased.TaskHandle>` 实例。 通过 TaskHandle "
+"以查询协程运行状态和关闭协程。"
 
 
 #: of pywebio.session.run_async:8
 #: of pywebio.session.run_async:8
 msgid ""
 msgid ""
@@ -66,12 +65,10 @@ msgstr "参见::ref:`协程会话的并发 <coroutine_based_concurrency>`"
 
 
 #: of pywebio.session.run_asyncio_coroutine:1
 #: of pywebio.session.run_asyncio_coroutine:1
 msgid ""
 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
 #: 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>`."
@@ -82,7 +79,7 @@ msgid "Coroutine object in `asyncio`"
 msgstr "`asyncio` 库中的协程对象"
 msgstr "`asyncio` 库中的协程对象"
 
 
 #: of pywebio.session.run_asyncio_coroutine:7 pywebio.session.run_js:8
 #: of pywebio.session.run_asyncio_coroutine:7 pywebio.session.run_js:8
-#: pywebio.session.set_env:10
+#: pywebio.session.set_env:12
 msgid "Example::"
 msgid "Example::"
 msgstr ""
 msgstr ""
 
 
@@ -140,17 +137,18 @@ msgstr ""
 
 
 #: of pywebio.session.eval_js:1
 #: of pywebio.session.eval_js:1
 msgid ""
 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表达式,并获取表达式的值"
 msgstr "在用户浏览器中执行JavaScript表达式,并获取表达式的值"
 
 
 #: of pywebio.session.eval_js:3
 #: of pywebio.session.eval_js:3
 msgid ""
 msgid ""
-"JavaScript expression. The value of the expression need to be JSON-serializable. "
-"If the value of the expression is a `promise <https://developer.mozilla.org/en-US/"
-"docs/Web/JavaScript/Reference/Global_Objects/Promise>`_, ``eval_js()`` will wait "
-"for the promise to resolve and return the value of it. When the promise is "
-"rejected, `None` is returned."
+"JavaScript expression. The value of the expression need to be JSON-"
+"serializable. If the value of the expression is a `promise "
+"<https://developer.mozilla.org/en-"
+"US/docs/Web/JavaScript/Reference/Global_Objects/Promise>`_, ``eval_js()`` "
+"will wait for the promise to resolve and return the value of it. When the "
+"promise is rejected, `None` is returned."
 msgstr ""
 msgstr ""
 
 
 #: of pywebio.session.eval_js:7
 #: of pywebio.session.eval_js:7
@@ -159,11 +157,12 @@ msgstr "js表达式的值"
 
 
 #: of pywebio.session.eval_js:9
 #: of pywebio.session.eval_js:9
 msgid ""
 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 ""
 msgstr ""
-"注意⚠️:在 :ref:`基于协程 <coroutine_based_session>` 的会话上下文中,需要使用 "
-"``await eval_js(expression)`` 语法来进行调用。"
+"注意⚠️:在 :ref:`基于协程 <coroutine_based_session>` 的会话上下文中,需要使用 ``await "
+"eval_js(expression)`` 语法来进行调用。"
 
 
 #: of pywebio.session.eval_js:13
 #: of pywebio.session.eval_js:13
 msgid ""
 msgid ""
@@ -193,8 +192,8 @@ msgstr ""
 
 
 #: of pywebio.session.register_thread:1
 #: of pywebio.session.register_thread:1
 msgid ""
 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 交互函数。"
 msgstr "注册线程,以便在线程内调用 PyWebIO 交互函数。"
 
 
 #: of pywebio.session.register_thread:3
 #: of pywebio.session.register_thread:3
@@ -215,15 +214,15 @@ msgstr "设置会话结束时调用的函数。"
 
 
 #: of pywebio.session.defer_call:3
 #: of pywebio.session.defer_call:3
 msgid ""
 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 "无论是用户主动关闭会话还是任务结束会话关闭,设置的函数都会被运行。"
 msgstr "无论是用户主动关闭会话还是任务结束会话关闭,设置的函数都会被运行。"
 
 
 #: of pywebio.session.defer_call:5
 #: of pywebio.session.defer_call:5
 msgid ""
 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()` ,会话结束后将会顺序执行设置的函数。"
 msgstr "在会话中可以多次调用 `defer_call()` ,会话结束后将会顺序执行设置的函数。"
 
 
 #: of pywebio.session.defer_call:7
 #: of pywebio.session.defer_call:7
@@ -239,9 +238,7 @@ msgstr ""
 
 
 #: of pywebio.session.defer_call:13
 #: of pywebio.session.defer_call:13
 msgid "PyWebIO interactive functions cannot be called inside the deferred functions."
 msgid "PyWebIO interactive functions cannot be called inside the deferred functions."
-msgstr ""
-"通过 `defer_call()` 设置的函数被调用时会话已经关闭,所以在函数体内不可以调用 "
-"PyWebIO 的交互函数"
+msgstr "通过 `defer_call()` 设置的函数被调用时会话已经关闭,所以在函数体内不可以调用 PyWebIO 的交互函数"
 
 
 #: of pywebio.session.hold:1
 #: of pywebio.session.hold:1
 msgid "Keep the session alive until the browser page is closed by user."
 msgid "Keep the session alive until the browser page is closed by user."
@@ -249,26 +246,25 @@ msgstr "保持会话,直到用户关闭浏览器。"
 
 
 #: of pywebio.session.hold:5
 #: of pywebio.session.hold:5
 msgid ""
 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 ""
 msgstr ""
 "在PyWebIO会话结束后,页面和服务端的连接便会断开,\n"
 "在PyWebIO会话结束后,页面和服务端的连接便会断开,\n"
-"页面上需要和服务端通信才可实现的功能(比如:下载通过 `put_file() <pywebio.output."
-"put_file>` 输出的文件,\n"
+"页面上需要和服务端通信才可实现的功能(比如:下载通过 `put_file() <pywebio.output.put_file>` 输出的文件,\n"
 "`put_buttons() <pywebio.output.put_buttons>` 按钮回调)便无法使用。\n"
 "`put_buttons() <pywebio.output.put_buttons>` 按钮回调)便无法使用。\n"
-"可以在任务函数末尾处调用 ``hold()`` 函数来将会话保持,这样在用户关闭浏览器页面前,"
-"会话将一直保持连接。"
+"可以在任务函数末尾处调用 ``hold()`` 函数来将会话保持,这样在用户关闭浏览器页面前,会话将一直保持连接。"
 
 
 #: of pywebio.session.hold:7
 #: of pywebio.session.hold:7
 msgid ""
 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 ""
 msgstr ""
-"注意⚠️:在 :ref:`基于协程 <coroutine_based_session>` 的会话上下文中,需要使用 "
-"``await hold()`` 语法来进行调用。"
+"注意⚠️:在 :ref:`基于协程 <coroutine_based_session>` 的会话上下文中,需要使用 ``await hold()`` "
+"语法来进行调用。"
 
 
 #: of pywebio.session:12
 #: of pywebio.session:12
 msgid "The session-local object for current session."
 msgid "The session-local object for current session."
@@ -276,15 +272,15 @@ msgstr "当前会话的数据对象(session-local object)。"
 
 
 #: of pywebio.session:14
 #: of pywebio.session:14
 msgid ""
 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."
+"``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."
 msgstr ""
 msgstr ""
-"``local`` 是一个可以通过属性访问的字典,访问不存在的属性时会返回 ``None`` 而不是抛"
-"出异常。``local`` 不支持字典的方法,支持使用 ``in`` 操作符来判断键是否存在,可以使"
-"用 ``local._dict`` 获取底层的字典表示。"
+"``local`` 是一个可以通过属性访问的字典,访问不存在的属性时会返回 ``None`` 而不是抛出异常。``local`` "
+"不支持字典的方法,支持使用 ``in`` 操作符来判断键是否存在,可以使用 ``local._dict`` 获取底层的字典表示。"
 
 
 #: of pywebio.session
 #: of pywebio.session
 msgid "Usage Scenes"
 msgid "Usage Scenes"
@@ -292,12 +288,10 @@ msgstr "使用场景"
 
 
 #: of pywebio.session:20
 #: of pywebio.session:20
 msgid ""
 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."
-msgstr ""
-"当需要在多个函数中保存一些会话独立的数据时,使用session-local对象保存状态会比通过函"
-"数参数传递更方便。"
+"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."
+msgstr "当需要在多个函数中保存一些会话独立的数据时,使用session-local对象保存状态会比通过函数参数传递更方便。"
 
 
 #: of pywebio.session:22
 #: of pywebio.session:22
 msgid "Here is a example of a session independent counter implementation::"
 msgid "Here is a example of a session independent counter implementation::"
@@ -332,8 +326,8 @@ msgid ""
 "\n"
 "\n"
 "def main():\n"
 "def main():\n"
 "    cnt = [0]  # Trick: to pass by reference\n"
 "    cnt = [0]  # Trick: to pass by reference\n"
-"    put_buttons(['Add counter', 'Show counter'], [partial(add, cnt), partial(show, "
-"cnt)])\n"
+"    put_buttons(['Add counter', 'Show counter'], [partial(add, cnt), "
+"partial(show, cnt)])\n"
 "    hold()"
 "    hold()"
 msgstr ""
 msgstr ""
 
 
@@ -391,36 +385,48 @@ msgstr "``title`` (str): 当前页面的标题"
 
 
 #: of pywebio.session.set_env:6
 #: of pywebio.session.set_env:6
 msgid ""
 msgid ""
-"``output_animation`` (bool): Whether to enable output animation, enabled by default"
-msgstr ""
-"``output_animation`` (bool): 是否启用输出动画(在输出内容时,使用过渡动画),默认启"
-"用"
+"``output_animation`` (bool): Whether to enable output animation, enabled by "
+"default"
+msgstr "``output_animation`` (bool): 是否启用输出动画(在输出内容时,使用过渡动画),默认启用"
 
 
 #: of pywebio.session.set_env:7
 #: of pywebio.session.set_env:7
 msgid ""
 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 ""
 msgstr ""
-"``auto_scroll_bottom`` (bool): 是否在内容输出时将页面自动滚动到底部,默认关闭。注"
-"意,开启后,只有输出到ROOT Scope才可以触发自动滚动。"
+"``auto_scroll_bottom`` (bool): 是否在内容输出时将页面自动滚动到底部,默认关闭。注意,开启后,只有输出到ROOT "
+"Scope才可以触发自动滚动。"
 
 
 #: of pywebio.session.set_env:8
 #: of pywebio.session.set_env:8
 msgid ""
 msgid ""
 "``http_pull_interval`` (int): The period of HTTP polling messages (in "
 "``http_pull_interval`` (int): The period of HTTP polling messages (in "
-"milliseconds, default 1000ms), only available in sessions based on HTTP connection."
+"milliseconds, default 1000ms), only available in sessions based on HTTP "
+"connection."
 msgstr ""
 msgstr ""
-"``http_pull_interval`` (int): HTTP轮询后端消息的周期(单位为毫秒,默认1000ms),仅"
-"在基于HTTP连接的会话(使用Flask或Django后端)中可用"
+"``http_pull_interval`` (int): "
+"HTTP轮询后端消息的周期(单位为毫秒,默认1000ms),仅在基于HTTP连接的会话(使用Flask或Django后端)中可用"
 
 
-#: of pywebio.session.set_env:12
+#: of pywebio.session.set_env:9
+msgid ""
+"``input_panel_min_height`` (int): The minimum height of input panel (in "
+"pixel, default 300px), it should be larger than 75px."
+msgstr ""
+
+#: of pywebio.session.set_env:10
+msgid ""
+"``input_panel_init_height`` (int): The initial height of input panel (in "
+"pixel, default 300px), it should be larger than 175px."
+msgstr ""
+
+#: of pywebio.session.set_env:14
 msgid "set_env(title='Awesome PyWebIO!!', output_animation=False)"
 msgid "set_env(title='Awesome PyWebIO!!', output_animation=False)"
 msgstr ""
 msgstr ""
 
 
 #: of pywebio.session.go_app:1
 #: of pywebio.session.go_app:1
 msgid ""
 msgid ""
-"Jump to another task of a same PyWebIO application. Only available in PyWebIO "
-"Server mode"
+"Jump to another task of a same PyWebIO application. Only available in "
+"PyWebIO Server mode"
 msgstr "在同一PyWebIO应用的不同服务之间跳转。仅在PyWebIO Server模式下可用"
 msgstr "在同一PyWebIO应用的不同服务之间跳转。仅在PyWebIO Server模式下可用"
 
 
 #: of pywebio.session.go_app:3
 #: of pywebio.session.go_app:3
@@ -441,32 +447,29 @@ msgstr "表示会话信息的对象,属性有:"
 
 
 #: of pywebio.session:90
 #: of pywebio.session:90
 msgid ""
 msgid ""
-"``user_agent`` : The Object of the user browser information, whose attributes are"
+"``user_agent`` : The Object of the user browser information, whose "
+"attributes are"
 msgstr "``user_agent`` : 表示用户浏览器信息的对象,属性有"
 msgstr "``user_agent`` : 表示用户浏览器信息的对象,属性有"
 
 
 #: of pywebio.session:92
 #: of pywebio.session:92
 msgid ""
 msgid ""
-"``is_mobile`` (bool): whether user agent is identified as a mobile phone (iPhone, "
-"Android phones, Blackberry, Windows Phone devices etc)"
+"``is_mobile`` (bool): whether user agent is identified as a mobile phone "
+"(iPhone, Android phones, Blackberry, Windows Phone devices etc)"
 msgstr ""
 msgstr ""
-"``is_mobile`` (bool): 用户使用的设备是否为手机 (比如 iPhone, Android phones, "
-"Blackberry, Windows Phone 等设备)"
+"``is_mobile`` (bool): 用户使用的设备是否为手机 (比如 iPhone, Android phones, Blackberry, "
+"Windows Phone 等设备)"
 
 
 #: of pywebio.session:93
 #: of pywebio.session:93
 msgid ""
 msgid ""
-"``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 等"
-"设备)"
+"``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:94
 #: of pywebio.session:94
 msgid ""
 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 的设"
-"备)"
+"``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:95
 #: of pywebio.session:95
 msgid "``is_touch_capable`` (bool): whether user agent has touch capabilities"
 msgid "``is_touch_capable`` (bool): whether user agent has touch capabilities"
@@ -510,46 +513,45 @@ msgstr "``device.model`` (str): 设备型号. 比如 'iPhone'"
 
 
 #: of pywebio.session:109
 #: of pywebio.session:109
 msgid ""
 msgid ""
-"``user_language`` (str): Language used by the user's operating system. (e.g., "
-"``'zh-CN'``)"
+"``user_language`` (str): Language used by the user's operating system. "
+"(e.g., ``'zh-CN'``)"
 msgstr "``user_language`` (str): 用户操作系统使用的语言. 比如 ``'zh-CN'``"
 msgstr "``user_language`` (str): 用户操作系统使用的语言. 比如 ``'zh-CN'``"
 
 
 #: of pywebio.session:110
 #: of pywebio.session:110
 msgid ""
 msgid ""
-"``server_host`` (str): PyWebIO server host, including domain and port, the port "
-"can be omitted when 80."
-msgstr ""
-"``server_host`` (str): 当前会话的服务器host,包含域名和端口,端口为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:111
 #: of pywebio.session:111
 msgid ""
 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 ""
 msgstr ""
-"``origin`` (str): 当前用户的页面地址. 包含 协议、主机、端口 部分. 比如 ``'http://"
-"localhost:8080'`` .\n"
-"可能为空,但保证当用户的页面地址不在当前服务器下(即 主机、端口部分和 "
-"``server_host`` 不一致)时有值."
+"``origin`` (str): 当前用户的页面地址. 包含 协议、主机、端口 部分. 比如 ``'http://localhost:8080'`` "
+".\n"
+"可能为空,但保证当用户的页面地址不在当前服务器下(即 主机、端口部分和 ``server_host`` 不一致)时有值."
 
 
 #: of pywebio.session:113
 #: of pywebio.session:113
 msgid "``user_ip`` (str): User's ip address."
 msgid "``user_ip`` (str): User's ip address."
-msgstr "用户的ip地址."
+msgstr "``user_ip`` (str): 用户的ip地址."
 
 
 #: of pywebio.session:114
 #: of pywebio.session:114
 msgid ""
 msgid ""
-"``backend`` (str): The current PyWebIO backend server implementation. The possible "
-"values are ``'tornado'``, ``'flask'``, ``'django'`` , ``'aiohttp'`` , "
-"``'starlette'``."
+"``backend`` (str): The current PyWebIO backend server implementation. The "
+"possible values are ``'tornado'``, ``'flask'``, ``'django'`` , ``'aiohttp'``"
+" , ``'starlette'``."
 msgstr ""
 msgstr ""
-"当前PyWebIO使用的后端Server实现. 可能出现的值有 ``'tornado'`` , ``'flask'`` , "
-"``'django'`` , ``'aiohttp'`` , ``'starlette'``."
+"``backend`` (str): 当前PyWebIO使用的后端Server实现. 可能出现的值有 ``'tornado'`` , "
+"``'flask'`` , ``'django'`` , ``'aiohttp'`` , ``'starlette'``."
 
 
 #: of pywebio.session:115
 #: of pywebio.session:115
 msgid ""
 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 ""
 msgstr ""
 
 
 #: of pywebio.session:116
 #: of pywebio.session:116
@@ -557,54 +559,59 @@ msgid ""
 "``request`` (object): The request object when creating the current session. "
 "``request`` (object): The request object when creating the current session. "
 "Depending on the backend server, the type of ``request`` can be:"
 "Depending on the backend server, the type of ``request`` can be:"
 msgstr ""
 msgstr ""
-"创建当前会话时的Web请求对象. 根据PyWebIO使用的后端Server不同,``request`` 的类型也"
-"不同:"
+"``request`` (object): 创建当前会话时的Web请求对象. 根据PyWebIO使用的后端Server不同,``request`` "
+"的类型也不同:"
 
 
 #: of pywebio.session:118
 #: of pywebio.session:118
 msgid ""
 msgid ""
-"When using Tornado, ``request`` is instance of `tornado.httputil.HTTPServerRequest "
-"<https://www.tornadoweb.org/en/stable/httputil.html#tornado.httputil."
-"HTTPServerRequest>`_"
+"When using Tornado, ``request`` is instance of "
+"`tornado.httputil.HTTPServerRequest "
+"<https://www.tornadoweb.org/en/stable/httputil.html#tornado.httputil.HTTPServerRequest>`_"
 msgstr ""
 msgstr ""
-"使用Tornado后端时, ``request`` 为 `tornado.httputil.HTTPServerRequest <https://www."
-"tornadoweb.org/en/stable/httputil.html#tornado.httputil.HTTPServerRequest>`_ 实例"
+"使用Tornado后端时, ``request`` 为 `tornado.httputil.HTTPServerRequest "
+"<https://www.tornadoweb.org/en/stable/httputil.html#tornado.httputil.HTTPServerRequest>`_"
+" 实例"
 
 
 #: of pywebio.session:120
 #: of pywebio.session:120
 msgid ""
 msgid ""
-"When using Flask, ``request`` is instance of `flask.Request <https://flask."
-"palletsprojects.com/en/1.1.x/api/#incoming-request-data>`_"
+"When using Flask, ``request`` is instance of `flask.Request "
+"<https://flask.palletsprojects.com/en/1.1.x/api/#incoming-request-data>`_"
 msgstr ""
 msgstr ""
-"使用Flask后端时, ``request`` 为 `flask.Request <https://flask.palletsprojects.com/"
-"en/1.1.x/api/#incoming-request-data>`_ 实例"
+"使用Flask后端时, ``request`` 为 `flask.Request "
+"<https://flask.palletsprojects.com/en/1.1.x/api/#incoming-request-data>`_ 实例"
 
 
 #: of pywebio.session:121
 #: of pywebio.session:121
 msgid ""
 msgid ""
-"When using Django, ``request`` is instance of `django.http.HttpRequest <https://"
-"docs.djangoproject.com/en/3.0/ref/request-response/#django.http.HttpRequest>`_"
+"When using Django, ``request`` is instance of `django.http.HttpRequest "
+"<https://docs.djangoproject.com/en/3.0/ref/request-"
+"response/#django.http.HttpRequest>`_"
 msgstr ""
 msgstr ""
-"使用Django后端时, ``request`` 为 `django.http.HttpRequest <https://docs."
-"djangoproject.com/en/3.0/ref/request-response/#django.http.HttpRequest>`_ 实例"
+"使用Django后端时, ``request`` 为 `django.http.HttpRequest "
+"<https://docs.djangoproject.com/en/3.0/ref/request-"
+"response/#django.http.HttpRequest>`_ 实例"
 
 
 #: of pywebio.session:122
 #: of pywebio.session:122
 msgid ""
 msgid ""
-"When using aiohttp, ``request`` is instance of `aiohttp.web.BaseRequest <https://"
-"docs.aiohttp.org/en/stable/web_reference.html#aiohttp.web.BaseRequest>`_"
+"When using aiohttp, ``request`` is instance of `aiohttp.web.BaseRequest "
+"<https://docs.aiohttp.org/en/stable/web_reference.html#aiohttp.web.BaseRequest>`_"
 msgstr ""
 msgstr ""
-"使用aiohttp后端时, ``request`` 为 `aiohttp.web.BaseRequest <https://docs.aiohttp."
-"org/en/stable/web_reference.html#aiohttp.web.BaseRequest>`_ 实例"
+"使用aiohttp后端时, ``request`` 为 `aiohttp.web.BaseRequest "
+"<https://docs.aiohttp.org/en/stable/web_reference.html#aiohttp.web.BaseRequest>`_"
+" 实例"
 
 
 #: of pywebio.session:123
 #: of pywebio.session:123
 msgid ""
 msgid ""
-"When using FastAPI/Starlette, ``request`` is instance of `starlette.websockets."
-"WebSocket <https://www.starlette.io/websockets/>`_"
+"When using FastAPI/Starlette, ``request`` is instance of "
+"`starlette.websockets.WebSocket <https://www.starlette.io/websockets/>`_"
 msgstr ""
 msgstr ""
 "当使用FastAPI或Starlette时, ``request`` 属性为 `starlette.websockets.WebSocket "
 "当使用FastAPI或Starlette时, ``request`` 属性为 `starlette.websockets.WebSocket "
 "<https://www.starlette.io/websockets/>`_ 实例"
 "<https://www.starlette.io/websockets/>`_ 实例"
 
 
 #: of pywebio.session:125
 #: of pywebio.session:125
 msgid ""
 msgid ""
-"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"
+"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 ""
 msgstr ""
 "会话信息对象的 ``user_agent`` 属性是通过 user-agents 库进行解析生成的。参见 "
 "会话信息对象的 ``user_agent`` 属性是通过 user-agents 库进行解析生成的。参见 "
 "https://github.com/selwin/python-user-agents#usage"
 "https://github.com/selwin/python-user-agents#usage"
@@ -621,7 +628,7 @@ msgid ""
 "put_code(json.dumps({\n"
 "put_code(json.dumps({\n"
 "    k: str(getattr(session_info, k))\n"
 "    k: str(getattr(session_info, k))\n"
 "    for k in ['user_agent', 'user_language', 'server_host',\n"
 "    for k in ['user_agent', 'user_language', 'server_host',\n"
-"              'origin', 'user_ip', 'backend', 'request']\n"
+"              'origin', 'user_ip', 'backend', 'protocol', 'request']\n"
 "}, indent=4), 'json')"
 "}, indent=4), 'json')"
 msgstr ""
 msgstr ""
 
 
@@ -648,5 +655,18 @@ msgstr "任务是否关闭"
 #~ msgstr "获取当前会话的相关信息"
 #~ msgstr "获取当前会话的相关信息"
 
 
 #~ msgid ""
 #~ msgid ""
-#~ "JavaScript expression. The value of the expression need to be JSON-serializable."
+#~ "JavaScript expression. The value of the "
+#~ "expression need to be JSON-serializable."
 #~ msgstr "js表达式. 表达式的值需要能JSON序列化"
 #~ msgstr "js表达式. 表达式的值需要能JSON序列化"
+
+#~ msgid ""
+#~ "import json\n"
+#~ "from pywebio.session import info as session_info\n"
+#~ "\n"
+#~ "put_code(json.dumps({\n"
+#~ "    k: str(getattr(session_info, k))\n"
+#~ "    for k in ['user_agent', 'user_language', 'server_host',\n"
+#~ "              'origin', 'user_ip', 'backend', 'request']\n"
+#~ "}, indent=4), 'json')"
+#~ msgstr ""
+

+ 6 - 5
docs/misc.rst

@@ -20,7 +20,7 @@ For complete Codemirror options, please visit: https://codemirror.net/doc/manual
 Nginx WebSocket Config Example
 Nginx WebSocket Config Example
 ---------------------------------
 ---------------------------------
 
 
-Assuming that the backend server is running at the ``localhost:5000`` address, and the backend API of PyWebIO is bind to the ``/tool`` path, the configuration of Nginx is as follows::
+Assuming that the PyWebIO application is running at the ``localhost:5000`` address, if you want to access your PyWebIO application via ``http://server_ip/some_path/tool``, a sample Nginx configuration is as follows::
 
 
     map $http_upgrade $connection_upgrade {
     map $http_upgrade $connection_upgrade {
         default upgrade;
         default upgrade;
@@ -30,21 +30,22 @@ Assuming that the backend server is running at the ``localhost:5000`` address, a
     server {
     server {
         listen 80;
         listen 80;
 
 
-        location / {
+        location /some_path/ {
             alias /path/to/pywebio/static/dir/;
             alias /path/to/pywebio/static/dir/;
         }
         }
-        location /tool {
+        location /some_path/tool {
              proxy_read_timeout 300s;
              proxy_read_timeout 300s;
              proxy_send_timeout 300s;
              proxy_send_timeout 300s;
              proxy_http_version 1.1;
              proxy_http_version 1.1;
+             proxy_set_header Host $host:$server_port;
              proxy_set_header Upgrade $http_upgrade;
              proxy_set_header Upgrade $http_upgrade;
              proxy_set_header Connection $connection_upgrade;
              proxy_set_header Connection $connection_upgrade;
-             proxy_pass http://localhost:5000;
+             proxy_pass http://localhost:5000/;
         }
         }
     }
     }
 
 
 
 
-The above configuration file hosts the static files of PyWebIO on the ``/`` path, and reverse proxy ``/tool`` to ``localhost:5000/tool``
+The above configuration file hosts the static files of PyWebIO on the ``/some_path/`` path, and reverse proxy ``/some_path/tool`` to ``localhost:5000``.
 
 
 The path of the static file of PyWebIO can be obtained with the command ``python3 -c "import pywebio; print(pywebio.STATIC_PATH)"``, you can also copy the static file to other directories::
 The path of the static file of PyWebIO can be obtained with the command ``python3 -c "import pywebio; print(pywebio.STATIC_PATH)"``, you can also copy the static file to other directories::
 
 

+ 5 - 2
pywebio/output.py

@@ -651,6 +651,7 @@ def put_buttons(buttons, onclick, small=None, link_style=False, scope=Scope.Curr
 
 
         The ``value`` of button can be any JSON serializable object.
         The ``value`` of button can be any JSON serializable object.
         The ``color`` of button can be one of: `primary`, `secondary`, `success`, `danger`, `warning`, `info`, `light`, `dark`.
         The ``color`` of button can be one of: `primary`, `secondary`, `success`, `danger`, `warning`, `info`, `light`, `dark`.
+        The `outline-` prefix can be added to those color values to enable outline buttons.
 
 
         Example:
         Example:
 
 
@@ -658,10 +659,12 @@ def put_buttons(buttons, onclick, small=None, link_style=False, scope=Scope.Curr
             :name: put_buttons-btn_class
             :name: put_buttons-btn_class
             :summary: `put_buttons()`
             :summary: `put_buttons()`
 
 
-            put_buttons([dict(label='primary', value='p', color='primary')], onclick=...)  # ..doc-only
+            put_buttons([dict(label='primary', value='p', color='outline-success')], onclick=...)  # ..doc-only
             put_buttons([  # ..demo-only
             put_buttons([  # ..demo-only
                 dict(label=i, value=i, color=i)  # ..demo-only
                 dict(label=i, value=i, color=i)  # ..demo-only
-                for i in ['primary' , 'secondary' , 'success' , 'danger' , 'warning' , 'info' , 'light' , 'dark']  # ..demo-only
+                for i in ['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark',   # ..demo-only
+                          'outline-primary', 'outline-secondary', 'outline-success', 'outline-danger', 'outline-warning',  # ..demo-only
+                          'outline-info', 'outline-light', 'outline-dark']  # ..demo-only
             ], onclick=put_text)  # ..demo-only
             ], onclick=put_text)  # ..demo-only
 
 
     :type onclick: callable / list
     :type onclick: callable / list

+ 1 - 0
pywebio/platform/tornado.py

@@ -251,6 +251,7 @@ async def open_webbrowser_on_server_started(host, port):
     is_open = await wait_host_port(host, port, duration=20)
     is_open = await wait_host_port(host, port, duration=20)
     if is_open:
     if is_open:
         logger.info('Try open %s in web browser' % url)
         logger.info('Try open %s in web browser' % url)
+        # webbrowser.open() may block, so invoke it in thread
         threading.Thread(target=webbrowser.open, args=(url,), daemon=True).start()
         threading.Thread(target=webbrowser.open, args=(url,), daemon=True).start()
     else:
     else:
         logger.error('Open %s in web browser failed.' % url)
         logger.error('Open %s in web browser failed.' % url)

+ 6 - 8
pywebio/platform/utils.py

@@ -1,13 +1,13 @@
+import fnmatch
+import json
 import urllib.parse
 import urllib.parse
+from collections import defaultdict
 from collections import namedtuple
 from collections import namedtuple
 from collections.abc import Mapping, Sequence
 from collections.abc import Mapping, Sequence
 from functools import partial
 from functools import partial
 from os import path
 from os import path
-import fnmatch
-from urllib.parse import urlparse
+
 from tornado import template
 from tornado import template
-import json
-from collections import defaultdict
 
 
 from ..__version__ import __version__ as version
 from ..__version__ import __version__ as version
 from ..exceptions import PyWebIOWarning
 from ..exceptions import PyWebIOWarning
@@ -189,7 +189,7 @@ class OriginChecker:
     @staticmethod
     @staticmethod
     def is_same_site(origin, host):
     def is_same_site(origin, host):
         """判断 origin 和 host 是否一致。origin 和 host 都为http协议请求头"""
         """判断 origin 和 host 是否一致。origin 和 host 都为http协议请求头"""
-        parsed_origin = urlparse(origin)
+        parsed_origin = urllib.parse.urlparse(origin)
         origin = parsed_origin.netloc
         origin = parsed_origin.netloc
         origin = origin.lower()
         origin = origin.lower()
 
 
@@ -236,7 +236,7 @@ def deserialize_binary_event(data: bytes):
     files = defaultdict(list)
     files = defaultdict(list)
     for idx in range(1, len(parts), 2):
     for idx in range(1, len(parts), 2):
         f = json.loads(parts[idx])
         f = json.loads(parts[idx])
-        f['content'] = parts[idx+1]
+        f['content'] = parts[idx + 1]
         input_name = f.pop('input_name')
         input_name = f.pop('input_name')
         files[input_name].append(f)
         files[input_name].append(f)
 
 
@@ -247,8 +247,6 @@ def deserialize_binary_event(data: bytes):
     return event
     return event
 
 
 
 
-
-
 def seo(title, description=None, app=None):
 def seo(title, description=None, app=None):
     """Set the SEO information of the PyWebIO application (web page information provided when indexed by search engines)
     """Set the SEO information of the PyWebIO application (web page information provided when indexed by search engines)
 
 

+ 1 - 1
pywebio/session/__init__.py

@@ -142,7 +142,7 @@ r"""
         put_code(json.dumps({
         put_code(json.dumps({
             k: str(getattr(session_info, k))
             k: str(getattr(session_info, k))
             for k in ['user_agent', 'user_language', 'server_host',
             for k in ['user_agent', 'user_language', 'server_host',
-                      'origin', 'user_ip', 'backend', 'request']
+                      'origin', 'user_ip', 'backend', 'protocol', 'request']
         }, indent=4), 'json')
         }, indent=4), 'json')
 
 
 .. autoclass:: pywebio.session.coroutinebased.TaskHandler
 .. autoclass:: pywebio.session.coroutinebased.TaskHandler

+ 2 - 2
pywebio/session/threadbased.py

@@ -32,8 +32,8 @@ class ThreadBasedSession(Session):
         curr = id(threading.current_thread())
         curr = id(threading.current_thread())
         session = cls.thread2session.get(curr)
         session = cls.thread2session.get(curr)
         if session is None:
         if session is None:
-            raise SessionNotFoundException(
-                "Can't find current session. Maybe session closed. Did you forget to use `register_thread` ?")
+            raise SessionNotFoundException("Can't find current session. "
+                                           "Maybe session closed or forget to use `register_thread()`.")
         return session
         return session
 
 
     @classmethod
     @classmethod

+ 1 - 1
webiojs/src/handlers/input.ts

@@ -15,7 +15,7 @@ export class InputHandler implements CommandHandler {
     accept_command: string[] = ['input', 'input_group', 'update_input', 'destroy_form'];
     accept_command: string[] = ['input', 'input_group', 'update_input', 'destroy_form'];
 
 
     session: Session;
     session: Session;
-    private form_ctrls: LRUMap;
+    private form_ctrls: LRUMap; // task_id -> stack of FormGroupController
     private readonly container_elem: JQuery;
     private readonly container_elem: JQuery;
 
 
     constructor(session: Session, container_elem: JQuery) {
     constructor(session: Session, container_elem: JQuery) {

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác