Skip to content

Commit

Permalink
doc update
Browse files Browse the repository at this point in the history
Rate limit · GitHub

Access has been restricted

You have triggered a rate limit.

Please wait a few minutes before you try again;
in some cases this may take up to an hour.

wang0618 committed Mar 23, 2021
1 parent bc36401 commit e3c8ce2
Showing 16 changed files with 621 additions and 645 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@
<img src="https://img.shields.io/pypi/v/pywebio?colorB=brightgreen" alt="Package version">
</a>
<a href="https://pypi.org/project/PyWebIO/">
<img src="https://img.shields.io/pypi/pyversions/PyWebIO.svg?colorB=brightgreen" alt="Python Version">
<img src="https://img.shields.io/badge/python->%3D%203.5.2-brightgreen" alt="Python Version">
</a>
<br/>
<a href="https://lgtm.com/projects/g/wang0618/PyWebIO/context:python">
@@ -173,7 +173,7 @@ Document is on [https://pywebio.readthedocs.io](https://pywebio.readthedocs.io)
<img src="https://img.shields.io/pypi/v/pywebio?colorB=brightgreen" alt="Package version">
</a>
<a href="https://pypi.org/project/PyWebIO/">
<img src="https://img.shields.io/pypi/pyversions/PyWebIO.svg?colorB=brightgreen" alt="Python Version">
<img src="https://img.shields.io/badge/python->%3D%203.5.2-brightgreen" alt="Python Version">
</a>
<br/>
<a href="https://lgtm.com/projects/g/wang0618/PyWebIO/context:python">
16 changes: 8 additions & 8 deletions demos/__main__.py
Original file line number Diff line number Diff line change
@@ -17,10 +17,10 @@

index_md = r"""### Basic demo
- [BMI calculation](./bmi): Calculating Body Mass Index based on height and weight [source](https://github.com/wang0618/PyWebIO/blob/dev/demos/bmi.py)
- [Online chat room](./chat_room): Chat with everyone currently online [source](https://github.com/wang0618/PyWebIO/blob/dev/demos/chat_room.py)
- [Input demo](./input_usage): Demonstrate various input usage supported by PyWebIO [source](https://github.com/wang0618/PyWebIO/blob/dev/demos/input_usage.py)
- [Output demo](./output_usage): Demonstrate various output usage supported by PyWebIO [source](https://github.com/wang0618/PyWebIO/blob/dev/demos/output_usage.py)
- [BMI calculation](./bmi): Calculating Body Mass Index based on height and weight
- [Online chat room](./chat_room): Chat with everyone currently online
- [Input demo](./input_usage): Demonstrate various input usage supported by PyWebIO
- [Output demo](./output_usage): Demonstrate various output usage supported by PyWebIO
### Data visualization demo
PyWebIO supports for data visualization with the third-party libraries.
@@ -58,10 +58,10 @@

index_md_zh = r"""### 基本demo
- [BMI计算](./bmi): 根据身高体重计算BMI指数 [源码](https://github.com/wang0618/PyWebIO/blob/dev/demos/bmi.py)
- [聊天室](./chat_room): 和当前所有在线的人聊天 [源码](https://github.com/wang0618/PyWebIO/blob/dev/demos/chat_room.py)
- [输入演示](./input_usage): 演示PyWebIO输入模块的用法 [源码](https://github.com/wang0618/PyWebIO/blob/dev/demos/input_usage.py)
- [输出演示](./output_usage): 演示PyWebIO输出模块的用法 [源码](https://github.com/wang0618/PyWebIO/blob/dev/demos/output_usage.py)
- [BMI计算](./bmi): 根据身高体重计算BMI指数
- [聊天室](./chat_room): 和当前所有在线的人聊天
- [输入演示](./input_usage): 演示PyWebIO输入模块的用法
- [输出演示](./output_usage): 演示PyWebIO输出模块的用法
- 更多Demo请见[文档](https://pywebio.readthedocs.io)中示例代码的在线Demo
### 数据可视化demo
10 changes: 5 additions & 5 deletions demos/input_usage.py
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ def t(eng, chinese):


def main():
"""PyWebIO input demo
"""PyWebIO Input Usage
Demonstrate various input usage supported by PyWebIO.
演示PyWebIO输入模块的使用
@@ -122,7 +122,7 @@ def main():
# 输入选项
put_markdown(t("""#### Parameter of input functions
There are many parameters that can be passed to the input function:
""","""#### 输入选项
""", """#### 输入选项
输入函数可指定的参数非常丰富:
"""), strip_indent=4)
put_markdown("""
@@ -137,7 +137,7 @@ def main():
datalist=['candidate1', 'candidate2', 'candidate2'])

# 校验函数
put_markdown(t("""You can specify a validation function for the input by using validate parameter. The validation function should return None when the check passes, otherwise an error message will be returned:""", """我们可以为输入指定校验函数,校验函数校验通过时返回None,否则返回错误消息:"""), strip_indent=4)
put_markdown(t("""You can specify a validation function for the input by using `validate` parameter. The validation function should return `None` when the check passes, otherwise an error message will be returned:""", """我们可以为输入指定校验函数,校验函数校验通过时返回`None`,否则返回错误消息:"""), strip_indent=4)
put_markdown("""
```python
def check_age(p): # return None when the check passes, otherwise return the error message
@@ -160,7 +160,7 @@ def check_age(p): # 检验函数校验通过时返回None,否则返回错误
put_markdown('`age = %r`' % age)

# Codemirror
put_markdown(t("""You can use `code` parameter in `pywebio.input.textarea()` to make a code editing textarea:""", """PyWebIO 的 `textarea()` 输入函数还支持使用 [Codemirror](https://codemirror.net/) 实现代码风格的编辑区,只需使用 `code` 参数传入Codemirror支持的选项即可(最简单的情况是直接传入` code={}` 或 `code=True`):"""), strip_indent=4)
put_markdown(t("""You can use `code` parameter in `pywebio.input.textarea()` to create a code editing textarea:""", """PyWebIO 的 `textarea()` 输入函数还支持使用 [Codemirror](https://codemirror.net/) 实现代码风格的编辑区,只需使用 `code` 参数传入Codemirror支持的选项即可(最简单的情况是直接传入` code={}` 或 `code=True`):"""), strip_indent=4)
put_markdown(r"""
```python
code = textarea('Code Edit', code={
@@ -179,7 +179,7 @@ def check_age(p): # 检验函数校验通过时返回None,否则返回错误

# 输入组
put_markdown(t("""### Input Group
`input_group()` accepts a list of single input function call as parameter, and returns a dictionary with the name from the single input function as the key and the input data as the value.
`input_group()` accepts a list of single input function call as parameter, and returns a dictionary with the name of the single input function as the key and the input data as the value.
The input group also supports using `validate` parameter to set the validation function, which accepts the entire form data as parameter:""",
"""### 输入组
`input_group()` 接受单项输入组成的列表作为参数,输入组中需要在每一项输入函数中提供 `name` 参数来用于在结果中标识不同输入项。输入组中同样支持设置校验函数,其接受整个表单数据作为参数。检验函数校验通过时返回None,否则返回 `(input name,错误消息)`
16 changes: 8 additions & 8 deletions demos/output_usage.py
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ def run_code(code, scope):


async def main():
"""PyWebIO Output demo
"""PyWebIO Output Usage
Demonstrate various output usage supported by PyWebIO.
演示PyWebIO输出模块的使用
@@ -95,13 +95,13 @@ async def main():
put_file('hello_word.txt', b'hello word!')
"""))

put_markdown(t(r"""For all output functions provided by PyWebIO, please refer to the document.
put_markdown(t(r"""For all output functions provided by PyWebIO, please refer to the [document](https://pywebio.readthedocs.io/en/latest/output.html#output-func-list).
### Combined Output
The output functions whose name starts with put_ can be combined with some output functions as part of the final output:
The output functions whose name starts with `put_` can be combined with some output functions as part of the final output:
You can pass `put_xxx()` calls to `put_table()` as cell content:
""", r"""PyWebIO提供的全部输出函数请参考PyWebIO文档
""", r"""PyWebIO提供的全部输出函数请参考[PyWebIO文档](https://pywebio.readthedocs.io/zh_CN/latest/output.html#output-func-list)
### 组合输出
@@ -134,11 +134,11 @@ async def main():
])
""")

put_markdown(t(r"For more output functions that accept `put_xxx()` calls as parameters, please refer to corresponding function documentation.",
r"更多接受`put_xxx()`作为参数的输出函数请参考函数文档。"))
put_markdown(t(r"For more output functions that accept `put_xxx()` calls as parameters, please refer to the [document](https://pywebio.readthedocs.io/en/latest/output.html#output-func-list).",
r"更多接受`put_xxx()`作为参数的输出函数请参考[函数文档](https://pywebio.readthedocs.io/zh_CN/latest/output.html#output-func-list)。"))

put_markdown(t(r"""### Callback
PyWebIO allows you to output some buttons, and the provided callback function will be executed when the button is clicked.
PyWebIO allows you to output some buttons and bind callbacks to them. The provided callback function will be executed when the button is clicked.
This is an example:%s
The call to `put_table()` will not block. When user clicks a button, the corresponding callback function will be invoked:
@@ -177,7 +177,7 @@ def edit_row(choice, row):
])
set_scope('table-callback')

put_markdown(t("Of course, PyWebIO also supports outputting individual button:", "当然,PyWebIO还支持单独的按钮控件:")+r"""
put_markdown(t("Of course, PyWebIO also supports outputting individual buttons:", "当然,PyWebIO还支持单独的按钮控件:")+r"""
```python
def btn_click(btn_val):
put_markdown("> You click `%s` button" % btn_val)
Binary file modified docs/assets/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/input_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/input_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Rate limit · GitHub

Access has been restricted

You have triggered a rate limit.

Please wait a few minutes before you try again;
in some cases this may take up to an hour.

0 comments on commit e3c8ce2

Please sign in to comment.