当前位置: 首页>>代码示例>>Python>>正文


Python weechat.prnt函数代码示例

本文整理汇总了Python中weechat.prnt函数的典型用法代码示例。如果您正苦于以下问题:Python prnt函数的具体用法?Python prnt怎么用?Python prnt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了prnt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: jmh_cmd

def jmh_cmd(data, buffer, args=None):
    """ Command /jabber_message_handler """
    if args:
        argv = args.split(None, 1)
        if len(argv) > 0:
            if argv[0] == "on":
                weechat.config_option_set(
                        jmh_config_option["enabled"], "on", 1)
            elif argv[0] == "off":
                weechat.config_option_set(
                        jmh_config_option["enabled"], "off", 1)
            elif argv[0] == "verbose":
                if len(argv) > 1:
                    weechat.config_option_set(
                            jmh_config_option["verbose"], argv[1], 1)
                else:
                    weechat.config_option_set(
                            jmh_config_option["verbose"], "toggle", 1)
            elif argv[0] == "log":
                if len(argv) > 1:
                    weechat.config_option_set(
                            jmh_config_option["log"], argv[1], 1)
            else:
                weechat.prnt("", "jabber_message_handler: unknown action")

    print_settings()
    return weechat.WEECHAT_RC_OK
开发者ID:zsw,项目名称:dotfiles,代码行数:27,代码来源:jabber_message_handler.py

示例2: 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

示例3: unread_cb

def unread_cb(data, buffer, command):
    global all_channels
    channels = []
    if command.find("set_unread_current_buffer") >= 0:
        if w.buffer_get_string(buffer, "localvar_server") == "slack" and \
           w.buffer_get_string(buffer, "localvar_type") in ["channel", "private"]:
            channels.append(w.buffer_get_string(buffer, "localvar_channel"))
    else:
        channels = _channels()

    for c in channels:
        cs = c.lstrip("#")
        if cs in all_channels:
            try:
                if c.startswith("#"):
                    if cs in private_groups:
                        r = slack.groups.mark(all_channels[cs], time.time())
                    else:
                        r = slack.channels.mark(all_channels[cs], time.time())
                else:
                    r = slack.im.mark(all_channels[cs], time.time())
                #w.prnt("", "%s: %s" % (c, r.body["ok"] and "ok" or "not ok"))
            except:
                w.prnt("", "Error while setting unread marker on %s" % c)
    w.prnt("", "%d channels marked as read" % len(channels))

    return w.WEECHAT_RC_OK
开发者ID:palbo,项目名称:dotfiles,代码行数:27,代码来源:slack.py

示例4: get_char

def get_char (c):
    try:
        with open( weechat.info_get('weechat_dir', '') + '/python/asciiwrite/font/' + str(ord(c)), 'r' ) as f:
            return f.read().split('\n')
    except:
        weechat.prnt('', 'Did not found char %s [%d]. Replacing by NULL.' % (c, ord(c)))
        return []
开发者ID:Niols,项目名称:WeeChat-Scripts,代码行数:7,代码来源:asciiwrite.py

示例5: wg_execute_action

def wg_execute_action():
    """ Execute action. """
    global wg_action, wg_action_args, wg_loaded_scripts
    if wg_action != "":
        wg_get_loaded_scripts()
        if wg_action == "list":
            wg_list_scripts(wg_action_args)
        elif wg_action == "listinstalled":
            wg_list_scripts(wg_action_args, installed=True)
        elif wg_action == "show":
            wg_show_script(wg_action_args)
        elif wg_action == "install":
            wg_install_scripts(wg_action_args)
        elif wg_action == "check":
            wg_check_scripts()
        elif wg_action == "upgrade":
            wg_upgrade_scripts()
        elif wg_action == "remove":
            wg_remove_scripts(wg_action_args)
        else:
            weechat.prnt("", "%s%s: unknown action \"%s\""
                         % (weechat.prefix("error"), SCRIPT_NAME, wg_action))

    # reset action
    wg_action = ""
    wg_action_args = ""
    wg_loaded_scripts = {}
开发者ID:zachwlewis,项目名称:dotfiles,代码行数:27,代码来源:weeget.py

示例6: process_complete

def process_complete(data, command, rc, stdout, stderr):
    global process_output
    process_output += stdout.strip()
    if int(rc) >= 0:
        weechat.prnt(weechat.current_buffer(), '[%s]' % process_output)

    return weechat.WEECHAT_RC_OK
开发者ID:norrs,项目名称:weechat-plugins,代码行数:7,代码来源:whatismyip.py

示例7: 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

示例8: wu_autoc

def wu_autoc(data, command, return_code, out, err):
    """ weather underground auto search """
    global jname
    if return_code == w.WEECHAT_HOOK_PROCESS_ERROR:
        w.prnt("", "Error with command `%s'" % command)
        return w.WEECHAT_RC_OK
    if return_code > 0:
        w.prnt("", "return_code = %d" % return_code)
    if err != "":
        w.prnt("", "stderr: %s" % err)
    if out != "":
        i = json.loads(out)
        try:
            loc = next((l for l in i["RESULTS"] if l["type"] == "city"), None)
            if loc is None:
                weebuffer("Unable to locate query.")
                return w.WEECHAT_RC_OK
        except:
            weebuffer("Invalid query. Try again.")
            return w.WEECHAT_RC_OK

        jname = loc["name"]
        location = loc["l"]
        prefix = "[weatherbot] mode:"
        if mode == "conditions":
            cond_url = "url:http://api.wunderground.com/api/{}/conditions{}.json".format(options["apikey"], location)
            w.prnt("", '{} {} {}'.format(prefix, mode, location))
            w.hook_process(cond_url, 30 * 1000, "wu_cond", "")

        if mode == "forecast":
            fore_url = "url:http://api.wunderground.com/api/{}/forecast{}.json".format(options["apikey"], location)
            w.prnt("", '{} {} {}'.format(prefix, mode, location))
            w.hook_process(fore_url, 30 * 1000, "wu_fore", "")

    return w.WEECHAT_RC_OK
开发者ID:deflax,项目名称:weechat-weatherbot,代码行数:35,代码来源:weatherbot.py

示例9: 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

示例10: process_complete

def process_complete(data, command, rc, stdout, stderr):
    url = stdout.strip()
    if url:
        color = weechat.color(weechat.config_get_plugin("color"))
        weechat.prnt(data, '%s[%s]' % (color, url))

    return weechat.WEECHAT_RC_OK
开发者ID:Brijen,项目名称:dotfiles-6,代码行数:7,代码来源:shortenurl.py

示例11: whois

def whois (username):
    '''Shows profile information about a given user'''
    if len(username) == 0:
        return weechat.WEECHAT_RC_ERROR
    
    response = statusnet_handler.handle_request(statusnet_handler.build_request('users', 'show', username))

    if response == None:
        pass
    elif response == False:
        weechat.prnt(weechat.current_buffer(), ('%sCan\'t retrieve information about %s' % (weechat.prefix('error'), username)))
    else:
        whois = json.load(response)

        whois['summary'] = ' '.join([u'\u00B5', str(whois['statuses_count']),
                                     u'\u2764', str(whois['favourites_count']),
                                     'subscribers', str(whois['followers_count']),
                                     'subscriptions', str(whois['friends_count'])])

        for property in ['name', 'description', 'url', 'location', 'profile_image_url', 'summary']:
            if property in whois and whois[property] != None:
                weechat.prnt(weechat.current_buffer(), ('%s[%s] %s' % (weechat.prefix('network'),
                                                                       nick_color(username),
                                                                       whois[property].encode('utf-8'))))
        
    return weechat.WEECHAT_RC_OK
开发者ID:s5unty,项目名称:dotfiles,代码行数:26,代码来源:tweetim.py

示例12: vdm_display

def vdm_display(vdm):
    """ Display VDMs in buffer. """
    global vdm_buffer
    weechat.buffer_set(vdm_buffer, "unread", "1")
    if weechat.config_get_plugin("number_as_prefix") == "on":
        separator = "\t"
    else:
        separator = " > "
    colors = weechat.config_get_plugin("colors").split(";");
    vdm2 = vdm[:]
    if weechat.config_get_plugin("reverse") == "on":
        vdm2.reverse()
    for index, item in enumerate(vdm2):
        item_id = item["id"]
        item_text = item["text"]
        if sys.version_info < (3,):
            # python 2.x: convert unicode to str (in python 3.x, id and text are already strings)
            item_id = item_id.encode("UTF-8")
            item_text = item_text.encode("UTF-8")
        weechat.prnt_date_tags(vdm_buffer,
                               0, "notify_message",
                               "%s%s%s%s%s" %
                               (weechat.color(weechat.config_get_plugin("color_number")),
                                item_id,
                                separator,
                                weechat.color(colors[0]),
                                item_text))
        colors.append(colors.pop(0))
        if index == len(vdm) - 1:
            weechat.prnt(vdm_buffer, "------")
        elif weechat.config_get_plugin("blank_line") == "on":
            weechat.prnt(vdm_buffer, "")
开发者ID:norrs,项目名称:weechat-plugins,代码行数:32,代码来源:vdm.py

示例13: message_private_irc

def message_private_irc(data, signal, signal_data):
    if jmh_verbose():
        weechat.prnt('', 'private irc message received')
    message = parse_message(signal_data)
    message['type'] = 'highlight'
    log_event(message)
    return weechat.WEECHAT_RC_OK
开发者ID:zsw,项目名称:dotfiles,代码行数:7,代码来源:jabber_message_handler.py

示例14: nicklist_cmd_cb

def nicklist_cmd_cb(data, buffer, args):
    ''' Command /nicklist '''
    if args == '':
        display_action()
        display_buffers()
    else:
        current_buffer_name = w.buffer_get_string(buffer, 'plugin') + '.' + w.buffer_get_string(buffer, 'name')
        if args == 'show':
            w.config_set_plugin('action', 'show')
            #display_action()
            w.command('', '/window refresh')
        elif args == 'hide':
            w.config_set_plugin('action', 'hide')
            #display_action()
            w.command('', '/window refresh')
        elif args == 'add':
            list = get_buffers_list()
            if current_buffer_name not in list:
                list.append(current_buffer_name)
                w.config_set_plugin('buffers', ','.join(list))
                #display_buffers()
                w.command('', '/window refresh')
            else:
                w.prnt('', '%s: buffer "%s" is already in list' % (SCRIPT_NAME, current_buffer_name))
        elif args == 'remove':
            list = get_buffers_list()
            if current_buffer_name in list:
                list.remove(current_buffer_name)
                w.config_set_plugin('buffers', ','.join(list))
                #display_buffers()
                w.command('', '/window refresh')
            else:
                w.prnt('', '%s: buffer "%s" is not in list' % (SCRIPT_NAME, current_buffer_name))
    
    return w.WEECHAT_RC_OK
开发者ID:bradfier,项目名称:configs,代码行数:35,代码来源:toggle_nicklist.py

示例15: ircrypt_info

def ircrypt_info(msg, buf=None):
	'''Print ifo message to specified buffer. If no buffer is set, the current
	foreground buffer is used to print the message.
	'''
	if buf is None:
		buf = weechat.current_buffer()
	weechat.prnt(buf, msg)
开发者ID:petvoigt,项目名称:ircrypt-weechat,代码行数:7,代码来源:ircrypt.py


注:本文中的weechat.prnt函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。