diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2021-03-04 18:40:53 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-04 18:40:53 +0100 |
| commit | e84a86d4ac0caf29d6074728376ff0a594243fec (patch) | |
| tree | 888c79ed0094ba2916a1d329861a85515959913c /lib/inx/utils.py | |
| parent | b39575a50191307b3b56eab6455626398eec6397 (diff) | |
Update for Inkscape 1.0 (#880)
* update for inkscape 1.0
* add about extension
* Build improvements for the inkscape1.0 branch (#985)
* zip: export real svg not stitch plan
* #411 and #726
* Tools for Font Creators (#1018)
* ignore very small holes in fills
* remove embroider (#1026)
* auto_fill: ignore shrink_or_grow if result is empty (#589)
* break apart: do not ignore small fills
Co-authored-by: Hagen Fritsch <rumpeltux-github@irgendwo.org>
Co-authored-by: Lex Neva <github.com@lexneva.name>
Diffstat (limited to 'lib/inx/utils.py')
| -rw-r--r-- | lib/inx/utils.py | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/lib/inx/utils.py b/lib/inx/utils.py index a7c98a60..2fb6b21b 100644 --- a/lib/inx/utils.py +++ b/lib/inx/utils.py @@ -6,11 +6,13 @@ from os.path import dirname from jinja2 import Environment, FileSystemLoader -from ..i18n import N_, locale_dir, translation as default_translation +from ..i18n import N_, locale_dir +from ..i18n import translation as default_translation _top_path = dirname(dirname(dirname(os.path.realpath(__file__)))) inx_path = os.path.join(_top_path, "inx") template_path = os.path.join(_top_path, "templates") +version_path = _top_path current_translation = default_translation current_locale = "en_US" @@ -26,16 +28,29 @@ def build_environment(): env.install_gettext_translations(current_translation) env.globals["locale"] = current_locale + with open(os.path.join(version_path, 'LICENSE'), 'r') as license: + env.globals["inkstitch_license"] = "".join(license.readlines()) + if "BUILD" in os.environ: # building a ZIP release, with inkstitch packaged as a binary + # About extension: add version information + with open(os.path.join(version_path, 'VERSION'), 'r') as version: + env.globals["inkstitch_version"] = "%s %s" % (version.readline(), current_locale) + # Command tag and icons path if sys.platform == "win32": - env.globals["command_tag"] = '<command reldir="extensions">inkstitch/bin/inkstitch.exe</command>' + env.globals["command_tag"] = '<command location="inx">inkstitch/bin/inkstitch.exe</command>' + env.globals["image_path"] = 'inkstitch/bin/icons/' + elif sys.platform == "darwin": + env.globals["command_tag"] = '<command location="inx">inkstitch.app/Contents/MacOS/inkstitch</command>' + env.globals["image_path"] = 'inkstitch.app/Contents/MacOS/icons/' else: - env.globals["command_tag"] = '<command reldir="extensions">inkstitch/bin/inkstitch</command>' + env.globals["command_tag"] = '<command location="inx">inkstitch/bin/inkstitch</command>' + env.globals["image_path"] = 'inkstitch/bin/icons/' else: # user is running inkstitch.py directly as a developer - env.globals["command_tag"] = '<command reldir="extensions" interpreter="python">inkstitch.py</command>' - + env.globals["command_tag"] = '<command location="inx" interpreter="python">../../inkstitch.py</command>' + env.globals["image_path"] = '../../icons/' + env.globals["inkstitch_version"] = "Manual Install" return env @@ -49,8 +64,8 @@ def write_inx_file(name, contents): raise inx_file_name = "inkstitch_%s.inx" % name - with open(os.path.join(inx_locale_dir, inx_file_name), 'w') as inx_file: - print >> inx_file, contents.encode("utf-8") + with open(os.path.join(inx_locale_dir, inx_file_name), 'w', encoding="utf-8") as inx_file: + print(contents, file=inx_file) def iterate_inx_locales(): @@ -64,7 +79,7 @@ def iterate_inx_locales(): # generate menu items for this language in Inkscape's "Extensions" # menu. magic_string = N_("Generate INX files") - translated_magic_string = translation.ugettext(magic_string) + translated_magic_string = translation.gettext(magic_string) if translated_magic_string != magic_string or locale == "en_US": current_translation = translation |
