From 182488a713603f7207fff0b566e5f7421a28326f Mon Sep 17 00:00:00 2001 From: Griatch Date: Fri, 17 Oct 2014 19:32:33 +0200 Subject: [PATCH] Updates to menu_node to make sure separate, new cmdsets are initialized in different tree instances, as per #596. --- contrib/menu_login.py | 3 ++- contrib/menusystem.py | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/contrib/menu_login.py b/contrib/menu_login.py index f7d92e899..5947beb00 100644 --- a/contrib/menu_login.py +++ b/contrib/menu_login.py @@ -346,7 +346,7 @@ node3 = MenuNode("node3", text=LOGIN_SCREEN_HELP, class UnloggedInCmdSet(CmdSet): "Cmdset for the unloggedin state" - key = "UnloggedinState" + key = "DefaultUnloggedin" priority = 0 def at_cmdset_creation(self): @@ -361,6 +361,7 @@ class CmdUnloggedinLook(Command): to the menu's own look command.. """ key = CMD_LOGINSTART + aliases = ["look", "l"] locks = "cmd:all()" def func(self): diff --git a/contrib/menusystem.py b/contrib/menusystem.py index 35b2a4199..dbab4e1f9 100644 --- a/contrib/menusystem.py +++ b/contrib/menusystem.py @@ -150,7 +150,7 @@ class MenuTree(object): tree as needed. For safety, being in a menu will not survive a 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 upon first entering the menu. The endnode need not actually 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 track of which nodes it is connected to. """ - menunode.init(self) self.tree[menunode.key] = menunode def goto(self, key): @@ -206,6 +205,8 @@ class MenuTree(object): # not exiting, look for a valid code. node = self.tree.get(key, None) if node: + # initialize - this creates new cmdset + node.init(self) if node.code: # Execute eventual code active on this # node. self.caller is available at this point. @@ -266,7 +267,7 @@ class MenuNode(object): code block, as well as ev. nodefaultcmds - if true, don't offer the default help and look commands 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.cmdset = None