[llvm-commits] [zorg] r130209 - in /zorg/trunk/lnt: lnt/lnttool/__init__.py lnt/server/ lnt/server/__init__.py lnt/server/ui/ lnt/server/ui/__init__.py lnt/server/ui/app.py lnt/server/ui/static/ lnt/server/ui/static/favicon.ico lnt/server/ui/static/style.css lnt/server/ui/templates/ lnt/server/ui/templates/index.html lnt/server/ui/templates/layout.html lnt/server/ui/views.py setup.py
Daniel Dunbar
daniel at zuster.org
Tue Apr 26 10:47:37 PDT 2011
Author: ddunbar
Date: Tue Apr 26 12:47:37 2011
New Revision: 130209
URL: http://llvm.org/viewvc/llvm-project?rev=130209&view=rev
Log:
LNT: Sketch outline for new Flask based server UI.
Added:
zorg/trunk/lnt/lnt/server/
zorg/trunk/lnt/lnt/server/__init__.py
zorg/trunk/lnt/lnt/server/ui/
zorg/trunk/lnt/lnt/server/ui/__init__.py
zorg/trunk/lnt/lnt/server/ui/app.py
zorg/trunk/lnt/lnt/server/ui/static/
zorg/trunk/lnt/lnt/server/ui/static/favicon.ico
zorg/trunk/lnt/lnt/server/ui/static/style.css
zorg/trunk/lnt/lnt/server/ui/templates/
zorg/trunk/lnt/lnt/server/ui/templates/index.html
zorg/trunk/lnt/lnt/server/ui/templates/layout.html
zorg/trunk/lnt/lnt/server/ui/views.py
Modified:
zorg/trunk/lnt/lnt/lnttool/__init__.py
zorg/trunk/lnt/setup.py
Modified: zorg/trunk/lnt/lnt/lnttool/__init__.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/lnttool/__init__.py?rev=130209&r1=130208&r2=130209&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/lnttool/__init__.py (original)
+++ zorg/trunk/lnt/lnt/lnttool/__init__.py Tue Apr 26 12:47:37 2011
@@ -25,6 +25,9 @@
parser.add_option("", "--processes", dest="processes", type=int,
metavar="N", help="number of processes to use [%default]",
default=1)
+ parser.add_option("", "--use-flask-app", dest="use_flask_app",
+ help="use the Flask based UI [%default]",
+ action="store_true", default=False)
(opts, args) = parser.parse_args(args)
if len(args) != 1:
@@ -41,11 +44,23 @@
if not config or not os.path.exists(config):
raise SystemExit,"error: invalid config: %r" % config
- from werkzeug import run_simple
- from lnt.viewer import app
- run_simple(opts.hostname, opts.port, app.create_app(config),
- opts.reloader, opts.debugger,
- False, None, 1, opts.threaded, opts.processes)
+ if opts.use_flask_app:
+ import lnt.server.ui.app
+ instance = lnt.server.ui.app.App.create_standalone(
+ config_path = config)
+ if opts.debugger:
+ instance.debug = True
+ instance.run(opts.hostname, opts.port,
+ use_reloader = opts.reloader,
+ use_debugger = opts.debugger,
+ threaded = opts.threaded,
+ processes = opts.processes)
+ else:
+ from werkzeug import run_simple
+ from lnt.viewer import app
+ run_simple(opts.hostname, opts.port, app.create_app(config),
+ opts.reloader, opts.debugger,
+ False, None, 1, opts.threaded, opts.processes)
from create import action_create
from convert import action_convert
Added: zorg/trunk/lnt/lnt/server/__init__.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/__init__.py?rev=130209&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/server/__init__.py (added)
+++ zorg/trunk/lnt/lnt/server/__init__.py Tue Apr 26 12:47:37 2011
@@ -0,0 +1 @@
+__all__ = []
Added: zorg/trunk/lnt/lnt/server/ui/__init__.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/__init__.py?rev=130209&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/__init__.py (added)
+++ zorg/trunk/lnt/lnt/server/ui/__init__.py Tue Apr 26 12:47:37 2011
@@ -0,0 +1 @@
+__all__ = []
Added: zorg/trunk/lnt/lnt/server/ui/app.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/app.py?rev=130209&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/app.py (added)
+++ zorg/trunk/lnt/lnt/server/ui/app.py Tue Apr 26 12:47:37 2011
@@ -0,0 +1,34 @@
+import logging
+import logging.handlers
+import os
+
+import flask
+
+import lnt.server.ui.views
+
+# FIXME: Redesign this.
+import lnt.viewer.Config
+
+class App(flask.Flask):
+ @staticmethod
+ def create_standalone(config_path):
+ # Construct the application.
+ app = App(__name__)
+
+ # Load the application configuration.
+ app.load_config(config_path)
+
+ # Load the application routes.
+ app.register_module(lnt.server.ui.views.frontend)
+
+ return app
+
+ def __init__(self, name):
+ super(App, self).__init__(name)
+
+ def load_config(self, config_path):
+ config_data = {}
+ exec open(config_path) in config_data
+
+ self.old_config = lnt.viewer.Config.Config.fromData(
+ config_path, config_data)
Added: zorg/trunk/lnt/lnt/server/ui/static/favicon.ico
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/static/favicon.ico?rev=130209&view=auto
==============================================================================
Binary files zorg/trunk/lnt/lnt/server/ui/static/favicon.ico (added) and zorg/trunk/lnt/lnt/server/ui/static/favicon.ico Tue Apr 26 12:47:37 2011 differ
Added: zorg/trunk/lnt/lnt/server/ui/static/style.css
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/static/style.css?rev=130209&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/static/style.css (added)
+++ zorg/trunk/lnt/lnt/server/ui/static/style.css Tue Apr 26 12:47:37 2011
@@ -0,0 +1,6 @@
+body {
+ background-color: #FFFFFF;
+ font-family: "Lucida Grande", "Lucida Sans Unicode", Arial, Verdana,
+ Helvetica, sans-serif;
+ font-size: small;
+}
Added: zorg/trunk/lnt/lnt/server/ui/templates/index.html
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/templates/index.html?rev=130209&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/templates/index.html (added)
+++ zorg/trunk/lnt/lnt/server/ui/templates/index.html Tue Apr 26 12:47:37 2011
@@ -0,0 +1,6 @@
+{% extends "layout.html" %}
+{% block title %}LNT{% endblock %}
+{% block body %}
+WIP
+{% endblock %}
+
Added: zorg/trunk/lnt/lnt/server/ui/templates/layout.html
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/templates/layout.html?rev=130209&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/templates/layout.html (added)
+++ zorg/trunk/lnt/lnt/server/ui/templates/layout.html Tue Apr 26 12:47:37 2011
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+ <title>{{ self.title() }}</title>
+ <link rel="stylesheet" type="text/css"{#
+ #} href="{{ url_for('.static', filename='style.css') }}">
+</head>
+<body>
+ <div class="body">{% block body %}{% endblock %}</div>
+</body>
+</html>
Added: zorg/trunk/lnt/lnt/server/ui/views.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/views.py?rev=130209&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/views.py (added)
+++ zorg/trunk/lnt/lnt/server/ui/views.py Tue Apr 26 12:47:37 2011
@@ -0,0 +1,14 @@
+import flask
+from flask import redirect
+from flask import render_template
+from flask import url_for
+
+frontend = flask.Module(__name__)
+
+ at frontend.route('/')
+def index():
+ return render_template("index.html")
+
+ at frontend.route('/favicon.ico')
+def favicon_ico():
+ return redirect(url_for('.static', filename='favicon.ico'))
Modified: zorg/trunk/lnt/setup.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/setup.py?rev=130209&r1=130208&r2=130209&view=diff
==============================================================================
--- zorg/trunk/lnt/setup.py (original)
+++ zorg/trunk/lnt/setup.py Tue Apr 26 12:47:37 2011
@@ -57,5 +57,5 @@
'lnt = lnt.lnttool:main',
],
},
- install_requires=['Quixote==2.7b2', 'SQLAlchemy', 'Werkzeug'],
+ install_requires=['Quixote==2.7b2', 'SQLAlchemy', 'Flask'],
)
More information about the llvm-commits
mailing list