improve debug_set_trace: add Allocate and Input events
Also log events at the beginning and end of Input.choose_nameplate and Input.choose_words, since those are the two big locally-driven (UI) triggers that cause multiple messages to be fired and lots of work to happen.
This commit is contained in:
parent
2fadadc4db
commit
dce01174eb
|
@ -108,14 +108,16 @@ class Boss(object):
|
|||
def _set_trace(self, client_name, which, file):
|
||||
names = {"B": self, "N": self._N, "M": self._M, "S": self._S,
|
||||
"O": self._O, "K": self._K, "SK": self._K._SK, "R": self._R,
|
||||
"RC": self._RC, "L": self._L, "C": self._C,
|
||||
"T": self._T}
|
||||
"RC": self._RC, "L": self._L, "A": self._A, "I": self._I,
|
||||
"C": self._C, "T": self._T}
|
||||
for machine in which.split():
|
||||
t = (lambda old_state, input, new_state, machine=machine:
|
||||
self._print_trace(old_state, input, new_state,
|
||||
client_name=client_name,
|
||||
machine=machine, file=file))
|
||||
names[machine].set_trace(t)
|
||||
if machine == "I":
|
||||
self._I.set_debug(t)
|
||||
|
||||
## def serialize(self):
|
||||
## raise NotImplemented
|
||||
|
|
|
@ -22,6 +22,13 @@ class Input(object):
|
|||
self._nameplate = None
|
||||
self._wordlist = None
|
||||
self._wordlist_waiters = []
|
||||
self._trace = None
|
||||
|
||||
def set_debug(self, f):
|
||||
self._trace = f
|
||||
def _debug(self, what):
|
||||
if self._trace:
|
||||
self._trace(old_state="", input=what, new_state="")
|
||||
|
||||
def wire(self, code, lister):
|
||||
self._C = _interfaces.ICode(code)
|
||||
|
@ -238,10 +245,14 @@ class Helper(object):
|
|||
def get_nameplate_completions(self, prefix):
|
||||
return self._input.get_nameplate_completions(prefix)
|
||||
def choose_nameplate(self, nameplate):
|
||||
self._input._debug("I.choose_nameplate")
|
||||
self._input.choose_nameplate(nameplate)
|
||||
self._input._debug("I.choose_nameplate finished")
|
||||
def when_wordlist_is_available(self):
|
||||
return self._input.when_wordlist_is_available()
|
||||
def get_word_completions(self, prefix):
|
||||
return self._input.get_word_completions(prefix)
|
||||
def choose_words(self, words):
|
||||
self._input._debug("I.choose_words")
|
||||
self._input.choose_words(words)
|
||||
self._input._debug("I.choose_words finished")
|
||||
|
|
|
@ -214,7 +214,8 @@ class _DeferredWormhole(object):
|
|||
self._boss.close() # only need to close if it wasn't already
|
||||
return d
|
||||
|
||||
def debug_set_trace(self, client_name, which="B N M S O K SK R RC L C T",
|
||||
def debug_set_trace(self, client_name,
|
||||
which="B N M S O K SK R RC L A I C T",
|
||||
file=sys.stderr):
|
||||
self._boss._set_trace(client_name, which, file)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user