summaryrefslogtreecommitdiff
path: root/src/plugins/python/weechat.pyi
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-07-06 19:00:16 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-07-08 13:28:40 +0200
commit66cb9f6ea2e534887e73c885d3f131710c48382d (patch)
tree1d21dafd605395a57078f9d82d8f525bad588bb6 /src/plugins/python/weechat.pyi
parent8f9d88edd0106c92daf1ce624638f037f7e8fe0d (diff)
downloadweechat-66cb9f6ea2e534887e73c885d3f131710c48382d.zip
core: add option type "enum" (closes #1973)
The type "enum" replaces type "integer" when used with string values. For compatibility, any option created with type "integer" and string values is automatically created to "enum" on creation, with no error.
Diffstat (limited to 'src/plugins/python/weechat.pyi')
-rw-r--r--src/plugins/python/weechat.pyi58
1 files changed, 40 insertions, 18 deletions
diff --git a/src/plugins/python/weechat.pyi b/src/plugins/python/weechat.pyi
index d3c2cb214..6d743e4c2 100644
--- a/src/plugins/python/weechat.pyi
+++ b/src/plugins/python/weechat.pyi
@@ -602,52 +602,52 @@ def config_new_option(config_file: str, section: str, name: str, type: str, desc
::
# example
- def option4_check_value_cb(data: str, option: str, value: str) -> int:
+ def option_str_check_value_cb(data: str, option: str, value: str) -> int:
# ...
return 1
# return 0
- def option4_change_cb(data: str, option: str) -> None:
+ def option_str_change_cb(data: str, option: str) -> None:
# ...
- def option4_delete_cb(data: str, option: str) -> None:
+ def option_str_delete_cb(data: str, option: str) -> None:
# ...
- option1 = weechat.config_new_option(config_file, section, "option1", "boolean",
+ option_bool = weechat.config_new_option(config_file, section, "option_bool", "boolean",
"My option, type boolean",
"", 0, 0, "on", "on", 0,
"", "",
"", "",
"", "")
- option2 = weechat.config_new_option(config_file, section, "option2", "integer",
+ option_int = weechat.config_new_option(config_file, section, "option_int", "integer",
"My option, type integer",
"", 0, 100, "15", "15", 0,
"", "",
"", "",
"", "")
- option3 = weechat.config_new_option(config_file, section, "option3", "integer",
- "My option, type integer (with string values)",
- "top|bottom|left|right",
- 0, 0, "bottom", "bottom", 0,
- "", "",
- "", "",
- "", "")
-
- option4 = weechat.config_new_option(config_file, section, "option4", "string",
+ option_str = weechat.config_new_option(config_file, section, "option_str", "string",
"My option, type string",
"", 0, 0, "test", "test", 1,
- "option4_check_value_cb", "",
- "option4_change_cb", "",
- "option4_delete_cb", "")
+ "option_str_check_value_cb", "",
+ "option_str_change_cb", "",
+ "option_str_delete_cb", "")
- option5 = weechat.config_new_option(config_file, section, "option5", "color",
+ option_col = weechat.config_new_option(config_file, section, "option_col", "color",
"My option, type color",
"", 0, 0, "lightblue", "lightblue", 0,
"", "",
"", "",
"", "")
+
+ option_enum = weechat.config_new_option(config_file, section, "option_enum", "enum",
+ "My option, type enum",
+ "top|bottom|left|right",
+ 0, 0, "bottom", "bottom", 0,
+ "", "",
+ "", "",
+ "", "")
"""
...
@@ -861,6 +861,28 @@ def config_color_default(option: str) -> str:
...
+def config_enum(option: str) -> int:
+ """`config_enum in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_enum>`_
+ ::
+
+ # example
+ option = weechat.config_get("plugin.section.option")
+ value = weechat.config_enum(option)
+ """
+ ...
+
+
+def config_enum_default(option: str) -> int:
+ """`config_enum_default in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_enum_default>`_
+ ::
+
+ # example
+ option = weechat.config_get("plugin.section.option")
+ value = weechat.config_enum_default(option)
+ """
+ ...
+
+
def config_write_option(config_file: str, option: str) -> int:
"""`config_write_option in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_write_option>`_
::