Made various parts of the core respect the CLIENT_DEFAULT_WIDTH setting. Resolves #710.
This commit is contained in:
parent
a01493bfa0
commit
c781160225
7 changed files with 35 additions and 24 deletions
|
|
@ -35,6 +35,7 @@ except ImportError:
|
|||
CHAR_TYPECLASS = settings.BASE_CHARACTER_TYPECLASS
|
||||
ROOM_TYPECLASS = settings.BASE_ROOM_TYPECLASS
|
||||
EXIT_TYPECLASS = settings.BASE_EXIT_TYPECLASS
|
||||
_DEFAULT_WIDTH = settings.CLIENT_DEFAULT_WIDTH
|
||||
|
||||
_PROTOTYPE_PARENTS = None
|
||||
|
||||
|
|
@ -1874,7 +1875,7 @@ class CmdExamine(ObjManipCommand):
|
|||
if things:
|
||||
string += "\n{wContents{n: %s" % ", ".join(["%s(%s)" % (cont.name, cont.dbref) for cont in obj.contents
|
||||
if cont not in exits and cont not in pobjs])
|
||||
separator = "-" * 78
|
||||
separator = "-" * _DEFAULT_WIDTH
|
||||
#output info
|
||||
return '%s\n%s\n%s' % (separator, string.strip(), separator)
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ __all__ = ("CmdAddCom", "CmdDelCom", "CmdAllCom",
|
|||
"CmdCWho", "CmdChannelCreate", "CmdClock", "CmdCdesc",
|
||||
"CmdPage", "CmdIRC2Chan", "CmdRSS2Chan")#, "CmdIMC2Chan", "CmdIMCInfo",
|
||||
#"CmdIMCTell")
|
||||
_DEFAULT_WIDTH = settings.CLIENT_DEFAULT_WIDTH
|
||||
|
||||
|
||||
def find_channel(caller, channelname, silent=False, noaliases=False):
|
||||
|
|
@ -276,7 +277,7 @@ class CmdChannels(MuxPlayerCommand):
|
|||
|
||||
if self.cmdstring == "comlist":
|
||||
# just display the subscribed channels with no extra info
|
||||
comtable = evtable.EvTable("{wchannel{n", "{wmy aliases{n", "{wdescription{n", align="l", maxwidth=78)
|
||||
comtable = evtable.EvTable("{wchannel{n", "{wmy aliases{n", "{wdescription{n", align="l", maxwidth=_DEFAULT_WIDTH)
|
||||
#comtable = prettytable.PrettyTable(["{wchannel", "{wmy aliases", "{wdescription"])
|
||||
for chan in subs:
|
||||
clower = chan.key.lower()
|
||||
|
|
@ -289,7 +290,7 @@ class CmdChannels(MuxPlayerCommand):
|
|||
caller.msg("\n{wChannel subscriptions{n (use {w@channels{n to list all, {waddcom{n/{wdelcom{n to sub/unsub):{n\n%s" % comtable)
|
||||
else:
|
||||
# full listing (of channels caller is able to listen to)
|
||||
comtable = evtable.EvTable("{wsub{n", "{wchannel{n", "{wmy aliases{n", "{wlocks{n", "{wdescription{n", maxwidth=78)
|
||||
comtable = evtable.EvTable("{wsub{n", "{wchannel{n", "{wmy aliases{n", "{wlocks{n", "{wdescription{n", maxwidth=_DEFAULT_WIDTH)
|
||||
#comtable = prettytable.PrettyTable(["{wsub", "{wchannel", "{wmy aliases", "{wlocks", "{wdescription"])
|
||||
for chan in channels:
|
||||
clower = chan.key.lower()
|
||||
|
|
@ -796,7 +797,7 @@ class CmdIRC2Chan(MuxCommand):
|
|||
ircbots = [bot for bot in PlayerDB.objects.filter(db_is_bot=True, username__startswith="ircbot-")]
|
||||
if ircbots:
|
||||
from evennia.utils.evtable import EvTable
|
||||
table = EvTable("{wdbid{n", "{wbotname{n", "{wev-channel{n", "{wirc-channel{n", maxwidth=78)
|
||||
table = EvTable("{wdbid{n", "{wbotname{n", "{wev-channel{n", "{wirc-channel{n", maxwidth=_DEFAULT_WIDTH)
|
||||
for ircbot in ircbots:
|
||||
ircinfo = "%s (%s:%s)" % (ircbot.db.irc_channel, ircbot.db.irc_network, ircbot.db.irc_port)
|
||||
table.add_row(ircbot.id, ircbot.db.irc_botname, ircbot.db.ev_channel, ircinfo)
|
||||
|
|
@ -905,7 +906,8 @@ class CmdRSS2Chan(MuxCommand):
|
|||
rssbots = [bot for bot in PlayerDB.objects.filter(db_is_bot=True, username__startswith="rssbot-")]
|
||||
if rssbots:
|
||||
from evennia.utils.evtable import EvTable
|
||||
table = EvTable("{wdbid{n", "{wupdate rate{n", "{wev-channel", "{wRSS feed URL{n", border="cells", maxwidth=78)
|
||||
table = EvTable("{wdbid{n", "{wupdate rate{n", "{wev-channel",
|
||||
"{wRSS feed URL{n", border="cells", maxwidth=_DEFAULT_WIDTH)
|
||||
for rssbot in rssbots:
|
||||
table.add_row(rssbot.id, rssbot.db.rss_rate, rssbot.db.ev_channel, rssbot.db.rss_url)
|
||||
self.caller.msg(table)
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ set. The normal, database-tied help system is used for collaborative
|
|||
creation of other help topics such as RP help or game-world aides.
|
||||
"""
|
||||
|
||||
from django.conf import settings
|
||||
from collections import defaultdict
|
||||
from evennia.utils.utils import fill, dedent
|
||||
from evennia.commands.command import Command
|
||||
|
|
@ -16,16 +17,15 @@ from evennia.commands.default.muxcommand import MuxCommand
|
|||
|
||||
# limit symbol import for API
|
||||
__all__ = ("CmdHelp", "CmdSetHelp")
|
||||
|
||||
|
||||
SEP = "{C" + "-" * 78 + "{n"
|
||||
_DEFAULT_WIDTH = settings.CLIENT_DEFAULT_WIDTH
|
||||
_SEP = "{C" + "-" * _DEFAULT_WIDTH + "{n"
|
||||
|
||||
|
||||
def format_help_entry(title, help_text, aliases=None, suggested=None):
|
||||
"""
|
||||
This visually formats the help entry.
|
||||
"""
|
||||
string = SEP + "\n"
|
||||
string = _SEP + "\n"
|
||||
if title:
|
||||
string += "{CHelp topic for {w%s{n" % title
|
||||
if aliases:
|
||||
|
|
@ -36,7 +36,7 @@ def format_help_entry(title, help_text, aliases=None, suggested=None):
|
|||
string += "\n\n{CSuggested:{n "
|
||||
string += "{w%s{n" % fill(", ".join(suggested))
|
||||
string.strip()
|
||||
string += "\n" + SEP
|
||||
string += "\n" + _SEP
|
||||
return string
|
||||
|
||||
|
||||
|
|
@ -48,12 +48,12 @@ def format_help_list(hdict_cmds, hdict_db):
|
|||
"""
|
||||
string = ""
|
||||
if hdict_cmds and any(hdict_cmds.values()):
|
||||
string += "\n" + SEP + "\n {CCommand help entries{n\n" + SEP
|
||||
string += "\n" + _SEP + "\n {CCommand help entries{n\n" + _SEP
|
||||
for category in sorted(hdict_cmds.keys()):
|
||||
string += "\n {w%s{n:\n" % (str(category).title())
|
||||
string += "{G" + fill(", ".join(sorted(hdict_cmds[category]))) + "{n"
|
||||
if hdict_db and any(hdict_db.values()):
|
||||
string += "\n\n" + SEP + "\n\r {COther help entries{n\n" + SEP
|
||||
string += "\n\n" + _SEP + "\n\r {COther help entries{n\n" + _SEP
|
||||
for category in sorted(hdict_db.keys()):
|
||||
string += "\n\r {w%s{n:\n" % (str(category).title())
|
||||
string += "{G" + fill(", ".join(sorted([str(topic) for topic in hdict_db[category]]))) + "{n"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue