Sophie

Sophie

distrib > Mandriva > 2010.1 > x86_64 > media > contrib-release > by-pkgid > 2eca861f24be6048290ed27335ec22aa > files > 1153

flumotion-doc-0.6.1-1mdv2010.0.x86_64.rpm

<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>flumotion.extern.log.termcolor</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        Package&nbsp;flumotion ::
        <a href="flumotion.extern-module.html">Package&nbsp;extern</a> ::
        <a href="flumotion.extern.log-module.html">Package&nbsp;log</a> ::
        Module&nbsp;termcolor
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="flumotion.extern.log.termcolor-module.html">Module flumotion.extern.log.termcolor</a></h1>
<pre class="py-src">
<a name="L1"></a><tt class="py-lineno">  1</tt>  <tt class="py-line"><tt class="py-comment"># Copyright 2006 Edward Loper. May be distributed under the same terms</tt> </tt>
<a name="L2"></a><tt class="py-lineno">  2</tt>  <tt class="py-line"><tt class="py-comment"># as Python itself.</tt> </tt>
<a name="L3"></a><tt class="py-lineno">  3</tt>  <tt class="py-line"><tt class="py-comment">#</tt> </tt>
<a name="L4"></a><tt class="py-lineno">  4</tt>  <tt class="py-line"><tt class="py-comment"># From http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/475116</tt> </tt>
<a name="L5"></a><tt class="py-lineno">  5</tt>  <tt class="py-line"> </tt>
<a name="L6"></a><tt class="py-lineno">  6</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">re</tt> </tt>
<a name="L7"></a><tt class="py-lineno">  7</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">sys</tt> </tt>
<a name="L8"></a><tt class="py-lineno">  8</tt>  <tt class="py-line"> </tt>
<a name="L9"></a><tt class="py-lineno">  9</tt>  <tt class="py-line"> </tt>
<a name="TerminalController"></a><div id="TerminalController-def"><a name="L10"></a><tt class="py-lineno"> 10</tt> <a class="py-toggle" href="#" id="TerminalController-toggle" onclick="return toggle('TerminalController');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="flumotion.extern.log.termcolor.TerminalController-class.html">TerminalController</a><tt class="py-op">:</tt> </tt>
</div><div id="TerminalController-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="TerminalController-expanded"><a name="L11"></a><tt class="py-lineno"> 11</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L12"></a><tt class="py-lineno"> 12</tt>  <tt class="py-line"><tt class="py-docstring">    A class that can be used to portably generate formatted output to</tt> </tt>
<a name="L13"></a><tt class="py-lineno"> 13</tt>  <tt class="py-line"><tt class="py-docstring">    a terminal.</tt> </tt>
<a name="L14"></a><tt class="py-lineno"> 14</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L15"></a><tt class="py-lineno"> 15</tt>  <tt class="py-line"><tt class="py-docstring">    `TerminalController` defines a set of instance variables whose</tt> </tt>
<a name="L16"></a><tt class="py-lineno"> 16</tt>  <tt class="py-line"><tt class="py-docstring">    values are initialized to the control sequence necessary to</tt> </tt>
<a name="L17"></a><tt class="py-lineno"> 17</tt>  <tt class="py-line"><tt class="py-docstring">    perform a given action.  These can be simply included in normal</tt> </tt>
<a name="L18"></a><tt class="py-lineno"> 18</tt>  <tt class="py-line"><tt class="py-docstring">    output to the terminal:</tt> </tt>
<a name="L19"></a><tt class="py-lineno"> 19</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L20"></a><tt class="py-lineno"> 20</tt>  <tt class="py-line"><tt class="py-docstring">        &gt;&gt;&gt; term = TerminalController()</tt> </tt>
<a name="L21"></a><tt class="py-lineno"> 21</tt>  <tt class="py-line"><tt class="py-docstring">        &gt;&gt;&gt; print 'This is '+term.GREEN+'green'+term.NORMAL</tt> </tt>
<a name="L22"></a><tt class="py-lineno"> 22</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L23"></a><tt class="py-lineno"> 23</tt>  <tt class="py-line"><tt class="py-docstring">    Alternatively, the `render()` method can used, which replaces</tt> </tt>
<a name="L24"></a><tt class="py-lineno"> 24</tt>  <tt class="py-line"><tt class="py-docstring">    '${action}' with the string required to perform 'action':</tt> </tt>
<a name="L25"></a><tt class="py-lineno"> 25</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L26"></a><tt class="py-lineno"> 26</tt>  <tt class="py-line"><tt class="py-docstring">        &gt;&gt;&gt; term = TerminalController()</tt> </tt>
<a name="L27"></a><tt class="py-lineno"> 27</tt>  <tt class="py-line"><tt class="py-docstring">        &gt;&gt;&gt; print term.render('This is ${GREEN}green${NORMAL}')</tt> </tt>
<a name="L28"></a><tt class="py-lineno"> 28</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L29"></a><tt class="py-lineno"> 29</tt>  <tt class="py-line"><tt class="py-docstring">    If the terminal doesn't support a given action, then the value of</tt> </tt>
<a name="L30"></a><tt class="py-lineno"> 30</tt>  <tt class="py-line"><tt class="py-docstring">    the corresponding instance variable will be set to ''.  As a</tt> </tt>
<a name="L31"></a><tt class="py-lineno"> 31</tt>  <tt class="py-line"><tt class="py-docstring">    result, the above code will still work on terminals that do not</tt> </tt>
<a name="L32"></a><tt class="py-lineno"> 32</tt>  <tt class="py-line"><tt class="py-docstring">    support color, except that their output will not be colored.</tt> </tt>
<a name="L33"></a><tt class="py-lineno"> 33</tt>  <tt class="py-line"><tt class="py-docstring">    Also, this means that you can test whether the terminal supports a</tt> </tt>
<a name="L34"></a><tt class="py-lineno"> 34</tt>  <tt class="py-line"><tt class="py-docstring">    given action by simply testing the truth value of the</tt> </tt>
<a name="L35"></a><tt class="py-lineno"> 35</tt>  <tt class="py-line"><tt class="py-docstring">    corresponding instance variable:</tt> </tt>
<a name="L36"></a><tt class="py-lineno"> 36</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L37"></a><tt class="py-lineno"> 37</tt>  <tt class="py-line"><tt class="py-docstring">        &gt;&gt;&gt; term = TerminalController()</tt> </tt>
<a name="L38"></a><tt class="py-lineno"> 38</tt>  <tt class="py-line"><tt class="py-docstring">        &gt;&gt;&gt; if term.CLEAR_SCREEN:</tt> </tt>
<a name="L39"></a><tt class="py-lineno"> 39</tt>  <tt class="py-line"><tt class="py-docstring">        ...     print 'This terminal supports clearning the screen.'</tt> </tt>
<a name="L40"></a><tt class="py-lineno"> 40</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L41"></a><tt class="py-lineno"> 41</tt>  <tt class="py-line"><tt class="py-docstring">    Finally, if the width and height of the terminal are known, then</tt> </tt>
<a name="L42"></a><tt class="py-lineno"> 42</tt>  <tt class="py-line"><tt class="py-docstring">    they will be stored in the `COLS` and `LINES` attributes.</tt> </tt>
<a name="L43"></a><tt class="py-lineno"> 43</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="L44"></a><tt class="py-lineno"> 44</tt>  <tt class="py-line">    <tt class="py-comment"># Cursor movement:</tt> </tt>
<a name="L45"></a><tt class="py-lineno"> 45</tt>  <tt class="py-line">    <tt id="link-0" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.BOL=flumotion.extern.log.termcolor.TerminalController-class.html#BOL"><a title="flumotion.extern.log.termcolor.TerminalController.BOL" class="py-name" href="#" onclick="return doclink('link-0', 'BOL', 'link-0');">BOL</a></tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt>             <tt class="py-comment">#: Move the cursor to the beginning of the line</tt> </tt>
<a name="L46"></a><tt class="py-lineno"> 46</tt>  <tt class="py-line">    <tt id="link-1" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.UP=flumotion.extern.log.termcolor.TerminalController-class.html#UP"><a title="flumotion.extern.log.termcolor.TerminalController.UP" class="py-name" href="#" onclick="return doclink('link-1', 'UP', 'link-1');">UP</a></tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt>              <tt class="py-comment">#: Move the cursor up one line</tt> </tt>
<a name="L47"></a><tt class="py-lineno"> 47</tt>  <tt class="py-line">    <tt id="link-2" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.DOWN=flumotion.extern.log.termcolor.TerminalController-class.html#DOWN"><a title="flumotion.extern.log.termcolor.TerminalController.DOWN" class="py-name" href="#" onclick="return doclink('link-2', 'DOWN', 'link-2');">DOWN</a></tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt>            <tt class="py-comment">#: Move the cursor down one line</tt> </tt>
<a name="L48"></a><tt class="py-lineno"> 48</tt>  <tt class="py-line">    <tt id="link-3" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.LEFT=flumotion.extern.log.termcolor.TerminalController-class.html#LEFT"><a title="flumotion.extern.log.termcolor.TerminalController.LEFT" class="py-name" href="#" onclick="return doclink('link-3', 'LEFT', 'link-3');">LEFT</a></tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt>            <tt class="py-comment">#: Move the cursor left one char</tt> </tt>
<a name="L49"></a><tt class="py-lineno"> 49</tt>  <tt class="py-line">    <tt id="link-4" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.RIGHT=flumotion.extern.log.termcolor.TerminalController-class.html#RIGHT"><a title="flumotion.extern.log.termcolor.TerminalController.RIGHT" class="py-name" href="#" onclick="return doclink('link-4', 'RIGHT', 'link-4');">RIGHT</a></tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt>           <tt class="py-comment">#: Move the cursor right one char</tt> </tt>
<a name="L50"></a><tt class="py-lineno"> 50</tt>  <tt class="py-line"> </tt>
<a name="L51"></a><tt class="py-lineno"> 51</tt>  <tt class="py-line">    <tt class="py-comment"># Deletion:</tt> </tt>
<a name="L52"></a><tt class="py-lineno"> 52</tt>  <tt class="py-line">    <tt id="link-5" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.CLEAR_SCREEN=flumotion.extern.log.termcolor.TerminalController-class.html#CLEAR_SCREEN"><a title="flumotion.extern.log.termcolor.TerminalController.CLEAR_SCREEN" class="py-name" href="#" onclick="return doclink('link-5', 'CLEAR_SCREEN', 'link-5');">CLEAR_SCREEN</a></tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt>    <tt class="py-comment">#: Clear the screen and move to home position</tt> </tt>
<a name="L53"></a><tt class="py-lineno"> 53</tt>  <tt class="py-line">    <tt id="link-6" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.CLEAR_EOL=flumotion.extern.log.termcolor.TerminalController-class.html#CLEAR_EOL"><a title="flumotion.extern.log.termcolor.TerminalController.CLEAR_EOL" class="py-name" href="#" onclick="return doclink('link-6', 'CLEAR_EOL', 'link-6');">CLEAR_EOL</a></tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt>       <tt class="py-comment">#: Clear to the end of the line.</tt> </tt>
<a name="L54"></a><tt class="py-lineno"> 54</tt>  <tt class="py-line">    <tt id="link-7" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.CLEAR_BOL=flumotion.extern.log.termcolor.TerminalController-class.html#CLEAR_BOL"><a title="flumotion.extern.log.termcolor.TerminalController.CLEAR_BOL" class="py-name" href="#" onclick="return doclink('link-7', 'CLEAR_BOL', 'link-7');">CLEAR_BOL</a></tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt>       <tt class="py-comment">#: Clear to the beginning of the line.</tt> </tt>
<a name="L55"></a><tt class="py-lineno"> 55</tt>  <tt class="py-line">    <tt id="link-8" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.CLEAR_EOS=flumotion.extern.log.termcolor.TerminalController-class.html#CLEAR_EOS"><a title="flumotion.extern.log.termcolor.TerminalController.CLEAR_EOS" class="py-name" href="#" onclick="return doclink('link-8', 'CLEAR_EOS', 'link-8');">CLEAR_EOS</a></tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt>       <tt class="py-comment">#: Clear to the end of the screen</tt> </tt>
<a name="L56"></a><tt class="py-lineno"> 56</tt>  <tt class="py-line"> </tt>
<a name="L57"></a><tt class="py-lineno"> 57</tt>  <tt class="py-line">    <tt class="py-comment"># Output modes:</tt> </tt>
<a name="L58"></a><tt class="py-lineno"> 58</tt>  <tt class="py-line">    <tt id="link-9" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.BOLD=flumotion.extern.log.termcolor.TerminalController-class.html#BOLD"><a title="flumotion.extern.log.termcolor.TerminalController.BOLD" class="py-name" href="#" onclick="return doclink('link-9', 'BOLD', 'link-9');">BOLD</a></tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt>            <tt class="py-comment">#: Turn on bold mode</tt> </tt>
<a name="L59"></a><tt class="py-lineno"> 59</tt>  <tt class="py-line">    <tt id="link-10" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.BLINK=flumotion.extern.log.termcolor.TerminalController-class.html#BLINK"><a title="flumotion.extern.log.termcolor.TerminalController.BLINK" class="py-name" href="#" onclick="return doclink('link-10', 'BLINK', 'link-10');">BLINK</a></tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt>           <tt class="py-comment">#: Turn on blink mode</tt> </tt>
<a name="L60"></a><tt class="py-lineno"> 60</tt>  <tt class="py-line">    <tt id="link-11" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.DIM=flumotion.extern.log.termcolor.TerminalController-class.html#DIM"><a title="flumotion.extern.log.termcolor.TerminalController.DIM" class="py-name" href="#" onclick="return doclink('link-11', 'DIM', 'link-11');">DIM</a></tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt>             <tt class="py-comment">#: Turn on half-bright mode</tt> </tt>
<a name="L61"></a><tt class="py-lineno"> 61</tt>  <tt class="py-line">    <tt id="link-12" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.REVERSE=flumotion.extern.log.termcolor.TerminalController-class.html#REVERSE"><a title="flumotion.extern.log.termcolor.TerminalController.REVERSE" class="py-name" href="#" onclick="return doclink('link-12', 'REVERSE', 'link-12');">REVERSE</a></tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt>         <tt class="py-comment">#: Turn on reverse-video mode</tt> </tt>
<a name="L62"></a><tt class="py-lineno"> 62</tt>  <tt class="py-line">    <tt id="link-13" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.NORMAL=flumotion.extern.log.termcolor.TerminalController-class.html#NORMAL"><a title="flumotion.extern.log.termcolor.TerminalController.NORMAL" class="py-name" href="#" onclick="return doclink('link-13', 'NORMAL', 'link-13');">NORMAL</a></tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt>          <tt class="py-comment">#: Turn off all modes</tt> </tt>
<a name="L63"></a><tt class="py-lineno"> 63</tt>  <tt class="py-line"> </tt>
<a name="L64"></a><tt class="py-lineno"> 64</tt>  <tt class="py-line">    <tt class="py-comment"># Cursor display:</tt> </tt>
<a name="L65"></a><tt class="py-lineno"> 65</tt>  <tt class="py-line">    <tt id="link-14" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.HIDE_CURSOR=flumotion.extern.log.termcolor.TerminalController-class.html#HIDE_CURSOR"><a title="flumotion.extern.log.termcolor.TerminalController.HIDE_CURSOR" class="py-name" href="#" onclick="return doclink('link-14', 'HIDE_CURSOR', 'link-14');">HIDE_CURSOR</a></tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt>     <tt class="py-comment">#: Make the cursor invisible</tt> </tt>
<a name="L66"></a><tt class="py-lineno"> 66</tt>  <tt class="py-line">    <tt id="link-15" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.SHOW_CURSOR=flumotion.extern.log.termcolor.TerminalController-class.html#SHOW_CURSOR"><a title="flumotion.extern.log.termcolor.TerminalController.SHOW_CURSOR" class="py-name" href="#" onclick="return doclink('link-15', 'SHOW_CURSOR', 'link-15');">SHOW_CURSOR</a></tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt>     <tt class="py-comment">#: Make the cursor visible</tt> </tt>
<a name="L67"></a><tt class="py-lineno"> 67</tt>  <tt class="py-line"> </tt>
<a name="L68"></a><tt class="py-lineno"> 68</tt>  <tt class="py-line">    <tt class="py-comment"># Terminal size:</tt> </tt>
<a name="L69"></a><tt class="py-lineno"> 69</tt>  <tt class="py-line">    <tt id="link-16" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.COLS=flumotion.extern.log.termcolor.TerminalController-class.html#COLS"><a title="flumotion.extern.log.termcolor.TerminalController.COLS" class="py-name" href="#" onclick="return doclink('link-16', 'COLS', 'link-16');">COLS</a></tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt>          <tt class="py-comment">#: Width of the terminal (None for unknown)</tt> </tt>
<a name="L70"></a><tt class="py-lineno"> 70</tt>  <tt class="py-line">    <tt id="link-17" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.LINES=flumotion.extern.log.termcolor.TerminalController-class.html#LINES"><a title="flumotion.extern.log.termcolor.TerminalController.LINES" class="py-name" href="#" onclick="return doclink('link-17', 'LINES', 'link-17');">LINES</a></tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt>         <tt class="py-comment">#: Height of the terminal (None for unknown)</tt> </tt>
<a name="L71"></a><tt class="py-lineno"> 71</tt>  <tt class="py-line"> </tt>
<a name="L72"></a><tt class="py-lineno"> 72</tt>  <tt class="py-line">    <tt class="py-comment"># Foreground colors:</tt> </tt>
<a name="L73"></a><tt class="py-lineno"> 73</tt>  <tt class="py-line">    <tt id="link-18" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.BLACK=flumotion.extern.log.termcolor.TerminalController-class.html#BLACK"><a title="flumotion.extern.log.termcolor.TerminalController.BLACK" class="py-name" href="#" onclick="return doclink('link-18', 'BLACK', 'link-18');">BLACK</a></tt> <tt class="py-op">=</tt> <tt id="link-19" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.BLUE=flumotion.extern.log.termcolor.TerminalController-class.html#BLUE"><a title="flumotion.extern.log.termcolor.TerminalController.BLUE" class="py-name" href="#" onclick="return doclink('link-19', 'BLUE', 'link-19');">BLUE</a></tt> <tt class="py-op">=</tt> <tt id="link-20" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.GREEN=flumotion.extern.log.termcolor.TerminalController-class.html#GREEN"><a title="flumotion.extern.log.termcolor.TerminalController.GREEN" class="py-name" href="#" onclick="return doclink('link-20', 'GREEN', 'link-20');">GREEN</a></tt> <tt class="py-op">=</tt> <tt id="link-21" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.CYAN=flumotion.extern.log.termcolor.TerminalController-class.html#CYAN"><a title="flumotion.extern.log.termcolor.TerminalController.CYAN" class="py-name" href="#" onclick="return doclink('link-21', 'CYAN', 'link-21');">CYAN</a></tt> <tt class="py-op">=</tt> <tt id="link-22" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.RED=flumotion.extern.log.termcolor.TerminalController-class.html#RED"><a title="flumotion.extern.log.termcolor.TerminalController.RED" class="py-name" href="#" onclick="return doclink('link-22', 'RED', 'link-22');">RED</a></tt> <tt class="py-op">=</tt> <tt id="link-23" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.MAGENTA=flumotion.extern.log.termcolor.TerminalController-class.html#MAGENTA"><a title="flumotion.extern.log.termcolor.TerminalController.MAGENTA" class="py-name" href="#" onclick="return doclink('link-23', 'MAGENTA', 'link-23');">MAGENTA</a></tt> <tt class="py-op">=</tt> <tt id="link-24" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.YELLOW=flumotion.extern.log.termcolor.TerminalController-class.html#YELLOW"><a title="flumotion.extern.log.termcolor.TerminalController.YELLOW" class="py-name" href="#" onclick="return doclink('link-24', 'YELLOW', 'link-24');">YELLOW</a></tt> <tt class="py-op">=</tt> <tt id="link-25" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.WHITE=flumotion.extern.log.termcolor.TerminalController-class.html#WHITE"><a title="flumotion.extern.log.termcolor.TerminalController.WHITE" class="py-name" href="#" onclick="return doclink('link-25', 'WHITE', 'link-25');">WHITE</a></tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt> </tt>
<a name="L74"></a><tt class="py-lineno"> 74</tt>  <tt class="py-line"> </tt>
<a name="L75"></a><tt class="py-lineno"> 75</tt>  <tt class="py-line">    <tt class="py-comment"># Background colors:</tt> </tt>
<a name="L76"></a><tt class="py-lineno"> 76</tt>  <tt class="py-line">    <tt id="link-26" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.BG_BLACK=flumotion.extern.log.termcolor.TerminalController-class.html#BG_BLACK"><a title="flumotion.extern.log.termcolor.TerminalController.BG_BLACK" class="py-name" href="#" onclick="return doclink('link-26', 'BG_BLACK', 'link-26');">BG_BLACK</a></tt> <tt class="py-op">=</tt> <tt id="link-27" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.BG_BLUE=flumotion.extern.log.termcolor.TerminalController-class.html#BG_BLUE"><a title="flumotion.extern.log.termcolor.TerminalController.BG_BLUE" class="py-name" href="#" onclick="return doclink('link-27', 'BG_BLUE', 'link-27');">BG_BLUE</a></tt> <tt class="py-op">=</tt> <tt id="link-28" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.BG_GREEN=flumotion.extern.log.termcolor.TerminalController-class.html#BG_GREEN"><a title="flumotion.extern.log.termcolor.TerminalController.BG_GREEN" class="py-name" href="#" onclick="return doclink('link-28', 'BG_GREEN', 'link-28');">BG_GREEN</a></tt> <tt class="py-op">=</tt> <tt id="link-29" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.BG_CYAN=flumotion.extern.log.termcolor.TerminalController-class.html#BG_CYAN"><a title="flumotion.extern.log.termcolor.TerminalController.BG_CYAN" class="py-name" href="#" onclick="return doclink('link-29', 'BG_CYAN', 'link-29');">BG_CYAN</a></tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt> </tt>
<a name="L77"></a><tt class="py-lineno"> 77</tt>  <tt class="py-line">    <tt id="link-30" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.BG_RED=flumotion.extern.log.termcolor.TerminalController-class.html#BG_RED"><a title="flumotion.extern.log.termcolor.TerminalController.BG_RED" class="py-name" href="#" onclick="return doclink('link-30', 'BG_RED', 'link-30');">BG_RED</a></tt> <tt class="py-op">=</tt> <tt id="link-31" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.BG_MAGENTA=flumotion.extern.log.termcolor.TerminalController-class.html#BG_MAGENTA"><a title="flumotion.extern.log.termcolor.TerminalController.BG_MAGENTA" class="py-name" href="#" onclick="return doclink('link-31', 'BG_MAGENTA', 'link-31');">BG_MAGENTA</a></tt> <tt class="py-op">=</tt> <tt id="link-32" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.BG_YELLOW=flumotion.extern.log.termcolor.TerminalController-class.html#BG_YELLOW"><a title="flumotion.extern.log.termcolor.TerminalController.BG_YELLOW" class="py-name" href="#" onclick="return doclink('link-32', 'BG_YELLOW', 'link-32');">BG_YELLOW</a></tt> <tt class="py-op">=</tt> <tt id="link-33" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController.BG_WHITE=flumotion.extern.log.termcolor.TerminalController-class.html#BG_WHITE"><a title="flumotion.extern.log.termcolor.TerminalController.BG_WHITE" class="py-name" href="#" onclick="return doclink('link-33', 'BG_WHITE', 'link-33');">BG_WHITE</a></tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt> </tt>
<a name="L78"></a><tt class="py-lineno"> 78</tt>  <tt class="py-line"> </tt>
<a name="L79"></a><tt class="py-lineno"> 79</tt>  <tt class="py-line">    <tt id="link-34" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController._STRING_CAPABILITIES=flumotion.extern.log.termcolor.TerminalController-class.html#_STRING_CAPABILITIES"><a title="flumotion.extern.log.termcolor.TerminalController._STRING_CAPABILITIES" class="py-name" href="#" onclick="return doclink('link-34', '_STRING_CAPABILITIES', 'link-34');">_STRING_CAPABILITIES</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"""</tt> </tt>
<a name="L80"></a><tt class="py-lineno"> 80</tt>  <tt class="py-line"><tt class="py-string">    BOL=cr UP=cuu1 DOWN=cud1 LEFT=cub1 RIGHT=cuf1</tt> </tt>
<a name="L81"></a><tt class="py-lineno"> 81</tt>  <tt class="py-line"><tt class="py-string">    CLEAR_SCREEN=clear CLEAR_EOL=el CLEAR_BOL=el1 CLEAR_EOS=ed BOLD=bold</tt> </tt>
<a name="L82"></a><tt class="py-lineno"> 82</tt>  <tt class="py-line"><tt class="py-string">    BLINK=blink DIM=dim REVERSE=rev UNDERLINE=smul NORMAL=sgr0</tt> </tt>
<a name="L83"></a><tt class="py-lineno"> 83</tt>  <tt class="py-line"><tt class="py-string">    HIDE_CURSOR=cinvis SHOW_CURSOR=cnorm"""</tt><tt class="py-op">.</tt><tt class="py-name">split</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L84"></a><tt class="py-lineno"> 84</tt>  <tt class="py-line">    <tt id="link-35" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController._COLORS=flumotion.extern.log.termcolor.TerminalController-class.html#_COLORS"><a title="flumotion.extern.log.termcolor.TerminalController._COLORS" class="py-name" href="#" onclick="return doclink('link-35', '_COLORS', 'link-35');">_COLORS</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"""BLACK BLUE GREEN CYAN RED MAGENTA YELLOW WHITE"""</tt><tt class="py-op">.</tt><tt class="py-name">split</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L85"></a><tt class="py-lineno"> 85</tt>  <tt class="py-line">    <tt id="link-36" class="py-name" targets="Variable flumotion.extern.log.termcolor.TerminalController._ANSICOLORS=flumotion.extern.log.termcolor.TerminalController-class.html#_ANSICOLORS"><a title="flumotion.extern.log.termcolor.TerminalController._ANSICOLORS" class="py-name" href="#" onclick="return doclink('link-36', '_ANSICOLORS', 'link-36');">_ANSICOLORS</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"BLACK RED GREEN YELLOW BLUE MAGENTA CYAN WHITE"</tt><tt class="py-op">.</tt><tt class="py-name">split</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L86"></a><tt class="py-lineno"> 86</tt>  <tt class="py-line"> </tt>
<a name="TerminalController.__init__"></a><div id="TerminalController.__init__-def"><a name="L87"></a><tt class="py-lineno"> 87</tt> <a class="py-toggle" href="#" id="TerminalController.__init__-toggle" onclick="return toggle('TerminalController.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="flumotion.extern.log.termcolor.TerminalController-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">term_stream</tt><tt class="py-op">=</tt><tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">stdout</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TerminalController.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="TerminalController.__init__-expanded"><a name="L88"></a><tt class="py-lineno"> 88</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
<a name="L89"></a><tt class="py-lineno"> 89</tt>  <tt class="py-line"><tt class="py-docstring">        Create a `TerminalController` and initialize its attributes</tt> </tt>
<a name="L90"></a><tt class="py-lineno"> 90</tt>  <tt class="py-line"><tt class="py-docstring">        with appropriate values for the current terminal.</tt> </tt>
<a name="L91"></a><tt class="py-lineno"> 91</tt>  <tt class="py-line"><tt class="py-docstring">        `term_stream` is the stream that will be used for terminal</tt> </tt>
<a name="L92"></a><tt class="py-lineno"> 92</tt>  <tt class="py-line"><tt class="py-docstring">        output; if this stream is not a tty, then the terminal is</tt> </tt>
<a name="L93"></a><tt class="py-lineno"> 93</tt>  <tt class="py-line"><tt class="py-docstring">        assumed to be a dumb terminal (i.e., have no capabilities).</tt> </tt>
<a name="L94"></a><tt class="py-lineno"> 94</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L95"></a><tt class="py-lineno"> 95</tt>  <tt class="py-line">        <tt class="py-comment"># Curses isn't available on all platforms</tt> </tt>
<a name="L96"></a><tt class="py-lineno"> 96</tt>  <tt class="py-line">        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L97"></a><tt class="py-lineno"> 97</tt>  <tt class="py-line">            <tt class="py-keyword">import</tt> <tt class="py-name">curses</tt> </tt>
<a name="L98"></a><tt class="py-lineno"> 98</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt> <tt class="py-name">ImportError</tt><tt class="py-op">:</tt> </tt>
<a name="L99"></a><tt class="py-lineno"> 99</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> </tt>
<a name="L100"></a><tt class="py-lineno">100</tt>  <tt class="py-line"> </tt>
<a name="L101"></a><tt class="py-lineno">101</tt>  <tt class="py-line">        <tt class="py-comment"># If the stream isn't a tty, then assume it has no capabilities.</tt> </tt>
<a name="L102"></a><tt class="py-lineno">102</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">term_stream</tt><tt class="py-op">.</tt><tt class="py-name">isatty</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L103"></a><tt class="py-lineno">103</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> </tt>
<a name="L104"></a><tt class="py-lineno">104</tt>  <tt class="py-line"> </tt>
<a name="L105"></a><tt class="py-lineno">105</tt>  <tt class="py-line">        <tt class="py-comment"># Check the terminal type.  If we fail, then assume that the</tt> </tt>
<a name="L106"></a><tt class="py-lineno">106</tt>  <tt class="py-line">        <tt class="py-comment"># terminal has no capabilities.</tt> </tt>
<a name="L107"></a><tt class="py-lineno">107</tt>  <tt class="py-line">        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L108"></a><tt class="py-lineno">108</tt>  <tt class="py-line">            <tt class="py-name">curses</tt><tt class="py-op">.</tt><tt class="py-name">setupterm</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L109"></a><tt class="py-lineno">109</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt><tt class="py-op">:</tt> </tt>
<a name="L110"></a><tt class="py-lineno">110</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> </tt>
<a name="L111"></a><tt class="py-lineno">111</tt>  <tt class="py-line"> </tt>
<a name="L112"></a><tt class="py-lineno">112</tt>  <tt class="py-line">        <tt class="py-comment"># Look up numeric capabilities.</tt> </tt>
<a name="L113"></a><tt class="py-lineno">113</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-37" class="py-name"><a title="flumotion.extern.log.termcolor.TerminalController.COLS" class="py-name" href="#" onclick="return doclink('link-37', 'COLS', 'link-16');">COLS</a></tt> <tt class="py-op">=</tt> <tt class="py-name">curses</tt><tt class="py-op">.</tt><tt class="py-name">tigetnum</tt><tt class="py-op">(</tt><tt class="py-string">'cols'</tt><tt class="py-op">)</tt> </tt>
<a name="L114"></a><tt class="py-lineno">114</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-38" class="py-name"><a title="flumotion.extern.log.termcolor.TerminalController.LINES" class="py-name" href="#" onclick="return doclink('link-38', 'LINES', 'link-17');">LINES</a></tt> <tt class="py-op">=</tt> <tt class="py-name">curses</tt><tt class="py-op">.</tt><tt class="py-name">tigetnum</tt><tt class="py-op">(</tt><tt class="py-string">'lines'</tt><tt class="py-op">)</tt> </tt>
<a name="L115"></a><tt class="py-lineno">115</tt>  <tt class="py-line"> </tt>
<a name="L116"></a><tt class="py-lineno">116</tt>  <tt class="py-line">        <tt class="py-comment"># Look up string capabilities.</tt> </tt>
<a name="L117"></a><tt class="py-lineno">117</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">capability</tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-39" class="py-name"><a title="flumotion.extern.log.termcolor.TerminalController._STRING_CAPABILITIES" class="py-name" href="#" onclick="return doclink('link-39', '_STRING_CAPABILITIES', 'link-34');">_STRING_CAPABILITIES</a></tt><tt class="py-op">:</tt> </tt>
<a name="L118"></a><tt class="py-lineno">118</tt>  <tt class="py-line">            <tt class="py-op">(</tt><tt class="py-name">attrib</tt><tt class="py-op">,</tt> <tt class="py-name">cap_name</tt><tt class="py-op">)</tt> <tt class="py-op">=</tt> <tt class="py-name">capability</tt><tt class="py-op">.</tt><tt class="py-name">split</tt><tt class="py-op">(</tt><tt class="py-string">'='</tt><tt class="py-op">)</tt> </tt>
<a name="L119"></a><tt class="py-lineno">119</tt>  <tt class="py-line">            <tt class="py-name">setattr</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">,</tt> <tt class="py-name">attrib</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-40" class="py-name" targets="Method flumotion.extern.log.termcolor.TerminalController._tigetstr()=flumotion.extern.log.termcolor.TerminalController-class.html#_tigetstr"><a title="flumotion.extern.log.termcolor.TerminalController._tigetstr" class="py-name" href="#" onclick="return doclink('link-40', '_tigetstr', 'link-40');">_tigetstr</a></tt><tt class="py-op">(</tt><tt class="py-name">cap_name</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> <tt class="py-string">''</tt><tt class="py-op">)</tt> </tt>
<a name="L120"></a><tt class="py-lineno">120</tt>  <tt class="py-line"> </tt>
<a name="L121"></a><tt class="py-lineno">121</tt>  <tt class="py-line">        <tt class="py-comment"># Colors</tt> </tt>
<a name="L122"></a><tt class="py-lineno">122</tt>  <tt class="py-line">        <tt class="py-name">set_fg</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-41" class="py-name"><a title="flumotion.extern.log.termcolor.TerminalController._tigetstr" class="py-name" href="#" onclick="return doclink('link-41', '_tigetstr', 'link-40');">_tigetstr</a></tt><tt class="py-op">(</tt><tt class="py-string">'setf'</tt><tt class="py-op">)</tt> </tt>
<a name="L123"></a><tt class="py-lineno">123</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">set_fg</tt><tt class="py-op">:</tt> </tt>
<a name="L124"></a><tt class="py-lineno">124</tt>  <tt class="py-line">            <tt class="py-keyword">for</tt> <tt class="py-name">i</tt><tt class="py-op">,</tt> <tt class="py-name">color</tt> <tt class="py-keyword">in</tt> <tt class="py-name">zip</tt><tt class="py-op">(</tt><tt class="py-name">range</tt><tt class="py-op">(</tt><tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-42" class="py-name"><a title="flumotion.extern.log.termcolor.TerminalController._COLORS" class="py-name" href="#" onclick="return doclink('link-42', '_COLORS', 'link-35');">_COLORS</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-43" class="py-name"><a title="flumotion.extern.log.termcolor.TerminalController._COLORS" class="py-name" href="#" onclick="return doclink('link-43', '_COLORS', 'link-35');">_COLORS</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L125"></a><tt class="py-lineno">125</tt>  <tt class="py-line">                <tt class="py-name">setattr</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">,</tt> <tt class="py-name">color</tt><tt class="py-op">,</tt> <tt class="py-name">curses</tt><tt class="py-op">.</tt><tt class="py-name">tparm</tt><tt class="py-op">(</tt><tt class="py-name">set_fg</tt><tt class="py-op">,</tt> <tt class="py-name">i</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> <tt class="py-string">''</tt><tt class="py-op">)</tt> </tt>
<a name="L126"></a><tt class="py-lineno">126</tt>  <tt class="py-line">        <tt class="py-name">set_fg_ansi</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-44" class="py-name"><a title="flumotion.extern.log.termcolor.TerminalController._tigetstr" class="py-name" href="#" onclick="return doclink('link-44', '_tigetstr', 'link-40');">_tigetstr</a></tt><tt class="py-op">(</tt><tt class="py-string">'setaf'</tt><tt class="py-op">)</tt> </tt>
<a name="L127"></a><tt class="py-lineno">127</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">set_fg_ansi</tt><tt class="py-op">:</tt> </tt>
<a name="L128"></a><tt class="py-lineno">128</tt>  <tt class="py-line">            <tt class="py-keyword">for</tt> <tt class="py-name">i</tt><tt class="py-op">,</tt> <tt class="py-name">color</tt> <tt class="py-keyword">in</tt> <tt class="py-name">zip</tt><tt class="py-op">(</tt><tt class="py-name">range</tt><tt class="py-op">(</tt><tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-45" class="py-name"><a title="flumotion.extern.log.termcolor.TerminalController._ANSICOLORS" class="py-name" href="#" onclick="return doclink('link-45', '_ANSICOLORS', 'link-36');">_ANSICOLORS</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L129"></a><tt class="py-lineno">129</tt>  <tt class="py-line">                                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-46" class="py-name"><a title="flumotion.extern.log.termcolor.TerminalController._ANSICOLORS" class="py-name" href="#" onclick="return doclink('link-46', '_ANSICOLORS', 'link-36');">_ANSICOLORS</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L130"></a><tt class="py-lineno">130</tt>  <tt class="py-line">                <tt class="py-name">setattr</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">,</tt> <tt class="py-name">color</tt><tt class="py-op">,</tt> <tt class="py-name">curses</tt><tt class="py-op">.</tt><tt class="py-name">tparm</tt><tt class="py-op">(</tt><tt class="py-name">set_fg_ansi</tt><tt class="py-op">,</tt> <tt class="py-name">i</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> <tt class="py-string">''</tt><tt class="py-op">)</tt> </tt>
<a name="L131"></a><tt class="py-lineno">131</tt>  <tt class="py-line">        <tt class="py-name">set_bg</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-47" class="py-name"><a title="flumotion.extern.log.termcolor.TerminalController._tigetstr" class="py-name" href="#" onclick="return doclink('link-47', '_tigetstr', 'link-40');">_tigetstr</a></tt><tt class="py-op">(</tt><tt class="py-string">'setb'</tt><tt class="py-op">)</tt> </tt>
<a name="L132"></a><tt class="py-lineno">132</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">set_bg</tt><tt class="py-op">:</tt> </tt>
<a name="L133"></a><tt class="py-lineno">133</tt>  <tt class="py-line">            <tt class="py-keyword">for</tt> <tt class="py-name">i</tt><tt class="py-op">,</tt> <tt class="py-name">color</tt> <tt class="py-keyword">in</tt> <tt class="py-name">zip</tt><tt class="py-op">(</tt><tt class="py-name">range</tt><tt class="py-op">(</tt><tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-48" class="py-name"><a title="flumotion.extern.log.termcolor.TerminalController._COLORS" class="py-name" href="#" onclick="return doclink('link-48', '_COLORS', 'link-35');">_COLORS</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-49" class="py-name"><a title="flumotion.extern.log.termcolor.TerminalController._COLORS" class="py-name" href="#" onclick="return doclink('link-49', '_COLORS', 'link-35');">_COLORS</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L134"></a><tt class="py-lineno">134</tt>  <tt class="py-line">                <tt class="py-name">setattr</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">,</tt> <tt class="py-string">'BG_'</tt><tt class="py-op">+</tt><tt class="py-name">color</tt><tt class="py-op">,</tt> <tt class="py-name">curses</tt><tt class="py-op">.</tt><tt class="py-name">tparm</tt><tt class="py-op">(</tt><tt class="py-name">set_bg</tt><tt class="py-op">,</tt> <tt class="py-name">i</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> <tt class="py-string">''</tt><tt class="py-op">)</tt> </tt>
<a name="L135"></a><tt class="py-lineno">135</tt>  <tt class="py-line">        <tt class="py-name">set_bg_ansi</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-50" class="py-name"><a title="flumotion.extern.log.termcolor.TerminalController._tigetstr" class="py-name" href="#" onclick="return doclink('link-50', '_tigetstr', 'link-40');">_tigetstr</a></tt><tt class="py-op">(</tt><tt class="py-string">'setab'</tt><tt class="py-op">)</tt> </tt>
<a name="L136"></a><tt class="py-lineno">136</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">set_bg_ansi</tt><tt class="py-op">:</tt> </tt>
<a name="L137"></a><tt class="py-lineno">137</tt>  <tt class="py-line">            <tt class="py-keyword">for</tt> <tt class="py-name">i</tt><tt class="py-op">,</tt> <tt class="py-name">color</tt> <tt class="py-keyword">in</tt> <tt class="py-name">zip</tt><tt class="py-op">(</tt><tt class="py-name">range</tt><tt class="py-op">(</tt><tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-51" class="py-name"><a title="flumotion.extern.log.termcolor.TerminalController._ANSICOLORS" class="py-name" href="#" onclick="return doclink('link-51', '_ANSICOLORS', 'link-36');">_ANSICOLORS</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L138"></a><tt class="py-lineno">138</tt>  <tt class="py-line">                                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-52" class="py-name"><a title="flumotion.extern.log.termcolor.TerminalController._ANSICOLORS" class="py-name" href="#" onclick="return doclink('link-52', '_ANSICOLORS', 'link-36');">_ANSICOLORS</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L139"></a><tt class="py-lineno">139</tt>  <tt class="py-line">                <tt class="py-name">setattr</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">,</tt> <tt class="py-string">'BG_'</tt><tt class="py-op">+</tt><tt class="py-name">color</tt><tt class="py-op">,</tt> <tt class="py-name">curses</tt><tt class="py-op">.</tt><tt class="py-name">tparm</tt><tt class="py-op">(</tt><tt class="py-name">set_bg_ansi</tt><tt class="py-op">,</tt> <tt class="py-name">i</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> <tt class="py-string">''</tt><tt class="py-op">)</tt> </tt>
</div><a name="L140"></a><tt class="py-lineno">140</tt>  <tt class="py-line"> </tt>
<a name="TerminalController._tigetstr"></a><div id="TerminalController._tigetstr-def"><a name="L141"></a><tt class="py-lineno">141</tt> <a class="py-toggle" href="#" id="TerminalController._tigetstr-toggle" onclick="return toggle('TerminalController._tigetstr');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="flumotion.extern.log.termcolor.TerminalController-class.html#_tigetstr">_tigetstr</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">cap_name</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TerminalController._tigetstr-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="TerminalController._tigetstr-expanded"><a name="L142"></a><tt class="py-lineno">142</tt>  <tt class="py-line">        <tt class="py-comment"># String capabilities can include "delays" of the form "$&lt;2&gt;".</tt> </tt>
<a name="L143"></a><tt class="py-lineno">143</tt>  <tt class="py-line">        <tt class="py-comment"># For any modern terminal, we should be able to just ignore</tt> </tt>
<a name="L144"></a><tt class="py-lineno">144</tt>  <tt class="py-line">        <tt class="py-comment"># these, so strip them out.</tt> </tt>
<a name="L145"></a><tt class="py-lineno">145</tt>  <tt class="py-line">        <tt class="py-keyword">import</tt> <tt class="py-name">curses</tt> </tt>
<a name="L146"></a><tt class="py-lineno">146</tt>  <tt class="py-line">        <tt class="py-name">cap</tt> <tt class="py-op">=</tt> <tt class="py-name">curses</tt><tt class="py-op">.</tt><tt class="py-name">tigetstr</tt><tt class="py-op">(</tt><tt class="py-name">cap_name</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> <tt class="py-string">''</tt> </tt>
<a name="L147"></a><tt class="py-lineno">147</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">re</tt><tt class="py-op">.</tt><tt class="py-name">sub</tt><tt class="py-op">(</tt><tt class="py-string">r'\$&lt;\d+&gt;[/*]?'</tt><tt class="py-op">,</tt> <tt class="py-string">''</tt><tt class="py-op">,</tt> <tt class="py-name">cap</tt><tt class="py-op">)</tt> </tt>
</div><a name="L148"></a><tt class="py-lineno">148</tt>  <tt class="py-line"> </tt>
<a name="TerminalController.render"></a><div id="TerminalController.render-def"><a name="L149"></a><tt class="py-lineno">149</tt> <a class="py-toggle" href="#" id="TerminalController.render-toggle" onclick="return toggle('TerminalController.render');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="flumotion.extern.log.termcolor.TerminalController-class.html#render">render</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">template</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TerminalController.render-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="TerminalController.render-expanded"><a name="L150"></a><tt class="py-lineno">150</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
<a name="L151"></a><tt class="py-lineno">151</tt>  <tt class="py-line"><tt class="py-docstring">        Replace each $-substitutions in the given template string with</tt> </tt>
<a name="L152"></a><tt class="py-lineno">152</tt>  <tt class="py-line"><tt class="py-docstring">        the corresponding terminal control string (if it's defined) or</tt> </tt>
<a name="L153"></a><tt class="py-lineno">153</tt>  <tt class="py-line"><tt class="py-docstring">        '' (if it's not).</tt> </tt>
<a name="L154"></a><tt class="py-lineno">154</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L155"></a><tt class="py-lineno">155</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">re</tt><tt class="py-op">.</tt><tt class="py-name">sub</tt><tt class="py-op">(</tt><tt class="py-string">r'\$\$|\${\w+}'</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-53" class="py-name" targets="Method flumotion.extern.log.termcolor.TerminalController._render_sub()=flumotion.extern.log.termcolor.TerminalController-class.html#_render_sub"><a title="flumotion.extern.log.termcolor.TerminalController._render_sub" class="py-name" href="#" onclick="return doclink('link-53', '_render_sub', 'link-53');">_render_sub</a></tt><tt class="py-op">,</tt> <tt class="py-name">template</tt><tt class="py-op">)</tt> </tt>
</div><a name="L156"></a><tt class="py-lineno">156</tt>  <tt class="py-line"> </tt>
<a name="TerminalController._render_sub"></a><div id="TerminalController._render_sub-def"><a name="L157"></a><tt class="py-lineno">157</tt> <a class="py-toggle" href="#" id="TerminalController._render_sub-toggle" onclick="return toggle('TerminalController._render_sub');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="flumotion.extern.log.termcolor.TerminalController-class.html#_render_sub">_render_sub</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">match</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TerminalController._render_sub-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="TerminalController._render_sub-expanded"><a name="L158"></a><tt class="py-lineno">158</tt>  <tt class="py-line">        <tt class="py-name">s</tt> <tt class="py-op">=</tt> <tt class="py-name">match</tt><tt class="py-op">.</tt><tt class="py-name">group</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L159"></a><tt class="py-lineno">159</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">s</tt> <tt class="py-op">==</tt> <tt class="py-string">'$$'</tt><tt class="py-op">:</tt> </tt>
<a name="L160"></a><tt class="py-lineno">160</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-name">s</tt> </tt>
<a name="L161"></a><tt class="py-lineno">161</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L162"></a><tt class="py-lineno">162</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-name">getattr</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">,</tt> <tt class="py-name">s</tt><tt class="py-op">[</tt><tt class="py-number">2</tt><tt class="py-op">:</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
</div></div><a name="L163"></a><tt class="py-lineno">163</tt>  <tt class="py-line"> </tt>
<a name="L164"></a><tt class="py-lineno">164</tt>  <tt class="py-line"><tt class="py-comment">#######################################################################</tt> </tt>
<a name="L165"></a><tt class="py-lineno">165</tt>  <tt class="py-line"><tt class="py-comment"># Example use case: progress bar</tt> </tt>
<a name="L166"></a><tt class="py-lineno">166</tt>  <tt class="py-line"><tt class="py-comment">#######################################################################</tt> </tt>
<a name="L167"></a><tt class="py-lineno">167</tt>  <tt class="py-line"> </tt>
<a name="L168"></a><tt class="py-lineno">168</tt>  <tt class="py-line"> </tt>
<a name="ProgressBar"></a><div id="ProgressBar-def"><a name="L169"></a><tt class="py-lineno">169</tt> <a class="py-toggle" href="#" id="ProgressBar-toggle" onclick="return toggle('ProgressBar');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="flumotion.extern.log.termcolor.ProgressBar-class.html">ProgressBar</a><tt class="py-op">:</tt> </tt>
</div><div id="ProgressBar-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="ProgressBar-expanded"><a name="L170"></a><tt class="py-lineno">170</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L171"></a><tt class="py-lineno">171</tt>  <tt class="py-line"><tt class="py-docstring">    A 3-line progress bar, which looks like::</tt> </tt>
<a name="L172"></a><tt class="py-lineno">172</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L173"></a><tt class="py-lineno">173</tt>  <tt class="py-line"><tt class="py-docstring">                                Header</tt> </tt>
<a name="L174"></a><tt class="py-lineno">174</tt>  <tt class="py-line"><tt class="py-docstring">        20% [===========----------------------------------]</tt> </tt>
<a name="L175"></a><tt class="py-lineno">175</tt>  <tt class="py-line"><tt class="py-docstring">                           progress message</tt> </tt>
<a name="L176"></a><tt class="py-lineno">176</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L177"></a><tt class="py-lineno">177</tt>  <tt class="py-line"><tt class="py-docstring">    The progress bar is colored, if the terminal supports color</tt> </tt>
<a name="L178"></a><tt class="py-lineno">178</tt>  <tt class="py-line"><tt class="py-docstring">    output; and adjusts to the width of the terminal.</tt> </tt>
<a name="L179"></a><tt class="py-lineno">179</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="L180"></a><tt class="py-lineno">180</tt>  <tt class="py-line">    <tt id="link-54" class="py-name" targets="Variable flumotion.extern.log.termcolor.ProgressBar.BAR=flumotion.extern.log.termcolor.ProgressBar-class.html#BAR"><a title="flumotion.extern.log.termcolor.ProgressBar.BAR" class="py-name" href="#" onclick="return doclink('link-54', 'BAR', 'link-54');">BAR</a></tt> <tt class="py-op">=</tt> <tt class="py-string">'%3d%% ${GREEN}[${BOLD}%s%s${NORMAL}${GREEN}]${NORMAL}\n'</tt> </tt>
<a name="L181"></a><tt class="py-lineno">181</tt>  <tt class="py-line">    <tt id="link-55" class="py-name" targets="Variable flumotion.extern.log.termcolor.ProgressBar.HEADER=flumotion.extern.log.termcolor.ProgressBar-class.html#HEADER"><a title="flumotion.extern.log.termcolor.ProgressBar.HEADER" class="py-name" href="#" onclick="return doclink('link-55', 'HEADER', 'link-55');">HEADER</a></tt> <tt class="py-op">=</tt> <tt class="py-string">'${BOLD}${CYAN}%s${NORMAL}\n\n'</tt> </tt>
<a name="L182"></a><tt class="py-lineno">182</tt>  <tt class="py-line"> </tt>
<a name="ProgressBar.__init__"></a><div id="ProgressBar.__init__-def"><a name="L183"></a><tt class="py-lineno">183</tt> <a class="py-toggle" href="#" id="ProgressBar.__init__-toggle" onclick="return toggle('ProgressBar.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="flumotion.extern.log.termcolor.ProgressBar-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">term</tt><tt class="py-op">,</tt> <tt class="py-param">header</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="ProgressBar.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="ProgressBar.__init__-expanded"><a name="L184"></a><tt class="py-lineno">184</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">term</tt> <tt class="py-op">=</tt> <tt class="py-name">term</tt> </tt>
<a name="L185"></a><tt class="py-lineno">185</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">term</tt><tt class="py-op">.</tt><tt id="link-56" class="py-name"><a title="flumotion.extern.log.termcolor.TerminalController.CLEAR_EOL" class="py-name" href="#" onclick="return doclink('link-56', 'CLEAR_EOL', 'link-6');">CLEAR_EOL</a></tt> <tt class="py-keyword">and</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">term</tt><tt class="py-op">.</tt><tt id="link-57" class="py-name"><a title="flumotion.extern.log.termcolor.TerminalController.UP" class="py-name" href="#" onclick="return doclink('link-57', 'UP', 'link-1');">UP</a></tt> <tt class="py-keyword">and</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">term</tt><tt class="py-op">.</tt><tt id="link-58" class="py-name"><a title="flumotion.extern.log.termcolor.TerminalController.BOL" class="py-name" href="#" onclick="return doclink('link-58', 'BOL', 'link-0');">BOL</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L186"></a><tt class="py-lineno">186</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">ValueError</tt><tt class="py-op">(</tt><tt class="py-string">"Terminal isn't capable enough -- you "</tt> </tt>
<a name="L187"></a><tt class="py-lineno">187</tt>  <tt class="py-line">                             <tt class="py-string">"should use a simpler progress dispaly."</tt><tt class="py-op">)</tt> </tt>
<a name="L188"></a><tt class="py-lineno">188</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">width</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">term</tt><tt class="py-op">.</tt><tt id="link-59" class="py-name"><a title="flumotion.extern.log.termcolor.TerminalController.COLS" class="py-name" href="#" onclick="return doclink('link-59', 'COLS', 'link-16');">COLS</a></tt> <tt class="py-keyword">or</tt> <tt class="py-number">75</tt> </tt>
<a name="L189"></a><tt class="py-lineno">189</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">bar</tt> <tt class="py-op">=</tt> <tt class="py-name">term</tt><tt class="py-op">.</tt><tt id="link-60" class="py-name" targets="Method flumotion.component.base.admin_gtk.BaseAdminGtk.render()=flumotion.component.base.admin_gtk.BaseAdminGtk-class.html#render,Method flumotion.component.base.baseadminnode.BaseAdminGtkNode.render()=flumotion.component.base.baseadminnode.BaseAdminGtkNode-class.html#render,Method flumotion.component.bouncers.admin_gtk.KeycardsNode.render()=flumotion.component.bouncers.admin_gtk.KeycardsNode-class.html#render,Method flumotion.component.misc.httpserver.httpfile.File.render()=flumotion.component.misc.httpserver.httpfile.File-class.html#render,Method flumotion.component.producers.videotest.admin_gtk.PatternNode.render()=flumotion.component.producers.videotest.admin_gtk.PatternNode-class.html#render,Method flumotion.extern.log.termcolor.TerminalController.render()=flumotion.extern.log.termcolor.TerminalController-class.html#render,Method flumotion.twisted.rtsp.ErrorResource.render()=flumotion.twisted.rtsp.ErrorResource-class.html#render,Method flumotion.twisted.rtsp.RTSPRequest.render()=flumotion.twisted.rtsp.RTSPRequest-class.html#render"><a title="flumotion.component.base.admin_gtk.BaseAdminGtk.render
flumotion.component.base.baseadminnode.BaseAdminGtkNode.render
flumotion.component.bouncers.admin_gtk.KeycardsNode.render
flumotion.component.misc.httpserver.httpfile.File.render
flumotion.component.producers.videotest.admin_gtk.PatternNode.render
flumotion.extern.log.termcolor.TerminalController.render
flumotion.twisted.rtsp.ErrorResource.render
flumotion.twisted.rtsp.RTSPRequest.render" class="py-name" href="#" onclick="return doclink('link-60', 'render', 'link-60');">render</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-61" class="py-name"><a title="flumotion.extern.log.termcolor.ProgressBar.BAR" class="py-name" href="#" onclick="return doclink('link-61', 'BAR', 'link-54');">BAR</a></tt><tt class="py-op">)</tt> </tt>
<a name="L190"></a><tt class="py-lineno">190</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-62" class="py-name" targets="Variable flumotion.component.misc.httpserver.httpfile.FLVFile.header=flumotion.component.misc.httpserver.httpfile.FLVFile-class.html#header"><a title="flumotion.component.misc.httpserver.httpfile.FLVFile.header" class="py-name" href="#" onclick="return doclink('link-62', 'header', 'link-62');">header</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">term</tt><tt class="py-op">.</tt><tt id="link-63" class="py-name"><a title="flumotion.component.base.admin_gtk.BaseAdminGtk.render
flumotion.component.base.baseadminnode.BaseAdminGtkNode.render
flumotion.component.bouncers.admin_gtk.KeycardsNode.render
flumotion.component.misc.httpserver.httpfile.File.render
flumotion.component.producers.videotest.admin_gtk.PatternNode.render
flumotion.extern.log.termcolor.TerminalController.render
flumotion.twisted.rtsp.ErrorResource.render
flumotion.twisted.rtsp.RTSPRequest.render" class="py-name" href="#" onclick="return doclink('link-63', 'render', 'link-60');">render</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-64" class="py-name"><a title="flumotion.extern.log.termcolor.ProgressBar.HEADER" class="py-name" href="#" onclick="return doclink('link-64', 'HEADER', 'link-55');">HEADER</a></tt> <tt class="py-op">%</tt> <tt id="link-65" class="py-name"><a title="flumotion.component.misc.httpserver.httpfile.FLVFile.header" class="py-name" href="#" onclick="return doclink('link-65', 'header', 'link-62');">header</a></tt><tt class="py-op">.</tt><tt class="py-name">center</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">width</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L191"></a><tt class="py-lineno">191</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">cleared</tt> <tt class="py-op">=</tt> <tt class="py-number">1</tt> <tt class="py-comment">#: true if we haven't drawn the bar yet.</tt> </tt>
<a name="L192"></a><tt class="py-lineno">192</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-66" class="py-name" targets="Method flumotion.admin.gtk.connections.Connections.update()=flumotion.admin.gtk.connections.Connections-class.html#update,Method flumotion.common.watched.WatchedDict.update()=flumotion.common.watched.WatchedDict-class.html#update,Method flumotion.component.misc.httpserver.httpserver.StatisticsUpdater.update()=flumotion.component.misc.httpserver.httpserver.StatisticsUpdater-class.html#update,Method flumotion.extern.code.Completer.update()=flumotion.extern.code.Completer-class.html#update,Method flumotion.extern.log.termcolor.ProgressBar.update()=flumotion.extern.log.termcolor.ProgressBar-class.html#update"><a title="flumotion.admin.gtk.connections.Connections.update
flumotion.common.watched.WatchedDict.update
flumotion.component.misc.httpserver.httpserver.StatisticsUpdater.update
flumotion.extern.code.Completer.update
flumotion.extern.log.termcolor.ProgressBar.update" class="py-name" href="#" onclick="return doclink('link-66', 'update', 'link-66');">update</a></tt><tt class="py-op">(</tt><tt class="py-number">0</tt><tt class="py-op">,</tt> <tt class="py-string">''</tt><tt class="py-op">)</tt> </tt>
</div><a name="L193"></a><tt class="py-lineno">193</tt>  <tt class="py-line"> </tt>
<a name="ProgressBar.update"></a><div id="ProgressBar.update-def"><a name="L194"></a><tt class="py-lineno">194</tt> <a class="py-toggle" href="#" id="ProgressBar.update-toggle" onclick="return toggle('ProgressBar.update');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="flumotion.extern.log.termcolor.ProgressBar-class.html#update">update</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">percent</tt><tt class="py-op">,</tt> <tt class="py-param">message</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="ProgressBar.update-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="ProgressBar.update-expanded"><a name="L195"></a><tt class="py-lineno">195</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">cleared</tt><tt class="py-op">:</tt> </tt>
<a name="L196"></a><tt class="py-lineno">196</tt>  <tt class="py-line">            <tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">stdout</tt><tt class="py-op">.</tt><tt id="link-67" class="py-name" targets="Method flumotion.component.misc.httpserver.httpserver.CancellableRequest.write()=flumotion.component.misc.httpserver.httpserver.CancellableRequest-class.html#write,Method flumotion.component.misc.httpserver.ratecontrol.TokenBucketConsumer.write()=flumotion.component.misc.httpserver.ratecontrol.TokenBucketConsumer-class.html#write"><a title="flumotion.component.misc.httpserver.httpserver.CancellableRequest.write
flumotion.component.misc.httpserver.ratecontrol.TokenBucketConsumer.write" class="py-name" href="#" onclick="return doclink('link-67', 'write', 'link-67');">write</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-68" class="py-name"><a title="flumotion.component.misc.httpserver.httpfile.FLVFile.header" class="py-name" href="#" onclick="return doclink('link-68', 'header', 'link-62');">header</a></tt><tt class="py-op">)</tt> </tt>
<a name="L197"></a><tt class="py-lineno">197</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">cleared</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
<a name="L198"></a><tt class="py-lineno">198</tt>  <tt class="py-line">        <tt class="py-name">n</tt> <tt class="py-op">=</tt> <tt class="py-name">int</tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">width</tt><tt class="py-op">-</tt><tt class="py-number">10</tt><tt class="py-op">)</tt><tt class="py-op">*</tt><tt class="py-name">percent</tt><tt class="py-op">)</tt> </tt>
<a name="L199"></a><tt class="py-lineno">199</tt>  <tt class="py-line">        <tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">stdout</tt><tt class="py-op">.</tt><tt id="link-69" class="py-name"><a title="flumotion.component.misc.httpserver.httpserver.CancellableRequest.write
flumotion.component.misc.httpserver.ratecontrol.TokenBucketConsumer.write" class="py-name" href="#" onclick="return doclink('link-69', 'write', 'link-67');">write</a></tt><tt class="py-op">(</tt> </tt>
<a name="L200"></a><tt class="py-lineno">200</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">term</tt><tt class="py-op">.</tt><tt id="link-70" class="py-name"><a title="flumotion.extern.log.termcolor.TerminalController.BOL" class="py-name" href="#" onclick="return doclink('link-70', 'BOL', 'link-0');">BOL</a></tt> <tt class="py-op">+</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">term</tt><tt class="py-op">.</tt><tt id="link-71" class="py-name"><a title="flumotion.extern.log.termcolor.TerminalController.UP" class="py-name" href="#" onclick="return doclink('link-71', 'UP', 'link-1');">UP</a></tt> <tt class="py-op">+</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">term</tt><tt class="py-op">.</tt><tt id="link-72" class="py-name"><a title="flumotion.extern.log.termcolor.TerminalController.CLEAR_EOL" class="py-name" href="#" onclick="return doclink('link-72', 'CLEAR_EOL', 'link-6');">CLEAR_EOL</a></tt> <tt class="py-op">+</tt> </tt>
<a name="L201"></a><tt class="py-lineno">201</tt>  <tt class="py-line">            <tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">bar</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-number">100</tt><tt class="py-op">*</tt><tt class="py-name">percent</tt><tt class="py-op">,</tt> <tt class="py-string">'='</tt><tt class="py-op">*</tt><tt class="py-name">n</tt><tt class="py-op">,</tt> <tt class="py-string">'-'</tt><tt class="py-op">*</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">width</tt><tt class="py-op">-</tt><tt class="py-number">10</tt><tt class="py-op">-</tt><tt class="py-name">n</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> <tt class="py-op">+</tt> </tt>
<a name="L202"></a><tt class="py-lineno">202</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">term</tt><tt class="py-op">.</tt><tt id="link-73" class="py-name"><a title="flumotion.extern.log.termcolor.TerminalController.CLEAR_EOL" class="py-name" href="#" onclick="return doclink('link-73', 'CLEAR_EOL', 'link-6');">CLEAR_EOL</a></tt> <tt class="py-op">+</tt> <tt id="link-74" class="py-name" targets="Method flumotion.admin.gtk.dialogs.ProgressDialog.message()=flumotion.admin.gtk.dialogs.ProgressDialog-class.html#message,Module flumotion.admin.gtk.message=flumotion.admin.gtk.message-module.html"><a title="flumotion.admin.gtk.dialogs.ProgressDialog.message
flumotion.admin.gtk.message" class="py-name" href="#" onclick="return doclink('link-74', 'message', 'link-74');">message</a></tt><tt class="py-op">.</tt><tt class="py-name">center</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">width</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
</div><a name="L203"></a><tt class="py-lineno">203</tt>  <tt class="py-line"> </tt>
<a name="ProgressBar.clear"></a><div id="ProgressBar.clear-def"><a name="L204"></a><tt class="py-lineno">204</tt> <a class="py-toggle" href="#" id="ProgressBar.clear-toggle" onclick="return toggle('ProgressBar.clear');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="flumotion.extern.log.termcolor.ProgressBar-class.html#clear">clear</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="ProgressBar.clear-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="ProgressBar.clear-expanded"><a name="L205"></a><tt class="py-lineno">205</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">cleared</tt><tt class="py-op">:</tt> </tt>
<a name="L206"></a><tt class="py-lineno">206</tt>  <tt class="py-line">            <tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">stdout</tt><tt class="py-op">.</tt><tt id="link-75" class="py-name"><a title="flumotion.component.misc.httpserver.httpserver.CancellableRequest.write
flumotion.component.misc.httpserver.ratecontrol.TokenBucketConsumer.write" class="py-name" href="#" onclick="return doclink('link-75', 'write', 'link-67');">write</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">term</tt><tt class="py-op">.</tt><tt id="link-76" class="py-name"><a title="flumotion.extern.log.termcolor.TerminalController.BOL" class="py-name" href="#" onclick="return doclink('link-76', 'BOL', 'link-0');">BOL</a></tt> <tt class="py-op">+</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">term</tt><tt class="py-op">.</tt><tt id="link-77" class="py-name"><a title="flumotion.extern.log.termcolor.TerminalController.CLEAR_EOL" class="py-name" href="#" onclick="return doclink('link-77', 'CLEAR_EOL', 'link-6');">CLEAR_EOL</a></tt> <tt class="py-op">+</tt> </tt>
<a name="L207"></a><tt class="py-lineno">207</tt>  <tt class="py-line">                             <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">term</tt><tt class="py-op">.</tt><tt id="link-78" class="py-name"><a title="flumotion.extern.log.termcolor.TerminalController.UP" class="py-name" href="#" onclick="return doclink('link-78', 'UP', 'link-1');">UP</a></tt> <tt class="py-op">+</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">term</tt><tt class="py-op">.</tt><tt id="link-79" class="py-name"><a title="flumotion.extern.log.termcolor.TerminalController.CLEAR_EOL" class="py-name" href="#" onclick="return doclink('link-79', 'CLEAR_EOL', 'link-6');">CLEAR_EOL</a></tt> <tt class="py-op">+</tt> </tt>
<a name="L208"></a><tt class="py-lineno">208</tt>  <tt class="py-line">                             <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">term</tt><tt class="py-op">.</tt><tt id="link-80" class="py-name"><a title="flumotion.extern.log.termcolor.TerminalController.UP" class="py-name" href="#" onclick="return doclink('link-80', 'UP', 'link-1');">UP</a></tt> <tt class="py-op">+</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">term</tt><tt class="py-op">.</tt><tt id="link-81" class="py-name"><a title="flumotion.extern.log.termcolor.TerminalController.CLEAR_EOL" class="py-name" href="#" onclick="return doclink('link-81', 'CLEAR_EOL', 'link-6');">CLEAR_EOL</a></tt><tt class="py-op">)</tt> </tt>
<a name="L209"></a><tt class="py-lineno">209</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">cleared</tt> <tt class="py-op">=</tt> <tt class="py-number">1</tt> </tt>
</div></div><a name="L210"></a><tt class="py-lineno">210</tt>  <tt class="py-line"> </tt>
<a name="L211"></a><tt class="py-lineno">211</tt>  <tt class="py-line"><tt class="py-keyword">if</tt> <tt id="link-82" class="py-name" targets="Variable flumotion.admin.assistant.interfaces.IEncoderPlugin.__name__=flumotion.admin.assistant.interfaces.IEncoderPlugin-class.html#__name__,Variable flumotion.admin.assistant.interfaces.IHTTPConsumerPlugin.__name__=flumotion.admin.assistant.interfaces.IHTTPConsumerPlugin-class.html#__name__,Variable flumotion.admin.assistant.interfaces.IProducerPlugin.__name__=flumotion.admin.assistant.interfaces.IProducerPlugin-class.html#__name__,Variable flumotion.admin.assistant.interfaces.IScenarioAssistantPlugin.__name__=flumotion.admin.assistant.interfaces.IScenarioAssistantPlugin-class.html#__name__,Variable flumotion.common.interfaces.IAdminMedium.__name__=flumotion.common.interfaces.IAdminMedium-class.html#__name__,Variable flumotion.common.interfaces.IComponentMedium.__name__=flumotion.common.interfaces.IComponentMedium-class.html#__name__,Variable flumotion.common.interfaces.IDirectory.__name__=flumotion.common.interfaces.IDirectory-class.html#__name__,Variable flumotion.common.interfaces.IFeedMedium.__name__=flumotion.common.interfaces.IFeedMedium-class.html#__name__,Variable flumotion.common.interfaces.IFeedServerParent.__name__=flumotion.common.interfaces.IFeedServerParent-class.html#__name__,Variable flumotion.common.interfaces.IFile.__name__=flumotion.common.interfaces.IFile-class.html#__name__,Variable flumotion.common.interfaces.IHeaven.__name__=flumotion.common.interfaces.IHeaven-class.html#__name__,Variable flumotion.common.interfaces.IJobMedium.__name__=flumotion.common.interfaces.IJobMedium-class.html#__name__,Variable flumotion.common.interfaces.IMedium.__name__=flumotion.common.interfaces.IMedium-class.html#__name__,Variable flumotion.common.interfaces.IPorterMedium.__name__=flumotion.common.interfaces.IPorterMedium-class.html#__name__,Variable flumotion.common.interfaces.IStreamingComponent.__name__=flumotion.common.interfaces.IStreamingComponent-class.html#__name__,Variable flumotion.common.interfaces.IWorkerMedium.__name__=flumotion.common.interfaces.IWorkerMedium-class.html#__name__,Variable flumotion.common.server.IServable.__name__=flumotion.common.server.IServable-class.html#__name__,Variable flumotion.twisted.credentials.IHTTPGetArguments.__name__=flumotion.twisted.credentials.IHTTPGetArguments-class.html#__name__,Variable flumotion.twisted.credentials.IToken.__name__=flumotion.twisted.credentials.IToken-class.html#__name__,Variable flumotion.twisted.credentials.IUsernameCryptPassword.__name__=flumotion.twisted.credentials.IUsernameCryptPassword-class.html#__name__,Variable flumotion.twisted.credentials.IUsernameSha256Password.__name__=flumotion.twisted.credentials.IUsernameSha256Password-class.html#__name__,Variable flumotion.twisted.flavors.IStateListener.__name__=flumotion.twisted.flavors.IStateListener-class.html#__name__,Variable twisted.web.resource.IResource.__name__=twisted.web.resource.IResource-class.html#__name__"><a title="flumotion.admin.assistant.interfaces.IEncoderPlugin.__name__
flumotion.admin.assistant.interfaces.IHTTPConsumerPlugin.__name__
flumotion.admin.assistant.interfaces.IProducerPlugin.__name__
flumotion.admin.assistant.interfaces.IScenarioAssistantPlugin.__name__
flumotion.common.interfaces.IAdminMedium.__name__
flumotion.common.interfaces.IComponentMedium.__name__
flumotion.common.interfaces.IDirectory.__name__
flumotion.common.interfaces.IFeedMedium.__name__
flumotion.common.interfaces.IFeedServerParent.__name__
flumotion.common.interfaces.IFile.__name__
flumotion.common.interfaces.IHeaven.__name__
flumotion.common.interfaces.IJobMedium.__name__
flumotion.common.interfaces.IMedium.__name__
flumotion.common.interfaces.IPorterMedium.__name__
flumotion.common.interfaces.IStreamingComponent.__name__
flumotion.common.interfaces.IWorkerMedium.__name__
flumotion.common.server.IServable.__name__
flumotion.twisted.credentials.IHTTPGetArguments.__name__
flumotion.twisted.credentials.IToken.__name__
flumotion.twisted.credentials.IUsernameCryptPassword.__name__
flumotion.twisted.credentials.IUsernameSha256Password.__name__
flumotion.twisted.flavors.IStateListener.__name__
twisted.web.resource.IResource.__name__" class="py-name" href="#" onclick="return doclink('link-82', '__name__', 'link-82');">__name__</a></tt> <tt class="py-op">==</tt> <tt class="py-string">'__main__'</tt><tt class="py-op">:</tt> </tt>
<a name="L212"></a><tt class="py-lineno">212</tt>  <tt class="py-line">    <tt class="py-name">term</tt> <tt class="py-op">=</tt> <tt id="link-83" class="py-name" targets="Class flumotion.extern.log.termcolor.TerminalController=flumotion.extern.log.termcolor.TerminalController-class.html"><a title="flumotion.extern.log.termcolor.TerminalController" class="py-name" href="#" onclick="return doclink('link-83', 'TerminalController', 'link-83');">TerminalController</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L213"></a><tt class="py-lineno">213</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-name">term</tt><tt class="py-op">.</tt><tt id="link-84" class="py-name"><a title="flumotion.component.base.admin_gtk.BaseAdminGtk.render
flumotion.component.base.baseadminnode.BaseAdminGtkNode.render
flumotion.component.bouncers.admin_gtk.KeycardsNode.render
flumotion.component.misc.httpserver.httpfile.File.render
flumotion.component.producers.videotest.admin_gtk.PatternNode.render
flumotion.extern.log.termcolor.TerminalController.render
flumotion.twisted.rtsp.ErrorResource.render
flumotion.twisted.rtsp.RTSPRequest.render" class="py-name" href="#" onclick="return doclink('link-84', 'render', 'link-60');">render</a></tt><tt class="py-op">(</tt><tt class="py-string">'${BOLD}${RED}Error:${NORMAL}'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-string">'paper is ripped'</tt> </tt>
<a name="L214"></a><tt class="py-lineno">214</tt>  <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Sun Sep 13 13:14:34 2009
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>