Help command: don't use EvMore if help text is shown in popup

This commit is contained in:
Simon Vermeersch 2017-02-04 20:30:46 +01:00 committed by Griatch
parent 91fd754e98
commit ba42c68c5c

View file

@ -42,19 +42,33 @@ class CmdHelp(Command):
# the current cmdset with the call to self.func(). # the current cmdset with the call to self.func().
return_cmdset = True return_cmdset = True
# Help messages are wrapped in an EvMore call (unless using the webclient
# Help messages are wrapped in an EvMore call. If you want to # with separate help popups) If you want to avoid this, simply set the
# avoid this, simply set the 'help_more' flag to False. # 'help_more' flag to False.
help_more = True help_more = True
def msg_help(self, text): def msg_help(self, text):
""" """
messages text to the caller, adding an extra oob argument to indicate messages text to the caller, adding an extra oob argument to indicate
that this is a help command result and could be rendered in a separate that this is a help command result and could be rendered in a separate
help window help window
""" """
self.msg((text, {"window": "help"})); if type(self).help_more:
usemore = True
if self.session.protocol_key in ("websocket", "ajax/comet"):
try:
options = self.caller.player.db._saved_webclient_options
if options["helppopup"]:
usemore = False
except KeyError:
pass
if usemore:
evmore.msg(self.caller, text)
return
self.msg((text, {"window": "help"}))
@staticmethod @staticmethod
def format_help_entry(title, help_text, aliases=None, suggested=None): def format_help_entry(title, help_text, aliases=None, suggested=None):
@ -209,10 +223,7 @@ class CmdHelp(Command):
match[0].__doc__, match[0].__doc__,
aliases=match[0].aliases, aliases=match[0].aliases,
suggested=suggestions) suggested=suggestions)
if type(self).help_more: self.msg_help(formatted)
evmore.msg(caller, formatted)
else:
self.msg_help(formatted)
return return
# try an exact database help entry match # try an exact database help entry match
@ -222,10 +233,7 @@ class CmdHelp(Command):
match[0].entrytext, match[0].entrytext,
aliases=match[0].aliases.all(), aliases=match[0].aliases.all(),
suggested=suggestions) suggested=suggestions)
if type(self).help_more: self.msg_help(formatted)
evmore.msg(caller, formatted)
else:
self.msg_help(formatted)
return return
# try to see if a category name was entered # try to see if a category name was entered