From 084c5555f21a6e927e4de98fdb66c4c408626f58 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Fri, 30 Mar 2018 20:37:11 -0400 Subject: print through web browser (#127) * spawn a web server and open a printable view of the design in the user's web browser * configurable inclusion of client and operator views * editable fields for color names, client, title, and purchase order number * groundwork laid to save these parameters back into the SVG * major refactor of codebase to support printing * code is organized logically into modules * added inkstitch logo and branding guidelines * l10n text extraction now handled by babel * removed legacy embroider_update extension * partial fix for #125 --- print/templates/color_swatch.html | 51 ++++++++++++++++++++ print/templates/footer.html | 7 +++ print/templates/headline.html | 12 +++++ print/templates/index.html | 32 +++++++++++++ print/templates/operator_detailedview.html | 77 ++++++++++++++++++++++++++++++ print/templates/operator_overview.html | 33 +++++++++++++ print/templates/print_detail.html | 28 +++++++++++ print/templates/print_overview.html | 42 ++++++++++++++++ print/templates/ui.html | 33 +++++++++++++ 9 files changed, 315 insertions(+) create mode 100644 print/templates/color_swatch.html create mode 100644 print/templates/footer.html create mode 100644 print/templates/headline.html create mode 100644 print/templates/index.html create mode 100644 print/templates/operator_detailedview.html create mode 100644 print/templates/operator_overview.html create mode 100644 print/templates/print_detail.html create mode 100644 print/templates/print_overview.html create mode 100644 print/templates/ui.html (limited to 'print/templates') diff --git a/print/templates/color_swatch.html b/print/templates/color_swatch.html new file mode 100644 index 00000000..21cc0c21 --- /dev/null +++ b/print/templates/color_swatch.html @@ -0,0 +1,51 @@ + + {% if printview != 'detailedview' %} +
+
+ + + + {{ _('Color') }}: {{ color_block.color.thread_name }} + {# We don't want to see rgb if we have more than 7 colorSwatches #} + {% if color_blocks|length < 7 %} + {{ _('rgb') }}: {{ color_block.color.rgb }} + {% endif %} + {# We don't want to see thread_used if we have more than 7 colorSwatches to show #} + {% if color_blocks|length < 7 %} + {{ _('thread used') }}: {{ color_block.color.thread_description }} + {% endif %} + {# We don't want to see num_stitch if we have more than 49 colorSwatches to show #} + {% if color_blocks|length < 49 %} + {{ _('# stitches') }}: {{ color_block.num_stitches }} + {% endif %} + {# We don't want to see stops and trims if we have more than 13 colorSwatches to show #} + {% if color_blocks|length < 13 %} + {{ _('# stops') }}: {{ color_block.num_stops }} + {{ _('# trims') }}: {{ color_block.num_trims }} + {% endif %} + + +
+
+ + {% else %} + +
+
+ + + +
+
+

{{ _('Color') }}:{{ color_block.color.thread_name }}

+

{{ _('rgb') }}:{{ color_block.color.rgb }}

+

{{ _('thread used') }}:{{ color_block.color.thread_description }}

+

{{ _('# stitches') }}:{{ color_block.num_stitches }}

+

{{ _('# stops') }}:{{ color_block.num_stops }}

+

{{ _('# trims') }}:{{ color_block.num_trims }}

+
+
+
+
+ + {%endif %} diff --git a/print/templates/footer.html b/print/templates/footer.html new file mode 100644 index 00000000..0c043e2f --- /dev/null +++ b/print/templates/footer.html @@ -0,0 +1,7 @@ + + + + diff --git a/print/templates/headline.html b/print/templates/headline.html new file mode 100644 index 00000000..649c02ea --- /dev/null +++ b/print/templates/headline.html @@ -0,0 +1,12 @@ + +
+
+

{{ job.title }}

+

{{ client }}

+

{{ purchase_order }}

+
+ +
{{ date|datetimeformat(_('%Y.%m.%d')) }}
+
diff --git a/print/templates/index.html b/print/templates/index.html new file mode 100644 index 00000000..21ca74ab --- /dev/null +++ b/print/templates/index.html @@ -0,0 +1,32 @@ + + + + Ink/Stitch Print Preview + + + + + + {% include 'ui.html' %} + +{# client overview #} +
{% include 'print_overview.html' %}
+ +{# client detailedview #} + {% set printview = 'detailedview' %} + {% for color_block in color_blocks %} + {% set outer_loop = loop %} +
{% include 'print_detail.html' %}
+ {% endfor %} + +{# operator overview #} +
{% include 'operator_overview.html' %}
+ +{# operator detailed view #} + {% for color_block_part in color_blocks | batch(13) %} + {% set outer_loop = loop %} +
{% include 'operator_detailedview.html' %}
+ {% endfor %} + + + diff --git a/print/templates/operator_detailedview.html b/print/templates/operator_detailedview.html new file mode 100644 index 00000000..633b9286 --- /dev/null +++ b/print/templates/operator_detailedview.html @@ -0,0 +1,77 @@ +
+ {% include 'headline.html' %} +
+ +
+
+
+

{# svg color #}

+

{# svg preview #}

+

{{ _('Color') }}

+

{{ _('Thread Consumption') }}

+

{{ _('Stops and Trims') }}

+

{{ _('Estimated Time') }}

+
+ {% if outer_loop.index == 1 %} +
+

+ ## +

+

+ {{ svg_overview|safe }} +

+

+ {{ _('Unique Colors') }}: {{ job.num_colors }} + {{ _('Color Blocks') }}: {{ job.num_color_blocks }} +

+

+ {{ _('Design box size') }}: {{ job.dimensions }} + {{ _('Total thread used') }}: {{job.estimated_thread }} + {{ _('Total stitch count') }}: {{job.num_stitches }} +

+

+ {{ _('Total nr stops') }}: {{ job.num_stops }} + {{ _('Total nr trims') }}: {{ job.num_trims }} +

+

+ {{ job.estimated_time }} +

+
+ {% endif %} + {% for color_block in color_block_part %} + +
+

+ + + + #{{ loop.index + outer_loop.index0 * 13 }} + + +

+

+ {{ color_block.svg_preview|safe }} +

+

+ {{ color_block.color.thread_name }} + {{ color_block.color.rgb }} +

+

+ {{ _('thread used') }}: {{ color_block.color.thread_description }} + {{ _('# stitches') }}: {{ color_block.num_stitches }} +

+

+ {{ _('# stops') }}: {{ color_block.num_stops }} + {{ _('# trims') }}: {{ color_block.num_trims }} +

+

+ {{ color_block.estimatedtime }} +

+
+ {% endfor %} +
+
+ + {% include 'footer.html' %} + + diff --git a/print/templates/operator_overview.html b/print/templates/operator_overview.html new file mode 100644 index 00000000..25048ab7 --- /dev/null +++ b/print/templates/operator_overview.html @@ -0,0 +1,33 @@ +
+ {% include 'headline.html' %} +
+
+
+

{{ _('Unique Colors') }}:{{ job.num_colors }}

+

{{ _('Color Blocks') }}:{{ job.num_color_blocks }}

+

{{ _('Total nr stops') }}:{{ job.num_stops }}

+

{{ _('Total nr trims') }}:{{ job.num_trims }}

+
+
+
+
+

{{ _('Design box size') }}:{{ job.dimensions }}

+

{{ _('Total stitch count') }}:{{job.num_stitches }}

+

{{ _('Total thread used') }}:{{job.estimated_thread }}

+
+
+
+
+

{{ _('Job estimated time') }}:

+

{{ job.estimated_time }}

+
+
+
+
+
+
+ {{ svg_overview|safe }} +
{{ _('Scale') }} {{ svg_scale }}
+
+
+ {% include 'footer.html' %} diff --git a/print/templates/print_detail.html b/print/templates/print_detail.html new file mode 100644 index 00000000..18a70bba --- /dev/null +++ b/print/templates/print_detail.html @@ -0,0 +1,28 @@ +
+ {% include 'headline.html' %} +
+
+
+

{{ _('COLOR') }}:{{ color_block.color.thread_name }}

+
+
+
+
+

{{ _('Estimated time') }}:

+

{{ color_block.estimatedtime }}

+
+
+
+
+
+
+ {{color_block.svg_preview|safe}} +
{{ _('Scale') }} {{ svg_scale }}
+
+ +
+ {% include 'color_swatch.html' %} +
+
+ + {% include 'footer.html' %} diff --git a/print/templates/print_overview.html b/print/templates/print_overview.html new file mode 100644 index 00000000..f5632ceb --- /dev/null +++ b/print/templates/print_overview.html @@ -0,0 +1,42 @@ +
+ {% include 'headline.html' %} +
+
+
+

{{ _('Unique Colors') }}:{{ job.num_colors }}

+

{{ _('Color Blocks') }}:{{ job.num_color_blocks }}

+

{{ _('Total nr stops') }}:{{ job.num_stops }}

+

{{ _('Total nr trims') }}:{{ job.num_trims }}

+
+
+
+
+

{{ _('Design box size') }}:{{ job.dimensions }}

+

{{ _('Total stitch count') }}:{{job.num_stitches }}

+

{{ _('Total thread used') }}:{{job.estimated_thread }}

+
+
+
+
+

{{ _('Job estimated time') }}:

+

{{ job.estimated_time }}

+
+
+
+
+
+
+ {{ svg_overview|safe }} +
{{ _('Scale') }} {{ svg_scale }}
+
+ +
+ {% for color_block in color_blocks %} + {% include 'color_swatch.html' %} + {% endfor %} + +
+
{{ _('Client Signature') }}
+
+ + {% include 'footer.html' %} diff --git a/print/templates/ui.html b/print/templates/ui.html new file mode 100644 index 00000000..078f1a4c --- /dev/null +++ b/print/templates/ui.html @@ -0,0 +1,33 @@ +
+

{{ _('Ink/Stitch Print Preview') }}

+
+ + + +
+
+ {{ _('⚠ lost connection to Ink/Stitch') }} +
+
+ +
+

X

+

{{ _('Settings') }}

+
+

{{ _('Printing Size') }}: + +

+
+
+
+ {{ ('Print Layouts') }}: +

+

+

+

+
+
+
-- cgit v1.2.3