summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2011-06-16 00:34:08 -0600
committerTavian Barnes <tavianator@gmail.com>2011-06-16 00:34:08 -0600
commit7fb247e17863bf550689be8198b2dbba2773356d (patch)
tree5ef130e6ec46686e96e2a11cfebed8ca6b6a0dd3
parent2d33c87a6357fe62cc88b2c2b2815f4604294ab9 (diff)
downloaddimension-7fb247e17863bf550689be8198b2dbba2773356d.tar.xz
More slight style fixes.
-rw-r--r--dimension/dimension.in69
-rw-r--r--libdimension-python/dimension.pyx8
2 files changed, 40 insertions, 37 deletions
diff --git a/dimension/dimension.in b/dimension/dimension.in
index b73ff1c..dc243ab 100644
--- a/dimension/dimension.in
+++ b/dimension/dimension.in
@@ -1,7 +1,7 @@
#!/usr/bin/python3
#########################################################################
-# Copyright (C) 2010-2011 Tavian Barnes <tavianator@tavianator.com> #
+# Copyright (C) 2011 Tavian Barnes <tavianator@tavianator.com> #
# #
# This file is part of Dimension. #
# #
@@ -23,43 +23,46 @@ import argparse
import os.path
# Parse the command line
-
_parser = argparse.ArgumentParser(
- description = '@PACKAGE_NAME@ @PACKAGE_VERSION@',
- conflict_handler = 'resolve', # For -h as height instead of help
+ epilog = "@PACKAGE_STRING@\n"
+ "@PACKAGE_URL@\n"
+ "Copyright (C) 2009-2011 Tavian Barnes <@PACKAGE_BUGREPORT@>\n"
+ "Licensed under the GNU General Public License",
+ formatter_class = argparse.RawDescriptionHelpFormatter,
+ conflict_handler = "resolve", # For -h as height instead of help
)
-_parser.add_argument('-V', '--version', action = 'version',
- version = '@PACKAGE_NAME@ @PACKAGE_VERSION@')
+_parser.add_argument("-V", "--version", action = "version",
+ version = "@PACKAGE_STRING@")
-_parser.add_argument('-w', '--width', action = 'store', type = int,
- default = 768, help = 'image width')
-_parser.add_argument('-h', '--height', action = 'store', type = int,
- default = 480, help = 'image height')
+_parser.add_argument("-w", "--width", action = "store", type = int,
+ default = 768, help = "image width")
+_parser.add_argument("-h", "--height", action = "store", type = int,
+ default = 480, help = "image height")
-_parser.add_argument('-v', '--verbose', action = 'store_true',
- help = 'print more information')
-_parser.add_argument('-q', '--quiet', action = 'store_true',
- help = 'print less information')
+_parser.add_argument("-v", "--verbose", action = "store_true",
+ help = "print more information")
+_parser.add_argument("-q", "--quiet", action = "store_true",
+ help = "print less information")
-_parser.add_argument('--strict', action = 'store_true',
- help = 'treat warnings as errors')
-_parser.add_argument('--threads', action = 'store', type = int,
- help = 'the number of threads to render with')
-_parser.add_argument('--quality', action = 'store', type = int,
- help = 'the scene quality')
+_parser.add_argument("--strict", action = "store_true",
+ help = "treat warnings as errors")
+_parser.add_argument("--threads", action = "store", type = int,
+ help = "the number of threads to render with")
+_parser.add_argument("--quality", action = "store", type = int,
+ help = "the scene quality")
-_parser.add_argument('-o', '--output', action = 'store', type = str,
- help = 'the output image file')
-_parser.add_argument('input', action = 'store', type = str,
- help = 'the input scene description file')
+_parser.add_argument("-o", "--output", action = "store", type = str,
+ help = "the output image file")
+_parser.add_argument("input", action = "store", type = str,
+ help = "the input scene description file")
_args = _parser.parse_args()
# Default output is basename(input).png
if _args.output is None:
_noext = os.path.splitext(os.path.basename(_args.input))[0]
- _args.output = _noext + '.png'
+ _args.output = _noext + ".png"
# Imports available to scripts
from math import *
@@ -79,11 +82,11 @@ recursion_limit = None
# Execute the input script
if not _args.quiet:
- print('Parsing scene ...')
+ print("Parsing scene ...")
parse_timer = Timer()
with open(_args.input) as _fh:
- exec(compile(_fh.read(), _args.input, 'exec'))
+ exec(compile(_fh.read(), _args.input, "exec"))
parse_timer.complete()
# Make the canvas
@@ -109,9 +112,9 @@ if _args.quality is not None:
# Raytrace the scene
if not _args.quiet:
if scene.nthreads == 1:
- print('Rendering scene ...')
+ print("Rendering scene ...")
else:
- print('Rendering scene (using %d threads) ...' % scene.nthreads)
+ print("Rendering scene (using %d threads) ..." % scene.nthreads)
scene.raytrace()
@@ -123,7 +126,7 @@ export_timer.complete()
# Print execution times
if _args.verbose:
print()
- print('Parsing time: ', parse_timer)
- print('Bounding time: ', scene.bounding_timer)
- print('Rendering time: ', scene.render_timer)
- print('Exporting time: ', export_timer)
+ print("Parsing time: ", parse_timer)
+ print("Bounding time: ", scene.bounding_timer)
+ print("Rendering time: ", scene.render_timer)
+ print("Exporting time: ", export_timer)
diff --git a/libdimension-python/dimension.pyx b/libdimension-python/dimension.pyx
index b19db18..1c78041 100644
--- a/libdimension-python/dimension.pyx
+++ b/libdimension-python/dimension.pyx
@@ -101,7 +101,7 @@ cdef class Vector:
if len(args) == 1:
if isinstance(args[0], Vector):
self._v = (<Vector>args[0])._v
- elif hasattr(args[0], '__iter__'): # Faster than try: ... except:
+ elif hasattr(args[0], "__iter__"): # Faster than try: ... except:
self._real_init(*args[0])
elif args[0] == 0:
self._v = dmnsn_zero
@@ -324,7 +324,7 @@ cdef class Color:
if len(args) == 1:
if isinstance(args[0], Color):
self._sRGB = (<Color>args[0])._sRGB
- elif hasattr(args[0], '__iter__'):
+ elif hasattr(args[0], "__iter__"):
self._real_init(*args[0])
else:
self._sRGB = dmnsn_color_mul(args[0], dmnsn_white)
@@ -1303,14 +1303,14 @@ cdef class Scene:
"""The Timer for building the bounding hierarchy."""
def __get__(self):
if self._scene.bounding_timer == NULL:
- raise RuntimeError('scene has not been rendered yet')
+ raise RuntimeError("scene has not been rendered yet")
return _Timer(self._scene.bounding_timer)
property render_timer:
"""The Timer for the actual render."""
def __get__(self):
if self._scene.render_timer == NULL:
- raise RuntimeError('scene has not been rendered yet')
+ raise RuntimeError("scene has not been rendered yet")
return _Timer(self._scene.render_timer)