diff --git a/mod/screenshot.py b/mod/screenshot.py index d8e177a2..a7e0a0d8 100644 --- a/mod/screenshot.py +++ b/mod/screenshot.py @@ -24,11 +24,10 @@ def generate_screenshot(bundle_path, callback): # running packaged through cxfreeze if os.path.isfile(sys.argv[0]): - # TODO this does not work yet - return - cmd = [os.path.join(cwd, 'mod-screenshot'), 'take_screenshot', bundle_path, HTML_DIR, CACHE_DIR] + cmd = [os.path.join(cwd, 'mod-pedalboard'), 'take_screenshot', bundle_path, HTML_DIR, CACHE_DIR] if sys.platform == 'win32': cmd[0] += ".exe" + print(' '.join(cmd)) # regular run else: @@ -36,20 +35,21 @@ def generate_screenshot(bundle_path, callback): if not DEV_ENVIRONMENT and DEVICE_KEY: # if using a real MOD, setup niceness cmd = ['/usr/bin/nice', '-n', '+34'] + cmd - proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, cwd=cwd) + proc = subprocess.Popen(cmd, cwd=cwd) loop = IOLoop.instance() - def proc_callback(fileno, _): + def proc_callback(): if proc.poll() is None: + loop.call_later(0.5, proc_callback) return - loop.remove_handler(fileno) if not os.path.exists(screenshot) or not os.path.exists(thumbnail): - return callback() + callback() + return callback(thumbnail) - loop.add_handler(proc.stdout.fileno(), proc_callback, 16) + loop.call_later(0.5, proc_callback) class ScreenshotGenerator(object): diff --git a/modtools/pedalboard.py b/modtools/pedalboard.py index 9be2f493..b8d9b7a9 100644 --- a/modtools/pedalboard.py +++ b/modtools/pedalboard.py @@ -559,7 +559,7 @@ def _take_screenshot(args): args = parser.parse_args() if hasattr(args, 'func'): args.func(args) - exit(0) + sys.exit(0) else: parser.print_usage() diff --git a/utils/Makefile b/utils/Makefile index 18409926..27c9ee9b 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -35,6 +35,9 @@ endif ifeq ($(MODAPP),1) CXXFLAGS += -DMODAPP +ifneq ($(MACOS)$(WINDOWS),true) +LDFLAGS += -Wl,-rpath,'$$ORIGIN/..' +endif else ifeq ($(shell pkg-config --exists alsa && echo true), true) CXXFLAGS += -DHAVE_ALSA ALSA_CFLAGS = $(shell pkg-config --cflags alsa)