diff --git a/doc/pattern_tools/gen_pattern.py b/doc/pattern_tools/gen_pattern.py index 1f90615736262643b4af854e1161b2a74aeae1f9..a6ffc7ca7ed7e2e9f5eb62bd2f6c383b199128bb 100755 --- a/doc/pattern_tools/gen_pattern.py +++ b/doc/pattern_tools/gen_pattern.py @@ -92,11 +92,11 @@ def main(): dest="square_size", type=float) parser.add_argument("-R", "--radius_rate", help="circles_radius = square_size/radius_rate", default="5.0", action="store", dest="radius_rate", type=float) - parser.add_argument("-w", "--page_width", help="page width in units", default="216", action="store", + parser.add_argument("-w", "--page_width", help="page width in units", default=argparse.SUPPRESS, action="store", dest="page_width", type=float) - parser.add_argument("-h", "--page_height", help="page height in units", default="279", action="store", - dest="page_width", type=float) - parser.add_argument("-a", "--page_size", help="page size, supersedes -h -w arguments", default="A4", action="store", + parser.add_argument("-h", "--page_height", help="page height in units", default=argparse.SUPPRESS, action="store", + dest="page_height", type=float) + parser.add_argument("-a", "--page_size", help="page size, superseded if -h and -w are set", default="A4", action="store", dest="page_size", choices=["A0", "A1", "A2", "A3", "A4", "A5"]) args = parser.parse_args() @@ -111,12 +111,16 @@ def main(): units = args.units square_size = args.square_size radius_rate = args.radius_rate - page_size = args.page_size - # page size dict (ISO standard, mm) for easy lookup. format - size: [width, height] - page_sizes = {"A0": [840, 1188], "A1": [594, 840], "A2": [420, 594], "A3": [297, 420], "A4": [210, 297], - "A5": [148, 210]} - page_width = page_sizes[page_size.upper()][0] - page_height = page_sizes[page_size.upper()][1] + if 'page_width' and 'page_height' in args: + page_width = args.page_width + page_height = args.page_height + else: + page_size = args.page_size + # page size dict (ISO standard, mm) for easy lookup. format - size: [width, height] + page_sizes = {"A0": [840, 1188], "A1": [594, 840], "A2": [420, 594], "A3": [297, 420], "A4": [210, 297], + "A5": [148, 210]} + page_width = page_sizes[page_size][0] + page_height = page_sizes[page_size][1] pm = PatternMaker(columns, rows, output, units, square_size, radius_rate, page_width, page_height) # dict for easy lookup of pattern type mp = {"circles": pm.make_circles_pattern, "acircles": pm.make_acircles_pattern,