本文整理汇总了Python中weechat.command函数的典型用法代码示例。如果您正苦于以下问题:Python command函数的具体用法?Python command怎么用?Python command使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了command函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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")
示例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
示例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'])
示例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
示例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
示例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")
示例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
示例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
示例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
示例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)
示例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
示例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
示例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
示例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")
示例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