summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--icons/inkstitch_colour_logo.pngbin991 -> 14644 bytes
-rw-r--r--lib/extensions/__init__.py4
-rw-r--r--lib/extensions/about.py14
-rw-r--r--lib/gui/about.py98
-rw-r--r--lib/inx/generate.py2
-rwxr-xr-xlib/inx/info.py14
-rwxr-xr-xlib/inx/utils.py12
-rwxr-xr-xlib/utils/version.py29
-rw-r--r--python-wheels/Shapely-1.6.3-cp27-cp27m-win32.whlbin547232 -> 0 bytes
-rw-r--r--templates/about.xml25
-rw-r--r--templates/embroider.xml18
11 files changed, 143 insertions, 73 deletions
diff --git a/icons/inkstitch_colour_logo.png b/icons/inkstitch_colour_logo.png
index 9bbdcb0a..28ce4404 100644
--- a/icons/inkstitch_colour_logo.png
+++ b/icons/inkstitch_colour_logo.png
Binary files differ
diff --git a/lib/extensions/__init__.py b/lib/extensions/__init__.py
index a4c8edca..e38eeb43 100644
--- a/lib/extensions/__init__.py
+++ b/lib/extensions/__init__.py
@@ -3,6 +3,7 @@
# Copyright (c) 2010 Authors
# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
+from .about import About
from .apply_palette import ApplyPalette
from .apply_threadlist import ApplyThreadlist
from .auto_run import AutoRun
@@ -66,7 +67,8 @@ from .update_svg import UpdateSvg
from .zigzag_line_to_satin import ZigzagLineToSatin
from .zip import Zip
-__all__ = extensions = [ApplyPalette,
+__all__ = extensions = [About,
+ ApplyPalette,
ApplyThreadlist,
AutoRun,
AutoSatin,
diff --git a/lib/extensions/about.py b/lib/extensions/about.py
new file mode 100644
index 00000000..f4ab233c
--- /dev/null
+++ b/lib/extensions/about.py
@@ -0,0 +1,14 @@
+# Authors: see git history
+#
+# Copyright (c) 2023 Authors
+# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
+
+from ..gui.about import AboutInkstitchApp
+from .base import InkstitchExtension
+
+
+class About(InkstitchExtension):
+
+ def effect(self):
+ app = AboutInkstitchApp()
+ app.MainLoop()
diff --git a/lib/gui/about.py b/lib/gui/about.py
new file mode 100644
index 00000000..5033dabf
--- /dev/null
+++ b/lib/gui/about.py
@@ -0,0 +1,98 @@
+# Authors: see git history
+#
+# Copyright (c) 2023 Authors
+# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
+
+import os
+import wx
+import wx.adv
+
+from ..i18n import _
+from ..utils import get_resource_dir
+from ..utils.version import get_inkstitch_version, get_inkstitch_license
+
+
+class AboutFrame(wx.Frame):
+
+ def __init__(self, *args, **kwargs):
+ wx.Frame.__init__(self, None, wx.ID_ANY, _("About Ink/Stitch"), *args, **kwargs)
+
+ self.SetWindowStyle(wx.FRAME_FLOAT_ON_PARENT | wx.DEFAULT_FRAME_STYLE)
+
+ main_panel = wx.Panel(self, wx.ID_ANY)
+
+ notebook_sizer = wx.BoxSizer(wx.VERTICAL)
+ notebook = wx.Notebook(main_panel, wx.ID_ANY)
+ notebook_sizer.Add(notebook, 1, wx.EXPAND, 0)
+
+ info_panel = wx.Panel(notebook, wx.ID_ANY)
+ notebook.AddPage(info_panel, _("About"))
+
+ info_sizer = wx.BoxSizer(wx.VERTICAL)
+
+ inkstitch_logo = wx.Image(
+ os.path.join(
+ get_resource_dir('icons'),
+ "inkstitch_colour_logo.png"
+ )
+ ).ConvertToBitmap()
+
+ inkstitch_logo = wx.StaticBitmap(info_panel, -1, inkstitch_logo, (10, 5), (inkstitch_logo.GetWidth(), inkstitch_logo.GetHeight()))
+
+ inkstitch_version = get_inkstitch_version()
+ inkstitch_version = wx.StaticText(info_panel, label=inkstitch_version)
+ version_font = wx.Font().Bold()
+ inkstitch_version.SetFont(version_font)
+
+ inkstitch_description = _("An open-source machine embroidery design platform based on Inkscape.")
+ inkstitch_description = wx.StaticText(info_panel, label=inkstitch_description)
+
+ inkstitch_link = wx.adv.HyperlinkCtrl(
+ info_panel,
+ wx.ID_ANY,
+ _("https://inkstitch.org"),
+ _("https://inkstitch.org")
+ )
+ inkstitch_link.Bind(wx.adv.EVT_HYPERLINK, self.on_link_clicked)
+
+ info_sizer.Add(inkstitch_logo, 1, wx.RIGHT | wx.LEFT | wx.ALIGN_CENTER, 20)
+ info_sizer.Add(inkstitch_version, 0, wx.RIGHT | wx.LEFT, 20)
+ info_sizer.Add(inkstitch_description, 0, wx.RIGHT | wx.LEFT, 20)
+ info_sizer.Add(0, 10, 0)
+ info_sizer.Add(inkstitch_link, 0, wx.RIGHT | wx.LEFT, 20)
+ info_sizer.Add(0, 40, 0)
+
+ license_panel = wx.Panel(notebook, wx.ID_ANY)
+ notebook.AddPage(license_panel, _("License"))
+
+ license_sizer = wx.BoxSizer(wx.VERTICAL)
+ license_text = get_inkstitch_license()
+ license_text = wx.TextCtrl(
+ license_panel,
+ size=(600, 500),
+ value=license_text,
+ style=wx.TE_MULTILINE | wx.SUNKEN_BORDER | wx.TE_READONLY | wx.HSCROLL
+ )
+ license_sizer.Add(license_text, 0, wx.EXPAND | wx.ALL, 8)
+
+ info_panel.SetSizer(info_sizer)
+ license_panel.SetSizer(license_sizer)
+ main_panel.SetSizer(notebook_sizer)
+
+ self.SetSizeHints(notebook_sizer.CalcMin())
+
+ self.Layout()
+
+ def on_link_clicked(self, event):
+ event.Skip()
+
+
+class AboutInkstitchApp(wx.App):
+ def __init__(self):
+ super().__init__()
+
+ def OnInit(self):
+ self.frame = AboutFrame()
+ self.SetTopWindow(self.frame)
+ self.frame.Show()
+ return True
diff --git a/lib/inx/generate.py b/lib/inx/generate.py
index 47ca3b6d..7cb59185 100644
--- a/lib/inx/generate.py
+++ b/lib/inx/generate.py
@@ -3,7 +3,6 @@
# Copyright (c) 2010 Authors
# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
-from .info import generate_info_inx_files
from .extensions import generate_extension_inx_files
from .inputs import generate_input_inx_files
from .outputs import generate_output_inx_files
@@ -32,4 +31,3 @@ def generate_inx_files(alter=None):
generate_input_inx_files(alter_data)
generate_output_inx_files(alter_data)
generate_extension_inx_files(alter_data)
- generate_info_inx_files(alter_data)
diff --git a/lib/inx/info.py b/lib/inx/info.py
deleted file mode 100755
index dc80c3eb..00000000
--- a/lib/inx/info.py
+++ /dev/null
@@ -1,14 +0,0 @@
-# Authors: see git history
-#
-# Copyright (c) 2010 Authors
-# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
-
-from .utils import build_environment, write_inx_file
-
-
-def generate_info_inx_files(alter_data):
- env = build_environment()
- info_inx_files = ['about', 'embroider']
- for info in info_inx_files:
- template = env.get_template(f'{info}.xml')
- write_inx_file(info, template.render(alter_data))
diff --git a/lib/inx/utils.py b/lib/inx/utils.py
index 31da518e..9168f2a2 100755
--- a/lib/inx/utils.py
+++ b/lib/inx/utils.py
@@ -12,7 +12,6 @@ from jinja2 import Environment, FileSystemLoader
_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
def build_environment():
@@ -22,29 +21,18 @@ def build_environment():
extensions=['jinja2.ext.i18n']
)
- 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" % version.readline()
# Command tag and icons path
if sys.platform == "win32":
env.globals["command_tag"] = '<command location="inx">../bin/inkstitch.exe</command>'
- env.globals["image_path"] = '../bin/icons/'
elif sys.platform == "darwin":
env.globals["command_tag"] = '<command location="inx">../../MacOS/inkstitch</command>'
- env.globals["image_path"] = '../../Resources/icons/'
else:
env.globals["command_tag"] = '<command location="inx">../bin/inkstitch</command>'
- env.globals["image_path"] = '../bin/icons/'
else:
# user is running inkstitch.py directly as a developer
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
diff --git a/lib/utils/version.py b/lib/utils/version.py
index 0b46669a..eaa539b8 100755
--- a/lib/utils/version.py
+++ b/lib/utils/version.py
@@ -10,16 +10,31 @@ from ..i18n import _
def get_inkstitch_version():
- if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
- if sys.platform == "darwin":
- version = realpath(join(sys._MEIPASS, "..", 'Resources', "VERSION"))
- else:
- version = realpath(join(sys._MEIPASS, "..", "VERSION"))
- else:
- version = realpath(join(realpath(__file__), "..", "..", "..", 'VERSION'))
+ version = _get_source_file("VERSION")
if isfile(version):
with open(version, 'r') as v:
inkstitch_version = _("Ink/Stitch Version: %s") % v.readline()
else:
inkstitch_version = _("Ink/Stitch Version: unknown")
return inkstitch_version
+
+
+def get_inkstitch_license():
+ license = _get_source_file("LICENSE")
+ if isfile(license):
+ with open(license, 'r') as lcs:
+ license = lcs.read()
+ else:
+ license = "License: GNU GENERAL PUBLIC LICENSE\nVersion 3, 29 June 2007"
+ return license
+
+
+def _get_source_file(filename):
+ if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
+ if sys.platform == "darwin":
+ source_file = realpath(join(sys._MEIPASS, "..", 'Resources', filename))
+ else:
+ source_file = realpath(join(sys._MEIPASS, "..", filename))
+ else:
+ source_file = realpath(join(realpath(__file__), "..", "..", "..", filename))
+ return source_file
diff --git a/python-wheels/Shapely-1.6.3-cp27-cp27m-win32.whl b/python-wheels/Shapely-1.6.3-cp27-cp27m-win32.whl
deleted file mode 100644
index 786e3756..00000000
--- a/python-wheels/Shapely-1.6.3-cp27-cp27m-win32.whl
+++ /dev/null
Binary files differ
diff --git a/templates/about.xml b/templates/about.xml
index fc937936..b58a7ebc 100644
--- a/templates/about.xml
+++ b/templates/about.xml
@@ -2,27 +2,14 @@
<inkscape-extension translationdomain="inkstitch" xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<name>About</name>
<id>org.{{ id_inkstitch }}.about</id>
- <param type="notebook" name="about-tabs" indent="1">
- <page name="about" gui-text="About">
- <image>{{ image_path }}inkstitch_colour_logo.svg</image>
- <label indent="1" appearance="header">Ink/Stitch - {{ inkstitch_version }}</label>
- <separator/>
- <label indent="1">An open-source machine embroidery design platform based on Inkscape.</label>
- <separator/>
- <spacer/>
- <label indent="1" appearance="url">https://inkstitch.org</label>
- </page>
- <page name="license" gui-text="License">
- <param name="license-text" gui-text=" " type="string" appearance="multiline">
-{{ inkstitch_license }}
- </param>
- </page>
- </param>
- <effect needs-live-preview="false" needs-document="false">
+ <param name="extension" type="string" gui-hidden="true">about</param>
+ <effect needs-custom-gui="true" show-stderr="true">
<object-type>all</object-type>
<effects-menu>
- <submenu name="{{ menu_inkstitch }}" translatable="no">
- </submenu>
+ <submenu name="{{ menu_inkstitch }}" translatable="no" />
</effects-menu>
</effect>
+ <script>
+ {{ command_tag | safe }}
+ </script>
</inkscape-extension>
diff --git a/templates/embroider.xml b/templates/embroider.xml
deleted file mode 100644
index 9641cb37..00000000
--- a/templates/embroider.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<inkscape-extension translationdomain="inkstitch" xmlns="http://www.inkscape.org/namespace/inkscape/extension">
- <name>Embroider</name>
- <id>org.{{ id_inkstitch }}.embroider</id>
- <label appearance="header">Create a stitch file</label>
- <label>Save your embroidery file through | File > Save a Copy ... |</label>
- <label>Choose from listed embroidery file formats and save.</label>
- <spacer />
- <label>Multiple file formats can be saved by choosing the zip file format.</label>
- <effect needs-live-preview="false" needs-document="false">
- <object-type>all</object-type>
- <effects-menu>
- <submenu name="{{ menu_inkstitch }}" translatable="no">
- <submenu name="Visualize and Export" />
- </submenu>
- </effects-menu>
- </effect>
-</inkscape-extension>