本文整理汇总了Python中weechat.command函数的典型用法代码示例。如果您正苦于以下问题:Python command函数的具体用法?Python command怎么用?Python command使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了command函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: key_cc
def key_cc(buf, input_line, cur, count):
"""Delete line and start Insert mode.
See Also:
`key_base()`.
"""
weechat.command("", "/input delete_line")
set_mode("INSERT")
开发者ID:tarruda,项目名称:dot-files,代码行数:7,代码来源:vimode.py
示例2: lb_line_run
def lb_line_run():
global lb_channels, lb_curline, lb_network
buff = weechat.info_get("irc_buffer", lb_network)
channel = lb_channels[lb_curline]['channel']
command = "/join %s" % channel
weechat.command(buff, command)
return
开发者ID:norrs,项目名称:weechat-plugins,代码行数:7,代码来源:listbuffer.py
示例3: keyEvent
def keyEvent (data, bufferp, args):
global urlGrab , urlGrabSettings, urlgrab_buffer, current_line
if args == "refresh":
refresh()
elif args == "up":
if current_line > 0:
current_line = current_line -1
refresh_line (current_line + 1)
refresh_line (current_line)
ugCheckLineOutsideWindow()
elif args == "down":
if current_line < len(urlGrab.globalUrls) - 1:
current_line = current_line +1
refresh_line (current_line - 1)
refresh_line (current_line)
ugCheckLineOutsideWindow()
elif args == "scroll_top":
temp_current = current_line
current_line = 0
refresh_line (temp_current)
refresh_line (current_line)
weechat.command(urlgrab_buffer, "/window scroll_top")
pass
elif args == "scroll_bottom":
temp_current = current_line
current_line = len(urlGrab.globalUrls)
refresh_line (temp_current)
refresh_line (current_line)
weechat.command(urlgrab_buffer, "/window scroll_bottom")
elif args == "enter":
if urlGrab.globalUrls[current_line]:
urlGrabOpenUrl (urlGrab.globalUrls[current_line]['url'])
开发者ID:bradfier,项目名称:configs,代码行数:32,代码来源:urlgrab.py
示例4: asciiwrite_cmd
def asciiwrite_cmd (data, buffer, args):
# On récupère les caractères
args = [get_char(c) for c in args]
height = 0
for char in args:
if len(char) > height:
height = len(char)
args = [ char + ['']*(height-len(char)) for char in args ]
new_args = []
for char in args:
width = 0
for line in char:
if len(line) > width:
width = len(line)
new_args.append([ line + ' '*(width-len(line)) for line in char ])
args = new_args
ascii = [''] * len(args[0])
for char in args:
for i in range(len(char)):
ascii[i] += char[i]
for line in ascii:
if line[0] == '/':
line = '/'+line
weechat.command (buffer, line)
weechat.command (buffer, ' ')
return weechat.WEECHAT_RC_OK
开发者ID:Niols,项目名称:WeeChat-Scripts,代码行数:33,代码来源:asciiwrite.py
示例5: wg_cmd
def wg_cmd(data, buffer, args):
""" Callback for /weeget command. """
global wg_action, wg_action_args
if args == "":
weechat.command("", "/help %s" % SCRIPT_COMMAND)
return weechat.WEECHAT_RC_OK
argv = args.strip().split(" ", 1)
if len(argv) == 0:
return weechat.WEECHAT_RC_OK
wg_action = ""
wg_action_args = ""
# check arguments
if len(argv) < 2:
if argv[0] == "show" or \
argv[0] == "install" or \
argv[0] == "remove":
weechat.prnt("", "%s: too few arguments for action \"%s\""
% (SCRIPT_NAME, argv[0]))
return weechat.WEECHAT_RC_OK
# execute asked action
if argv[0] == "update":
wg_update_cache()
else:
wg_action = argv[0]
wg_action_args = ""
if len(argv) > 1:
wg_action_args = argv[1]
wg_read_scripts()
return weechat.WEECHAT_RC_OK
开发者ID:zachwlewis,项目名称:dotfiles,代码行数:33,代码来源:weeget.py
示例6: get_recent_track
def get_recent_track(data, command, rc, out, err):
"""Get last track played (artist - name)"""
if rc == weechat.WEECHAT_HOOK_PROCESS_ERROR:
weechat.prnt('', "Error with command '{}'".format(command))
elif rc > 0:
weechat.prnt('', "rc = {}".format(rc))
try:
data = json.loads(out)
if data.has_key('error'):
weechat.prnt('', "Last.fm API error: '{}'".format(data['message']))
else:
artist = data['recenttracks']['track'][0]['artist']['#text']
name = data['recenttracks']['track'][0]['name']
track = "{} - {}".format(artist, name)
user = data['recenttracks']['@attr']['user'].lower()
# print username or not, depending on config/arg
if user == weechat.config_get_plugin('user').lower():
cmd = weechat.config_get_plugin('command')
else:
cmd = weechat.config_get_plugin('command_arg')
# format isn't picky, ignores {user} if not present
cmd = cmd.format(user=user, track=track)
weechat.command(weechat.current_buffer(), cmd)
except IndexError, KeyError:
weechat.prnt('', "Error parsing Last.fm data")
开发者ID:DarkDefender,项目名称:scripts,代码行数:30,代码来源:lastfm2.py
示例7: flip_hook
def flip_hook(data, buffer, args):
if not args:
text = u'%s %s' % (flip(), table())
else:
text = u'%s %s' % (flip(), flip_text(args))
weechat.command(buffer, text.encode('utf-8'))
return weechat.WEECHAT_RC_OK
开发者ID:aimeeble,项目名称:dotfiles,代码行数:7,代码来源:flip.py
示例8: private_opened_cb
def private_opened_cb(data, signal, signal_data):
buffer = signal_data
short_name = weechat.buffer_get_string(buffer, "short_name")
if _newserv_match(short_name):
destination = _find_first_buffer_number()
weechat.command(buffer, "/buffer merge {}".format(destination))
return weechat.WEECHAT_RC_OK
开发者ID:PaulSalden,项目名称:weechat-scripts,代码行数:7,代码来源:nmerge.py
示例9: timer_cb
def timer_cb(servbuf, remaining_calls):
channels = queue.pop(servbuf)
while channels:
chanstring = ",".join(channels[:10])
weechat.command(servbuf, "/join {}".format(chanstring))
channels = channels[10:]
return _OK
开发者ID:PaulSalden,项目名称:weechat-scripts,代码行数:7,代码来源:qinvite.py
示例10: grabnick
def grabnick(servername, nick):
if nick and servername:
if OPTIONS['text']:
t = Template( string_eval_expression(OPTIONS['text']) )
text = t.safe_substitute(server=servername, nick=nick)
weechat.prnt(weechat.current_buffer(), text)
weechat.command(weechat.buffer_search('irc','%s.%s' % ('server',servername)), OPTIONS['command'] % nick)
开发者ID:DarkDefender,项目名称:scripts,代码行数:7,代码来源:keepnick.py
示例11: command_run_input
def command_run_input(data, buffer, command):
""" Function called when a command "/input xxxx" is run """
global commands, commands_pos
if command == "/input search_text" or command.find("/input jump") == 0:
# search text or jump to another buffer is forbidden now
return w.WEECHAT_RC_OK_EAT
elif command == "/input complete_next":
# choose next buffer in list
commands_pos += 1
if commands_pos >= len(commands):
commands_pos = 0
w.hook_signal_send("input_text_changed",
w.WEECHAT_HOOK_SIGNAL_STRING, "")
return w.WEECHAT_RC_OK_EAT
elif command == "/input complete_previous":
# choose previous buffer in list
commands_pos -= 1
if commands_pos < 0:
commands_pos = len(commands) - 1
w.hook_signal_send("input_text_changed",
w.WEECHAT_HOOK_SIGNAL_STRING, "")
return w.WEECHAT_RC_OK_EAT
elif command == "/input return":
# As in enter was pressed.
# Put the current command on the input bar
histsearch_end(buffer)
if len(commands) > 0:
w.command(buffer, "/input insert " + commands[commands_pos])
return w.WEECHAT_RC_OK_EAT
return w.WEECHAT_RC_OK
开发者ID:FiXato,项目名称:weechat-scripts-xt,代码行数:30,代码来源:histsearch.py
示例12: mpvs_np
def mpvs_np(data, buffer, args):
filename, title, progress = parse_info(False)
color = "01,01"
op = "/me np: %s{}%s for %s{}" % ("11", "", "09")
weechat.command(weechat.current_buffer(),
op.format(filename, progress))
return weechat.WEECHAT_RC_OK
开发者ID:Luminarys,项目名称:dotfiles,代码行数:7,代码来源:mpv.py
示例13: mpv_np
def mpv_np(data, buffer, args):
filename, title, progress, duration = parse_info()
color = "01,01"
op = "/me nw: %s{} %s{}/{}" % ("11", "09")
weechat.command(weechat.current_buffer(),
op.format(filename, progress, duration))
return weechat.WEECHAT_RC_OK
开发者ID:Luminarys,项目名称:dotfiles,代码行数:7,代码来源:mpv.py
示例14: key_C
def key_C(buf, input_line, cur, count):
"""Delete from cursor to end of line and start Insert mode.
See Also:
`key_base()`.
"""
weechat.command("", "/input delete_end_of_line")
set_mode("INSERT")
开发者ID:tarruda,项目名称:dot-files,代码行数:7,代码来源:vimode.py
示例15: input_set
def input_set(data, remaining_calls):
"""Set the input line's content."""
buf = weechat.current_buffer()
weechat.buffer_set(buf, "input", data)
# move the cursor back to its position prior to setting the content
weechat.command('', "/input move_next_char")
return weechat.WEECHAT_RC_OK
开发者ID:jnbek,项目名称:_weechat,代码行数:7,代码来源:vimode.py
示例16: shell_process_cb
def shell_process_cb(data, command, rc, stdout, stderr):
"""Callback for hook_process()."""
global cmd_hook_process, cmd_buffer, cmd_stdout, cmd_stderr, cmd_send_to_buffer
cmd_stdout += stdout
cmd_stderr += stderr
if int(rc) >= 0:
if cmd_stdout:
lines = cmd_stdout.rstrip().split('\n')
if cmd_send_to_buffer == 'current':
for line in lines:
weechat.command(cmd_buffer, '%s' % line)
else:
weechat.prnt(cmd_buffer, '')
if cmd_send_to_buffer != 'new':
weechat.prnt(cmd_buffer, '%sCommand "%s" (rc %d), stdout:'
% (SHELL_PREFIX, data, int(rc)))
for line in lines:
weechat.prnt(cmd_buffer, ' \t%s' % line)
if cmd_stderr:
lines = cmd_stderr.rstrip().split('\n')
if cmd_send_to_buffer == 'current':
for line in lines:
weechat.command(cmd_buffer, '%s' % line)
else:
weechat.prnt(cmd_buffer, '')
if cmd_send_to_buffer != 'new':
weechat.prnt(cmd_buffer, '%s%sCommand "%s" (rc %d), stderr:'
% (weechat.prefix('error'), SHELL_PREFIX, data, int(rc)))
for line in lines:
weechat.prnt(cmd_buffer, '%s%s' % (weechat.prefix('error'), line))
cmd_hook_process = ''
shell_set_title()
return weechat.WEECHAT_RC_OK
开发者ID:HongxuChen,项目名称:dotfiles,代码行数:33,代码来源:shell.py
示例17: screen_away_timer_cb
def screen_away_timer_cb(buffer, args):
'''Check if screen is attached, update awayness'''
global AWAY, SOCK
suffix = w.config_get_plugin('away_suffix')
attached = os.access(SOCK, os.X_OK) # X bit indicates attached
if attached and AWAY:
w.prnt('', '%s: Screen attached. Clearing away status' % SCRIPT_NAME)
for server, nick in get_servers():
w.command(server, "/away")
if suffix and nick.endswith(suffix):
nick = nick[:-len(suffix)]
w.command(server, "/nick %s" % nick)
AWAY = False
elif not attached and not AWAY:
w.prnt('', '%s: Screen detached. Setting away status' % SCRIPT_NAME)
for server, nick in get_servers():
if suffix:
w.command(server, "/nick %s%s" % (nick, suffix));
w.command(server, "/away %s" % w.config_get_plugin('message'));
AWAY = True
if w.config_get_plugin("command_on_detach"):
w.command("", w.config_get_plugin("command_on_detach"))
return w.WEECHAT_RC_OK
开发者ID:ronin13,项目名称:seed,代码行数:28,代码来源:screen_away.py
示例18: command_run_input
def command_run_input(data, buffer, command):
""" Function called when a command "/input xxxx" is run """
global buffers, buffers_pos
if command == "/input search_text" or command.find("/input jump") == 0:
# search text or jump to another buffer is forbidden now
return weechat.WEECHAT_RC_OK_EAT
elif command == "/input complete_next":
# choose next buffer in list
buffers_pos += 1
if buffers_pos >= len(buffers):
buffers_pos = 0
weechat.hook_signal_send("input_text_changed", weechat.WEECHAT_HOOK_SIGNAL_STRING, "")
return weechat.WEECHAT_RC_OK_EAT
elif command == "/input complete_previous":
# choose previous buffer in list
buffers_pos -= 1
if buffers_pos < 0:
buffers_pos = len(buffers) - 1
weechat.hook_signal_send("input_text_changed", weechat.WEECHAT_HOOK_SIGNAL_STRING, "")
return weechat.WEECHAT_RC_OK_EAT
elif command == "/input return":
# switch to selected buffer (if any)
go_end(buffer)
if len(buffers) > 0:
weechat.command(buffer, "/buffer " + str(buffers[buffers_pos]["number"]))
return weechat.WEECHAT_RC_OK_EAT
return weechat.WEECHAT_RC_OK
开发者ID:thisismiller,项目名称:dotfiles,代码行数:27,代码来源:go.py
示例19: send_messages
def send_messages(server, channel, nick):
buffer = w.buffer_search("", "%s.%s" % (server, channel))
messages = postpone_data[server][channel][nick]
for time, msg in messages:
tstr = strftime("%Y-%m-%d %H:%M:%S", time.timetuple())
w.command(buffer, msg + " (This message has been postponed on " + tstr + ".)")
messages[:] = []
开发者ID:DarkDefender,项目名称:scripts,代码行数:7,代码来源:postpone.py
示例20: check_buffer_timer_cb
def check_buffer_timer_cb(data, remaining_calls):
global WEECHAT_VERSION,whitelist
# search for buffers in hotlist
ptr_infolist = weechat.infolist_get("hotlist", "", "")
while weechat.infolist_next(ptr_infolist):
ptr_buffer = weechat.infolist_pointer(ptr_infolist, "buffer_pointer")
localvar_name = weechat.buffer_get_string(ptr_buffer, 'localvar_name')
# buffer in whitelist? go to next buffer
buf_type = weechat.buffer_get_string(ptr_buffer,'localvar_type')
# buffer is a query buffer?
if OPTIONS['ignore_query'].lower() == 'on' and buf_type == 'private':
continue
# buffer in whitelist?
if localvar_name in whitelist:
continue
if ptr_buffer:
if get_time_from_line(ptr_buffer):
if OPTIONS['clear'].lower() == 'hotlist' or OPTIONS['clear'].lower() == 'all':
weechat.buffer_set(ptr_buffer, "hotlist", '-1')
if OPTIONS['clear'].lower() == 'unread' or OPTIONS['clear'].lower() == 'all':
weechat.command(ptr_buffer,"/input set_unread_current_buffer")
weechat.infolist_free(ptr_infolist)
return weechat.WEECHAT_RC_OK
开发者ID:DarkDefender,项目名称:scripts,代码行数:25,代码来源:automarkbuffer.py
注:本文中的weechat.command函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论