本文整理汇总了Python中weechat.config_set_plugin函数的典型用法代码示例。如果您正苦于以下问题:Python config_set_plugin函数的具体用法?Python config_set_plugin怎么用?Python config_set_plugin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了config_set_plugin函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: 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
示例2: print_tweet_data
def print_tweet_data(buffer,tweets,data):
for message in tweets:
nick = message[1]
text = message[3]
reply_id = ""
if script_options['tweet_nicks']:
parse_for_nicks(text,buffer)
add_to_nicklist(buffer,nick,tweet_nicks_group[buffer])
if script_options['print_id']:
t_id = weechat.color('reset') + ' ' + dict_tweet(message[2])
else:
t_id = ''
if len(message) == 5:
#This is a reply to a tweet
arrow_col = weechat.color('chat_prefix_suffix')
reset_col = weechat.color('reset')
reply_id = arrow_col + "<" + reset_col + dict_tweet(message[4]) + arrow_col + "> " + reset_col
temp_text = text
text = reply_id
reply_id = temp_text
weechat.prnt_date_tags(buffer, message[0], "notify_message",
"%s%s\t%s%s" % (nick, t_id, text,reply_id))
if data == "id":
try:
if script_options['last_id'] < tweets[-1][2]:
script_options['last_id'] = tweets[-1][2]
# Save last id
weechat.config_set_plugin("last_id",script_options["last_id"])
except:
pass
开发者ID:Arlefreak,项目名称:dotfiles,代码行数:34,代码来源:weetweet.py
示例3: at_control
def at_control(data,buffer,args):
argv = args.split(' ')
js = ', '
if argv[0] in ['enable','disable','toggle']:
if argv[0] == 'enable' : config['enable'] = True
if argv[0] == 'disable': config['enable'] = False
if argv[0] == 'toggle' : config['enable'] = not config['enable']
weechat.config_set_plugin('enable','on' if config['enable'] else 'off')
if argv[0] == 'status':
weechat.prnt('','atcomplete: %s' % 'on' if config['enable'] else 'off')
weechat.prnt('',' servers: %s' % js.join(config['servers']))
weechat.prnt('',' buffers: %s' % js.join(config['buffers']))
if argv[0] in ['server','buffer']:
sets = argv[0]+'s'
if argv[1] == 'list':
weechat.prnt('','atcomplete %s: %s' % (sets,js.join(config[sets])))
if (argv[1] == 'add' and len(argv) == 3):
if argv[2] not in config[sets]:
config[sets].append(argv[2])
at_config('',STRIP_VAR+sets,js.join(config[sets]))
if (argv[1] == 'del' and len(argv) == 3):
if argv[2] in config[sets]:
config[sets].remove(argv[2])
at_config('',STRIP_VAR+sets,js.join(config[sets]))
return weechat.WEECHAT_RC_OK
开发者ID:WarheadsSE,项目名称:weechat-atcompletion,代码行数:25,代码来源:at_completion.py
示例4: main
def main():
'''Sets up WeeChat notifications.'''
# Initialize options.
for option, value in SETTINGS.items():
if not weechat.config_is_set_plugin(option):
weechat.config_set_plugin(option, value)
# Initialize.
name = "WeeChat"
icon = "/usr/share/pixmaps/weechat.xpm"
notifications = [
'Public',
'Private',
'Action',
'Notice',
'Invite',
'Highlight',
'Server',
'Channel',
'DCC',
'WeeChat'
]
STATE['icon'] = icon
# Register hooks.
weechat.hook_signal(
'irc_server_connected',
'cb_irc_server_connected',
'')
weechat.hook_signal(
'irc_server_disconnected',
'cb_irc_server_disconnected',
'')
weechat.hook_signal('upgrade_ended', 'cb_upgrade_ended', '')
weechat.hook_print('', '', '', 1, 'cb_process_message', '')
weechat.hook_timer(1000, 1, 65535, "cb_buffer_tick", "")
pynotify.init(name)
开发者ID:kilogram,项目名称:weechat-anotify,代码行数:35,代码来源:anotify.py
示例5: load_config
def load_config(data=None, option=None, value=None):
"""
Load configuration options and (re)register hook_timer to clear old
messages based on the current value of check_every. If check_every is 0
then messages are never cleared.
"""
# On initial load set any unset options to the defaults.
if not option:
for option, default in settings.iteritems():
if not weechat.config_is_set_plugin(option):
weechat.config_set_plugin(option, default)
if not option or option.endswith('check_every'):
# If hook_timer for clearing old messages is set already, clear it.
old_hook = globals().get('CLEAR_HOOK', None)
if old_hook is not None:
weechat.unhook(old_hook)
# Register hook_timer to clear old messages.
check_every = get_option_int('check_every') * 1000
if check_every:
globals()['CLEAR_HOOK'] = weechat.hook_timer(
check_every, 0, 0, 'clear_messages_cb', '')
return weechat.WEECHAT_RC_OK
开发者ID:KokaKiwi,项目名称:weechat-scripts,代码行数:26,代码来源:apply_corrections.py
示例6: load_settings
def load_settings():
for (option, default_value) in configs.items():
if w.config_get_plugin(option) == '':
if configs[option] == '_required':
w.prnt('', 'missing plugins.var.python.weepushover.{}'.format(option))
else:
w.config_set_plugin(option, configs[option])
开发者ID:qguv,项目名称:config,代码行数:7,代码来源:weepushover.py
示例7: command_cb
def command_cb(data, buffer, args):
debug('adding "%s"' % args)
items = weechat.config_get_plugin('items')
new_items = '%s %s' % (items, args)
debug('new_items: %s' % new_items)
weechat.config_set_plugin('items', new_items)
return weechat.WEECHAT_RC_OK
开发者ID:Raimondi,项目名称:weechat_scripts,代码行数:7,代码来源:mislabeled.py
示例8: del_from_exemptions
def del_from_exemptions(entry):
"""Remove an entry from the list of defined exemptions.
:param entry: The entry to delete, which can be specified by the position in the list or by the name itself.
:returns: the new list of entries. The return value is only used for unit testing.
"""
entries = list_exemptions()
try:
# by index
try:
index = int(entry) - 1
if index < 0:
raise IndexError
entry = entries.pop(index)
except IndexError:
weechat.prnt("", "[{}] del: Index out of range".format(SCRIPT_COMMAND))
return entries
except ValueError:
try:
# by name
entries.remove(entry)
weechat.config_set_plugin("exemptions", DELIMITER.join(entries))
except ValueError:
weechat.prnt("", "[{}] del: Could not find {}".format(SCRIPT_COMMAND, entry))
return entries
weechat.config_set_plugin("exemptions", DELIMITER.join(entries))
weechat.prnt("", "[{}] del: Removed {} from exemptions.".format(SCRIPT_COMMAND, entry))
return entries
开发者ID:oakkitten,项目名称:scripts,代码行数:29,代码来源:buffer_autohide.py
示例9: get_validated_key_from_config
def get_validated_key_from_config(setting):
key = weechat.config_get_plugin(setting)
if key != 'mask' and key != 'nick':
weechat.prnt("", "Key %s not found. Valid settings are 'nick' and 'mask'. Reverted the setting to 'mask'" % key)
weechat.config_set_plugin("clone_report_key", "mask")
key = "mask"
return key
开发者ID:killerrabbit,项目名称:weechat_scripts,代码行数:7,代码来源:clone_scanner.py
示例10: init_options
def init_options():
for option,value in OPTIONS.items():
if not weechat.config_get_plugin(option):
weechat.config_set_plugin(option, value[0])
else:
OPTIONS[option] = weechat.config_get_plugin(option)
weechat.config_set_desc_plugin(option, '%s (default: "%s")' % (value[1], value[0]))
开发者ID:norrs,项目名称:weechat-plugins,代码行数:7,代码来源:logsize.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():
'''Sets up WeeChat notifications.'''
# Initialize options.
for option, value in SETTINGS.items():
if not weechat.config_is_set_plugin(option):
weechat.config_set_plugin(option, value)
# Initialize.
notifications = [
'Public',
'Private',
'Action',
'Notice',
'Invite',
'Highlight',
'Server',
'Channel',
'DCC',
'WeeChat'
]
# Register hooks.
weechat.hook_signal(
'irc_server_connected',
'cb_irc_server_connected',
'')
weechat.hook_signal(
'irc_server_disconnected',
'cb_irc_server_disconnected',
'')
weechat.hook_signal('upgrade_ended', 'cb_upgrade_ended', '')
weechat.hook_print('', '', '', 1, 'cb_process_message', '')
开发者ID:mmaker,项目名称:mnotify,代码行数:30,代码来源:mnotify.py
示例13: urlview
def urlview(data, buf, args):
infolist = weechat.infolist_get("buffer_lines", buf, "")
lines = []
while weechat.infolist_next(infolist) == 1:
lines.append(
weechat.string_remove_color(
weechat.infolist_string(infolist, "message"),
""
)
)
weechat.infolist_free(infolist)
if not lines:
weechat.prnt(buf, "No URLs found")
return weechat.WEECHAT_RC_OK
if not weechat.config_is_set_plugin("command"):
weechat.config_set_plugin("command", "urlview")
command = weechat.config_get_plugin("command")
text = "\n".join(reversed(lines))
response = os.system("echo %s | %s" % (pipes.quote(text), command))
if response != 0:
weechat.prnt(buf, "No URLs found")
weechat.command(buf, "/window refresh")
return weechat.WEECHAT_RC_OK
开发者ID:keith,项目名称:urlview-weechat,代码行数:29,代码来源:urlview.py
示例14: main
def main():
'''Sets up WeeChat Growl notifications.'''
# Initialize options.
for option, value in SETTINGS.items():
if not weechat.config_is_set_plugin(option):
weechat.config_set_plugin(option, value)
# Initialize Growl.
name = "WeeChat"
hostname = weechat.config_get_plugin('hostname')
password = weechat.config_get_plugin('password')
icon_path = os.path.join(weechat.info_get("weechat_dir", ""),
weechat.config_get_plugin('icon'))
try:
icon = open(icon_path, "rb").read()
except IOError:
weechat.prnt('',
'Weechat-Growl: {0} could not be opened. '.format(icon_path) +
'Please make sure it exists.')
icon = None
notifications = [
'Public',
'Private',
'Action',
'Notice',
'Invite',
'Highlight',
'Server',
'Channel',
'DCC',
'WeeChat'
]
if len(hostname) == 0:
hostname = ''
if len(password) == 0:
password = ''
growl = GrowlNotifier(
applicationName=name,
hostname=hostname,
password=password,
notifications=notifications,
applicationIcon=icon)
try:
growl.register()
except Exception as error:
weechat.prnt('', 'growl: {0}'.format(error))
STATE['growl'] = growl
STATE['icon'] = icon
# Register hooks.
weechat.hook_signal(
'irc_server_connected',
'cb_irc_server_connected',
'')
weechat.hook_signal(
'irc_server_disconnected',
'cb_irc_server_disconnected',
'')
weechat.hook_signal('upgrade_ended', 'cb_upgrade_ended', '')
weechat.hook_print('', '', '', 1, 'cb_process_message', '')
开发者ID:sorin-ionescu,项目名称:weechat-growl,代码行数:59,代码来源:growl.py
示例15: init_options
def init_options():
for option,value in list(OPTIONS.items()):
if not weechat.config_is_set_plugin(option):
weechat.config_set_plugin(option, value[0])
OPTIONS[option] = value[0]
else:
OPTIONS[option] = weechat.config_get_plugin(option)
weechat.config_set_desc_plugin(option, "%s (default: '%s')" % (value[1], value[0]))
开发者ID:weechatter,项目名称:weechat-scripts,代码行数:8,代码来源:bufsize.py
示例16: init_options
def init_options():
for option,value in OPTIONS.items():
if not weechat.config_is_set_plugin(option):
weechat.config_set_plugin(option, value[0])
toggle_refresh(None, 'plugins.var.python.' + SCRIPT_NAME + '.' + option, value[0])
else:
toggle_refresh(None, 'plugins.var.python.' + SCRIPT_NAME + '.' + option, weechat.config_get_plugin(option))
weechat.config_set_desc_plugin(option, '%s (default: "%s")' % (value[1], value[0]))
开发者ID:DarkDefender,项目名称:scripts,代码行数:8,代码来源:shutup.py
示例17: save_state
def save_state():
global buffers
global maintop
if(len(buffers)):
wee.config_set_plugin(conf_opt, py2wee(buffers))
wee.config_set_plugin(conf_opt2, str(maintop))
return
开发者ID:numerical,项目名称:dotfiles,代码行数:8,代码来源:buffer_priority.py
示例18: 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
示例19: lb_set_default_settings
def lb_set_default_settings():
global lb_settings
# Set default settings
for option, default_value, description in lb_settings:
if not weechat.config_is_set_plugin(option):
weechat.config_set_plugin(option, default_value)
version = weechat.info_get("version_number", "") or 0
if int(version) >= 0x00030500:
weechat.config_set_desc_plugin(option, description)
开发者ID:norrs,项目名称:weechat-plugins,代码行数:9,代码来源:listbuffer.py
示例20: _init_options
def _init_options():
global wb_options
for opt, def_val in wb_options.items():
if not weechat.config_is_set_plugin(opt):
weechat.config_set_plugin(opt, str(def_val))
for key in wb_options:
cfg_check('', '.%s' % key, weechat.config_get_plugin(key))
开发者ID:alkafir,项目名称:wee-buzzer,代码行数:9,代码来源:wee-buzzer.py
注:本文中的weechat.config_set_plugin函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论