Created
November 23, 2012 15:01
-
-
Save moschlar/4136023 to your computer and use it in GitHub Desktop.
Index page for comparing different JavaScript-based source code editor widgets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import tw2.core as twc | |
import tw2.forms as twf | |
import tw2.bootstrap.forms as twb | |
import tw2.devtools as twd | |
#https://github.com/moschlar/tw2.ace | |
import tw2.ace | |
#https://github.com/moschlar/tw2.codemirror | |
import tw2.codemirror | |
#https://github.com/moschlar/tw2.editarea | |
import tw2.editarea | |
value = u'''class HelloWorld { | |
public static void main(String[] args) { | |
System.out.println("Hello World!"); | |
return; | |
} | |
} | |
''' | |
class Index(twf.FormPage): | |
title = 'Index' | |
inline_engine_name = 'mako' | |
template = u''' | |
<%namespace name="tw" module="tw2.core.mako_util"/>\ | |
<html> | |
<head><title>${w.title or ''}</title></head> | |
<body ${tw.attrs(attrs=w.attrs)}> | |
<div class="container"><div class="row"><div class="span12"> | |
<div class="page-header"><h1>${w.title or ''}</h1></div> | |
% if w.child: | |
${w.child.display() | n} | |
% endif | |
</div></div></div> | |
</body> | |
</html> | |
''' | |
class child(twb.HorizontalForm): | |
ace = tw2.ace.AceWidget( | |
mode='java', | |
value=value, | |
attrs=dict(style='width: 600px; height: 200px;') | |
) | |
codemirror = tw2.codemirror.CodeMirrorWidget( | |
mode='clike', | |
value=value, | |
cols=80, rows=5, | |
attrs=dict(style='width: 600px; height: 200px;') | |
) | |
editarea = tw2.editarea.EditAreaWidget( | |
syntax='java', | |
value=value, | |
cols=80, rows=5, | |
attrs=dict(style='width: 600px; height: 200px;') | |
) | |
twd.dev_server(host='0.0.0.0') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment