Package envi :: Package qt :: Module html
[hide private]
[frames] | no frames]

Source Code for Module envi.qt.html

  1  '''
 
  2  The envi.qt.html module contains the HTML template and javascript
 
  3  code used by the renderers (which are based on QtWebKit)
 
  4  ''' 
  5  
 
  6  template = '''
 
  7  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
  8  <html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg" id="mainhtml">
 
  9  <head></head>
 
 10  
 
 11  <style type="text/css">
 
 12  
 
 13  body {
 
 14      color: #00ff00;
 
 15      background-color: #000000;
 
 16      font: 10pt Monospace;
 
 17  }
 
 18  
 
 19  div.memcanvas {
 
 20      color: #00ff00;
 
 21      background-color: #000000;
 
 22  }
 
 23  
 
 24  div.codeblock {
 
 25      color: #00ff00;
 
 26      background-color: #000000;
 
 27      border: 2px solid #00ff00;
 
 28      display: inline-block;
 
 29  }
 
 30  
 
 31  div.codeblock:hover {
 
 32      border: 2px solid #ff0000;
 
 33  }
 
 34  
 
 35  mnemonic {
 
 36      color: #ffff00;
 
 37      background-color: #000000;
 
 38  }
 
 39  
 
 40  va {
 
 41      color: #4040ff;
 
 42      background-color: #000000;
 
 43  }
 
 44  
 
 45  va:hover {
 
 46      font-weight: 900;
 
 47  }
 
 48  
 
 49  name {
 
 50      color: #00ff00;
 
 51      background-color: #000000;
 
 52  }
 
 53  
 
 54  registers {
 
 55      color: #ff0000;
 
 56      background-color: #000000;
 
 57  }
 
 58  
 
 59  </style>
 
 60  
 
 61  <style type="text/css" id="cmapstyle">
 
 62  </style>
 
 63  
 
 64  <script language="javascript">
 
 65  <![CDATA[
 
 66  
 
 67  function colorCssClass(seltext, color, bgcolor) {
 
 68  
 
 69      var i = 0;
 
 70      var myrules = document.styleSheets[0].cssRules;
 
 71  
 
 72      seltext = seltext.toLowerCase();
 
 73  
 
 74      // Attempt to find the matching rule.
 
 75      for ( i = 0; i < myrules.length; i++) {
 
 76  
 
 77          if( myrules[i].selectorText.toLowerCase() == seltext) {
 
 78              myrules[i].style.color = color;
 
 79              myrules[i].style.backgroundColor = bgcolor;
 
 80              return;
 
 81          }
 
 82  
 
 83      }
 
 84  
 
 85      // If we get here, there is no rule for just that tag yet...
 
 86      var rule = seltext + " { color: " + color + "; background-color: " + bgcolor + "; }";
 
 87      document.styleSheets[0].insertRule(rule, 0);
 
 88  }
 
 89  
 
 90  function getStyleProp(elem, cssprop) {
 
 91      return document.defaultView.getComputedStyle(elem, "").getPropertyValue(cssprop);
 
 92  }
 
 93  
 
 94  function swapColors(elem) {
 
 95      var cssname = elem.tagName + '.' + elem.className;
 
 96      var fgcolor = getStyleProp(elem, 'color');
 
 97      var bgcolor = getStyleProp(elem, 'background-color');
 
 98      colorCssClass(cssname, bgcolor, fgcolor);
 
 99  }
 
100  
 
101  var curname = null;
 
102  function nameclick(elem) {
 
103      if (curname != null) {
 
104          swapColors(curname);
 
105      }
 
106      swapColors(elem);
 
107      curname = elem;
 
108  }
 
109  
 
110  var curva = null;
 
111  function vaclick(elem) {
 
112      if (curva != null) {
 
113          swapColors(curva);
 
114      }
 
115      swapColors(elem);
 
116      curva = elem;
 
117  
 
118      var vastr = elem.className.split("_", 2)[1];
 
119      vnav._jsSetCurVa(vastr)
 
120  }
 
121  
 
122  function vagoto(elem) {
 
123      var vastr = elem.className.split("_", 2)[1];
 
124      vnav._jsGotoExpr(vastr);
 
125  }
 
126  
 
127  
 
128  ]]>
 
129  </script>
 
130  
 
131  <body id="vbody" width="999px">
 
132  
 
133  <div class="memcanvas" id="memcanvas">
 
134  </div>
 
135  
 
136  </body>
 
137  
 
138  </html>
 
139  ''' 
140