2021-03-12 04:17:19 +00:00
|
|
|
# Authors: see git history
|
|
|
|
#
|
|
|
|
# Copyright (c) 2010 Authors
|
|
|
|
# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
|
|
|
|
|
2020-04-28 16:34:05 +00:00
|
|
|
from ..api import APIServer
|
|
|
|
from ..gui import open_url
|
|
|
|
|
|
|
|
from .base import InkstitchExtension
|
|
|
|
|
|
|
|
|
|
|
|
class Simulator(InkstitchExtension):
|
|
|
|
def __init__(self):
|
|
|
|
InkstitchExtension.__init__(self)
|
|
|
|
|
|
|
|
def effect(self):
|
2020-05-16 21:01:00 +00:00
|
|
|
if not self.get_elements():
|
|
|
|
return
|
2020-04-28 16:34:05 +00:00
|
|
|
api_server = APIServer(self)
|
|
|
|
port = api_server.start_server()
|
2023-05-22 20:33:19 +00:00
|
|
|
electron = open_url("/simulator", port)
|
2020-04-28 16:34:05 +00:00
|
|
|
electron.wait()
|
|
|
|
api_server.stop()
|
|
|
|
api_server.join()
|