Skip to content

Commit 11a5780

Browse files
committed
init commit
1 parent fc74b93 commit 11a5780

14 files changed

+2660
-0
lines changed

templates/404.html

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{% extends "header.html" %}
2+
{% block body %}
3+
4+
5+
6+
<body class="body">
7+
8+
<!--<div class="list-group">
9+
<a href="#" class="list-group-item active">
10+
<h3 style="color:#FFF">Beginner to advanced Python tutorials, your way.</h3>
11+
12+
</a>
13+
</div>-->
14+
15+
16+
17+
<div class="container" align="left">
18+
<img src="{{ url_for('static', filename='images/404-snake.png') }}">
19+
20+
</div>
21+
<div class="container" align="left">
22+
23+
<h4>Page Not Found</h4>
24+
<p>The requested URL was not found on this server.</p>
25+
26+
<p>PythonProgramming.net was just re-written, so maybe the URL path was not correctly transferred! You can try searching for it by going to the "start learning" button and browsing.</p>
27+
28+
<p>This error has been logged and will be reviewed. Feel free to contact [email protected] if you want the proper link.</p>
29+
<p><a class="btn btn-primary btn-lg" onclick="goBack()" role="button">Go Back!</a></p>
30+
31+
</div>
32+
33+
34+
35+
36+
37+
38+
39+
</body>
40+
{% endblock %}
41+

templates/_formhelpers.html

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{% macro render_field(field) %}
2+
<dt>{{ field.label }}
3+
<dd>{{ field(**kwargs)|safe }}
4+
{% if field.errors %}
5+
<ul class=errors>
6+
{% for error in field.errors %}
7+
<li>{{ error }}</li>
8+
{% endfor %}
9+
</ul>
10+
{% endif %}
11+
</dd>
12+
{% endmacro %}

templates/brythoneditor.html

+167
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
2+
<!DOCTYPE html>
3+
<html>
4+
<head>
5+
<meta charset="utf-8">
6+
<title>Brython Editor</title>
7+
<link rel="stylesheet" href="http://brython.info/doc/doc_brython.css">
8+
<link rel="stylesheet" href="http://brython.info/tests/console.css">
9+
<link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet" media="screen">
10+
11+
<script type="text/javascript" src="http://brython.info/src/brython_builtins.js"></script>
12+
<script type="text/javascript" src="http://brython.info/src/version_info.js"></script>
13+
<script type="text/javascript" src="http://brython.info/src/identifiers_re.js"></script>
14+
<script type="text/javascript" src="http://brython.info/src/py2js.js"></script>
15+
<script type="text/javascript" src="http://brython.info/src/py_object.js"></script>
16+
<script type="text/javascript" src="http://brython.info/src/py_type.js"></script>
17+
<script type="text/javascript" src="http://brython.info/src/py_utils.js"></script>
18+
<script type="text/javascript" src="http://brython.info/src/py_generator.js"></script>
19+
<script type="text/javascript" src="http://brython.info/src/py_builtin_functions.js"></script>
20+
<script type="text/javascript" src="http://brython.info/src/py_bytes.js"></script>
21+
<script type="text/javascript" src="http://brython.info/src/py_set.js"></script>
22+
<script type="text/javascript" src="http://brython.info/src/js_objects.js"></script>
23+
<script type="text/javascript" src="http://brython.info/src/stdlib_paths.js"></script>
24+
<script type="text/javascript" src="http://brython.info/src/py_import.js"></script>
25+
26+
<script type="text/javascript" src="http://brython.info/src/py_string.js"></script>
27+
<script type="text/javascript" src="http://brython.info/src/py_int.js"></script>
28+
<script type="text/javascript" src="http://brython.info/src/py_float.js"></script>
29+
<script type="text/javascript" src="http://brython.info/src/py_complex.js"></script>
30+
<script type="text/javascript" src="http://brython.info/src/py_dict.js"></script>
31+
<script type="text/javascript" src="http://brython.info/src/py_list.js"></script>
32+
<script type="text/javascript" src="http://brython.info/src/py_dom.js"></script>
33+
34+
<script type="text/javascript" src="http://brython.info/src/py_VFS.js"></script>
35+
36+
<script src="http://brython.info/tests/ace/ace.js" type="text/javascript" charset="utf-8"></script>
37+
<script src="http://brython.info/tests/ace/ext-language_tools.js" type="text/javascript" charset="utf-8"></script>
38+
<script src="http://brython.info/tests/ace/mode-python3.js" type="text/javascript" charset="utf-8"></script>
39+
<script src="http://brython.info/tests/ace/snippets/python.js" type="text/javascript" charset="utf-8"></script>
40+
41+
42+
43+
<script src="http://brython.info/src/brython_dist.js"></script>
44+
45+
<script type="text/python3" src="{{ url_for('static', filename='editor.py') }}"></script>
46+
47+
<script type="text/python3">
48+
from browser import document as doc
49+
from browser import html
50+
import header
51+
52+
qs_lang,language = header.show('../')
53+
54+
# other translations
55+
56+
trans = {
57+
'report_bugs':{'en':'Please report bugs in the ',
58+
'es':'Poner los bugs en el ',
59+
'fr':"Signalez les bugs dans l'"},
60+
'test_page':{'en':'Tests page','es':'P&aacute;gina de pruebas','fr':'Page de tests'},
61+
'run':{'en':'run','es':'ejecutar','fr':'ex?cuter'},
62+
'clear':{'en':'clear','es':'borrar','fr':'effacer'}
63+
}
64+
65+
for key in trans:
66+
if key in doc:
67+
doc[key].html = trans[key].get(language,trans[key]['en'])
68+
69+
# link to test page
70+
71+
if qs_lang:
72+
tplink.href += '?lang=%s' %qs_lang
73+
74+
def set_debug(ev):
75+
pass
76+
77+
78+
79+
# bindings
80+
81+
82+
83+
# next functions are defined in editor.py
84+
85+
doc['run'].bind('click',run)
86+
87+
88+
# erase "main" div
89+
def clear_main(ev):
90+
doc['main'].text = ''
91+
92+
main_content = 'Zone with id="main" ; use it to test interaction with DOM elements'
93+
94+
# add "main" div
95+
def add_main(ev):
96+
global main_content
97+
try:
98+
# if "main" div already exists, save content and erase container
99+
main_content = doc["main"].html
100+
doc["main_container"].html = ""
101+
doc["add_main"].text = 'Show "main" div'
102+
except KeyError:
103+
t = html.TABLE()
104+
row = html.TR()
105+
b = html.BUTTON('Clear')
106+
b.bind('click', clear_main)
107+
row <= html.TD(b)+html.TD(html.DIV(Id="main"))
108+
t <= row
109+
doc["main_container"] <= t
110+
doc["main"].html = main_content
111+
doc["add_main"].text = 'Hide "main" div'
112+
113+
114+
115+
</script>
116+
117+
<script>
118+
function run_js(){
119+
var cons = document.getElementById("console")
120+
var jscode = cons.value
121+
var t0 = (new Date()).getTime()
122+
eval(jscode)
123+
var t1 = (new Date()).getTime()
124+
console.log("Javascript code run in "+(t1-t0)+" ms")
125+
}
126+
</script>
127+
</head>
128+
<body onload="brython({debug:1, cache:'version'})">
129+
130+
<table id="banner" cellpadding=0 cellspacing=0>
131+
<tr id="banner_row">
132+
</tr>
133+
</table>
134+
135+
136+
<div id="container-fluid">
137+
<div id="container">
138+
<div id="left-div">
139+
<div style="padding: 3px 3px 3px 3px;">
140+
<button type="button" class="btn btn-success" id="run"><span class="glyphicon glyphicon-play-circle" aria-hidden="true"></span> Run</button>
141+
142+
</div>
143+
<div id="editor"></div>
144+
</div>
145+
146+
<div id="right-div">
147+
<div style="padding: 3px 3px 3px 3px;">
148+
<div style="float:left">
149+
<h4><span class="label label-default">Output:</span></h4>
150+
</div>
151+
152+
153+
</div>
154+
<div style="width:100%;height:100%;">
155+
<textarea id="console"></textarea>
156+
<div id="footer"><p style="font-size:75%">Python 3 editor created with <a href="http://brython.info/" target="_blank">Brython</a></p></div>
157+
</div>
158+
159+
</div>
160+
</div>
161+
</div>
162+
163+
164+
165+
166+
</body>
167+
</html>

0 commit comments

Comments
 (0)