6
#append this to module path so we can load from the parent directory
7
sys.path.append(os.path.abspath('../'))
8
from scaffold.web import web as html
11
#the heart of the system
13
web.document_root=os.path.dirname(__file__)
14
#set the default theme folder
15
web.template.theme_full_path=os.path.abspath('../')+os.sep+'template'+os.sep
18
#these allow you to load in a static file to header and footer
19
web.template.load_header()
20
web.template.load_footer()
22
#normally this will look for the defaults.css file in your theme we are not serving files so set local path
23
web.template.css_includes.append('file:///'+web.template.theme_full_path+'default.css')
25
#generate the main content of the page here
26
web.page.header('Hello World Extended Header')
27
web.page.section('Hello World Extended Body Text')
30
#example of creating a table
31
web.table.create('My Table Title',('Column 1','Column 2','Column 3','Column 4','Column 5'))
32
for row in range(0,6):
33
web.table.append([row,'a','b','c','d'])
35
#actually lets modify the rows for the table, just an example to show it possible as long as render has not been called
37
row[2]='<b>'+row[2]+'</b>'
39
"""These tutorials will outline how to build a simple cad application using opengl and gtk 3 using python as the language making it simple for other to extend."""
41
"""First create your interface using glade interface designer or grab it from the launchpad repository"""
43
web.page.section(web.table.render())
44
#append the html into the document body
45
web.template.body.append(web.page.render())
49
#nothing special dump content to a file and open in browser
50
f = tempfile.NamedTemporaryFile(delete=False)
51
f.write(web.render().encode('UTF-8'))
53
webbrowser.open_new_tab('file:///'+f.name)