From 88825efaeb28ef9ebff572a8ac4b9056d77b5913 Mon Sep 17 00:00:00 2001 From: bogo Date: Sat, 28 Sep 2024 09:12:18 +0200 Subject: [PATCH] Add popper for custom distance --- app.py | 8 +++++--- templates/base.html | 2 +- templates/custom.html | 22 +++++++++++++++------- templates/pdf_template_custom.html | 8 +++++--- templates/popper_svg.html | 3 +++ templates/setup.html | 4 ++-- translations/pl/LC_MESSAGES/messages.mo | Bin 2972 -> 3086 bytes translations/pl/LC_MESSAGES/messages.po | 8 +++++++- 8 files changed, 38 insertions(+), 17 deletions(-) create mode 100644 templates/popper_svg.html diff --git a/app.py b/app.py index dd54947..48003f1 100644 --- a/app.py +++ b/app.py @@ -27,6 +27,8 @@ IPSC_TARGET_HEIGHT = 58 IPSC_STAGE_WIDTH = 322 IDPA_TARGET_HEIGHT = 78 +POPPER_HEIGHT = 85 +POPPER_WIDTH = 30 VALUES = { "five_to_go": { @@ -276,15 +278,15 @@ def generate_pdf_custom(): size = request.form.get('size') target_type = request.form.get('target_type') scale = distance / simulated_distance - print(distance,simulated_distance_meters, simulated_distance, scale) - original_target_height= IPSC_TARGET_HEIGHT if target_type == 'ipsc' else IDPA_TARGET_HEIGHT + original_target_height= (IPSC_TARGET_HEIGHT if target_type == 'ipsc' else IDPA_TARGET_HEIGHT if target_type == 'idpa' else POPPER_HEIGHT) + original_target_width= (IPSC_TARGET_WIDTH if target_type == 'ipsc' else IPSC_TARGET_WIDTH if target_type == 'idpa' else POPPER_WIDTH) rendered_html = render_template( 'pdf_template_custom.html', distance=distance, size=size, target_height=scale * original_target_height, - target_width=scale * IPSC_TARGET_WIDTH, + target_width=scale * original_target_width, gap=scale * IPSC_GAP + scale * IPSC_TARGET_WIDTH, target_type=target_type, simulated_distance=simulated_distance_meters diff --git a/templates/base.html b/templates/base.html index 6be841d..722f5ae 100644 --- a/templates/base.html +++ b/templates/base.html @@ -44,7 +44,7 @@ - Custom + {% trans %}Custom distance{% endtrans %} diff --git a/templates/custom.html b/templates/custom.html index 11f2b27..019d817 100644 --- a/templates/custom.html +++ b/templates/custom.html @@ -1,19 +1,27 @@ {% extends "base.html" %} -{% block title %}El Presidente{% endblock %} +{% block title %}{%trans%}Custom distance{%endtrans%}{% endblock %} {% block content %}
{% include 'setup.html' %} +
+

{%trans%}Simulated distance{%endtrans%} [m]

+ +
-

{%trans%}Select the stage{%endtrans%}

- -
-

{%trans%}Simulated distance{%endtrans%} [m]

- -
+

{%trans%}Select the target type{%endtrans%}

+
+ +