1.1 --- a/Makefile Fri Apr 18 16:27:01 2014 +0200
1.2 +++ b/Makefile Mon May 05 10:04:09 2014 +0200
1.3 @@ -1,22 +1,22 @@
1.4 #
1.5 -# Makefile for pymove3D
1.6 +# Makefile for eskp
1.7 #
1.8
1.9 -# location for the pymove3d.py we use:
1.10 +# location for the eskp.py we use:
1.11 export PYTHONPATH=$(PWD)
1.12
1.13 pylint:
1.14 - pylint ./pymove3d.py
1.15 + pylint ./eskp.py
1.16
1.17 pybabel_init:
1.18 - pybabel extract -o ./translations/pymove3d.pot .
1.19 - pybabel init -i ./translations/pymove3d.pot -d translations -l de
1.20 - pybabel init -i ./translations/pymove3d.pot -d translations -l en
1.21 + pybabel extract -o ./translations/eskp.pot .
1.22 + pybabel init -i ./translations/eskp.pot -d translations -l de
1.23 + pybabel init -i ./translations/eskp.pot -d translations -l en
1.24
1.25 pybabel_update:
1.26 - pybabel extract -o ./translations/pymove3d.pot .
1.27 - pybabel update -i ./translations/pymove3d.pot -d translations -l de
1.28 - pybabel update -i ./translations/pymove3d.pot -d translations -l en
1.29 + pybabel extract -o ./translations/eskp.pot .
1.30 + pybabel update -i ./translations/eskp.pot -d translations -l de
1.31 + pybabel update -i ./translations/eskp.pot -d translations -l en
1.32
1.33 msgfmt:
1.34 msgfmt --strict ./translations/de/LC_MESSAGES/messages.po -o ./translations/de/LC_MESSAGES/messages.mo
2.1 --- a/README.rst Fri Apr 18 16:27:01 2014 +0200
2.2 +++ b/README.rst Mon May 05 10:04:09 2014 +0200
2.3 @@ -2,13 +2,12 @@
2.4 ------------
2.5
2.6 First you have to clone this repository and all its submodules::
2.7 - hg clone ssh://hg@bitbucket.org/pkoppatz/pymove3d-app
2.8 - cd pymove3d-app
2.9 + cd eskp-app
2.10
2.11 Next create a virtualenv and install all the requirments into it. In this
2.12 example we are using virtualenvwrapper to manage the virtualenv::
2.13
2.14 - mkvirtualenv pymove3d-env
2.15 + mkvirtualenv eskp-env
2.16
2.17 This repository provides requirements and configurations.
2.18
2.19 @@ -17,9 +16,9 @@
2.20
2.21 pip install -r requirements.txt
2.22
2.23 -Now that this is complete, you can run pymove3d in that environment::
2.24 +Now that this is complete, you can run eskp in that environment::
2.25
2.26 - python ./pymove3d.py
2.27 + python ./eskp.py
2.28
2.29 Testing and developing is done with::
2.30
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/eskp.py Mon May 05 10:04:09 2014 +0200
3.3 @@ -0,0 +1,178 @@
3.4 +# -*- coding: utf-8 -*-
3.5 +
3.6 +import os
3.7 +import codecs
3.8 +
3.9 +from docutils.core import publish_parts
3.10 +from flask import Flask
3.11 +from flask import render_template
3.12 +from flask import request
3.13 +from flask.ext.babel import gettext as _
3.14 +from flask.ext.babel import Babel
3.15 +from config import LANGUAGES
3.16 +from sayings import get_saying
3.17 +
3.18 +
3.19 +LANGUAGE_SELECTED = "de"
3.20 +#ToDo after engelish is implemented set LANGUAGE_SELECTED = None
3.21 +
3.22 +app = Flask(__name__)
3.23 +babel = Babel(app)
3.24 +
3.25 +app.config['BABEL_DEFAULT_LOCALE'] = 'de'
3.26 +
3.27 +
3.28 +def get_content(filename, overrides=None):
3.29 + content = u""
3.30 + if os.path.isfile(filename):
3.31 + with codecs.open(filename, 'r', 'utf-8') as f:
3.32 + rst_data = f.read()
3.33 + f.close()
3.34 + content = publish_parts(rst_data, writer_name='html', settings_overrides=overrides)['html_body']
3.35 + return content
3.36 +
3.37 +def get_topmenue():
3.38 + menue = [('/competition', _(u'Competition')),
3.39 + ('/task', _(u'Task')),
3.40 + ('/coursematerial', _(u'Coursematerial')),
3.41 + ('/submission', _(u'Submission')),
3.42 + ('/prizes', _(u'Prizes')),
3.43 + ]
3.44 + return menue
3.45 +
3.46 +app.jinja_env.globals.update(get_topmenue=get_topmenue)
3.47 +
3.48 +
3.49 +@babel.localeselector
3.50 +def get_locale():
3.51 + """ToDo: if translation is completed, switch to en """
3.52 + return LANGUAGE_SELECTED or request.accept_languages.best_match(LANGUAGES.keys()) or 'de'
3.53 +
3.54 +
3.55 +@app.route("/")
3.56 +@app.route("/index")
3.57 +def index():
3.58 + saying, author = get_saying()
3.59 + return render_template("/index.html",
3.60 + saying=saying,
3.61 + author=author,
3.62 + competition_info=_(u'About Competition'),
3.63 + dates=_(u'Dates'),
3.64 + impressions=_(u'Impressions'))
3.65 +
3.66 +@app.route('/de')
3.67 +def de():
3.68 + global LANGUAGE_SELECTED
3.69 + LANGUAGE_SELECTED = "de"
3.70 + saying, author = get_saying()
3.71 + return render_template("/index.html",
3.72 + saying=saying,
3.73 + author=author,
3.74 + competition_info=_(u'About Competition'),
3.75 + dates=_(u'Dates'),
3.76 + impressions=_(u'Impressions'))
3.77 +
3.78 +@app.route('/en')
3.79 +def en():
3.80 + saying, author = get_saying()
3.81 + global LANGUAGE_SELECTED
3.82 + LANGUAGE_SELECTED = "en"
3.83 + return render_template("/index.html",
3.84 + saying=saying,
3.85 + author=author,
3.86 + competition_info=_(u'About Competition'),
3.87 + dates=_(u'Dates'),
3.88 + impressions=_(u'Impressions'))
3.89 +
3.90 +@app.route("/competition")
3.91 +def competition():
3.92 + filename = os.path.join("templates", get_locale(), "rst", "competition.rst")
3.93 + content = get_content(filename)
3.94 + return render_template("/content.html", act="competition", content=content)
3.95 +
3.96 +@app.route("/task")
3.97 +def task():
3.98 + filename = os.path.join("templates", get_locale(), "rst", "task.rst")
3.99 + content = get_content(filename)
3.100 + return render_template("/content.html", act="task", content=content)
3.101 +
3.102 +@app.route("/submission")
3.103 +def submission():
3.104 + filename = os.path.join("templates", get_locale(), "rst", "submission.rst")
3.105 + content = get_content(filename)
3.106 + return render_template("/content.html", act="submission", content=content)
3.107 +
3.108 +@app.route("/coursematerial")
3.109 +def coursematerial():
3.110 + filename = os.path.join("templates", get_locale(), "rst", "coursematerial.rst")
3.111 + content = get_content(filename)
3.112 + return render_template("/content.html", act="coursematerial", content=content)
3.113 +
3.114 +@app.route("/imprint")
3.115 +def imprint():
3.116 + filename = os.path.join("templates", get_locale(), "rst", "imprint.rst")
3.117 + content = get_content(filename)
3.118 + return render_template("/content.html", act="imprint", content=content)
3.119 +
3.120 +@app.route("/privacy")
3.121 +def privacy():
3.122 + filename = os.path.join("templates", get_locale(), "rst", "privacy.rst")
3.123 + overrides = {
3.124 + 'initial_header_level': 2,
3.125 + }
3.126 + content = get_content(filename, overrides=overrides)
3.127 + return render_template("/content.html", act="privacy", content=content)
3.128 +
3.129 +@app.route("/dates")
3.130 +def dates():
3.131 + filename = os.path.join("templates", get_locale(), "rst", "dates.rst")
3.132 + content = get_content(filename)
3.133 + return render_template("/content.html",
3.134 + act="dates", content=content)
3.135 +
3.136 +@app.route("/prizes")
3.137 +def prizes():
3.138 + filename = os.path.join("templates", get_locale(), "rst", "prizes.rst")
3.139 + overrides = {
3.140 + 'initial_header_level': 2,
3.141 + }
3.142 + content = get_content(filename, overrides=overrides)
3.143 + return render_template("/prizes.html",act="prizes", content=content)
3.144 +
3.145 +
3.146 +
3.147 +@app.route("/competition/2013")
3.148 +def competition_2013():
3.149 + competition = _(u'Competition 2013')
3.150 + introduction = _(u'The winners of the programming competition, '
3.151 + u'showed at the PyCon.DE 2013 in Cologne their results. '
3.152 + u'A short presentation inlcuding a movie about their work done.')
3.153 + article = [_(u'Both students presented to the astonished audience of over 250 Python developers their work.'),
3.154 + _(u'A long applause showed up.'
3.155 + u' Valentin had 9 months ago learned Python and Blender discovered earlier. '
3.156 + u'His Skatsimulation even includes 3D sound.'),
3.157 + _(u'The preparatory courses were made by volunteers, such as the '
3.158 + u'employees of the magazine "Time Online" performed. '
3.159 + u'The following blog entry is a little impression of the success of the courses'),
3.160 + ]
3.161 + game_of_life = _(u'Anne a 15 year old girl showed a 3D-Version of the »Game of life«')
3.162 + skat_simulation = _(u'Valentin (13 years) demomstrates his »Skat-Simulation«')
3.163 + awards = _(u'The award ceremony')
3.164 + return render_template("/impressions_2013.html",
3.165 + act="competition_2013",
3.166 + competition=competition,
3.167 + introduction=introduction,
3.168 + article=article,
3.169 + game_of_life=game_of_life,
3.170 + skat_simulation=skat_simulation,
3.171 + awards=awards)
3.172 +
3.173 +
3.174 +@app.errorhandler(404)
3.175 +def page_not_found(e):
3.176 + msg = _(u"Url: %(url)s not found", url=request.url)
3.177 + info = _(u"This information is not available!")
3.178 + return render_template("404.html", msg=msg, info=info)
3.179 +
3.180 +if __name__ == "__main__":
3.181 + app.run(host='localhost', port=5014, debug=True)
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/eskp_babel.cfg Mon May 05 10:04:09 2014 +0200
4.3 @@ -0,0 +1,4 @@
4.4 +[python: **.py]
4.5 +[jinja2: **/templates/**.html]
4.6 +extensions=jinja2.ext.autoescape,jinja2.ext.with_
4.7 +
5.1 --- a/pymove3d.py Fri Apr 18 16:27:01 2014 +0200
5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
5.3 @@ -1,178 +0,0 @@
5.4 -# -*- coding: utf-8 -*-
5.5 -
5.6 -import os
5.7 -import codecs
5.8 -
5.9 -from docutils.core import publish_parts
5.10 -from flask import Flask
5.11 -from flask import render_template
5.12 -from flask import request
5.13 -from flask.ext.babel import gettext as _
5.14 -from flask.ext.babel import Babel
5.15 -from config import LANGUAGES
5.16 -from sayings import get_saying
5.17 -
5.18 -
5.19 -LANGUAGE_SELECTED = "de"
5.20 -#ToDo after engelish is implemented set LANGUAGE_SELECTED = None
5.21 -
5.22 -app = Flask(__name__)
5.23 -babel = Babel(app)
5.24 -
5.25 -app.config['BABEL_DEFAULT_LOCALE'] = 'de'
5.26 -
5.27 -
5.28 -def get_content(filename, overrides=None):
5.29 - content = u""
5.30 - if os.path.isfile(filename):
5.31 - with codecs.open(filename, 'r', 'utf-8') as f:
5.32 - rst_data = f.read()
5.33 - f.close()
5.34 - content = publish_parts(rst_data, writer_name='html', settings_overrides=overrides)['html_body']
5.35 - return content
5.36 -
5.37 -def get_topmenue():
5.38 - menue = [('/competition', _(u'Competition')),
5.39 - ('/task', _(u'Task')),
5.40 - ('/coursematerial', _(u'Coursematerial')),
5.41 - ('/submission', _(u'Submission')),
5.42 - ('/prizes', _(u'Prizes')),
5.43 - ]
5.44 - return menue
5.45 -
5.46 -app.jinja_env.globals.update(get_topmenue=get_topmenue)
5.47 -
5.48 -
5.49 -@babel.localeselector
5.50 -def get_locale():
5.51 - """ToDo: if translation is completed, switch to en """
5.52 - return LANGUAGE_SELECTED or request.accept_languages.best_match(LANGUAGES.keys()) or 'de'
5.53 -
5.54 -
5.55 -@app.route("/")
5.56 -@app.route("/index")
5.57 -def index():
5.58 - saying, author = get_saying()
5.59 - return render_template("/index.html",
5.60 - saying=saying,
5.61 - author=author,
5.62 - competition_info=_(u'About Competition'),
5.63 - dates=_(u'Dates'),
5.64 - impressions=_(u'Impressions'))
5.65 -
5.66 -@app.route('/de')
5.67 -def de():
5.68 - global LANGUAGE_SELECTED
5.69 - LANGUAGE_SELECTED = "de"
5.70 - saying, author = get_saying()
5.71 - return render_template("/index.html",
5.72 - saying=saying,
5.73 - author=author,
5.74 - competition_info=_(u'About Competition'),
5.75 - dates=_(u'Dates'),
5.76 - impressions=_(u'Impressions'))
5.77 -
5.78 -@app.route('/en')
5.79 -def en():
5.80 - saying, author = get_saying()
5.81 - global LANGUAGE_SELECTED
5.82 - LANGUAGE_SELECTED = "en"
5.83 - return render_template("/index.html",
5.84 - saying=saying,
5.85 - author=author,
5.86 - competition_info=_(u'About Competition'),
5.87 - dates=_(u'Dates'),
5.88 - impressions=_(u'Impressions'))
5.89 -
5.90 -@app.route("/competition")
5.91 -def competition():
5.92 - filename = os.path.join("templates", get_locale(), "rst", "competition.rst")
5.93 - content = get_content(filename)
5.94 - return render_template("/content.html", act="competition", content=content)
5.95 -
5.96 -@app.route("/task")
5.97 -def task():
5.98 - filename = os.path.join("templates", get_locale(), "rst", "task.rst")
5.99 - content = get_content(filename)
5.100 - return render_template("/content.html", act="task", content=content)
5.101 -
5.102 -@app.route("/submission")
5.103 -def submission():
5.104 - filename = os.path.join("templates", get_locale(), "rst", "submission.rst")
5.105 - content = get_content(filename)
5.106 - return render_template("/content.html", act="submission", content=content)
5.107 -
5.108 -@app.route("/coursematerial")
5.109 -def coursematerial():
5.110 - filename = os.path.join("templates", get_locale(), "rst", "coursematerial.rst")
5.111 - content = get_content(filename)
5.112 - return render_template("/content.html", act="coursematerial", content=content)
5.113 -
5.114 -@app.route("/imprint")
5.115 -def imprint():
5.116 - filename = os.path.join("templates", get_locale(), "rst", "imprint.rst")
5.117 - content = get_content(filename)
5.118 - return render_template("/content.html", act="imprint", content=content)
5.119 -
5.120 -@app.route("/privacy")
5.121 -def privacy():
5.122 - filename = os.path.join("templates", get_locale(), "rst", "privacy.rst")
5.123 - overrides = {
5.124 - 'initial_header_level': 2,
5.125 - }
5.126 - content = get_content(filename, overrides=overrides)
5.127 - return render_template("/content.html", act="privacy", content=content)
5.128 -
5.129 -@app.route("/dates")
5.130 -def dates():
5.131 - filename = os.path.join("templates", get_locale(), "rst", "dates.rst")
5.132 - content = get_content(filename)
5.133 - return render_template("/content.html",
5.134 - act="dates", content=content)
5.135 -
5.136 -@app.route("/prizes")
5.137 -def prizes():
5.138 - filename = os.path.join("templates", get_locale(), "rst", "prizes.rst")
5.139 - overrides = {
5.140 - 'initial_header_level': 2,
5.141 - }
5.142 - content = get_content(filename, overrides=overrides)
5.143 - return render_template("/prizes.html",act="prizes", content=content)
5.144 -
5.145 -
5.146 -
5.147 -@app.route("/competition/2013")
5.148 -def competition_2013():
5.149 - competition = _(u'Competition 2013')
5.150 - introduction = _(u'The winners of the programming competition, '
5.151 - u'showed at the PyCon.DE 2013 in Cologne their results. '
5.152 - u'A short presentation inlcuding a movie about their work done.')
5.153 - article = [_(u'Both students presented to the astonished audience of over 250 Python developers their work.'),
5.154 - _(u'A long applause showed up.'
5.155 - u' Valentin had 9 months ago learned Python and Blender discovered earlier. '
5.156 - u'His Skatsimulation even includes 3D sound.'),
5.157 - _(u'The preparatory courses were made by volunteers, such as the '
5.158 - u'employees of the magazine "Time Online" performed. '
5.159 - u'The following blog entry is a little impression of the success of the courses'),
5.160 - ]
5.161 - game_of_life = _(u'Anne a 15 year old girl showed a 3D-Version of the »Game of life«')
5.162 - skat_simulation = _(u'Valentin (13 years) demomstrates his »Skat-Simulation«')
5.163 - awards = _(u'The award ceremony')
5.164 - return render_template("/impressions_2013.html",
5.165 - act="competition_2013",
5.166 - competition=competition,
5.167 - introduction=introduction,
5.168 - article=article,
5.169 - game_of_life=game_of_life,
5.170 - skat_simulation=skat_simulation,
5.171 - awards=awards)
5.172 -
5.173 -
5.174 -@app.errorhandler(404)
5.175 -def page_not_found(e):
5.176 - msg = _(u"Url: %(url)s not found", url=request.url)
5.177 - info = _(u"This information is not available!")
5.178 - return render_template("404.html", msg=msg, info=info)
5.179 -
5.180 -if __name__ == "__main__":
5.181 - app.run(host='localhost', port=5014, debug=True)
6.1 --- a/pymove3d_babel.cfg Fri Apr 18 16:27:01 2014 +0200
6.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
6.3 @@ -1,4 +0,0 @@
6.4 -[python: **.py]
6.5 -[jinja2: **/templates/**.html]
6.6 -extensions=jinja2.ext.autoescape,jinja2.ext.with_
6.7 -