Updates to menu_node to make sure separate, new cmdsets are initialized in different tree instances, as per #596.
This commit is contained in:
parent
8a9e1a9b4b
commit
182488a713
2 changed files with 6 additions and 4 deletions
|
|
@ -346,7 +346,7 @@ node3 = MenuNode("node3", text=LOGIN_SCREEN_HELP,
|
||||||
|
|
||||||
class UnloggedInCmdSet(CmdSet):
|
class UnloggedInCmdSet(CmdSet):
|
||||||
"Cmdset for the unloggedin state"
|
"Cmdset for the unloggedin state"
|
||||||
key = "UnloggedinState"
|
key = "DefaultUnloggedin"
|
||||||
priority = 0
|
priority = 0
|
||||||
|
|
||||||
def at_cmdset_creation(self):
|
def at_cmdset_creation(self):
|
||||||
|
|
@ -361,6 +361,7 @@ class CmdUnloggedinLook(Command):
|
||||||
to the menu's own look command..
|
to the menu's own look command..
|
||||||
"""
|
"""
|
||||||
key = CMD_LOGINSTART
|
key = CMD_LOGINSTART
|
||||||
|
aliases = ["look", "l"]
|
||||||
locks = "cmd:all()"
|
locks = "cmd:all()"
|
||||||
|
|
||||||
def func(self):
|
def func(self):
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ class MenuTree(object):
|
||||||
tree as needed. For safety, being in a menu will not survive a
|
tree as needed. For safety, being in a menu will not survive a
|
||||||
server reboot.
|
server reboot.
|
||||||
|
|
||||||
A menutree have two special node keys given by 'startnode' and
|
A menutree has two special node keys given by 'startnode' and
|
||||||
'endnode' arguments. The startnode is where the user will start
|
'endnode' arguments. The startnode is where the user will start
|
||||||
upon first entering the menu. The endnode need not actually
|
upon first entering the menu. The endnode need not actually
|
||||||
exist, the moment it is linked to and that link is used, the menu
|
exist, the moment it is linked to and that link is used, the menu
|
||||||
|
|
@ -188,7 +188,6 @@ class MenuTree(object):
|
||||||
Add a menu node object to the tree. Each node itself keeps
|
Add a menu node object to the tree. Each node itself keeps
|
||||||
track of which nodes it is connected to.
|
track of which nodes it is connected to.
|
||||||
"""
|
"""
|
||||||
menunode.init(self)
|
|
||||||
self.tree[menunode.key] = menunode
|
self.tree[menunode.key] = menunode
|
||||||
|
|
||||||
def goto(self, key):
|
def goto(self, key):
|
||||||
|
|
@ -206,6 +205,8 @@ class MenuTree(object):
|
||||||
# not exiting, look for a valid code.
|
# not exiting, look for a valid code.
|
||||||
node = self.tree.get(key, None)
|
node = self.tree.get(key, None)
|
||||||
if node:
|
if node:
|
||||||
|
# initialize - this creates new cmdset
|
||||||
|
node.init(self)
|
||||||
if node.code:
|
if node.code:
|
||||||
# Execute eventual code active on this
|
# Execute eventual code active on this
|
||||||
# node. self.caller is available at this point.
|
# node. self.caller is available at this point.
|
||||||
|
|
@ -266,7 +267,7 @@ class MenuNode(object):
|
||||||
code block, as well as ev.
|
code block, as well as ev.
|
||||||
nodefaultcmds - if true, don't offer the default help and look commands
|
nodefaultcmds - if true, don't offer the default help and look commands
|
||||||
in the node
|
in the node
|
||||||
separator - this string will be put on the line between menu nodes5B.
|
separator - this string will be put on the line between menu nodes.
|
||||||
"""
|
"""
|
||||||
self.key = key
|
self.key = key
|
||||||
self.cmdset = None
|
self.cmdset = None
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue