kopia lustrzana https://github.com/inkstitch/inkstitch
Language-Stylesheets for Print-PDF (#1156)
rodzic
92b0b0a8bd
commit
08adc27b30
|
@ -21,6 +21,7 @@ from jinja2 import Environment, FileSystemLoader, select_autoescape
|
|||
from lxml import etree
|
||||
|
||||
from ..gui import open_url
|
||||
from ..i18n import get_languages
|
||||
from ..i18n import translation as inkstitch_translation
|
||||
from ..stitch_plan import patches_to_stitch_plan
|
||||
from ..svg import render_stitch_plan
|
||||
|
@ -186,9 +187,11 @@ class PrintPreviewServer(Thread):
|
|||
class Print(InkstitchExtension):
|
||||
def build_environment(self):
|
||||
if getattr(sys, 'frozen', False):
|
||||
template_dir = os.path.join(sys._MEIPASS, "print", "templates")
|
||||
print_dir = os.path.join(sys._MEIPASS, "print")
|
||||
else:
|
||||
template_dir = os.path.realpath(os.path.join(os.path.dirname(__file__), "..", "..", "print", "templates"))
|
||||
print_dir = os.path.realpath(os.path.join(os.path.dirname(__file__), "..", "..", "print"))
|
||||
|
||||
template_dir = os.path.join(print_dir, "templates")
|
||||
|
||||
env = Environment(
|
||||
loader=FileSystemLoader(template_dir),
|
||||
|
@ -199,6 +202,14 @@ class Print(InkstitchExtension):
|
|||
env.filters['datetimeformat'] = datetimeformat
|
||||
env.install_gettext_translations(inkstitch_translation)
|
||||
|
||||
languages_with_style = []
|
||||
languages = get_languages()
|
||||
for lang in languages:
|
||||
css_file = "%s.css" % lang
|
||||
if os.path.isfile(os.path.join(print_dir, "resources", css_file)):
|
||||
languages_with_style.append(lang)
|
||||
env.languages = languages_with_style
|
||||
|
||||
return env
|
||||
|
||||
def strip_namespaces(self, svg):
|
||||
|
@ -280,6 +291,7 @@ class Print(InkstitchExtension):
|
|||
color_blocks=stitch_plan.color_blocks,
|
||||
palettes=ThreadCatalog().palette_names(),
|
||||
selected_palette=selected_palette,
|
||||
languages=env.languages
|
||||
)
|
||||
|
||||
def effect(self):
|
||||
|
|
Plik binarny nie jest wyświetlany.
Plik binarny nie jest wyświetlany.
|
@ -0,0 +1,21 @@
|
|||
@font-face {
|
||||
font-family: 'FiraSans';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(fonts/FiraSansLight.woff) format('woff');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'FiraSans Condensed';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(fonts/FiraSansCondensed-Light.woff) format('woff');
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'FiraSans', sans-serif;
|
||||
}
|
||||
|
||||
.condensed {
|
||||
font-family: 'FiraSans Condensed', sans-serif;
|
||||
}
|
|
@ -1,45 +1,43 @@
|
|||
@font-face {
|
||||
font-family: 'Barlow Condensed';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(barlow_condensed.ttf) format('truetype');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Barlow';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(barlow.ttf) format('truetype');
|
||||
src: url(fonts/barlow.ttf) format('truetype');
|
||||
}
|
||||
|
||||
|
||||
@font-face {
|
||||
font-family: 'Barlow';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: url(barlow-bold.ttf) format('truetype');
|
||||
src: url(fonts/barlow-bold.ttf) format('truetype');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Barlow';
|
||||
font-style: normal;
|
||||
font-weight: 800;
|
||||
src: url(barlow-extra-bold.ttf) format('truetype');
|
||||
src: url(fonts/barlow-extra-bold.ttf) format('truetype');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Barlow Condensed';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(fonts/barlow_condensed.ttf) format('truetype');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Barlow Condensed';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: url(barlow-condensed-bold.ttf) format('truetype');
|
||||
src: url(fonts/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');
|
||||
src: url(fonts/barlow-condensed-extra-bold.ttf) format('truetype');
|
||||
}
|
||||
|
||||
body {
|
||||
|
@ -51,6 +49,10 @@ body {
|
|||
margin-bottom: 5mm;
|
||||
}
|
||||
|
||||
.condensed {
|
||||
font-family: "Barlow Condensed", sans-serif;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
@ -475,7 +477,6 @@ body {
|
|||
display: -ms-flexbox; /* IE 10 */
|
||||
width: calc(100% - 50mm);
|
||||
height: 50%;
|
||||
font-family: "Barlow Condensed", sans-serif;
|
||||
font-size: 10pt;
|
||||
}
|
||||
|
||||
|
@ -610,7 +611,6 @@ body {
|
|||
color: white;
|
||||
display: inline-block;
|
||||
font-size: 16px;
|
||||
font-family: "Barlow", sans-serif;
|
||||
padding-left: 3px;
|
||||
padding-right: 3px;
|
||||
margin: 0px 1px 0px 1px;
|
||||
|
@ -647,8 +647,6 @@ body {
|
|||
}
|
||||
|
||||
.color-swatch {
|
||||
font-family: "Barlow", sans-serif;
|
||||
|
||||
/* white text on dark colors doesn't print well unless it's bold */
|
||||
font-weight: 700;
|
||||
font-size: 12pt;
|
||||
|
@ -946,7 +944,6 @@ body {
|
|||
right: 1em;
|
||||
top: 1em;
|
||||
color: red;
|
||||
font-family: "Barlow", sans-serif;
|
||||
font-size: 12pt;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
<script src="resources/jquery-3.3.1.min.js"></script>
|
||||
<script src="resources/inkstitch.js"></script>
|
||||
<link rel="stylesheet" href="resources/style.css" />
|
||||
{% for l in languages %}
|
||||
<link rel="stylesheet" href="resources/{{ l }}.css" />
|
||||
{% endfor %}
|
||||
<link rel="shortcut icon" type="image/png" href="/favicon.png"/>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<header>
|
||||
{% include 'headline.html' %}
|
||||
<div class="job-details">
|
||||
<div class="job-details condensed">
|
||||
<div>
|
||||
<div class="table">
|
||||
<p><span>{{ _('Unique Colors') }}:</span><span>{{ job.num_colors }}</span></p>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<header>
|
||||
{% include 'headline.html' %}
|
||||
<div class="job-details">
|
||||
<div class="job-details condensed">
|
||||
<div>
|
||||
<div class="table">
|
||||
<p><span>{{ _('COLOR') }}:</span><span data-field-name="color-{{ color_block.color.hex_digits }}" contenteditable="true" data-placeholder="{{ _('Enter thread name...') }}">{{ color_block.color.thread_name }}</span></p>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<header>
|
||||
{% include 'headline.html' %}
|
||||
<div class="job-details">
|
||||
<div class="job-details condensed">
|
||||
<div>
|
||||
<div class="table">
|
||||
<p><span>{{ _('Unique Colors') }}:</span><span>{{ job.num_colors }}</span></p>
|
||||
|
|
Ładowanie…
Reference in New Issue