Correct olc update options, add local display to menudebug command
This commit is contained in:
parent
f4422544cd
commit
8a52a76d8c
2 changed files with 28 additions and 13 deletions
|
|
@ -2027,14 +2027,14 @@ def node_apply_diff(caller, **kwargs):
|
||||||
sep=" |r->|n ", new='', change=inst))
|
sep=" |r->|n ", new='', change=inst))
|
||||||
options.append(_keep_option(key, prototype,
|
options.append(_keep_option(key, prototype,
|
||||||
base_obj, obj_prototype, diff, update_objects, back_node))
|
base_obj, obj_prototype, diff, update_objects, back_node))
|
||||||
options.extend(
|
options.extend(
|
||||||
[{"key": ("|wu|Wpdate {} objects".format(len(update_objects)), "update", "u"),
|
[{"key": ("|wu|Wpdate {} objects".format(len(update_objects)), "update", "u"),
|
||||||
"desc": "Update {} objects".format(len(update_objects)),
|
"desc": "Update {} objects".format(len(update_objects)),
|
||||||
"goto": (_apply_diff, {"prototype": prototype, "objects": update_objects,
|
"goto": (_apply_diff, {"prototype": prototype, "objects": update_objects,
|
||||||
"back_node": back_node, "diff": diff, "base_obj": base_obj})},
|
"back_node": back_node, "diff": diff, "base_obj": base_obj})},
|
||||||
{"key": ("|wr|Weset changes", "reset", "r"),
|
{"key": ("|wr|Weset changes", "reset", "r"),
|
||||||
"goto": ("node_apply_diff", {"prototype": prototype, "back_node": back_node,
|
"goto": ("node_apply_diff", {"prototype": prototype, "back_node": back_node,
|
||||||
"objects": update_objects})}])
|
"objects": update_objects})}])
|
||||||
|
|
||||||
if ichanges < 1:
|
if ichanges < 1:
|
||||||
text = ["Analyzed a random sample object (out of {}) - "
|
text = ["Analyzed a random sample object (out of {}) - "
|
||||||
|
|
|
||||||
|
|
@ -866,19 +866,34 @@ class EvMenu(object):
|
||||||
props = {prop: value for prop, value in all_props if prop not in all_methods and
|
props = {prop: value for prop, value in all_props if prop not in all_methods and
|
||||||
prop not in all_builtins and not prop.endswith("__")}
|
prop not in all_builtins and not prop.endswith("__")}
|
||||||
|
|
||||||
|
local = {key: var for key, var in locals().items()
|
||||||
|
if key not in all_props and not key.endswith("__")}
|
||||||
|
|
||||||
if arg:
|
if arg:
|
||||||
if arg in props:
|
if arg in props:
|
||||||
debugtxt = " |y* {}:|n\n{}".format(arg, props[arg])
|
debugtxt = " |y* {}:|n\n{}".format(arg, props[arg])
|
||||||
|
elif arg in local:
|
||||||
|
debugtxt = " |y* {}:|n\n{}".format(arg, local[arg])
|
||||||
elif arg == 'full':
|
elif arg == 'full':
|
||||||
debugtxt = ("|yMENU DEBUG full ... |n\n" + "\n".join(props) +
|
debugtxt = ("|yMENU DEBUG full ... |n\n" + "\n".join(
|
||||||
|
"|y *|n {}: {}".format(key, val)
|
||||||
|
for key, val in sorted(props.items())) +
|
||||||
|
"\n |yLOCAL VARS:|n\n" + "\n".join(
|
||||||
|
"|y *|n {}: {}".format(key, val)
|
||||||
|
for key, val in sorted(local.items())) +
|
||||||
"\n |y... END MENU DEBUG|n")
|
"\n |y... END MENU DEBUG|n")
|
||||||
else:
|
else:
|
||||||
debugtxt = "|yUsage: menudebug full|<name of property>|n"
|
debugtxt = "|yUsage: menudebug full|<name of property>|n"
|
||||||
else:
|
else:
|
||||||
debugtxt = "|yMENU DEBUG properties:|n\n" + "\n".join("|y *|n {}: {}".format(
|
debugtxt = ("|yMENU DEBUG properties ... |n\n" + "\n".join(
|
||||||
prop, crop(to_str(value, force_string=True), width=50))
|
"|y *|n {}: {}".format(
|
||||||
for prop, value in sorted(props.items()))
|
key, crop(to_str(val, force_string=True), width=50))
|
||||||
debugtxt += "\n|y... END MENU DEBUG (use menudebug <name> for full value)|n"
|
for key, val in sorted(props.items())) +
|
||||||
|
"\n |yLOCAL VARS:|n\n" + "\n".join(
|
||||||
|
"|y *|n {}: {}".format(
|
||||||
|
key, crop(to_str(val, force_string=True), width=50))
|
||||||
|
for key, val in sorted(local.items())) +
|
||||||
|
"\n |y... END MENU DEBUG|n")
|
||||||
self.caller.msg(debugtxt)
|
self.caller.msg(debugtxt)
|
||||||
|
|
||||||
def parse_input(self, raw_string):
|
def parse_input(self, raw_string):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue