本文整理汇总了Python中weechat.register函数的典型用法代码示例。如果您正苦于以下问题:Python register函数的具体用法?Python register怎么用?Python register使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了register函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: main
def main():
""" Entry point, initializes everything """
# Setup the translation table, mapping latin characters to their Unicode
# fullwidth equivalents.
global FW_TABLE
FW_TABLE = dict(zip(range(0x21, 0x7F),
range(0xFF01, 0xFF5F)))
# Handle space specially.
FW_TABLE[0x20] = 0x3000
weechat.register(
SCRIPT_NAME,
SCRIPT_AUTHOR,
SCRIPT_VERSION,
SCRIPT_LICENSE,
SCRIPT_DESCRIPTION,
"", # Shutdown callback function
"", # Charset (blank for utf-8)
)
# Command callbacks
weechat.hook_command( # command name
"fw",
# description
"Translates latin characters to their fullwidth equivalents.",
# arguments
"text",
# description of arguments
" text: text to be full-width'd",
# completions
"",
"fw_cb", "")
开发者ID:flowbish,项目名称:weechat-fullwidth,代码行数:33,代码来源:fullwidth.py
示例2: Register
def Register():
weechat.register(TRIV['register']['script_name'],
TRIV['register']['author'],
TRIV['register']['version'],
TRIV['register']['license'],
TRIV['register']['description'],
TRIV['register']['shutdown_function'],
TRIV['register']['charset'])
开发者ID:manuelalcocer,项目名称:trivial,代码行数:8,代码来源:trivial.py
示例3: register
def register():
weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION,
SCRIPT_LICENSE, SCRIPT_DESC, '', '')
weechat.hook_print('', 'irc_332', '', 1, 'print_332', '')
weechat.hook_print('', 'irc_topic', '', 1, 'print_topic', '')
weechat.hook_signal('*,irc_in2_332', 'irc_in2_332', '')
weechat.hook_signal('*,irc_in2_topic', 'irc_in2_topic', '')
开发者ID:KokaKiwi,项目名称:weechat-scripts,代码行数:8,代码来源:topicdiff.py
示例4: main
def main():
""" Entry point, initializes everything """
weechat.register(
SCRIPT_NAME,
SCRIPT_AUTHOR,
SCRIPT_VERSION,
SCRIPT_LICENSE,
SCRIPT_DESCRIPTION,
"", # Shutdown callback function
"", # Charset (blank for utf-8)
)
# Default values for settings
default_settings = {
'dbfile': os.path.join(
weechat.info_get("weechat_dir", ""), "emojis-db.dat")
}
# Apply default configuration values if anything is unset
for option, default in default_settings.items():
if not weechat.config_is_set_plugin(option):
weechat.config_set_plugin(option, default)
# Hook callbacks
weechat.hook_config("plugins.var.python." + SCRIPT_NAME + ".*",
"configuration_cb", "")
weechat.hook_command_run("/input return", "transform_cb", "")
weechat.hook_command_run("/input complete*", "complete_cb", "")
#weechat.hook_modifier("input_text_display", "collapse_cb", "")
# Command callbacks
weechat.hook_command( # command name
SCRIPT_NAME,
# description
" display :common_name: with its emoji equivalent",
# arguments
"reload"
" || add <name> <emoji>"
" || show <emoji>",
# description of arguments
" name: emoji name, sans colons\n"
"emoji: text that replaces :name:\n",
# completions
"reload || add || show %(emoji_name)", "emojis_cb", "")
weechat.hook_completion("emoji_name", "Emoji name", "emoji_name_completion_cb", "")
dbfile = weechat.config_get_plugin("dbfile")
weechat.prnt("", "%s: Loading emojis from %s" % (SCRIPT_NAME, dbfile))
try:
load_emojis(dbfile)
except IOError as e:
weechat.prnt("",
"%s%s: Database file %s is missing or inaccessible." \
% (weechat.prefix("error"), SCRIPT_NAME, dbfile))
raise e # TODO: handle this better instead of brutally aborting
开发者ID:flowbish,项目名称:weechat-emojis,代码行数:58,代码来源:emojis.py
示例5: __init__
def __init__(self):
''' Creates the script instance and add hook, unfortunately it is
not possible to use mathods as callbacks.
'''
weechat.register("SystrayIcon",
"Ziviani",
"0.1",
"GPLv2",
"Systray icon for weechat.",
"_shutdown_plugin",
"")
weechat.hook_print("", "irc_privmsg", "", 1, "_highlight_msg_cb", "")
开发者ID:jrziviani,项目名称:laboratory,代码行数:13,代码来源:blinkicon.py
示例6: main
def main():
"""Main entry"""
weechat.register(NAME, AUTHOR, VERSION, LICENSE, DESC, '', '')
weechat.hook_completion('replacer_plugin', 'Try to match last word with '
'those in replacement map keys, and replace it '
'with value.', 'replace_cb', '')
weechat.hook_completion('completion_cb', 'Complete replacement map keys',
'completion_cb', '')
weechat.hook_command(COMMAND, DESC, "[add <word> <text>|del <word>]",
__doc__ % {"command": COMMAND},
'add|del %(completion_cb)', 'replace_cmd', '')
开发者ID:gryf,项目名称:weechat-replacer,代码行数:13,代码来源:replacer.py
示例7: main
def main():
""" Entry point, initializes everything """
weechat.register(
SCRIPT_NAME,
SCRIPT_AUTHOR,
SCRIPT_VERSION,
SCRIPT_LICENSE,
SCRIPT_DESCRIPTION,
"", # Shutdown callback function
"", # Charset (blank for utf-8)
)
# Default values for settings
default_settings = {
'dbfile': os.path.join(
weechat.info_get("weechat_dir", ""), "emojis-db.dat")
}
# Apply default configuration values if anything is unset
for option, default in default_settings.items():
if not weechat.config_is_set_plugin(option):
weechat.config_set_plugin(option, default)
# Hook callbacks
weechat.hook_config(
"plugins.var.python." + SCRIPT_NAME + ".*",
"configuration_cb", "")
weechat.hook_command_run("/input return", "transform_cb", "")
weechat.hook_command_run("/input complete*", "complete_cb", "")
# Command callbacks
weechat.hook_command(
"reloademojis", "reload emojis from file",
"", "", "", "reload_emojis_cb", "")
dbfile = weechat.config_get_plugin("dbfile")
weechat.prnt("", "%s: Loading emojis from %s" % (SCRIPT_NAME, dbfile))
try:
load_emojis(dbfile)
except IOError as e:
weechat.prnt(
"",
"%s%s: Database file %s is missing or inaccessible."
% (weechat.prefix("error"), SCRIPT_NAME, dbfile))
raise e # TODO: handle this better instead of brutally aborting
开发者ID:OliverUv,项目名称:weechat-emojis,代码行数:48,代码来源:emojis.py
示例8: main
def main():
if not weechat.register("edit", "Keith Smiley", "1.0.0", "MIT",
"Open your $EDITOR to compose a message", "", ""):
return weechat.WEECHAT_RC_ERROR
weechat.hook_command("edit", "Open your $EDITOR to compose a message", "",
"", "", "edit", "")
开发者ID:keith,项目名称:edit-weechat,代码行数:7,代码来源:edit.py
示例9: go_main
def go_main():
"""Entry point."""
if not weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION,
SCRIPT_LICENSE, SCRIPT_DESC,
'go_unload_script', ''):
return
weechat.hook_command(
SCRIPT_COMMAND,
'Quick jump to buffers', '[term(s)]',
'term(s): directly jump to buffer matching the provided term(s) single'
'or space dilimited list (without argument, list is displayed)\n\n'
'You can bind command to a key, for example:\n'
' /key bind meta-g /go\n\n'
'You can use completion key (commonly Tab and shift-Tab) to select '
'next/previous buffer in list.',
'%(buffers_names)',
'go_cmd', '')
# set default settings
version = weechat.info_get('version_number', '') or 0
for option, value in SETTINGS.items():
if not weechat.config_is_set_plugin(option):
weechat.config_set_plugin(option, value[0])
if int(version) >= 0x00030500:
weechat.config_set_desc_plugin(
option, '%s (default: "%s")' % (value[1], value[0]))
weechat.hook_info('go_running',
'Return "1" if go is running, otherwise "0"',
'',
'go_info_running', '')
开发者ID:gilbertw1,项目名称:scripts,代码行数:30,代码来源:go.py
示例10: main
def main():
if not weechat.register("giphy", "Keith Smiley", "1.0.0", "MIT",
"Insert a random giphy URL", "", ""):
return weechat.WEECHAT_RC_ERROR
weechat.hook_command("giphy", "Insert a random giphy URL", "",
"", "", "giphy", "")
开发者ID:keith,项目名称:giphy-weechat,代码行数:7,代码来源:giphy.py
示例11: main
def main():
if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE, SCRIPT_DESC, "", ""):
version = int(weechat.info_get("version_number", "")) or 0
# unset unused setting from older versions of script
if weechat.config_is_set_plugin("display_unit"):
weechat.prnt("", "Option plugins.var.python.bandwidth.display_unit no longer used, removing.")
weechat.config_unset_plugin("display_unit")
# set default settings
for option in SCRIPT_SETTINGS.iterkeys():
if not weechat.config_is_set_plugin(option):
weechat.config_set_plugin(option, SCRIPT_SETTINGS[option][0])
if version >= 0x00030500:
weechat.config_set_desc_plugin(option, SCRIPT_SETTINGS[option][1])
# ensure sane refresh_rate setting
if int(weechat.config_get_plugin("refresh_rate")) < 1:
weechat.prnt(
"",
"{}Invalid value for option plugins.var.python.bandwidth.refresh_rate, setting to default of {}".format(
weechat.prefix("error"), SCRIPT_SETTINGS["refresh_rate"][0]
),
)
weechat.config_set_plugin("refresh_rate", SCRIPT_SETTINGS["refresh_rate"][0])
# create the bandwidth monitor bar item
weechat.bar_item_new("bandwidth", "bandwidth_item_cb", "")
# update it every plugins.var.python.bandwidth.refresh_rate seconds
weechat.hook_timer(int(weechat.config_get_plugin("refresh_rate")) * 1000, 0, 0, "bandwidth_timer_cb", "")
开发者ID:Shrews,项目名称:scripts,代码行数:30,代码来源:bandwidth.py
示例12: main
def main():
if not weechat.register("emote", "Keith Smiley", "1.0.0", "MIT",
"Paste awesome unicode!", "", ""):
return weechat.WEECHAT_RC_ERROR
weechat.hook_command("emote", "Paste awesome unicode!", "", "",
"|".join(mappings.keys()), "emote", "")
开发者ID:keith,项目名称:emote-weechat,代码行数:7,代码来源:emote.py
示例13: weechat_script
def weechat_script():
settings = {"host": "localhost", "port": "4321", "icon": "utilities-terminal", "pm-icon": "emblem-favorite"}
if w.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE, SCRIPT_DESC, "", ""):
for (kw, v) in settings.items():
if not w.config_get_plugin(kw):
w.config_set_plugin(kw, v)
w.hook_print("", "notify_message", "", 1, "on_msg", "")
w.hook_print("", "notify_private", "", 1, "on_msg", "private")
w.hook_print("", "notify_highlight", "", 1, "on_msg", "") # Not sure if this is needed
开发者ID:norrs,项目名称:weechat-plugins,代码行数:9,代码来源:pyrnotify.py
示例14: main
def main():
if not weechat.register("imgur", "Keith Smiley", "1.0.0", "MIT",
"Upload an image to imgur", "", ""):
return weechat.WEECHAT_RC_ERROR
if not weechat.config_get_plugin(CLIENT_ID):
weechat.config_set_plugin(CLIENT_ID, "Set imgur client ID")
weechat.hook_command("imgur", "Pass the current buffer to urlview", "",
"", "filename", "imgur", "")
开发者ID:keith,项目名称:imgur-weechat,代码行数:10,代码来源:imgur.py
示例15: main
def main():
if distutils.spawn.find_executable("urlview") is None:
return weechat.WEECHAT_RC_ERROR
if not weechat.register("urlview", "Keith Smiley", "1.0.2", "MIT",
"Use urlview on the current buffer", "", ""):
return weechat.WEECHAT_RC_ERROR
weechat.hook_command("urlview", "Pass the current buffer to urlview", "",
"", "", "urlview", "")
开发者ID:keith,项目名称:urlview-weechat,代码行数:10,代码来源:urlview.py
示例16: init
def init():
ok = import_ok and weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION,
SCRIPT_LICENSE, SCRIPT_DESC, "", "")
if not ok:
return
# Set default settings
for option, default_value in settings.iteritems():
if not weechat.config_is_set_plugin(option):
weechat.config_set_plugin(option, default_value)
return True
开发者ID:frumiousbandersnatch,项目名称:weechat-scripts,代码行数:12,代码来源:bee.py
示例17: main
def main():
if not weechat.register("terminal_notifier", "Keith Smiley", "1.1.0", "MIT",
"Get OS X notifications for messages", "", ""):
return weechat.WEECHAT_RC_ERROR
if distutils.spawn.find_executable("osascript") is None:
return weechat.WEECHAT_RC_OK
weechat.hook_signal("weechat_pv", "notify", "")
weechat.hook_signal("weechat_highlight", "notify", "")
return weechat.WEECHAT_RC_OK
开发者ID:keith,项目名称:terminal-notifier-weechat,代码行数:12,代码来源:terminal_notifier.py
示例18: main
def main():
if weechat.register(Script.NAME, Script.AUTHOR, Script.VERSION, Script.LICENSE, Script.DESCRIPTION, "CallbackPluginUnloaded", ""):
plugin.SetDefaultOptions()
plugin.SetCommands()
plugin.RegisterTimer("vk-auth", 60 * 1000, 60, 0, "CallbackVkAuth", "")
## TODO: look into how to make this callback co-exist with vk-fetch-updates
## plugin.RegisterTimer("vk-fetch-friends", 10 * 60 * 1000, 30, 0, "CallbackVkFetchFriends", "")
plugin.RegisterTimer("vk-fetch-updates", 5 * 1000, 10, 0, "CallbackVkFetchUpdates", "")
## Do not wait for the timers to be triggered in 60s
CallbackVkAuth(None, -1)
CallbackVkFetchFriends(None, -1)
开发者ID:lenormf,项目名称:vk-chat.py,代码行数:13,代码来源:vk-chat.py
示例19: weechat_script
def weechat_script():
settings = {'host' : "localhost",
'port' : "4321",
'icon' : "utilities-terminal",
'pm-icon' : "emblem-favorite",
'urgency_default' : 'critical',
'display_time_default' : '10000',
'display_time_highlight' : '30000',
'display_time_private_highlight' : '0'}
if w.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE, SCRIPT_DESC, "", ""):
for (kw, v) in settings.items():
if not w.config_get_plugin(kw):
w.config_set_plugin(kw, v)
w.hook_print("", "notify_message", "", 1, "on_msg", "")
w.hook_print("", "notify_private", "", 1, "on_msg", "private")
w.hook_print("", "notify_highlight", "", 1, "on_msg", "") # Not sure if this is needed
开发者ID:zeltak,项目名称:dotfiles,代码行数:17,代码来源:weechat-remote-notify.py
示例20: main_weechat
def main_weechat():
"""Main function, called only in WeeChat."""
if not weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION,
SCRIPT_LICENSE, SCRIPT_DESC, '', ''):
return
theme_config_init()
theme_config_read()
theme_init()
weechat.hook_command(
SCRIPT_COMMAND,
'WeeChat theme manager',
'list [<text>] || info|show [<theme>] || install <theme>'
' || installfile <file> || update || undo || backup || save <file>'
' || restore || export [-white] <file>',
' list: list themes (search text if given)\n'
' info: show info about theme (without argument: for current '
'theme)\n'
' show: show all options in theme (without argument: for '
'current theme)\n'
' install: install a theme from repository\n'
'installfile: load theme from a file\n'
' update: download and unpack themes in themes directory\n'
' undo: undo last theme install\n'
' backup: backup current theme (by default in '
'~/.weechat/themes/_backup.theme); this is done the first time script '
'is loaded\n'
' save: save current theme in a file\n'
' restore: restore theme backuped by script\n'
' export: save current theme as HTML in a file (with "-white": '
'use white background in HTML)\n\n'
'Examples:\n'
' /' + SCRIPT_COMMAND + ' save /tmp/flashcode.theme => save current '
'theme',
'list'
' || info %(filename)'
' || show %(filename)'
' || install %(themes)'
' || installfile %(filename)'
' || update'
' || undo'
' || save %(filename)'
' || backup'
' || restore'
' || export -white|%(filename) %(filename)',
'theme_cmd', '')
开发者ID:MatthewCox,项目名称:dotfiles,代码行数:45,代码来源:theme.py
注:本文中的weechat.register函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论