class_docstr: A class that can be used to portably generate formatted output to
  a terminal.
  
  C{TerminalController} defines a set of instance variables whose
  values are initialized to the control sequence necessary to
  perform a given action.  These can be simply included in normal
  output to the terminal:
  
      >>> term = TerminalController()
      >>> print('This is '+term.GREEN+'green'+term.NORMAL)
      This is green
  
  Alternatively, the L{render()} method can used, which replaces
  C{${action}} with the string required to perform C{action}:
  
      >>> term = TerminalController()
      >>> print(term.render('This is ${GREEN}green${NORMAL}'))
      This is green
  
  If the terminal doesn't support a given action, then the value of
  the corresponding instance variable will be set to ''.  As a
  result, the above code will still work on terminals that do not
  support color, except that their output will not be colored.
  Also, this means that you can test whether the terminal supports a
  given action by simply testing the truth value of the
  corresponding instance variable:
  
      >>> term = TerminalController()
      >>> if term.CLEAR_SCREEN:
      ...     print 'This terminal supports clearning the screen.'
      ...
  
  Finally, if the width and height of the terminal are known, then
  they will be stored in the C{COLS} and C{LINES} attributes.
  
  @author: Edward Loper
class_docstr_tok: ["A","class","that","can","be","used","to","portably","generate","formatted","output","to","a","terminal",".","C","{","TerminalController","}","defines","a","set","of","instance","variables","whose","values","are","initialized","to","the","control","sequence","necessary","to","perform","a","given","action",".","These","can","be","simply","included","in","normal","output","to","the","terminal",":",">",">",">","term","=","TerminalController","(",")",">",">",">","print","(","'This","is","'+term.GREEN+'green'+term.NORMAL",")","This","is","green","Alternatively",",","the","L","{","render","(",")","}","method","can","used",",","which","replaces","C","{","$","{","action","}","}","with","the","string","required","to","perform","C","{","action","}",":",">",">",">","term","=","TerminalController","(",")",">",">",">","print","(","term.render","(","'This","is","$","{","GREEN","}","green","$","{","NORMAL","}","'",")",")","This","is","green","If","the","terminal","does","n't","support","a","given","action",",","then","the","value","of","the","corresponding","instance","variable","will","be","set","to","``",".","As","a","result",",","the","above","code","will","still","work","on","terminals","that","do","not","support","color",",","except","that","their","output","will","not","be","colored",".","Also",",","this","means","that","you","can","test","whether","the","terminal","supports","a","given","action","by","simply","testing","the","truth","value","of","the","corresponding","instance","variable",":",">",">",">","term","=","TerminalController","(",")",">",">",">","if","term.CLEAR_SCREEN",":","...","print","'This","terminal","supports","clearning","the","screen",".","'","...","Finally",",","if","the","width","and","height","of","the","terminal","are","known",",","then","they","will","be","stored","in","the","C","{","COLS","}","and","C","{","LINES","}","attributes",".","@","author",":","Edward","Loper"]
docstr: Create a C{TerminalController} and initialize its attributes
  with appropriate values for the current terminal.
  C{term_stream} is the stream that will be used for terminal
  output; if this stream is not a tty, then the terminal is
  assumed to be a dumb terminal (i.e., have no capabilities).
code: def __init__(self, term_stream=sys.stdout):
      """
      Create a C{TerminalController} and initialize its attributes
      with appropriate values for the current terminal.
      C{term_stream} is the stream that will be used for terminal
      output; if this stream is not a tty, then the terminal is
      assumed to be a dumb terminal (i.e., have no capabilities).
      """
      # Curses isn't available on all platforms
      try:
          import curses
      except ImportError:
          return
  
      # If the stream isn't a tty, then assume it has no capabilities.
      if not term_stream.isatty():
          return
  
      # Check the terminal type.  If we fail, then assume that the
      # terminal has no capabilities.
      try:
          curses.setupterm()
      except Exception:
          return
  
      # Look up numeric capabilities.
      self.COLS = curses.tigetnum("cols")
      self.LINES = curses.tigetnum("lines")
  
      # Look up string capabilities.
      for capability in self._STRING_CAPABILITIES:
          (attrib, cap_name) = capability.split("=")
          setattr(self, attrib, self._tigetstr(cap_name) or "")
  
      # Colors
      set_fg = self._tigetstr("setf")
      if set_fg:
          for i, color in zip(range(len(self._COLORS)), self._COLORS):
              setattr(self, color, self._tparm(set_fg, i) or "")
      set_fg_ansi = self._tigetstr("setaf")
      if set_fg_ansi:
          for i, color in zip(
              range(len(self._ANSICOLORS)), self._ANSICOLORS
          ):
              setattr(self, color, self._tparm(set_fg_ansi, i) or "")
      set_bg = self._tigetstr("setb")
      if set_bg:
          for i, color in zip(range(len(self._COLORS)), self._COLORS):
              setattr(self, "BG_" + color, self._tparm(set_bg, i) or "")
      set_bg_ansi = self._tigetstr("setab")
      if set_bg_ansi:
          for i, color in zip(
              range(len(self._ANSICOLORS)), self._ANSICOLORS
          ):
              setattr(
                  self, "BG_" + color, self._tparm(set_bg_ansi, i) or ""
              )
  
imports: from abc import ABCMeta, abstractmethod
  import re
  import sys
  from igraph import __version__
  from igraph._igraph import set_progress_handler, set_status_handler
  from igraph.configuration import Configuration
label_desc: Use image node_id 1 to create a new TerminalController object  with example: obj = TerminalController(term_stream)