kopia lustrzana https://github.com/inkstitch/inkstitch
flesh out job details
rodzic
097cc72949
commit
2f30ddd026
|
@ -195,12 +195,22 @@ class Print(InkstitchExtension):
|
|||
view = {'overview': True, 'detailedview': True},
|
||||
logo = {'src' : '', 'title' : 'LOGO'},
|
||||
date = date.today(),
|
||||
client = "The name of the long client name thing",
|
||||
job = {'title' : 'TITLE OF THE JOB LONG NAME THING', 'totalcolors' : '000', 'totalstops' : '000', 'totaltrims' : '000', 'size' : '0000 x 0000', 'stitchcount' : '000 000 000', 'totalthread' : '000 000 000', 'estimatedtime' : '00h00 @ 000mm/s'},
|
||||
client = "",
|
||||
job = {
|
||||
'title': 'Ink/Stitch Design',
|
||||
'num_colors': stitch_plan.num_colors,
|
||||
'num_color_blocks': len(stitch_plan),
|
||||
'num_stops': stitch_plan.num_stops,
|
||||
'num_trims': stitch_plan.num_trims,
|
||||
'dimensions': stitch_plan.dimensions_mm,
|
||||
'num_stitches': stitch_plan.num_stitches,
|
||||
'estimated_time': "", # TODO
|
||||
'estimated_thread': "", # TODO
|
||||
},
|
||||
svg_overview = overview_svg,
|
||||
svg_scale = '1/1',
|
||||
svg_scale = '100%',
|
||||
color_blocks = stitch_plan.color_blocks,
|
||||
num_pages = '2',
|
||||
num_pages = len(stitch_plan.color_blocks) + 1,
|
||||
)
|
||||
|
||||
print_preview_server = PrintPreviewServer(html=html)
|
||||
|
|
|
@ -72,6 +72,32 @@ class StitchPlan(object):
|
|||
def __iter__(self):
|
||||
return iter(self.color_blocks)
|
||||
|
||||
def __len__(self):
|
||||
return len(self.color_blocks)
|
||||
|
||||
@property
|
||||
def num_colors(self):
|
||||
"""Number of unique colors in the stitch plan."""
|
||||
return len({block.color for block in self})
|
||||
|
||||
@property
|
||||
def num_stops(self):
|
||||
return sum(block.num_stops for block in self)
|
||||
|
||||
@property
|
||||
def num_trims(self):
|
||||
return sum(block.num_trims for block in self)
|
||||
|
||||
@property
|
||||
def num_stitches(self):
|
||||
return sum(block.num_stitches for block in self)
|
||||
|
||||
@property
|
||||
def dimensions_mm(self):
|
||||
# TODO: implement this. Should do a bounding box calculation and
|
||||
# convert to millimeters.
|
||||
return ""
|
||||
|
||||
|
||||
class ColorBlock(object):
|
||||
"""Holds a set of stitches, all with the same thread color."""
|
||||
|
@ -106,6 +132,26 @@ class ColorBlock(object):
|
|||
else:
|
||||
return None
|
||||
|
||||
@property
|
||||
def num_stitches(self):
|
||||
"""Number of stitches in this color block."""
|
||||
return len(self.stitches)
|
||||
|
||||
@property
|
||||
def num_stops(self):
|
||||
"""Number of pauses in this color block."""
|
||||
|
||||
# Stops are encoded using two STOP stitches each. See the comment in
|
||||
# stop.py for an explanation.
|
||||
|
||||
return sum(1 for stitch in self if stitch.stop) / 2
|
||||
|
||||
@property
|
||||
def num_trims(self):
|
||||
"""Number of trims in this color block."""
|
||||
|
||||
return sum(1 for stitch in self if stitch.trim)
|
||||
|
||||
def filter_duplicate_stitches(self):
|
||||
if not self.stitches:
|
||||
return
|
||||
|
|
|
@ -22,6 +22,9 @@ class ThreadColor(object):
|
|||
else:
|
||||
return self == ThreadColor(other)
|
||||
|
||||
def __hash__(self):
|
||||
return hash(self.rgb)
|
||||
|
||||
def __ne__(self, other):
|
||||
return not(self == other)
|
||||
|
||||
|
|
13
messages.po
13
messages.po
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PROJECT VERSION\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2018-03-21 20:10-0400\n"
|
||||
"POT-Creation-Date: 2018-03-21 22:09-0400\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -279,13 +279,13 @@ msgstr ""
|
|||
msgid "thread used"
|
||||
msgstr ""
|
||||
|
||||
msgid "nr. stitches"
|
||||
msgid "# stitches"
|
||||
msgstr ""
|
||||
|
||||
msgid "nr. stops"
|
||||
msgid "# stops"
|
||||
msgstr ""
|
||||
|
||||
msgid "nr. trims"
|
||||
msgid "# trims"
|
||||
msgstr ""
|
||||
|
||||
msgid "Page"
|
||||
|
@ -325,7 +325,10 @@ msgstr ""
|
|||
msgid "Client Signature"
|
||||
msgstr ""
|
||||
|
||||
msgid "Total colors"
|
||||
msgid "Unique Colors"
|
||||
msgstr ""
|
||||
|
||||
msgid "Color Blocks"
|
||||
msgstr ""
|
||||
|
||||
msgid "Total nr stops"
|
||||
|
|
Plik binarny nie jest wyświetlany.
Plik binarny nie jest wyświetlany.
Plik binarny nie jest wyświetlany.
Plik binarny nie jest wyświetlany.
|
@ -13,6 +13,35 @@
|
|||
}
|
||||
|
||||
|
||||
@font-face {
|
||||
font-family: 'Barlow';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: url(barlow-bold.ttf) format('truetype');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Barlow';
|
||||
font-style: normal;
|
||||
font-weight: 800;
|
||||
src: url(barlow-extra-bold.ttf) format('truetype');
|
||||
}
|
||||
|
||||
|
||||
@font-face {
|
||||
font-family: 'Barlow Condensed';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: url(barlow-condensed-bold.ttf) format('truetype');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Barlow Condensed';
|
||||
font-style: normal;
|
||||
font-weight: 800;
|
||||
src: url(barlow-condensed-extra-bold.ttf) format('truetype');
|
||||
}
|
||||
|
||||
@media screen {
|
||||
.page {
|
||||
margin-top: 20mm !important;
|
||||
|
@ -313,7 +342,10 @@ footer {
|
|||
}
|
||||
|
||||
.colorSwatch {
|
||||
font-family: "Barlow Condensed", sans-serif;
|
||||
font-family: "Barlow", sans-serif;
|
||||
|
||||
/* white text on dark colors doesn't print well unless it's bold */
|
||||
font-weight: 700;
|
||||
font-size: 12pt;
|
||||
color: black;
|
||||
background: white;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<svg width="100%" height="100%" class="colorSwatchSVG" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect fill="rgb{{ color_block.color.rgb }}" width="100%" height="100%" />
|
||||
<text fill="rgb{{ color_block.color.font_color }}" x="2mm" y="2mm">
|
||||
<tspan dy="1.2em" x="10" class="colorName">{{ _('Color') }}: {{ color_block.color.thred_name }}</tspan>
|
||||
<tspan dy="1.2em" x="10" class="colorName">{{ _('Color') }}: {{ color_block.color.thread_name }}</tspan>
|
||||
{# We don't want to see rgb and thread_used if we have more than 7 colorSwatches to show #}
|
||||
{% if view == 'detailedview' or (view != 'detailedview' and color_blocks|length < 7) %}
|
||||
<tspan dy="1.2em" x="10" class="colorRgb">{{ _('rgb') }}: {{ color_block.color.rgb }}</tspan>
|
||||
|
@ -11,12 +11,12 @@
|
|||
{% endif %}
|
||||
{# We don't want to see num_stitch if we have more than 49 colorSwatches to show #}
|
||||
{% if view == 'detailedview' or (view != 'detailedview' and color_blocks|length < 49) %}
|
||||
<tspan dy="1.2em" x="10" class="swatchStitches">{{ _('nr. stitches') }}: {{ color_block.num_stitches }}</tspan>
|
||||
<tspan dy="1.2em" x="10" class="swatchStitches">{{ _('# stitches') }}: {{ color_block.num_stitches }}</tspan>
|
||||
{% endif %}
|
||||
{# We don't want to see stops and trims if we have more than 13 colorSwatches to show #}
|
||||
{% if view == 'detailedview' or (view != 'detailedview' and color_blocks|length < 13) %}
|
||||
<tspan dy="1.2em" x="10" class="swatchStops">{{ _('nr. stops') }}: {{ color_block.num_stops }}</tspan>
|
||||
<tspan dy="1.2em" x="10" class="swatchTrims">{{ _('nr. trims') }}: {{ color_block.num_stops }}</tspan>
|
||||
<tspan dy="1.2em" x="10" class="swatchStops">{{ _('# stops') }}: {{ color_block.num_stops }}</tspan>
|
||||
<tspan dy="1.2em" x="10" class="swatchTrims">{{ _('# trims') }}: {{ color_block.num_stops }}</tspan>
|
||||
{% endif %}
|
||||
</text>
|
||||
</svg>
|
||||
|
|
|
@ -2,18 +2,19 @@
|
|||
{% include 'headline.html' %}
|
||||
<div class="jobDetails">
|
||||
<div>
|
||||
<p><span>{{ _('Total colors') }}:</span><span>{{ job.totalcolors }}</span></p>
|
||||
<p><span>{{ _('Total nr stops') }}:</span><span>{{ job.totalstops }}</span></p>
|
||||
<p><span>{{ _('Total nr trims') }}:</span><span>{{ job.totaltrims }}</span></p>
|
||||
<p><span>{{ _('Unique Colors') }}:</span><span>{{ job.num_colors }}</span></p>
|
||||
<p><span>{{ _('Color Blocks') }}:</span><span>{{ job.num_color_blocks }}</span></p>
|
||||
<p><span>{{ _('Total nr stops') }}:</span><span>{{ job.num_stops }}</span></p>
|
||||
<p><span>{{ _('Total nr trims') }}:</span><span>{{ job.num_trims }}</span></p>
|
||||
</div>
|
||||
<div>
|
||||
<p><span>{{ _('Design box size') }}:</span><span>{{ job.size }}</span></p>
|
||||
<p><span>{{ _('Total stitch count') }}:</span><span>{{job.stitchcount }}</span></p>
|
||||
<p><span>{{ _('Total thread used') }}:</span><span>{{job.totalthread }}</span></p>
|
||||
<p><span>{{ _('Design box size') }}:</span><span>{{ job.dimensions }}</span></p>
|
||||
<p><span>{{ _('Total stitch count') }}:</span><span>{{job.num_stitches }}</span></p>
|
||||
<p><span>{{ _('Total thread used') }}:</span><span>{{job.estimated_thread }}</span></p>
|
||||
</div>
|
||||
<div>
|
||||
<p><span>{{ _('Job estimated time') }}:</span></p>
|
||||
<p><span>{{ job.estimatedtime }}</span></p>
|
||||
<p><span>{{ job.estimated_time }}</span></p>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
|
Ładowanie…
Reference in New Issue