• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python weechat.infolist_pointer函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: reorder_buffers

def reorder_buffers():
    global buffers
    bufcopy = dict(buffers)
    priolist = []
    while len(bufcopy):
        priolist.append(max(bufcopy, key=bufcopy.get))
        bufcopy.pop(max(bufcopy, key=bufcopy.get))
    pointerlist = {}
    infolist = wee.infolist_get("buffer", "", "")
    while wee.infolist_next(infolist): # go through the buffers and jot down relevant pointers
        for name in priolist:
            try:
                bufname = wee.infolist_string(infolist, "name").split('.', 1)[1]
            except IndexError:
                bufname = wee.infolist_string(infolist, "name")
            if name == bufname:
                if name in pointerlist:
                    pointerlist[name].append(
                            wee.infolist_pointer(infolist, "pointer"))
                else:
                    pointerlist[name] = [wee.infolist_pointer(
                        infolist, "pointer")]

    index = 1
    if(maintop):
        index += 1
    for name in priolist:
        if name in pointerlist:
            for pointer in pointerlist[name]:
                wee.buffer_set(pointer, "number", str(index))
                index += 1
    return
开发者ID:numerical,项目名称:dotfiles,代码行数:32,代码来源:buffer_priority.py


示例2: command_main

def command_main(data, buffer, args):
  infolist = w.infolist_get("buffer", "", "")
  buffer_groups = {}
  results = []
  buffer_count = 0
  merge_count = 0
  numbers = set()
  while w.infolist_next(infolist):
    bplugin = w.infolist_string(infolist, "plugin_name")
    bname = w.infolist_string(infolist, "name")
    bpointer = w.infolist_pointer(infolist, "pointer")
    bnumber = w.infolist_integer(infolist, "number")
    btype = w.buffer_get_string(bpointer, 'localvar_type')
    if not bnumber in numbers:
      numbers.add(bnumber)
    else:
      merge_count += 1

    if btype == 'server':
      bdesc = 'servers'
    elif btype == 'channel':
      bdesc = 'channels'
    elif btype == 'private':
      bdesc = 'queries'
    else:
      bdesc = bplugin

    buffer_groups.setdefault(bdesc,[]).append({'name': bname, 'pointer': bpointer})

  w.infolist_free(infolist)

  infolist = w.infolist_get("window", "", "")
  windows_v = set()
  windows_h = set()
  windows = set()
  while w.infolist_next(infolist):
    window = w.infolist_pointer(infolist, "pointer")
    window_w = w.infolist_integer(infolist, "width_pct")
    window_h = w.infolist_integer(infolist, "height_pct")
    windows.add(window)
    if window_h == 100 and window_w != 100:
      windows_v.add(window)
    elif window_w == 100 and window_h != 100:
      windows_h.add(window)
    #else: #both 100%, thus no splits
  w.infolist_free(infolist)

  window_count = len(windows)

  for desc, buffers in buffer_groups.iteritems():
    buffer_count += len(buffers)
    results.append('%i %s' % (len(buffers), desc))

  buffer_stats = ', '.join(sorted(results, key = lambda item: (int(item.partition(' ')[0]) if item[0].isdigit() else float('inf'), item),reverse=True)) # descending numerical sort of strings
  stats_string = '%i buffers (%i merged): %s; %i windows' % (buffer_count, merge_count, buffer_stats, window_count)
  if '-split' in args:
    stats_string += ": %i vertically / %i horizontally split" % (len(windows_v), len(windows_h))
  w.command("", "/input insert %s" % stats_string)
  return w.WEECHAT_RC_OK
开发者ID:DarkDefender,项目名称:scripts,代码行数:59,代码来源:weestats.py


示例3: get_all_buffers

def get_all_buffers():
    '''Returns list with pointers of all open buffers.'''
    buffers = []
    infolist = w.infolist_get('buffer', '', '')
    while w.infolist_next(infolist):
        buffer_type = w.buffer_get_string(w.infolist_pointer(infolist, 'pointer'), 'localvar_type')
        if buffer_type == 'private': # we only close private message buffers for now
            buffers.append(w.infolist_pointer(infolist, 'pointer'))
    w.infolist_free(infolist)
    return buffers
开发者ID:BenoitZugmeyer,项目名称:dotfiles,代码行数:10,代码来源:buffer_autoclose.py


示例4: get_all_buffers

def get_all_buffers():
    """Returns list with pointers of all open buffers."""
    buffers = []
    infolist = w.infolist_get("buffer", "", "")
    while w.infolist_next(infolist):
        buffer_type = w.buffer_get_string(w.infolist_pointer(infolist, "pointer"), "localvar_type")
        if buffer_type == "private":  # we only close private message buffers for now
            buffers.append(w.infolist_pointer(infolist, "pointer"))
    w.infolist_free(infolist)
    return buffers
开发者ID:hackerzzgroup,项目名称:IRC_Scripts,代码行数:10,代码来源:buffer_autoclose.py


示例5: command_main

def command_main(data, buffer, args):
  infolist = w.infolist_get("buffer", "", "")
  buffer_groups = {}
  results = []
  buffer_count = 0
  merge_count = 0
  numbers = set()
  while w.infolist_next(infolist):
    bplugin = w.infolist_string(infolist, "plugin_name")
    bname = w.infolist_string(infolist, "name")
    bpointer = w.infolist_pointer(infolist, "pointer")
    bnumber = w.infolist_integer(infolist, "number")
    if not bnumber in numbers:
      numbers.add(bnumber)
    else:
      merge_count += 1
    btype = bplugin
    if bplugin == 'irc':
      if  'server.' in bname:
        btype = '%s servers' % btype
      elif '#' in bname:
        btype = '%s channels' % btype
      else:
        btype = '%s queries' % btype
      
    buffer_groups.setdefault(btype,[]).append({'name': bname, 'pointer': bpointer})

  w.infolist_free(infolist)

  infolist = w.infolist_get("window", "", "")
  windows_v = set()
  windows_h = set()
  windows = set()
  while w.infolist_next(infolist):
    window = w.infolist_pointer(infolist, "pointer")
    window_w = w.infolist_integer(infolist, "width_pct")
    window_h = w.infolist_integer(infolist, "height_pct")
    windows.add(window)
    if window_h == 100 and window_w != 100:
      windows_v.add(window)
    elif window_w == 100 and window_h != 100:
      windows_h.add(window)
    #else: #both 100%, thus no splits
  w.infolist_free(infolist)
    
  window_count = len(windows)

  for bplugin, buffers in buffer_groups.iteritems():
    buffer_count += len(buffers)
    results.append('%i %s' % (len(buffers), bplugin))

  buffer_stats = ', '.join(sorted(results))
  stats_string = '%i windows used (%i vertically / %i horizontally split). %i (of which %i merged) buffers open: %s' % (window_count, len(windows_v), len(windows_h), buffer_count, merge_count, buffer_stats)
  w.command("", "/input insert %s" % stats_string)
  return w.WEECHAT_RC_OK
开发者ID:idk,项目名称:moo-skel,代码行数:55,代码来源:weestats.py


示例6: save_query_buffer_to_file

def save_query_buffer_to_file():
    global query_buffer_list

    ptr_infolist_buffer = weechat.infolist_get("buffer", "", "")

    while weechat.infolist_next(ptr_infolist_buffer):
        ptr_buffer = weechat.infolist_pointer(ptr_infolist_buffer, "pointer")

        type = weechat.buffer_get_string(ptr_buffer, "localvar_type")
        if type == "private":
            server = weechat.buffer_get_string(ptr_buffer, "localvar_server")
            channel = weechat.buffer_get_string(ptr_buffer, "localvar_channel")
            query_buffer_list.insert(0, "%s %s" % (server, channel))

    weechat.infolist_free(ptr_infolist_buffer)

    filename = get_filename_with_path()

    if len(query_buffer_list):
        try:
            f = open(filename, "w")
            i = 0
            while i < len(query_buffer_list):
                f.write("%s\n" % query_buffer_list[i])
                i = i + 1
            f.close()
        except:
            weechat.prnt(
                "", '%s%s: Error writing query buffer to "%s"' % (weechat.prefix("error"), SCRIPT_NAME, filename)
            )
            raise
    else:  # no query buffer(s). remove file
        if os.path.isfile(filename):
            os.remove(filename)
    return
开发者ID:Shrews,项目名称:scripts,代码行数:35,代码来源:queryman.py


示例7: disable_logging

    def disable_logging(self):
        """Return the previous logger level and set the buffer logger level
        to 0. If it was already 0, return None."""
        # If previous_log_level has not been previously set, return the level
        # we detect now.
        if not hasattr(self, 'previous_log_level'):
            infolist = weechat.infolist_get('logger_buffer', '', '')

            buf = self.buffer()
            previous_log_level = 0

            while weechat.infolist_next(infolist):
                if weechat.infolist_pointer(infolist, 'buffer') == buf:
                    previous_log_level = weechat.infolist_integer(
                        infolist, 'log_level')
                    if self.is_logged():
                        weechat.command(buf, '/mute logger disable')
                        self.print_buffer(
                            'Logs have been temporarily disabled for the session. They will be restored upon finishing the OTR session.')
                        break

            weechat.infolist_free(infolist)

            return previous_log_level

        # If previous_log_level was already set, it means we already altered it
        # and that we just detected an already modified logging level.
        # Return the pre-existing value so it doesn't get lost, and we can
        # restore it later.
        else:
            return self.previous_log_level
开发者ID:LogicalDash,项目名称:weechat-otr,代码行数:31,代码来源:weechat_otr.py


示例8: save_query_buffer_to_file

def save_query_buffer_to_file():
    global query_buffer_list

    ptr_infolist_buffer = weechat.infolist_get('buffer', '', '')

    while weechat.infolist_next(ptr_infolist_buffer):
        ptr_buffer = weechat.infolist_pointer(ptr_infolist_buffer,'pointer')

        type = weechat.buffer_get_string(ptr_buffer, 'localvar_type')
        if type == 'private':
            server = weechat.buffer_get_string(ptr_buffer, 'localvar_server')
            channel = weechat.buffer_get_string(ptr_buffer, 'localvar_channel')
            query_buffer_list.insert(0,"%s %s" % (server,channel))

    weechat.infolist_free(ptr_infolist_buffer)

    filename = get_filename_with_path()

    if len(query_buffer_list):
        try:
            f = open(filename, 'w')
            i = 0
            while i < len(query_buffer_list):
                f.write('%s\n' % query_buffer_list[i])
                i = i + 1
            f.close()
        except:
            weechat.prnt('','%s%s: Error writing query buffer to "%s"' % (weechat.prefix('error'), SCRIPT_NAME, filename))
            raise
    else:       # no query buffer(s). remove file
        if os.path.isfile(filename):
            os.remove(filename)
    return
开发者ID:MatthewCox,项目名称:scripts,代码行数:33,代码来源:queryman.py


示例9: format_option

def format_option(match):
    """Replace ${xxx} by its value in option format."""
    global cmdhelp_settings, cmdhelp_option_infolist
    global cmdhelp_option_infolist_fields
    string = match.group()
    end = string.find('}')
    if end < 0:
        return string
    field = string[2:end]
    color1 = ''
    color2 = ''
    pos = field.find(':')
    if pos:
        color1 = field[0:pos]
        field = field[pos+1:]
    if color1:
        color1 = weechat.color(color1)
        color2 = weechat.color(cmdhelp_settings['color_option_help'])
    fieldtype = cmdhelp_option_infolist_fields.get(field, '')
    if fieldtype == 'i':
        string = str(weechat.infolist_integer(cmdhelp_option_infolist, field))
    elif fieldtype == 's':
        string = weechat.infolist_string(cmdhelp_option_infolist, field)
    elif fieldtype == 'p':
        string = weechat.infolist_pointer(cmdhelp_option_infolist, field)
    elif fieldtype == 't':
        date = weechat.infolist_time(cmdhelp_option_infolist, field)
        # since WeeChat 2.2, infolist_time returns a long integer instead of
        # a string
        if not isinstance(date, str):
            date = time.strftime('%F %T', time.localtime(int(date)))
        string = date
    return '%s%s%s' % (color1, string, color2)
开发者ID:DarkDefender,项目名称:scripts,代码行数:33,代码来源:cmd_help.py


示例10: allquery_command_cb

def allquery_command_cb(data, buffer, args):
    """ Callback for /allquery command """
    args = args.strip()
    if args == "":
        weechat.command("", "/help %s" % SCRIPT_COMMAND)
        return weechat.WEECHAT_RC_OK
    argv = args.split(" ")

    exclude_nick = None

    if argv[0].startswith("-exclude="):
        exclude_nick = make_list(argv[0])
        command = " ".join(argv[1::])
    else:
        command = args
    if not command.startswith("/"):
        weechat.command("", "/help %s" % SCRIPT_COMMAND)
        return weechat.WEECHAT_RC_OK

    infolist = weechat.infolist_get("buffer", "", "")
    while weechat.infolist_next(infolist):
        if weechat.infolist_string(infolist, "plugin_name") == "irc":
            ptr = weechat.infolist_pointer(infolist, "pointer")
            server = weechat.buffer_get_string(ptr, "localvar_server")
            query = weechat.buffer_get_string(ptr, "localvar_channel")
            execute_command = re.sub(r'\b\$nick\b', query, command)
            if weechat.buffer_get_string(ptr, "localvar_type") == "private":
                if exclude_nick is not None:
                    if not query in exclude_nick:
                        weechat.command(ptr, execute_command)
                else:
                    weechat.command(ptr, execute_command)
    weechat.infolist_free(infolist)
    return weechat.WEECHAT_RC_OK
开发者ID:fbesser,项目名称:weechat_scripts,代码行数:34,代码来源:allquery.py


示例11: update_title

def update_title(data, signal, signal_data):
    ''' The callback that adds title. '''

    if w.config_get_plugin('short_name') == 'on':
        title = w.buffer_get_string(w.current_buffer(), 'short_name')
    else:
        title = w.buffer_get_string(w.current_buffer(), 'name')

    hotlist = w.infolist_get('hotlist', '', '')
    hot_text = ''
    while w.infolist_next(hotlist):
        priority = w.infolist_integer(hotlist, 'priority')
        if priority >= int(w.config_get_plugin('title_priority')):
            number = w.infolist_integer(hotlist, 'buffer_number')
            thebuffer = w.infolist_pointer(hotlist, 'buffer_pointer')
            name = w.buffer_get_string(thebuffer, 'short_name')

            hot_text += ' %s' % number
    if hot_text:
        title += ' [A:%s]' % hot_text
    w.infolist_free(hotlist)

    w.window_set_title(title)

    return w.WEECHAT_RC_OK
开发者ID:aimeeble,项目名称:dotfiles,代码行数:25,代码来源:title.py


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


示例13: format_option

def format_option(match):
    """Replace ${xxx} by its value in option format."""
    global cmdhelp_settings, cmdhelp_option_infolist, cmdhelp_option_infolist_fields
    string = match.group()
    end = string.find('}')
    if end < 0:
        return string
    field = string[2:end]
    color1 = ''
    color2 = ''
    pos = field.find(':')
    if pos:
        color1 = field[0:pos]
        field = field[pos+1:]
    if color1:
        color1 = weechat.color(color1)
        color2 = weechat.color(cmdhelp_settings['color_option_help'])
    fieldtype = cmdhelp_option_infolist_fields.get(field, '')
    if fieldtype == 'i':
        string = str(weechat.infolist_integer(cmdhelp_option_infolist, field))
    elif fieldtype == 's':
        string = weechat.infolist_string(cmdhelp_option_infolist, field)
    elif fieldtype == 'p':
        string = weechat.infolist_pointer(cmdhelp_option_infolist, field)
    elif fieldtype == 't':
        string = weechat.infolist_time(cmdhelp_option_infolist, field)
    return '%s%s%s' % (color1, string, color2)
开发者ID:sitaktif,项目名称:weechat-scripts,代码行数:27,代码来源:cmd_help.py


示例14: bas_config_option_cb

def bas_config_option_cb(data, option, value):
    if not weechat.config_boolean(bas_options["look_instant"]):
        return weechat.WEECHAT_RC_OK

    if not weechat.config_get(option):  # option was deleted
        return weechat.WEECHAT_RC_OK

    option = option[len("%s.buffer." % CONFIG_FILE_NAME):]

    pos = option.rfind(".")
    if pos > 0:
        buffer_mask = option[0:pos]
        property = option[pos+1:]
        if buffer_mask and property:
            buffers = weechat.infolist_get("buffer", "", buffer_mask)

            if not buffers:
                return weechat.WEECHAT_RC_OK

            while weechat.infolist_next(buffers):
                buffer = weechat.infolist_pointer(buffers, "pointer")
                weechat.buffer_set(buffer, property, value)

            weechat.infolist_free(buffers)

    return weechat.WEECHAT_RC_OK
开发者ID:AndyHoang,项目名称:dotfiles,代码行数:26,代码来源:buffer_autoset.py


示例15: hotlist_dict

def hotlist_dict():
    """Return the contents of the hotlist as a dictionary.

    The returned dictionary has the following structure:
    >>> hotlist = {
    ...     "0x0": {                    # string representation of the buffer pointer
    ...         "count_low": 0,
    ...         "count_message": 0,
    ...         "count_private": 0,
    ...         "count_highlight": 0,
    ...     }
    ... }
    """
    hotlist = {}
    infolist = weechat.infolist_get("hotlist", "", "")
    while weechat.infolist_next(infolist):
        buffer_pointer = weechat.infolist_pointer(infolist, "buffer_pointer")
        hotlist[buffer_pointer] = {}
        hotlist[buffer_pointer]["count_low"] = weechat.infolist_integer(
            infolist, "count_00")
        hotlist[buffer_pointer]["count_message"] = weechat.infolist_integer(
            infolist, "count_01")
        hotlist[buffer_pointer]["count_private"] = weechat.infolist_integer(
            infolist, "count_02")
        hotlist[buffer_pointer]["count_highlight"] = weechat.infolist_integer(
            infolist, "count_03")
    weechat.infolist_free(infolist)
    return hotlist
开发者ID:DarkDefender,项目名称:scripts,代码行数:28,代码来源:buffer_autohide.py


示例16: get_help_command

def get_help_command(plugin, input_cmd, input_args):
    """Get help for command in input."""
    global cmdhelp_settings
    if input_cmd == 'set' and input_args:
        return get_help_option(input_args)
    infolist = weechat.infolist_get('hook', '', 'command,%s' % input_cmd)
    cmd_plugin_name = ''
    cmd_command = ''
    cmd_args = ''
    cmd_desc = ''
    while weechat.infolist_next(infolist):
        cmd_plugin_name = (weechat.infolist_string(infolist, 'plugin_name') or
                           'core')
        cmd_command = weechat.infolist_string(infolist, 'command')
        cmd_args = weechat.infolist_string(infolist, 'args_nls')
        cmd_desc = weechat.infolist_string(infolist, 'description')
        if weechat.infolist_pointer(infolist, 'plugin') == plugin:
            break
    weechat.infolist_free(infolist)
    if cmd_plugin_name == 'alias':
        return '%sAlias %s%s%s => %s%s' % (
            weechat.color(cmdhelp_settings['color_alias']),
            weechat.color(cmdhelp_settings['color_alias_name']),
            cmd_command,
            weechat.color(cmdhelp_settings['color_alias']),
            weechat.color(cmdhelp_settings['color_alias_value']),
            cmd_desc,
        )
    if input_args:
        cmd_args = get_command_arguments(input_args, cmd_args)
    if not cmd_args:
        return None
    return '%s%s' % (weechat.color(cmdhelp_settings['color_arguments']),
                     cmd_args)
开发者ID:DarkDefender,项目名称:scripts,代码行数:34,代码来源:cmd_help.py


示例17: save_history

def save_history():
    global history_list
    # get buffers
    ptr_infolist_buffer = weechat.infolist_get('buffer','','')

    while weechat.infolist_next(ptr_infolist_buffer):
        ptr_buffer = weechat.infolist_pointer(ptr_infolist_buffer,'pointer')

        # check for localvar_save_history
        if not weechat.buffer_get_string(ptr_buffer, 'localvar_save_history') and OPTIONS['save_buffer'].lower() == 'off':
            continue

        plugin = weechat.buffer_get_string(ptr_buffer, 'localvar_plugin')
        name = weechat.buffer_get_string(ptr_buffer, 'localvar_name')
        filename = get_filename_with_path('%s.%s' % (plugin,name))

        get_buffer_history(ptr_buffer)
        if len(history_list):
            write_history(filename)

    weechat.infolist_free(ptr_infolist_buffer)

    if OPTIONS['save_global'].lower() != 'off':
        get_buffer_history('')  # buffer pointer (if not set, return global history) 
        if len(history_list):
            write_history(filename_global_history)
开发者ID:weechatter,项目名称:weechat-scripts,代码行数:26,代码来源:histman.py


示例18: get_matching_buffers

def get_matching_buffers(input):
    """ Return list with buffers matching user input """
    global buffers_pos
    list = []
    if len(input) == 0:
        buffers_pos = 0
    input = input.lower()
    infolist = weechat.infolist_get("buffer", "", "")
    while weechat.infolist_next(infolist):
        if weechat.config_get_plugin("short_name") == "on":
            name = weechat.infolist_string(infolist, "short_name")
        else:
            name = weechat.infolist_string(infolist, "name")
        number = weechat.infolist_integer(infolist, "number")
        matching = name.lower().find(input) >= 0
        if not matching and input[-1] == ' ':
            matching = name.lower().endswith(input.strip())
        if not matching and input.isdigit():
            matching = str(number).startswith(input)
        if len(input) == 0 or matching:
            list.append({"number": number, "name": name})
            if len(input) == 0 and weechat.infolist_pointer(infolist, "pointer") == weechat.current_buffer():
                buffers_pos = len(list) - 1
    weechat.infolist_free(infolist)
    return list
开发者ID:GGLucas,项目名称:configs,代码行数:25,代码来源:go.py


示例19: get_matching_buffers

def get_matching_buffers(input):
    """ Return list with buffers matching user input """
    global buffers_pos
    list = []
    if len(input) == 0:
        buffers_pos = 0
    input = input.lower()
    infolist = weechat.infolist_get("buffer", "", "")
    while weechat.infolist_next(infolist):
        if weechat.config_get_plugin("short_name") == "on":
            name = weechat.infolist_string(infolist, "short_name")
        else:
            name = weechat.infolist_string(infolist, "name")
        if weechat.config_get_plugin("use_core_instead_weechat") == "on" and name == "weechat":
            name = "core"
        number = weechat.infolist_integer(infolist, "number")
        full_name = weechat.infolist_string(infolist, "full_name")
        if not full_name:
            full_name = "%s.%s" % (weechat.infolist_string(infolist, "plugin_name"),
                                   weechat.infolist_string(infolist, "name"))
        pointer = weechat.infolist_pointer(infolist, "pointer")
        matching = name.lower().find(input) >= 0
        if not matching and input[-1] == ' ':
            matching = name.lower().endswith(input.strip())
        if not matching and input.isdigit():
            matching = str(number).startswith(input)
        if len(input) == 0 or matching:
            list.append({"number": number, "name": name, "full_name": full_name, "pointer": pointer})
            if len(input) == 0 and pointer == weechat.current_buffer():
                buffers_pos = len(list) - 1
    weechat.infolist_free(infolist)
    if not weechat.config_string_to_boolean(weechat.config_get_plugin('sort_by_activity')):
        return list
    # sort buffers like in hotlist.
    hotlist = []
    infolist = weechat.infolist_get("hotlist", "", "")
    while weechat.infolist_next(infolist):
        hotlist.append(weechat.infolist_pointer(infolist, "buffer_pointer"))
    weechat.infolist_free(infolist)
    last_index = len(hotlist)
    def priority(b):
        try:
            return hotlist.index(b["pointer"])
        except ValueError:
            # not in hotlist, always last.
            return last_index
    return sorted(list, key=priority)
开发者ID:norrs,项目名称:weechat-plugins,代码行数:47,代码来源:go.py


示例20: get_all_buffers

def get_all_buffers():
	"""Returns list with pointers of all open buffers."""
	buffers = []
	infolist = weechat.infolist_get('buffer', '', '')
	while weechat.infolist_next(infolist):
		buffers.append(weechat.infolist_pointer(infolist, 'pointer'))
	weechat.infolist_free(infolist)
	return buffers
开发者ID:AndreMouche,项目名称:my-vim-config,代码行数:8,代码来源:egrep.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python weechat.infolist_string函数代码示例发布时间:2022-05-26
下一篇:
Python weechat.infolist_next函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap