summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/extensions/print_pdf.py12
-rw-r--r--lib/gui/electron.py22
2 files changed, 7 insertions, 27 deletions
diff --git a/lib/extensions/print_pdf.py b/lib/extensions/print_pdf.py
index 4d8ffbd4..0cbce479 100644
--- a/lib/extensions/print_pdf.py
+++ b/lib/extensions/print_pdf.py
@@ -88,18 +88,6 @@ class PrintPreviewServer(Thread):
def resources(resource):
return send_from_directory(self.resources_path, resource, cache_timeout=1)
- @self.app.route('/printing/start')
- def printing_start():
- # temporarily turn off the watcher while the print dialog is up,
- # because javascript will be frozen
- self.last_request_time = None
- return "OK"
-
- @self.app.route('/printing/end')
- def printing_end():
- # nothing to do here -- request_started() will restart the watcher
- return "OK"
-
@self.app.route('/settings/<field_name>', methods=['POST'])
def set_field(field_name):
self.metadata[field_name] = request.json['value']
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