summaryrefslogtreecommitdiff
path: root/lib/extensions/simulate.py
diff options
context:
space:
mode:
authorLex Neva <lexelby@users.noreply.github.com>2018-05-19 14:41:50 -0400
committerGitHub <noreply@github.com>2018-05-19 14:41:50 -0400
commit9dadd836e2f09b0216f7b40c782e2b55bcc90dee (patch)
tree128b6f13ea682a8e5a033370ab2e13388801f100 /lib/extensions/simulate.py
parentba7288d8fcd62678bd17d8fab01d0d488d9e21e8 (diff)
parent6fe417cd64090f028c0d07b799620eb94637bf33 (diff)
Merge pull request #163 from lexelby/lexelby-single-extension
single code entry point
Diffstat (limited to 'lib/extensions/simulate.py')
-rw-r--r--lib/extensions/simulate.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/extensions/simulate.py b/lib/extensions/simulate.py
new file mode 100644
index 00000000..0c372d4d
--- /dev/null
+++ b/lib/extensions/simulate.py
@@ -0,0 +1,28 @@
+import wx
+
+from .base import InkstitchExtension
+from ..i18n import _
+from ..simulator import EmbroiderySimulator
+from ..stitch_plan import patches_to_stitch_plan
+
+
+class Simulate(InkstitchExtension):
+ def __init__(self):
+ InkstitchExtension.__init__(self)
+ self.OptionParser.add_option("-P", "--path",
+ action="store", type="string",
+ dest="path", default=".",
+ help="Directory in which to store output file")
+
+ def effect(self):
+ if not self.get_elements():
+ return
+
+ patches = self.elements_to_patches(self.elements)
+ stitch_plan = patches_to_stitch_plan(patches)
+ app = wx.App()
+ frame = EmbroiderySimulator(None, -1, _("Embroidery Simulation"), wx.DefaultPosition, size=(1000, 1000), stitch_plan=stitch_plan)
+ app.SetTopWindow(frame)
+ frame.Show()
+ wx.CallAfter(frame.go)
+ app.MainLoop()