Moved from php to python
This commit is contained in:
		
							parent
							
								
									35a8522088
								
							
						
					
					
						commit
						925f6bab74
					
				
							
								
								
									
										13
									
								
								.htaccess
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								.htaccess
									
									
									
									
									
								
							@ -1 +1,12 @@
 | 
			
		||||
php_value include_path 'include'
 | 
			
		||||
AddHandler cgi-script .py
 | 
			
		||||
Options +ExecCGI
 | 
			
		||||
 | 
			
		||||
DirectoryIndex index.py
 | 
			
		||||
 | 
			
		||||
ErrorDocument 403 /errors/403/
 | 
			
		||||
ErrorDocument 404 /errors/404/
 | 
			
		||||
 | 
			
		||||
<Files "index.html">
 | 
			
		||||
    Order Allow,Deny
 | 
			
		||||
    Deny from all
 | 
			
		||||
</Files>
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										8
									
								
								bouncing/index.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								bouncing/index.html
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,8 @@
 | 
			
		||||
        <section>
 | 
			
		||||
            <h2>Bouncing cube</h2>
 | 
			
		||||
            <p>
 | 
			
		||||
                Click on the cube to make it jump !
 | 
			
		||||
            </p>
 | 
			
		||||
            <div id="container"></div>
 | 
			
		||||
#
 | 
			
		||||
        </section>
 | 
			
		||||
@ -1,18 +0,0 @@
 | 
			
		||||
<?php include_once("header_functions.php"); ?>
 | 
			
		||||
<!doctype html>
 | 
			
		||||
<html>
 | 
			
		||||
    <?php head("Bouncing cube"); ?>
 | 
			
		||||
    <body>
 | 
			
		||||
        <?php include("header.php"); ?>
 | 
			
		||||
        <?php include("nav.php"); ?>
 | 
			
		||||
        <section>
 | 
			
		||||
            <h2>Bouncing cube</h2>
 | 
			
		||||
            <p>
 | 
			
		||||
                Click on the cube to make it jump !
 | 
			
		||||
            </p>
 | 
			
		||||
            <div id="container"></div>
 | 
			
		||||
        </section>
 | 
			
		||||
        <?php include("jsIncludes.php"); ?>
 | 
			
		||||
        <script src="js/BouncingMain.js"></script>
 | 
			
		||||
    </body>
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										28
									
								
								bouncing/index.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										28
									
								
								bouncing/index.py
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,28 @@
 | 
			
		||||
#!/usr/bin/python
 | 
			
		||||
# -*- coding: utf-8 -*-
 | 
			
		||||
 | 
			
		||||
import sys
 | 
			
		||||
from webtools import Web
 | 
			
		||||
 | 
			
		||||
def main():
 | 
			
		||||
    print('Content-type: text/html')
 | 
			
		||||
    print()
 | 
			
		||||
 | 
			
		||||
    page = Web.Element(Web.ROOT_DIR + 'templates/page.html')
 | 
			
		||||
    head = Web.Element(Web.ROOT_DIR + 'templates/head.html')
 | 
			
		||||
    body = Web.Element(Web.ROOT_DIR + 'templates/body.html')
 | 
			
		||||
    jsIncludes = Web.Element(Web.ROOT_DIR + 'templates/jsIncludes.html')
 | 
			
		||||
    mainJs = Web.Element()
 | 
			
		||||
    mainJs.open_string = '        <script src="js/BouncingMain.js"></script>'
 | 
			
		||||
    content = Web.Element('index.html')
 | 
			
		||||
 | 
			
		||||
    page.add_child(head)
 | 
			
		||||
    page.add_child(body)
 | 
			
		||||
    body.add_child(content)
 | 
			
		||||
    body.add_child(jsIncludes)
 | 
			
		||||
    jsIncludes.add_child(mainJs)
 | 
			
		||||
 | 
			
		||||
    page.print()
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
    main()
 | 
			
		||||
							
								
								
									
										10
									
								
								errors/403/index.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								errors/403/index.html
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,10 @@
 | 
			
		||||
        <section>
 | 
			
		||||
            <h2>Error 403</h2>
 | 
			
		||||
            <p>
 | 
			
		||||
                You're not supposed to be here :o
 | 
			
		||||
            </p>
 | 
			
		||||
            <p>
 | 
			
		||||
                Please go back to the <a href="/">index</a> or wherever you want...
 | 
			
		||||
            </p>
 | 
			
		||||
#
 | 
			
		||||
        </section>
 | 
			
		||||
							
								
								
									
										23
									
								
								errors/403/index.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										23
									
								
								errors/403/index.py
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,23 @@
 | 
			
		||||
#!/usr/bin/python
 | 
			
		||||
# -*- coding: utf-8 -*-
 | 
			
		||||
 | 
			
		||||
import sys
 | 
			
		||||
from webtools import Web
 | 
			
		||||
 | 
			
		||||
def main():
 | 
			
		||||
    print('Content-type: text/html')
 | 
			
		||||
    print()
 | 
			
		||||
 | 
			
		||||
    page = Web.Element(Web.ROOT_DIR + 'templates/page.html')
 | 
			
		||||
    head = Web.Element(Web.ROOT_DIR + 'templates/head.html')
 | 
			
		||||
    body = Web.Element(Web.ROOT_DIR + 'templates/body.html')
 | 
			
		||||
    content = Web.Element('index.html')
 | 
			
		||||
 | 
			
		||||
    page.add_child(head)
 | 
			
		||||
    page.add_child(body)
 | 
			
		||||
    body.add_child(content)
 | 
			
		||||
 | 
			
		||||
    page.print()
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
    main()
 | 
			
		||||
							
								
								
									
										10
									
								
								errors/404/index.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								errors/404/index.html
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,10 @@
 | 
			
		||||
        <section>
 | 
			
		||||
            <h2>Error 404</h2>
 | 
			
		||||
            <p>
 | 
			
		||||
                The page you requested was not found... this is annoying :s
 | 
			
		||||
            </p>
 | 
			
		||||
            <p>
 | 
			
		||||
                You can go back to the <a href="/">index</a> or wherever you want...
 | 
			
		||||
            </p>
 | 
			
		||||
#
 | 
			
		||||
        </section>
 | 
			
		||||
							
								
								
									
										23
									
								
								errors/404/index.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										23
									
								
								errors/404/index.py
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,23 @@
 | 
			
		||||
#!/usr/bin/python
 | 
			
		||||
# -*- coding: utf-8 -*-
 | 
			
		||||
 | 
			
		||||
import sys
 | 
			
		||||
from webtools import Web
 | 
			
		||||
 | 
			
		||||
def main():
 | 
			
		||||
    print('Content-type: text/html')
 | 
			
		||||
    print()
 | 
			
		||||
 | 
			
		||||
    page = Web.Element(Web.ROOT_DIR + 'templates/page.html')
 | 
			
		||||
    head = Web.Element(Web.ROOT_DIR + 'templates/head.html')
 | 
			
		||||
    body = Web.Element(Web.ROOT_DIR + 'templates/body.html')
 | 
			
		||||
    content = Web.Element('index.html')
 | 
			
		||||
 | 
			
		||||
    page.add_child(head)
 | 
			
		||||
    page.add_child(body)
 | 
			
		||||
    body.add_child(content)
 | 
			
		||||
 | 
			
		||||
    page.print()
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
    main()
 | 
			
		||||
							
								
								
									
										4571
									
								
								img/python-powered.svg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4571
									
								
								img/python-powered.svg
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| 
		 After Width: | Height: | Size: 172 KiB  | 
@ -1,5 +0,0 @@
 | 
			
		||||
 | 
			
		||||
        <header>
 | 
			
		||||
            <h1 id="title">Welcome !</h1>
 | 
			
		||||
        </header>
 | 
			
		||||
 | 
			
		||||
@ -1,12 +0,0 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
    function head($title = "Title")
 | 
			
		||||
    {
 | 
			
		||||
        echo "\n\t<head>\n";
 | 
			
		||||
        echo "\t\t<title>The begining - " . $title . "</title>\n";
 | 
			
		||||
        echo "\t\t<meta charset='utf-8' />\n";
 | 
			
		||||
        echo "\t\t<link rel=\"stylesheet\" href=\"http://fonts.googleapis.com/css?family=Ubuntu:400,700,400italic\" />\n";
 | 
			
		||||
        echo "\t\t<link rel=\"stylesheet\" href=\"/css/style.css\" />\n";
 | 
			
		||||
        echo "\t</head>\n\n";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -1,10 +1,3 @@
 | 
			
		||||
<?php include_once("header_functions.php"); ?>
 | 
			
		||||
<!doctype html>
 | 
			
		||||
<html>
 | 
			
		||||
    <?php head("Index"); ?>
 | 
			
		||||
    <body>
 | 
			
		||||
        <?php include("header.php"); ?>
 | 
			
		||||
        <?php include("nav.php"); ?>
 | 
			
		||||
        <section>
 | 
			
		||||
            <h2>Index</h2>
 | 
			
		||||
            <ul>
 | 
			
		||||
@ -46,6 +39,5 @@
 | 
			
		||||
                    </p>
 | 
			
		||||
                </li>
 | 
			
		||||
            </ul>
 | 
			
		||||
#
 | 
			
		||||
        </section>
 | 
			
		||||
    </body>
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										23
									
								
								index.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										23
									
								
								index.py
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,23 @@
 | 
			
		||||
#!/usr/bin/python
 | 
			
		||||
# -*- coding: utf-8 -*-
 | 
			
		||||
 | 
			
		||||
import sys
 | 
			
		||||
from webtools import Web
 | 
			
		||||
 | 
			
		||||
def main():
 | 
			
		||||
    print('Content-type: text/html')
 | 
			
		||||
    print()
 | 
			
		||||
 | 
			
		||||
    page = Web.Element(Web.ROOT_DIR + 'templates/page.html')
 | 
			
		||||
    head = Web.Element(Web.ROOT_DIR + 'templates/head.html')
 | 
			
		||||
    body = Web.Element(Web.ROOT_DIR + 'templates/body.html')
 | 
			
		||||
    content = Web.Element('index.html')
 | 
			
		||||
 | 
			
		||||
    page.add_child(head)
 | 
			
		||||
    page.add_child(body)
 | 
			
		||||
    body.add_child(content)
 | 
			
		||||
 | 
			
		||||
    page.print()
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
    main()
 | 
			
		||||
@ -1,10 +1,3 @@
 | 
			
		||||
<?php include_once("header_functions.php"); ?>
 | 
			
		||||
<!doctype html>
 | 
			
		||||
<html>
 | 
			
		||||
    <?php head("Multisphere"); ?>
 | 
			
		||||
    <body>
 | 
			
		||||
        <?php include("header.php"); ?>
 | 
			
		||||
        <?php include("nav.php"); ?>
 | 
			
		||||
        <section>
 | 
			
		||||
            <h2>Multiresolution sphere</h2>
 | 
			
		||||
            <p>
 | 
			
		||||
@ -14,8 +7,5 @@
 | 
			
		||||
                the canvas.
 | 
			
		||||
            </p>
 | 
			
		||||
            <div id="container"></div>
 | 
			
		||||
#
 | 
			
		||||
        </section>
 | 
			
		||||
        <?php include("jsIncludes.php"); ?>
 | 
			
		||||
        <script src="js/MultiSphere.js"></script>
 | 
			
		||||
    </body>
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										28
									
								
								multisphere/index.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										28
									
								
								multisphere/index.py
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,28 @@
 | 
			
		||||
#!/usr/bin/python
 | 
			
		||||
# -*- coding: utf-8 -*-
 | 
			
		||||
 | 
			
		||||
import sys
 | 
			
		||||
from webtools import Web
 | 
			
		||||
 | 
			
		||||
def main():
 | 
			
		||||
    print('Content-type: text/html')
 | 
			
		||||
    print()
 | 
			
		||||
 | 
			
		||||
    page = Web.Element(Web.ROOT_DIR + 'templates/page.html')
 | 
			
		||||
    head = Web.Element(Web.ROOT_DIR + 'templates/head.html')
 | 
			
		||||
    body = Web.Element(Web.ROOT_DIR + 'templates/body.html')
 | 
			
		||||
    jsIncludes = Web.Element(Web.ROOT_DIR + 'templates/jsIncludes.html')
 | 
			
		||||
    mainJs = Web.Element()
 | 
			
		||||
    mainJs.open_string = '        <script src="js/MultiSphere.js"></script>'
 | 
			
		||||
    content = Web.Element('index.html')
 | 
			
		||||
 | 
			
		||||
    page.add_child(head)
 | 
			
		||||
    page.add_child(body)
 | 
			
		||||
    body.add_child(content)
 | 
			
		||||
    body.add_child(jsIncludes)
 | 
			
		||||
    jsIncludes.add_child(mainJs)
 | 
			
		||||
 | 
			
		||||
    page.print()
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
    main()
 | 
			
		||||
							
								
								
									
										4
									
								
								prototype/.htaccess
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								prototype/.htaccess
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,4 @@
 | 
			
		||||
<Files "index.html">
 | 
			
		||||
    Order Allow,Deny
 | 
			
		||||
    Deny from all
 | 
			
		||||
</Files>
 | 
			
		||||
@ -1,10 +1,3 @@
 | 
			
		||||
<?php include_once("header_functions.php"); ?>
 | 
			
		||||
<!doctype html>
 | 
			
		||||
<html>
 | 
			
		||||
    <?php head("Prototype"); ?>
 | 
			
		||||
    <body>
 | 
			
		||||
        <?php include("header.php"); ?>
 | 
			
		||||
        <?php include("nav.php"); ?>
 | 
			
		||||
        <section>
 | 
			
		||||
            <h2>3D Interface</h2>
 | 
			
		||||
            <p>
 | 
			
		||||
@ -20,8 +13,5 @@
 | 
			
		||||
                recommended viewpoint.
 | 
			
		||||
            </p>
 | 
			
		||||
            <div style="border-width:1px; border-style: solid;" id="container"></div>
 | 
			
		||||
#
 | 
			
		||||
        </section>
 | 
			
		||||
        <?php include("jsIncludes.php"); ?>
 | 
			
		||||
        <script src="js/main.js"></script>
 | 
			
		||||
    </body>
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										28
									
								
								prototype/index.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										28
									
								
								prototype/index.py
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,28 @@
 | 
			
		||||
#!/usr/bin/python
 | 
			
		||||
# -*- coding: utf-8 -*-
 | 
			
		||||
 | 
			
		||||
import sys
 | 
			
		||||
from webtools import Web
 | 
			
		||||
 | 
			
		||||
def main():
 | 
			
		||||
    print('Content-type: text/html')
 | 
			
		||||
    print()
 | 
			
		||||
 | 
			
		||||
    page = Web.Element(Web.ROOT_DIR + 'templates/page.html')
 | 
			
		||||
    head = Web.Element(Web.ROOT_DIR + 'templates/head.html')
 | 
			
		||||
    body = Web.Element(Web.ROOT_DIR + 'templates/body.html')
 | 
			
		||||
    jsIncludes = Web.Element(Web.ROOT_DIR + 'templates/jsIncludes.html')
 | 
			
		||||
    mainJs = Web.Element()
 | 
			
		||||
    mainJs.open_string = '        <script src="js/main.js"></script>'
 | 
			
		||||
    content = Web.Element('index.html')
 | 
			
		||||
 | 
			
		||||
    page.add_child(head)
 | 
			
		||||
    page.add_child(body)
 | 
			
		||||
    body.add_child(content)
 | 
			
		||||
    body.add_child(jsIncludes)
 | 
			
		||||
    jsIncludes.add_child(mainJs)
 | 
			
		||||
 | 
			
		||||
    page.print()
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
    main()
 | 
			
		||||
							
								
								
									
										0
									
								
								scene/js/main.js → prototype/js/main.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										0
									
								
								scene/js/main.js → prototype/js/main.js
									
									
									
									
										vendored
									
									
								
							@ -1 +0,0 @@
 | 
			
		||||
php_value include_path '../include'
 | 
			
		||||
@ -1,10 +1,3 @@
 | 
			
		||||
<?php include_once("header_functions.php"); ?>
 | 
			
		||||
<!doctype html>
 | 
			
		||||
<html>
 | 
			
		||||
    <?php head('Streaming simulator'); ?>
 | 
			
		||||
    <body>
 | 
			
		||||
        <?php include("header.php"); ?>
 | 
			
		||||
        <?php include("nav.php"); ?>
 | 
			
		||||
        <section>
 | 
			
		||||
            <h2>Streaming simulator</h2>
 | 
			
		||||
            <p>
 | 
			
		||||
@ -20,9 +13,5 @@
 | 
			
		||||
                </form>
 | 
			
		||||
            </p>
 | 
			
		||||
            <div style="border-width:1px; border-style: solid;" id="container"></div>
 | 
			
		||||
#
 | 
			
		||||
        </section>
 | 
			
		||||
        <?php include("jsIncludes.php"); ?>
 | 
			
		||||
        <script src="js/Params.js.php?<?php echo htmlentities($_SERVER['QUERY_STRING']); ?>"></script>
 | 
			
		||||
        <script src="js/main.js"></script>
 | 
			
		||||
    </body>
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										48
									
								
								stream/index.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										48
									
								
								stream/index.py
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,48 @@
 | 
			
		||||
#!/usr/bin/python
 | 
			
		||||
# -*- coding: utf-8 -*-
 | 
			
		||||
 | 
			
		||||
import sys
 | 
			
		||||
import cgi
 | 
			
		||||
from webtools import Web
 | 
			
		||||
 | 
			
		||||
def main():
 | 
			
		||||
    print('Content-type: text/html')
 | 
			
		||||
    print()
 | 
			
		||||
 | 
			
		||||
    page = Web.Element(Web.ROOT_DIR + 'templates/page.html')
 | 
			
		||||
    head = Web.Element(Web.ROOT_DIR + 'templates/head.html')
 | 
			
		||||
    body = Web.Element(Web.ROOT_DIR + 'templates/body.html')
 | 
			
		||||
    jsIncludes = Web.Element(Web.ROOT_DIR + 'templates/jsIncludes.html')
 | 
			
		||||
 | 
			
		||||
    # Parse parameter res
 | 
			
		||||
    res = None
 | 
			
		||||
    try:
 | 
			
		||||
        parameters = cgi.FieldStorage()
 | 
			
		||||
        res = int(cgi.escape(parameters.getvalue('res')))
 | 
			
		||||
        if res < 1 or res > 25:
 | 
			
		||||
            raise IndexError('res must be between 1 and 25')
 | 
			
		||||
    except:
 | 
			
		||||
        res = 5
 | 
			
		||||
 | 
			
		||||
    mainJs = Web.Element()
 | 
			
		||||
    mainJs.open_string = """\
 | 
			
		||||
        <script>
 | 
			
		||||
            params = {};
 | 
			
		||||
            params.get = {};
 | 
			
		||||
            params.post = {};
 | 
			
		||||
            params.get.res = """ + str(res) + """;
 | 
			
		||||
        </script>
 | 
			
		||||
        <script src="js/main.js"></script>\
 | 
			
		||||
"""
 | 
			
		||||
    content = Web.Element('index.html')
 | 
			
		||||
 | 
			
		||||
    page.add_child(head)
 | 
			
		||||
    page.add_child(body)
 | 
			
		||||
    body.add_child(content)
 | 
			
		||||
    body.add_child(jsIncludes)
 | 
			
		||||
    jsIncludes.add_child(mainJs)
 | 
			
		||||
 | 
			
		||||
    page.print()
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
    main()
 | 
			
		||||
@ -1,39 +0,0 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
    // This file will generate a js script
 | 
			
		||||
    header("Content-Type: text/javascript");
 | 
			
		||||
 | 
			
		||||
    echo "params = {};\n";
 | 
			
		||||
    echo "params.get = {};\n";
 | 
			
		||||
    echo "params.post = {};\n";
 | 
			
		||||
 | 
			
		||||
    // Next part is to check the value of the parameters
 | 
			
		||||
    // All this is necessary, we must be sure that res is a number before
 | 
			
		||||
    // generating js code, otherwise, a malicious user might inject js code
 | 
			
		||||
    // For example, if we simply did
 | 
			
		||||
    // echo "params.get.res = " . $_GET['res'] . ";\n";
 | 
			
		||||
    // One could inject a js alert by going to
 | 
			
		||||
    // http://localhost/stream?res=3;alert('toto')
 | 
			
		||||
 | 
			
		||||
    // Default value, will be applied if the res variable is not correct
 | 
			
		||||
    $default = 5;
 | 
			
		||||
    $res = null;
 | 
			
		||||
 | 
			
		||||
    try
 | 
			
		||||
    {
 | 
			
		||||
        // Cast res to an int and check if it's in the bounds
 | 
			
		||||
        // res will be 0 if filter_var returns false
 | 
			
		||||
        $res = intval(filter_var($_GET['res'], FILTER_VALIDATE_INT));
 | 
			
		||||
        if ($res < 1 || $res > 25)
 | 
			
		||||
        {
 | 
			
		||||
            throw new Exception('Variable res not set');
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    catch (Exception $e)
 | 
			
		||||
    {
 | 
			
		||||
        // If an exception occur, let's just set the default value
 | 
			
		||||
        $res = $default;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // And finally, generate a correct js code with no possible injection
 | 
			
		||||
    echo "params.get.res = " . $res . ";\n";
 | 
			
		||||
@ -1,11 +1,15 @@
 | 
			
		||||
 | 
			
		||||
    <body>
 | 
			
		||||
        <header>
 | 
			
		||||
            <h1 id="title">Welcome ! <img src='/img/python-powered.svg' alt='Python powered' width=80/></h1>
 | 
			
		||||
        </header>
 | 
			
		||||
        <nav>
 | 
			
		||||
            <ul>
 | 
			
		||||
                <li><a href="/">Index</a></li>
 | 
			
		||||
                <li><a href="/bouncing/">Bouncing cube</a></li>
 | 
			
		||||
                <li><a href="/multisphere/">Multi-sphere</a></li>
 | 
			
		||||
                <li><a href="/scene/">Prototype</a></li>
 | 
			
		||||
                <li><a href="/prototype/">Prototype</a></li>
 | 
			
		||||
                <li><a href="/stream/">Streaming simulator</a></li>
 | 
			
		||||
            </ul>
 | 
			
		||||
        </nav>
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
    </body>
 | 
			
		||||
							
								
								
									
										7
									
								
								templates/head.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								templates/head.html
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,7 @@
 | 
			
		||||
    <head>
 | 
			
		||||
        <title>3DUI</title>
 | 
			
		||||
        <meta charset="utf-8" />
 | 
			
		||||
        <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Ubuntu:400,700,400italic" />
 | 
			
		||||
        <link rel="stylesheet" href="/css/style.css" />
 | 
			
		||||
#
 | 
			
		||||
    </head>
 | 
			
		||||
@ -1,4 +1,3 @@
 | 
			
		||||
 | 
			
		||||
        <script src="/js/three.js"></script>
 | 
			
		||||
        <script src="/js/Tools.js"></script>
 | 
			
		||||
        <script src="/js/three/DDSLoader.js"></script>
 | 
			
		||||
@ -13,4 +12,4 @@
 | 
			
		||||
        <script src="/js/BufferGeometryToGeometry.js"></script>
 | 
			
		||||
        <script src="/js/PointerCamera.js"></script>
 | 
			
		||||
        <script src="/js/CameraContainer.js"></script>
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
							
								
								
									
										4
									
								
								templates/page.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								templates/page.html
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,4 @@
 | 
			
		||||
<!doctype html>
 | 
			
		||||
<html>
 | 
			
		||||
#
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										1
									
								
								webtools/.htaccess
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								webtools/.htaccess
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1 @@
 | 
			
		||||
Deny from all
 | 
			
		||||
							
								
								
									
										46
									
								
								webtools/Web.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										46
									
								
								webtools/Web.py
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,46 @@
 | 
			
		||||
#!/usr/bin/python
 | 
			
		||||
# -*- coding: utf-8 -*-
 | 
			
		||||
 | 
			
		||||
import sys
 | 
			
		||||
import os
 | 
			
		||||
 | 
			
		||||
# ROOT_DIR = '/'.join(__file__.split('/')[:-2]) + '/'
 | 
			
		||||
ROOT_DIR = '/home/thomas/stage/javascript/web/'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Element:
 | 
			
		||||
    def __init__(self, filename = None):
 | 
			
		||||
        self.children = []
 | 
			
		||||
        self.open_string = ''
 | 
			
		||||
        self.close_string = ''
 | 
			
		||||
        if filename:
 | 
			
		||||
            self.load(filename)
 | 
			
		||||
 | 
			
		||||
    def load(self, filename):
 | 
			
		||||
        with open(filename, 'r') as f:
 | 
			
		||||
            first_part = True
 | 
			
		||||
            for line in f:
 | 
			
		||||
                if line[0] == '#':
 | 
			
		||||
                    first_part = False
 | 
			
		||||
                    continue
 | 
			
		||||
                if first_part:
 | 
			
		||||
                    self.open_string += line
 | 
			
		||||
                else:
 | 
			
		||||
                    self.close_string += line
 | 
			
		||||
        self.open_string = self.open_string[:-1]
 | 
			
		||||
        self.close_string = self.close_string[:-1]
 | 
			
		||||
 | 
			
		||||
    def open(self, format = {}):
 | 
			
		||||
        print(self.open_string % format)
 | 
			
		||||
 | 
			
		||||
    def close(self, format = {}):
 | 
			
		||||
        print(self.close_string % format)
 | 
			
		||||
 | 
			
		||||
    def add_child(self, child):
 | 
			
		||||
        self.children.append(child)
 | 
			
		||||
 | 
			
		||||
    def print(self, format = {}):
 | 
			
		||||
        self.open()
 | 
			
		||||
        for i in self.children:
 | 
			
		||||
                i.print(format)
 | 
			
		||||
        self.close()
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user