Fixed EvMenu, it was not updated to self.caller from self._caller properly.
This commit is contained in:
parent
4acea5a20d
commit
653a46b7ad
1 changed files with 18 additions and 18 deletions
|
|
@ -469,13 +469,13 @@ class EvMenu(object):
|
||||||
|
|
||||||
|
|
||||||
# store ourself on the object
|
# store ourself on the object
|
||||||
self._caller.ndb._menutree = self
|
self.caller.ndb._menutree = self
|
||||||
|
|
||||||
# set up the menu command on the caller
|
# set up the menu command on the caller
|
||||||
menu_cmdset = EvMenuCmdSet()
|
menu_cmdset = EvMenuCmdSet()
|
||||||
menu_cmdset.mergetype = str(cmdset_mergetype).lower().capitalize() or "Replace"
|
menu_cmdset.mergetype = str(cmdset_mergetype).lower().capitalize() or "Replace"
|
||||||
menu_cmdset.priority = int(cmdset_priority)
|
menu_cmdset.priority = int(cmdset_priority)
|
||||||
self._caller.cmdset.add(menu_cmdset)
|
self.caller.cmdset.add(menu_cmdset)
|
||||||
# start the menu
|
# start the menu
|
||||||
self.goto(self._startnode, "")
|
self.goto(self._startnode, "")
|
||||||
|
|
||||||
|
|
@ -524,13 +524,13 @@ class EvMenu(object):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# handle the node text
|
# handle the node text
|
||||||
nodetext = self._nodetext_formatter(nodetext, len(optionlist), self._caller)
|
nodetext = self._nodetext_formatter(nodetext, len(optionlist), self.caller)
|
||||||
|
|
||||||
# handle the options
|
# handle the options
|
||||||
optionstext = self._options_formatter(optionlist, self._caller)
|
optionstext = self._options_formatter(optionlist, self.caller)
|
||||||
|
|
||||||
# format the entire node
|
# format the entire node
|
||||||
return self._node_formatter(nodetext, optionstext, self._caller)
|
return self._node_formatter(nodetext, optionstext, self.caller)
|
||||||
|
|
||||||
|
|
||||||
def _execute_node(self, nodename, raw_string):
|
def _execute_node(self, nodename, raw_string):
|
||||||
|
|
@ -551,31 +551,31 @@ class EvMenu(object):
|
||||||
try:
|
try:
|
||||||
node = self._menutree[nodename]
|
node = self._menutree[nodename]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
self._caller.msg(_ERR_NOT_IMPLEMENTED.format(nodename=nodename))
|
self.caller.msg(_ERR_NOT_IMPLEMENTED.format(nodename=nodename))
|
||||||
raise EvMenuError
|
raise EvMenuError
|
||||||
try:
|
try:
|
||||||
# the node should return data as (text, options)
|
# the node should return data as (text, options)
|
||||||
if len(getargspec(node).args) > 1:
|
if len(getargspec(node).args) > 1:
|
||||||
# a node accepting raw_string
|
# a node accepting raw_string
|
||||||
nodetext, options = node(self._caller, raw_string)
|
nodetext, options = node(self.caller, raw_string)
|
||||||
else:
|
else:
|
||||||
# a normal node, only accepting caller
|
# a normal node, only accepting caller
|
||||||
nodetext, options = node(self._caller)
|
nodetext, options = node(self.caller)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
self._caller.msg(_ERR_NOT_IMPLEMENTED.format(nodename=nodename))
|
self.caller.msg(_ERR_NOT_IMPLEMENTED.format(nodename=nodename))
|
||||||
raise EvMenuError
|
raise EvMenuError
|
||||||
except Exception:
|
except Exception:
|
||||||
self._caller.msg(_ERR_GENERAL.format(nodename=nodename))
|
self.caller.msg(_ERR_GENERAL.format(nodename=nodename))
|
||||||
raise
|
raise
|
||||||
return nodetext, options
|
return nodetext, options
|
||||||
|
|
||||||
|
|
||||||
def display_nodetext(self):
|
def display_nodetext(self):
|
||||||
self._caller.msg(self.nodetext)
|
self.caller.msg(self.nodetext)
|
||||||
|
|
||||||
|
|
||||||
def display_helptext(self):
|
def display_helptext(self):
|
||||||
self._caller.msg(self.helptext)
|
self.caller.msg(self.helptext)
|
||||||
|
|
||||||
|
|
||||||
def callback_goto(self, callback, goto, raw_string):
|
def callback_goto(self, callback, goto, raw_string):
|
||||||
|
|
@ -601,12 +601,12 @@ class EvMenu(object):
|
||||||
try:
|
try:
|
||||||
if len(getargspec(nodename).args) > 1:
|
if len(getargspec(nodename).args) > 1:
|
||||||
# callable accepting raw_string
|
# callable accepting raw_string
|
||||||
nodename(self._caller, raw_string)
|
nodename(self.caller, raw_string)
|
||||||
else:
|
else:
|
||||||
# normal callable, only the caller as arg
|
# normal callable, only the caller as arg
|
||||||
nodename(self._caller)
|
nodename(self.caller)
|
||||||
except Exception:
|
except Exception:
|
||||||
self._caller.msg(_ERR_GENERAL.format(nodename=nodename))
|
self.caller.msg(_ERR_GENERAL.format(nodename=nodename))
|
||||||
raise
|
raise
|
||||||
else:
|
else:
|
||||||
# nodename is a string; lookup as node
|
# nodename is a string; lookup as node
|
||||||
|
|
@ -684,10 +684,10 @@ class EvMenu(object):
|
||||||
"""
|
"""
|
||||||
Shutdown menu; occurs when reaching the end node.
|
Shutdown menu; occurs when reaching the end node.
|
||||||
"""
|
"""
|
||||||
self._caller.cmdset.remove(EvMenuCmdSet)
|
self.caller.cmdset.remove(EvMenuCmdSet)
|
||||||
del self._caller.ndb._menutree
|
del self.caller.ndb._menutree
|
||||||
if self.cmd_on_quit is not None:
|
if self.cmd_on_quit is not None:
|
||||||
self.cmd_on_quit(self._caller, self)
|
self.cmd_on_quit(self.caller, self)
|
||||||
|
|
||||||
|
|
||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue