add python file to the demo

This commit is contained in:
Fabian Jakobs 2010-12-10 17:26:14 +01:00
commit 5224b0cf97
2 changed files with 23 additions and 20 deletions

View file

@ -87,6 +87,7 @@
<option value="js">JS Document</option> <option value="js">JS Document</option>
<option value="html">HTML Document</option> <option value="html">HTML Document</option>
<option value="css">CSS Document</option> <option value="css">CSS Document</option>
<option value="python">Python Document</option>
</select> </select>
</td> </td>
<td> <td>
@ -97,6 +98,7 @@
<option value="xml">XML</option> <option value="xml">XML</option>
<option value="html">HTML</option> <option value="html">HTML</option>
<option value="css">CSS</option> <option value="css">CSS</option>
<option value="python">Python</option>
</select> </select>
</td> </td>
<td> <td>
@ -136,8 +138,7 @@
font-family: Monaco, "Courier New", monospace; font-family: Monaco, "Courier New", monospace;
font-size: 12px; font-size: 12px;
cursor: text; cursor: text;
} }</script>
</script>
<script type="text/editor" id="htmltext"><html> <script type="text/editor" id="htmltext"><html>
<head> <head>
@ -154,27 +155,29 @@
<body> <body>
<h1 style="color:red">Juhu Kinners</h1> <h1 style="color:red">Juhu Kinners</h1>
</body> </body>
</html> </html></script>
<script type="text/editor" id="pythontext">#!/usr/local/bin/python
import string, sys
# If no arguments were given, print a helpful message
if len(sys.argv)==1:
print 'Usage: celsius temp1 temp2 ...'
sys.exit(0)
# Loop over the arguments
for i in sys.argv[1:]:
try:
fahrenheit=float(string.atoi(i))
except string.atoi_error:
print repr(i), "not a numeric value"
else:
celsius=(fahrenheit-32)*5.0/9.0
print '%i\260F = %i\260C' % (int(fahrenheit), int(celsius+.5))
</script> </script>
<script type="text/editor" id="pythontext"> <input id="cockpit" type="text"/>
</style>
</head>
<body>
<h1 style="color:red">Juhu Kinners</h1>
</body>
</html>
</script>
</head>
<body>
<h1 style="color:red">Juhu Kinners</h1>
</body>
</html>
</script>
<input id=cockpit type=text/>
</body> </body>
</html> </html>

View file

@ -62,7 +62,7 @@ var ScrollBar = function(parent) {
oop.implement(this, EventEmitter); oop.implement(this, EventEmitter);
this.onScroll = function() { this.onScroll = function() {
this.$dispatchEvent("scroll", {data: this.element.scrollTop}); this._dispatchEvent("scroll", {data: this.element.scrollTop});
}; };
this.getWidth = function() { this.getWidth = function() {