Made so the default add_default_cmdset script also removes the added cmdset when stopped. Fixed the function of @delplayer command.

This commit is contained in:
Griatch 2010-09-05 18:20:39 +00:00
parent 212061abb6
commit e125763ea5
5 changed files with 86 additions and 36 deletions

View file

@ -307,7 +307,7 @@ class CmdSetHandler(object):
the last cmdset in the stack is removed. Whenever
the cmdset_stack changes, the cmdset is updated.
The default cmdset (first entry in stack) is never
removed - set it to an empty set with add_default instead.
removed - remove it explicitly with delete_default.
key_or_class - a specific cmdset key or a cmdset class (in
the latter case, *all* cmdsets of this class
@ -339,6 +339,11 @@ class CmdSetHandler(object):
# re-sync the cmdsethandler.
self.update()
def delete_default(self):
"This explicitly deletes the default cmdset. It's the only command that can."
self.cmdset_stack[0] = CmdSet(cmdsetobj=self.obj, key="Empty")
self.update()
def all(self):
"""
Returns the list of cmdsets. Mostly useful to check if stack if empty or not.