summaryrefslogtreecommitdiff
path: root/lib/gui/electron.py
diff options
context:
space:
mode:
authorLex Neva <github.com@lexneva.name>2019-04-12 17:45:57 -0400
committerLex Neva <github.com@lexneva.name>2019-04-12 17:57:07 -0400
commit9b2a47136b34a4b9cfcc42282a39fdd909e9f8af (patch)
tree67edbda61bb5b72afac0c1bf26836f7feda43a48 /lib/gui/electron.py
parent785e3798c46a00ccbde89c0aeee95140dfbe6d92 (diff)
enable print button
Diffstat (limited to 'lib/gui/electron.py')
-rw-r--r--lib/gui/electron.py22
1 files changed, 7 insertions, 15 deletions
diff --git a/lib/gui/electron.py b/lib/gui/electron.py
index ced3ad66..f1bdeb61 100644
--- a/lib/gui/electron.py
+++ b/lib/gui/electron.py
@@ -1,4 +1,3 @@
-from glob import glob
import os
import subprocess
import sys
@@ -14,21 +13,14 @@ def open_url(url):
if getattr(sys, 'frozen', None) is not None:
electron_path = os.path.join(get_bundled_dir("electron"), "inkstitch-gui")
- else:
- # It's a bit trickier to find the electron app in a development environment.
- base_dir = get_bundled_dir("electron")
-
- try:
- package_dir = glob(os.path.join(base_dir, 'dist', '*-unpacked'))[0]
- except IndexError:
- raise Exception("Electron app not found. Be sure to run 'yarn; yarn dist' in %s." % base_dir)
-
- electron_path = os.path.join(base_dir, package_dir, "inkstitch-gui")
- if sys.platform == "darwin":
- electron_path += ".app/Contents/MacOS/inkstitch-gui"
- app_process = subprocess.Popen(["open", "-a", electron_path, "--args", url])
+ if sys.platform == "darwin":
+ electron_path += ".app/Contents/MacOS/inkstitch-gui"
+ subprocess.Popen(["open", "-a", electron_path, "--args", url])
+ else:
+ app_process = subprocess.Popen([electron_path, url])
else:
- app_process = subprocess.Popen([electron_path, url])
+ # if we're not running in a pyinstaller bundle, run electron directly
+ app_process = subprocess.Popen(["yarn", "dev", url], cwd=get_bundled_dir("electron"))
return app_process