本文整理汇总了Python中weechat.config_write函数的典型用法代码示例。如果您正苦于以下问题:Python config_write函数的具体用法?Python config_write怎么用?Python config_write使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了config_write函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: shutdown
def shutdown():
"""Script unload callback."""
debug('shutdown')
weechat.config_write(CONFIG_FILE)
for account in ACCOUNTS.itervalues():
account.end_all_private()
free_all_config()
weechat.bar_item_remove(OTR_STATUSBAR)
return weechat.WEECHAT_RC_OK
示例2: __init__
def __init__(self, filename):
''' Initialize the configuration. '''
self.filename = filename
self.config_file = weechat.config_new(self.filename, '', '')
self.sorting_section = None
self.case_sensitive = False
self.group_irc = True
self.rules = []
self.highest = 0
self.__case_sensitive = None
self.__group_irc = None
self.__rules = None
if not self.config_file:
log('Failed to initialize configuration file "{}".'.format(self.filename))
return
self.sorting_section = weechat.config_new_section(self.config_file, 'sorting', False, False, '', '', '', '', '', '', '', '', '', '')
if not self.sorting_section:
log('Failed to initialize section "sorting" of configuration file.')
weechat.config_free(self.config_file)
return
self.__case_sensitive = weechat.config_new_option(
self.config_file, self.sorting_section,
'case_sensitive', 'boolean',
'If this option is on, sorting is case sensitive.',
'', 0, 0, 'off', 'off', 0,
'', '', '', '', '', ''
)
self.__group_irc = weechat.config_new_option(
self.config_file, self.sorting_section,
'group_irc', 'boolean',
'If this option is on, the script pretends that IRC channel/private buffers are renamed to "irc.server.{network}.{channel}" rather than "irc.{network}.{channel}".' +
'This ensures that thsee buffers are grouped with their respective server buffer.',
'', 0, 0, 'on', 'on', 0,
'', '', '', '', '', ''
)
self.__rules = weechat.config_new_option(
self.config_file, self.sorting_section,
'rules', 'string',
'An ordered list of sorting rules encoded as JSON. See /help autosort for commands to manipulate these rules.',
'', 0, 0, Config.default_rules, Config.default_rules, 0,
'', '', '', '', '', ''
)
if weechat.config_read(self.config_file) != weechat.WEECHAT_RC_OK:
log('Failed to load configuration file.')
if weechat.config_write(self.config_file) != weechat.WEECHAT_RC_OK:
log('Failed to write configuration file.')
self.reload()
示例3: __init__
def __init__(self, filename):
''' Initialize the configuration. '''
self.filename = filename
self.config_file = weechat.config_new(self.filename, '', '')
self.sorting_section = None
self.case_sensitive = False
self.group_irc = True
self.rules = []
self.replacements = []
self.signals = []
self.sort_on_config = True
self.__case_sensitive = None
self.__group_irc = None
self.__rules = None
self.__replacements = None
self.__signals = None
self.__sort_on_config = None
if not self.config_file:
log('Failed to initialize configuration file "{0}".'.format(self.filename))
return
self.sorting_section = weechat.config_new_section(self.config_file, 'sorting', False, False, '', '', '', '', '', '', '', '', '', '')
if not self.sorting_section:
log('Failed to initialize section "sorting" of configuration file.')
weechat.config_free(self.config_file)
return
self.__case_sensitive = weechat.config_new_option(
self.config_file, self.sorting_section,
'case_sensitive', 'boolean',
'If this option is on, sorting is case sensitive.',
'', 0, 0, 'off', 'off', 0,
'', '', '', '', '', ''
)
self.__group_irc = weechat.config_new_option(
self.config_file, self.sorting_section,
'group_irc', 'boolean',
'If this option is on, the script pretends that IRC channel/private buffers are renamed to "irc.server.{network}.{channel}" rather than "irc.{network}.{channel}".' +
'This ensures that these buffers are grouped with their respective server buffer.',
'', 0, 0, 'on', 'on', 0,
'', '', '', '', '', ''
)
self.__rules = weechat.config_new_option(
self.config_file, self.sorting_section,
'rules', 'string',
'An ordered list of sorting rules encoded as JSON. See /help autosort for commands to manipulate these rules.',
'', 0, 0, Config.default_rules, Config.default_rules, 0,
'', '', '', '', '', ''
)
self.__replacements = weechat.config_new_option(
self.config_file, self.sorting_section,
'replacements', 'string',
'An ordered list of replacement patterns to use on buffer name components, encoded as JSON. See /help autosort for commands to manipulate these replacements.',
'', 0, 0, Config.default_replacements, Config.default_replacements, 0,
'', '', '', '', '', ''
)
self.__signals = weechat.config_new_option(
self.config_file, self.sorting_section,
'signals', 'string',
'The signals that will cause autosort to resort your buffer list. Seperate signals with spaces.',
'', 0, 0, Config.default_signals, Config.default_signals, 0,
'', '', '', '', '', ''
)
self.__sort_on_config = weechat.config_new_option(
self.config_file, self.sorting_section,
'sort_on_config_change', 'boolean',
'Decides if the buffer list should be sorted when autosort configuration changes.',
'', 0, 0, 'on', 'on', 0,
'', '', '', '', '', ''
)
if weechat.config_read(self.config_file) != weechat.WEECHAT_RC_OK:
log('Failed to load configuration file.')
if weechat.config_write(self.config_file) != weechat.WEECHAT_RC_OK:
log('Failed to write configuration file.')
self.reload()
示例4: fish_config_write
def fish_config_write():
global fish_config_file
return weechat.config_write(fish_config_file)
示例5: __init__
#.........这里部分代码省略.........
self.sorting_section = None
self.v3_section = None
self.case_sensitive = False
self.rules = []
self.helpers = {}
self.signals = []
self.signal_delay = Config.default_signal_delay,
self.sort_on_config = True
self.__case_sensitive = None
self.__rules = None
self.__helpers = None
self.__signals = None
self.__signal_delay = None
self.__sort_on_config = None
if not self.config_file:
log('Failed to initialize configuration file "{0}".'.format(self.filename))
return
self.sorting_section = weechat.config_new_section(self.config_file, 'sorting', False, False, '', '', '', '', '', '', '', '', '', '')
self.v3_section = weechat.config_new_section(self.config_file, 'v3', False, False, '', '', '', '', '', '', '', '', '', '')
if not self.sorting_section:
log('Failed to initialize section "sorting" of configuration file.')
weechat.config_free(self.config_file)
return
self.__case_sensitive = weechat.config_new_option(
self.config_file, self.sorting_section,
'case_sensitive', 'boolean',
'If this option is on, sorting is case sensitive.',
'', 0, 0, 'off', 'off', 0,
'', '', '', '', '', ''
)
weechat.config_new_option(
self.config_file, self.sorting_section,
'rules', 'string',
'Sort rules used by autosort v2.x and below. Not used by autosort anymore.',
'', 0, 0, '', '', 0,
'', '', '', '', '', ''
)
weechat.config_new_option(
self.config_file, self.sorting_section,
'replacements', 'string',
'Replacement patterns used by autosort v2.x and below. Not used by autosort anymore.',
'', 0, 0, '', '', 0,
'', '', '', '', '', ''
)
self.__rules = weechat.config_new_option(
self.config_file, self.v3_section,
'rules', 'string',
'An ordered list of sorting rules encoded as JSON. See /help autosort for commands to manipulate these rules.',
'', 0, 0, Config.default_rules, Config.default_rules, 0,
'', '', '', '', '', ''
)
self.__helpers = weechat.config_new_option(
self.config_file, self.v3_section,
'helpers', 'string',
'A dictionary helper variables to use in the sorting rules, encoded as JSON. See /help autosort for commands to manipulate these helpers.',
'', 0, 0, Config.default_helpers, Config.default_helpers, 0,
'', '', '', '', '', ''
)
self.__signals = weechat.config_new_option(
self.config_file, self.sorting_section,
'signals', 'string',
'A space separated list of signals that will cause autosort to resort your buffer list.',
'', 0, 0, Config.default_signals, Config.default_signals, 0,
'', '', '', '', '', ''
)
self.__signal_delay = weechat.config_new_option(
self.config_file, self.sorting_section,
'signal_delay', 'integer',
'Delay in milliseconds to wait after a signal before sorting the buffer list. This prevents triggering many times if multiple signals arrive in a short time. It can also be needed to wait for buffer localvars to be available.',
'', 0, 1000, str(Config.default_signal_delay), str(Config.default_signal_delay), 0,
'', '', '', '', '', ''
)
self.__sort_on_config = weechat.config_new_option(
self.config_file, self.sorting_section,
'sort_on_config_change', 'boolean',
'Decides if the buffer list should be sorted when autosort configuration changes.',
'', 0, 0, 'on', 'on', 0,
'', '', '', '', '', ''
)
if weechat.config_read(self.config_file) != weechat.WEECHAT_RC_OK:
log('Failed to load configuration file.')
if weechat.config_write(self.config_file) != weechat.WEECHAT_RC_OK:
log('Failed to write configuration file.')
self.reload()
示例6: wee_ns_script_unload_cb
def wee_ns_script_unload_cb():
weechat.config_write(wee_ns_config_file)
return weechat.WEECHAT_RC_OK
示例7: WeeNSServer
######################################
# Main
######################################
if __name__ == "__main__":
if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION,
SCRIPT_LICENSE, SCRIPT_DESC, '',
'wee_ns_script_unload_cb'):
weechat.hook_completion('ns_send', 'login completion',
'wee_ns_hook_completion_send', '')
weechat.hook_command('ns', 'weeNetsoul: A netsoul plugin for weechat',
' | '.join("%s%s" % (k, "" if 'desc' not in v
else " " + v['desc'])
for k, v in hook_cmd_ns.items()),
'\n'.join("%s: %s" % (k, v['cb'].__doc__)
for k, v in hook_cmd_ns.items()),
' || '.join("%s%s" % (k, "" if 'compl' not in v
else " " + v['compl'])
for k, v in hook_cmd_ns.items()),
'wee_ns_hook_cmd_ns', '')
wee_ns_config_file = weechat.config_new(SCRIPT_NAME, '', '')
wee_ns_conf_serv_sect = weechat.config_new_section(wee_ns_config_file,
'server', 0, 0,
('wee_ns_serv_'
'sect_read_cb'),
'', '', '', '', '',
'', '', '', '')
server = WeeNSServer()
weechat.config_read(wee_ns_config_file)
weechat.config_write(wee_ns_config_file)
示例8: len
msg = ' '.join(arglist[2:])
server.getChatByRecipient(groups[0], groups[1], create = True).send(msg)
else :
weechat.prnt(buffer, 'Message recipient must be of type login_x[:fd]')
elif arglist[0] == 'who' and server.isConnected() and len(arglist) > 1 :
server._ns_user_cmd_who(arglist[1])
elif arglist[0] == 'state' and server.isConnected() and len(arglist) > 1 :
server._ns_state(arglist[1])
else :
weechat.prnt(buffer, '%sNo such command, wrong argument count, or you need to (dis)connect' % weechat.prefix('error'))
return weechat.WEECHAT_RC_OK
######################################
# Main
######################################
if __name__ == "__main__" :
if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE, SCRIPT_DESC, '', 'weeNS_script_unload_cb'):
weechat.hook_command('ns', 'weeNetsoul main command', 'connect | disconnect | send <login> <msg> | state <status> | who <login>',
" connect : Connect\n"
" disconnect : Diconnect\n"
" send : Send <msg> to <login> (any client) or to <:fd> (unique client)\n"
" state : Change status to <status> (en ligne/actif/whatever)\n"
" who : Show infos about <login>\n",
'connect|disconnect|send|state|who', 'weeNS_hook_cmd_ns', '')
weeNS_config_file = weechat.config_new(SCRIPT_NAME, '', '')
weeNS_config_server_section = weechat.config_new_section(weeNS_config_file, 'server', 0, 0, 'weeNS_server_section_read_cb', '', '', '', '', '', '', '', '', '')
server = weeNSServer()
weechat.config_read(weeNS_config_file)
weechat.config_write(weeNS_config_file)
示例9: ircrypt_config_write
def ircrypt_config_write():
''' Write IRCrypt configuration file (ircrypt.conf) to disk.
'''
return weechat.config_write(ircrypt_config_file)
示例10: jmh_config_write
def jmh_config_write():
""" Write jabber config file (jabber.conf). """
global jmh_config_file
return weechat.config_write(jmh_config_file)
示例11: execbot_config_write
def execbot_config_write():
''' Write Execbot configuration file (execbot.conf) to disk.'''
return weechat.config_write(execbot_config_file)
示例12: bas_config_write
def bas_config_write():
"""Write configuration file."""
global bas_config_file
return weechat.config_write(bas_config_file)
示例13: theme_config_write
def theme_config_write():
"""Write configuration file."""
return weechat.config_write(theme_cfg_file)
示例14: wg_config_write
def wg_config_write():
""" Write configuration file. """
global wg_config_file
return weechat.config_write(wg_config_file)
示例15: weeNS_script_unload_cb
def weeNS_script_unload_cb() :
global weeNS_config_file
weechat.config_write(weeNS_config_file)
return weechat.WEECHAT_RC_OK