wangweimin %!s(int64=3) %!d(string=hai) anos
pai
achega
8a038df6ba
Modificáronse 3 ficheiros con 10 adicións e 5 borrados
  1. 2 2
      pywebio/input.py
  2. 4 1
      pywebio/pin.py
  3. 4 2
      pywebio/platform/page.py

+ 2 - 2
pywebio/input.py

@@ -98,7 +98,7 @@ RADIO = 'radio'
 SELECT = 'select'
 SELECT = 'select'
 TEXTAREA = 'textarea'
 TEXTAREA = 'textarea'
 
 
-__all__ = ['TEXT', 'NUMBER', 'FLOAT', 'PASSWORD', 'URL', 'DATE', 'TIME', 'input', 'textarea', 'select',
+__all__ = ['TEXT', 'NUMBER', 'FLOAT', 'PASSWORD', 'URL', 'DATE', 'TIME', 'COLOR', 'input', 'textarea', 'select',
            'checkbox', 'radio', 'actions', 'file_upload', 'slider', 'input_group', 'input_update']
            'checkbox', 'radio', 'actions', 'file_upload', 'slider', 'input_group', 'input_update']
 
 
 
 
@@ -205,7 +205,7 @@ def input(label='', type=TEXT, *, validate=None, name=None, value=None, action=N
         Note: When using :ref:`Coroutine-based session <coroutine_based_session>` implementation, the ``callback``
         Note: When using :ref:`Coroutine-based session <coroutine_based_session>` implementation, the ``callback``
         function can be a coroutine function.
         function can be a coroutine function.
 
 
-    :param callable onchange: A callback function which will be called when the value of this input field changed.
+    :param callable onchange: A callback function which will be called when user change the value of this input field.
 
 
        The ``onchange`` callback is invoked with one argument, the current value of input field.
        The ``onchange`` callback is invoked with one argument, the current value of input field.
        A typical usage scenario of ``onchange`` is to update other input item by using `input_update()`
        A typical usage scenario of ``onchange`` is to update other input item by using `input_update()`

+ 4 - 1
pywebio/pin.py

@@ -96,7 +96,8 @@ Pin utils
     Pin widgets value getter and setter.
     Pin widgets value getter and setter.
 
 
     You can use attribute or key index of ``pin`` object to get the current value of a pin widget.
     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.
+    By default, when accessing the value of a widget that does not exist, it returns ``None`` instead of
+    throwing an exception.
 
 
     You can also use the ``pin`` object to set the value of pin widget:
     You can also use the ``pin`` object to set the value of pin widget:
 
 
@@ -114,6 +115,8 @@ Pin utils
     Note: When using :ref:`coroutine-based session <coroutine_based_session>`,
     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.
     you need to use the ``await pin.name`` (or ``await pin['name']``) syntax to get pin widget value.
 
 
+    Use `pin.pin.use_strict()` to enable strict mode for getting pin widget value.
+    An ``AssertionError`` will be raised when try to get value of pin widgets that are currently not in the page.
 
 
 .. autofunction:: pin_wait_change
 .. autofunction:: pin_wait_change
 .. autofunction:: pin_update
 .. autofunction:: pin_update

+ 4 - 2
pywebio/platform/page.py

@@ -247,12 +247,14 @@ def config(*, title=None, description=None, theme=None, js_code=None, js_file=[]
     If you use ``config()`` as decorator, the configuration will only work on single PyWebIO application function.
     If you use ``config()`` as decorator, the configuration will only work on single PyWebIO application function.
     ::
     ::
 
 
-        config(title="My application")
+        config(title="My application")  # global configuration
 
 
-        @config(css_style="* { color:red }")
+        @config(css_style="* { color:red }")  # only works on this application
         def app():
         def app():
             put_text("hello PyWebIO")
             put_text("hello PyWebIO")
 
 
+    .. note:: The configuration will affect all sessions
+
     ``title`` and ``description`` are used for SEO, which are provided when indexed by search engines.
     ``title`` and ``description`` are used for SEO, which are provided when indexed by search engines.
     If no ``title`` and ``description`` set for a PyWebIO application function,
     If no ``title`` and ``description`` set for a PyWebIO application function,
     the `docstring <https://www.python.org/dev/peps/pep-0257/>`_ of the function will be used as title and description by default::
     the `docstring <https://www.python.org/dev/peps/pep-0257/>`_ of the function will be used as title and description by default::