Skip to content

Commit

Permalink
Bugfix for --camera. Added verbose mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
Garth Minette committed Feb 17, 2021
1 parent 4801941 commit 1317dae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
13 changes: 11 additions & 2 deletions openscad_runner/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ def __init__(
customizer_file=None,
customizer_params={},
hard_warnings=False,
quiet=False
quiet=False,
verbose=False
):
"""
Initializer method. Arguments are:
Expand Down Expand Up @@ -107,6 +108,7 @@ def __init__(
- customizer_params = An optional dictionary of customizer parameter names and values to set.
- hard_warnings = Stop at first WARNING, as if it were an ERROR. Default: False
- quiet = Suppresses non-error, non-warning messages. Default: False
- verbose = Print the command-line to stdout on each execution. Default: False
"""
if platform.system() == "Darwin":
self.OPENSCAD = "/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD"
Expand Down Expand Up @@ -136,6 +138,7 @@ def __init__(
self.customizer_params = customizer_params
self.hard_warnings = hard_warnings
self.quiet = quiet
self.verbose = verbose

self.cmdline = []
self.script = []
Expand Down Expand Up @@ -191,7 +194,7 @@ def run(self):
if self.camera is not None:
while len(self.camera) < 6:
self.camera.append(0)
scadcmd.extend(["--camera", ",".join(self.camera)])
scadcmd.extend(["--camera", ",".join(str(x) for x in self.camera)])
if self.color_scheme != ColorScheme.cornfield:
scadcmd.extend(["--colorscheme", self.color_scheme])
if self.orthographic:
Expand Down Expand Up @@ -227,6 +230,12 @@ def run(self):
if self.quiet:
scadcmd.append("--quiet")
scadcmd.append(self.scriptfile)
if self.verbose:
line = " ".join([
"'{}'".format(arg) if ' ' in arg or arg=='' else arg
for arg in scadcmd
])
print(line)
p = subprocess.Popen(scadcmd, shell=False, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
(stdoutdata, stderrdata) = p.communicate(None)
stdoutdata = stdoutdata.decode('utf-8')
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from setuptools import setup

VERSION = "1.0.5"
VERSION = "1.0.6"


with open('README.rst') as f:
Expand All @@ -19,7 +19,7 @@
author='Revar Desmera',
author_email='[email protected]',
url='https://github.com/revarbat/openscad_runner',
download_url='https://github.com/revarbat/openscad_runner/archive/v1.0.5.zip',
download_url='https://github.com/revarbat/openscad_runner/archive/v1.0.6.zip',
packages=['openscad_runner'],
license='MIT License',
classifiers=[
Expand Down

0 comments on commit 1317dae

Please sign in to comment.