From 1ede4ab8dcf23a789938054e46225309c46a6fa3 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Sat, 14 Sep 2013 01:01:34 +0200 Subject: Remove python SVG stuff --- app/views/svg.py | 43 ------------------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 app/views/svg.py (limited to 'app/views/svg.py') diff --git a/app/views/svg.py b/app/views/svg.py deleted file mode 100644 index 06666b3..0000000 --- a/app/views/svg.py +++ /dev/null @@ -1,43 +0,0 @@ -from ..flask_extend import Blueprint - -from .expenses import calc_month_exp -from . import static_url -from ..model import Category - -from pygal.style import DefaultStyle as Style -from pygal import Pie as _Pie - -mod = Blueprint('svg', __name__) - -Style.background = Style.plot_background = "rgba(255,0,0,0)" - -def Pie(*args, **kwargs): - # does not work as functools.partial, because static_url would be called without request - return _Pie(*args, - style=Style, - js = [static_url('pygal/pygal.js', _external = True)], - legend_font_size = 24, - tooltip_font_size = 24, - value_font_size = 24, - margin = 0, - legend_at_bottom = True, - pretty_print = True, - **kwargs) - -@mod.route("/month//.svg") -def month(year, month): - exp = calc_month_exp(year, month) - pie = Pie() - - expenses = {} - for c in exp.catexps: - expenses[c.cat.name] = float(c.expense) - - for c in Category.query.order_by(Category.name).all(): - pie.add(c.name, expenses.get(c.name, 0.0)) - - if not expenses: - pie.raw_series = [] - pie.add("Empty", 0.1) - - return pie.render_response() -- cgit v1.2.3-70-g09d2