2018-04-29 02:14:23 +00:00
|
|
|
import wx
|
|
|
|
|
2018-04-29 01:26:53 +00:00
|
|
|
from .base import InkstitchExtension
|
2018-05-02 01:21:07 +00:00
|
|
|
from ..i18n import _
|
2018-04-29 01:26:53 +00:00
|
|
|
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()
|
2018-08-17 05:16:34 +00:00
|
|
|
current_screen = wx.Display.GetFromPoint(wx.GetMousePosition())
|
|
|
|
display = wx.Display(current_screen)
|
|
|
|
screen_rect = display.GetClientArea()
|
|
|
|
|
|
|
|
simulator_pos = (screen_rect[0], screen_rect[1])
|
|
|
|
|
|
|
|
frame = EmbroiderySimulator(None, -1, _("Embroidery Simulation"), pos=simulator_pos, size=(1000, 1000), stitch_plan=stitch_plan)
|
2018-04-29 01:26:53 +00:00
|
|
|
app.SetTopWindow(frame)
|
|
|
|
frame.Show()
|
|
|
|
wx.CallAfter(frame.go)
|
|
|
|
app.MainLoop()
|