From 3c5b3147f4760a1efb06fa92fbbd4b6b8ae9e96a Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Tue, 21 Jun 2016 21:51:55 +0200 Subject: [PATCH] Fix boolean params in web interface by switching to action=store, type=bool instead of using action=store_true --- boxes/__init__.py | 2 +- scripts/boxesserver | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/boxes/__init__.py b/boxes/__init__.py index 5a8a75a..cbf4a47 100755 --- a/boxes/__init__.py +++ b/boxes/__init__.py @@ -186,7 +186,7 @@ class Boxes: "--output", action="store", type=str, default="box.svg", help="name of resulting file") self.argparser.add_argument( - "--debug", action="store_true", default=False, + "--debug", action="store", type=bool, default=False, help="print surrounding boxes for some structures") self.argparser.add_argument( "--burn", action="store", type=float, default=0.05, diff --git a/scripts/boxesserver b/scripts/boxesserver index 2c09ea9..ec6d8f8 100755 --- a/scripts/boxesserver +++ b/scripts/boxesserver @@ -98,16 +98,16 @@ class BServer: return "" row = """%s%%s%s\n""" % \ (name, a.help or "") - if isinstance(a, argparse._StoreTrueAction): - input = """""" % \ - (name, a.default) - elif (isinstance(a, argparse._StoreAction) and + if (isinstance(a, argparse._StoreAction) and isinstance(a.type, boxes.ArgparseEdgeType)): input = a.type.html(name, a.default) elif a.dest == "layout": val = a.default.split("\n") input = """""" % \ (name, max((len(l) for l in val))+10, len(val)+1, a.default) + elif a.type is bool: + input = """""" % \ + (name, ) else: input = """""" % \ (name, a.default)