Example #1
0
    def getInfo(self, text="", colorize=0):
        """
    Returns information about the highlights in here.

    This is used by #highlight to tell all the highlights involved
    as well as #write which takes this information and dumps
    it to the file.

    @param text: we return info on highlights that match this text
    @type  text: string

    @param colorize: whether (1) or not (0) to colorize the style
        text in the style
    @type  colorize: int

    @return: list of strings where each string represents a highlight
    @rtype: list of strings
    """
        listing = list(self._highlights.keys())

        if text:
            listing = utils.expand_text(text, listing)

        data = []
        for mem in listing:
            if colorize == 1:
                data.append("highlight {%s%s%s} {%s}" %
                            (ansi.get_color(self._highlights[mem][0]),
                             self._highlights[mem][0],
                             ansi.get_color("default"), utils.escape(mem)))
            else:
                data.append("highlight {%s} {%s}" %
                            (self._highlights[mem][0], utils.escape(mem)))

        return data
Example #2
0
    def getInfo(self, text="", tag=None):
        """
    Returns information about the actions in here.

    This is used by #action to tell all the actions involved
    as well as #write which takes this information and dumps
    it to the file.

    @param text: the text to expand to find actions the user
        wants information about.
    @type  text: string

    @param tag: the tag which to find actions for.
    @type  tag: string

    @return: a list of strings where each string represents an action
    @rtype: list of strings
    """
        listing = self._actions.keys()
        if text:
            listing = utils.expand_text(text, listing)

        data = []
        for mem in listing:
            actup = self._actions[mem]

            if not tag or actup[6] == tag:
                data.append(
                    "action {%s} {%s} color={%d} priority={%d} onetime={%s} tag={%s}"
                    % (utils.escape(mem), utils.escape(
                        actup[2]), actup[3], actup[4], actup[5], actup[6]))

        return data
Example #3
0
  def getInfo(self, text="", tag=None):
    """
    Returns information about the actions in here.

    This is used by #action to tell all the actions involved
    as well as #write which takes this information and dumps
    it to the file.

    @param text: the text to expand to find actions the user
        wants information about.
    @type  text: string

    @param tag: the tag which to find actions for.
    @type  tag: string

    @return: a list of strings where each string represents an action
    @rtype: list of strings
    """
    listing = self._actions.keys()
    if text:
      listing = utils.expand_text(text, listing)

    data = []
    for mem in listing:
      actup = self._actions[mem]
      
      if not tag or actup[6] == tag:
        data.append("action {%s} {%s} color={%d} priority={%d} onetime={%s} tag={%s}" % 
                (utils.escape(mem), utils.escape(actup[2]), actup[3], actup[4], actup[5], actup[6]))

    return data
Example #4
0
  def getInfo(self, text=""):
    """
    Returns information about the aliases in here.

    This is used by #alias to tell all the aliases involved
    as well as #write which takes this information and dumps
    it to the file.

    @param text: the text to expand to find aliases the user
        wants information about.
    @type  text: string

    @return: a list of strings where each string represents an alias
    @rtype: list of strings
    """
    if len(self._aliases) == 0:
      return []

    listing = list(self._aliases.keys())
    if text:
      listing = utils.expand_text(text, listing)

    data = []
    for mem in listing:
      data.append("alias {%s} {%s}" % (mem, utils.escape(self._aliases[mem])))

    return data
Example #5
0
  def getInfoMappings(self):
    l = []
    for mem in self._highlights.keys():
      l.append( { "style": self._highlights[mem][0],
                  "text": utils.escape(mem) } )

    return l
Example #6
0
    def getInfo(self, text=''):
        """
    Returns information about the substitutes in here.

    This is used by #substitute to tell all the substitutes involved
    as well as #write which takes this information and dumps
    it to the file.

    @param text: the text used to figure out which substitutes to provide
        information on
    @type  text: string

    @return: list of strings where each string represents a substitute
    @rtype: list of strings
    """
        listing = self._substitutes.keys()
        if text:
            listing = utils.expand_text(text, listing)

        listing = [
            "substitute {%s} {%s}" %
            (mem, utils.escape(self._substitutes[mem])) for mem in listing
        ]

        return listing
Example #7
0
  def getInfo(self, text=""):
    """
    Returns information about the aliases in here.

    This is used by #alias to tell all the aliases involved
    as well as #write which takes this information and dumps
    it to the file.

    @param text: the text to expand to find aliases the user
        wants information about.
    @type  text: string

    @return: a list of strings where each string represents an alias
    @rtype: list of strings
    """
    if len(self._aliases) == 0:
      return []

    listing = self._aliases.keys()
    if text:
      listing = utils.expand_text(text, listing)

    data = []
    for mem in listing:
      data.append("alias {%s} {%s}" % (mem, utils.escape(self._aliases[mem])))

    return data
Example #8
0
 def getSubstituteInfoMapping(self):
     l = []
     for mem in self._substitutes.keys():
         l.append({
             "item": mem,
             "substitution": utils.escape(self._substitutes[mem])
         })
     return l
Example #9
0
  def getInfo(self, text="", colorize=0):
    """
    Returns information about the highlights in here.

    This is used by #highlight to tell all the highlights involved
    as well as #write which takes this information and dumps
    it to the file.

    @param text: we return info on highlights that match this text
    @type  text: string

    @param colorize: whether (1) or not (0) to colorize the style
        text in the style
    @type  colorize: int

    @return: list of strings where each string represents a highlight
    @rtype: list of strings
    """
    listing = self._highlights.keys()

    if text:
      listing = utils.expand_text(text, listing)

    data = []
    for mem in listing:
      if colorize == 1:
        data.append("highlight {%s%s%s} {%s}" % 
                    (ansi.get_color(self._highlights[mem][0]),
                     self._highlights[mem][0], 
                     ansi.get_color("default"),
                     utils.escape(mem)))
      else:
        data.append("highlight {%s} {%s}" % 
                    (self._highlights[mem][0], utils.escape(mem)))

    return data
Example #10
0
  def getInfo(self, text=''):
    """
    Returns information about the substitutes in here.

    This is used by #substitute to tell all the substitutes involved
    as well as #write which takes this information and dumps
    it to the file.

    @param text: the text used to figure out which substitutes to provide
        information on
    @type  text: string

    @return: list of strings where each string represents a substitute
    @rtype: list of strings
    """
    listing = self._substitutes.keys()
    if text:
      listing = utils.expand_text(text, listing)

    listing = ["substitute {%s} {%s}" % (mem, utils.escape(self._substitutes[mem])) for mem in listing]

    return listing
Example #11
0
 def getSubstituteInfoMapping(self):
   l = []
   for mem in self._substitutes.keys():
     l.append( { "item": mem,
                 "substitution": utils.escape(self._substitutes[mem]) } )
   return l