From: <rw...@us...> - 2007-08-16 00:54:15
|
Revision: 6167 http://cctbx.svn.sourceforge.net/cctbx/?rev=6167&view=rev Author: rwgk Date: 2007-08-15 17:54:11 -0700 (Wed, 15 Aug 2007) Log Message: ----------- support display of phil definition attributes via --show-defaults=all.help, --show-defaults=all.more, --show-defaults=all.all Modified Paths: -------------- trunk/iotbx/iotbx/command_line/pdb.superpose_centers_of_mass.py trunk/libtbx/libtbx/option_parser.py trunk/mmtbx/mmtbx/maps.py trunk/mmtbx/mmtbx/pdbtools.py Modified: trunk/iotbx/iotbx/command_line/pdb.superpose_centers_of_mass.py =================================================================== --- trunk/iotbx/iotbx/command_line/pdb.superpose_centers_of_mass.py 2007-08-15 22:19:33 UTC (rev 6166) +++ trunk/iotbx/iotbx/command_line/pdb.superpose_centers_of_mass.py 2007-08-16 00:54:11 UTC (rev 6167) @@ -49,7 +49,9 @@ .enable_symmetry_comprehensive() ).process(args=args) if (command_line.expert_level is not None): - master_params.show(expert_level=command_line.expert_level) + master_params.show( + expert_level=command_line.expert_level, + attributes_level=command_line.attributes_level) sys.exit(0) # # Loop over command-line arguments. Modified: trunk/libtbx/libtbx/option_parser.py =================================================================== --- trunk/libtbx/libtbx/option_parser.py 2007-08-15 22:19:33 UTC (rev 6166) +++ trunk/libtbx/libtbx/option_parser.py 2007-08-16 00:54:11 UTC (rev 6167) @@ -58,9 +58,11 @@ action="callback", type="string", callback=self.show_defaults_callback, - help="Print parameters visible at the given expert level and exit", - metavar=\ - "EXPERT_LEVEL, (EXPERT_LEVEL = integer number or all for everything)")) + help='Print parameters visible at the given expert level' + ' (integer value or "all") and exit. Optionally,' + ' append .help or .attr to the expert level, for example:\n' + ' --show-defaults=all.help', + metavar="EXPERT_LEVEL")) self.show_defaults_callback.is_enabled = True return self @@ -110,6 +112,7 @@ self.options = options self.args = args self.expert_level = show_defaults_callback.expert_level + self.attributes_level = show_defaults_callback.attributes_level self.chunk_n = chunk_callback.n self.chunk_i = chunk_callback.i @@ -118,13 +121,9 @@ def __init__(self): self.is_enabled = False self.expert_level = None + self.attributes_level = 0 - def __call__(self, option, opt, value, parser): - if (value.strip().lower() == "all"): - self.expert_level = -1 - else: - try: value = int(value) - except ValueError: + def raise_sorry(self, value): raise Sorry("""\ Invalid option value: --show-defaults="%s" Please specify an integer value or the word "all" @@ -133,9 +132,33 @@ --show_defaults=1 # slightly advanced --show_defaults=2 # more advanced etc. - --show_defaults=all # everything""" % value) + --show_defaults=all # everything + Optionally, append + .help to display the parameter help, or + .more to display all parameter attributes which are not None + .all to display all parameter attributes + Examples: + --show_defaults=all.help + --show_defaults=all.all""" % value) - self.expert_level = value + def __call__(self, option, opt, value, parser): + flds = value.strip().lower().split(".") + if (1 > len(flds) > 2): self.raise_sorry(value=value) + if (flds[0] == "all"): + self.expert_level = -1 + else: + try: expert_level = int(flds[0]) + except ValueError: self.raise_sorry(value=value) + self.expert_level = expert_level + if (len(flds) > 1): + if (flds[1] == "help"): + self.attributes_level = 1 + elif (flds[1] == "more"): + self.attributes_level = 2 + elif (flds[1] == "all"): + self.attributes_level = 3 + else: + self.raise_sorry(value=value) class chunk_callback(object): Modified: trunk/mmtbx/mmtbx/maps.py =================================================================== --- trunk/mmtbx/mmtbx/maps.py 2007-08-15 22:19:33 UTC (rev 6166) +++ trunk/mmtbx/mmtbx/maps.py 2007-08-16 00:54:11 UTC (rev 6167) @@ -268,7 +268,8 @@ if(self.command_line.expert_level is not None): master_params.show( out = self.log, - expert_level = self.command_line.expert_level) + expert_level = self.command_line.expert_level, + attributes_level = self.command_line.attributes_level) sys.exit(0) print >> self.log if (len(args) > 0): Modified: trunk/mmtbx/mmtbx/pdbtools.py =================================================================== --- trunk/mmtbx/mmtbx/pdbtools.py 2007-08-15 22:19:33 UTC (rev 6166) +++ trunk/mmtbx/mmtbx/pdbtools.py 2007-08-16 00:54:11 UTC (rev 6167) @@ -337,7 +337,8 @@ if(self.command_line.expert_level is not None): master_params.show( out = self.log, - expert_level = self.command_line.expert_level) + expert_level = self.command_line.expert_level, + attributes_level = self.command_line.attributes_level) sys.exit(0) if (len(args) > 0): utils.print_header("Getting inputs", out = self.log) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |