Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/studio/studio.py
diff options
context:
space:
mode:
authorSebastian Silva <sebastian@sugarlabs.org>2011-11-09 05:24:34 (GMT)
committer Sebastian Silva <sebastian@sugarlabs.org>2011-11-09 05:24:34 (GMT)
commit61517139f02df2ce417f465dfabdbf5dbe8f4063 (patch)
treefaca86aa6dfce7512efaf60ea6c8d9db0dd8e70f /studio/studio.py
parentf19b166851a2d722802b10901a12d4d8962f9fb6 (diff)
IDE+Documentation Redesign
Diffstat (limited to 'studio/studio.py')
-rw-r--r--studio/studio.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/studio/studio.py b/studio/studio.py
index 586bf2d..d3c9fe9 100644
--- a/studio/studio.py
+++ b/studio/studio.py
@@ -1,7 +1,7 @@
import os
import sys
-from flaskext.genshi import Genshi, render_response
from flask import Flask,request,url_for,redirect
+from flaskext.genshi import Genshi, render_response
studio = Flask(__name__)
studio.debug = True
@@ -39,15 +39,14 @@ def identify(filename):
if os.path.isdir(filename):
icon = 'folder.png'
href = '/files/%s' % filename
+ mode = 'dir'
if filename.endswith('.xo'):
href = '#'
return icon,mode,href
@studio.route('/')
def index():
- port = request.environ.get('SERVER_PORT')
- return render_response('index.html', dict(name="WebSDK Activity",
- port=port))
+ return vsplit()
@studio.route('/edit/')
@studio.route('/edit/<path:filename>')
@@ -69,7 +68,7 @@ def save():
print "saving content: %s" % filename
f.close()
directory = os.path.dirname(filename)
- return redirect(url_for('browse', directory=directory))
+ return redirect(url_for('help'))
@studio.route('/files/')
@studio.route('/files/<path:directory>')
@@ -79,6 +78,7 @@ def browse(directory="."):
if not os.path.abspath(directory)==os.path.abspath("."):
files.append( { 'name': '..',
'icon': 'folder.png',
+ 'mode': 'dir',
'href': '/files/%s' % os.path.join(directory,"..") })
for filename in sorted(filelist):
icon, mode, href = identify(directory + "/" + filename)
@@ -88,6 +88,7 @@ def browse(directory="."):
continue
files.append( { 'name': filename,
'icon': icon,
+ 'mode': mode,
'href': href } )
return render_response('filer.html', dict(files=files, absdir=os.path.normpath(directory)))
@@ -102,7 +103,12 @@ def shutdown():
shutdown_server()
return 'Goodbye'
-def vsplit(frame1='/files/studio', frame2='/files/studio/templates'):
+@studio.route('/help')
+def help():
+ port = request.environ.get('SERVER_PORT')
+ return render_response('help.html', dict(port=port))
+
+def vsplit(frame1='/help', frame2='/files/studio'):
return render_response('split-view.html', dict(frame1=frame1, frame2=frame2))
@studio.route('/split')