Pull line editor out of contrib and into main.

This commit is contained in:
Jonathan Piacenti 2015-03-26 16:25:18 -05:00
parent eddb5dadf5
commit 89a39a8481
4 changed files with 20 additions and 10 deletions

View file

@ -1,9 +1,6 @@
"""
Evennia Line Editor
Contribution - Griatch 2011
This implements an advanced line editor for editing longer texts
in-game. The editor mimics the command mechanisms of the VI editor as
far as possible.
@ -20,7 +17,6 @@ Whereas the editor is intended to be called from other commands that
requires more elaborate text editing of data, there is also a
stand-alone editor command for editing Attributes at the end of this
module. To use it just import and add it to your default `cmdset`.
"""
import re
@ -684,8 +680,10 @@ class CmdEditor(Command):
editor_key = "%s/%s" % (self.objname, self.attrname)
# start editor, it will handle things from here.
self.editor = LineEditor(self.caller,
loadfunc=load_attr,
savefunc=save_attr,
quitfunc=quit_hook,
key=editor_key)
self.editor = utils.get_line_editor()(
self.caller,
loadfunc=load_attr,
savefunc=save_attr,
quitfunc=quit_hook,
key=editor_key
)

View file

@ -9,5 +9,5 @@ See README.md for more info.
import evennia
evennia._init()
import barter, dice, extended_room, menu_login, talking_npc
import chargen, email_login, gendersub, lineeditor, menusystem, slow_exit
import chargen, email_login, gendersub, menusystem, slow_exit
import tutorial_world, tutorial_examples

View file

@ -282,6 +282,11 @@ CMDSET_PLAYER = "commands.default_cmdsets.PlayerCmdSet"
# Location to search for cmdsets if full path not given
CMDSET_PATHS = ["commands"]
# Line editor path. Points to a line editor class that commands may use to give
# users extended editing control. See the default path for a reference implementation
# and usage.
LINE_EDITOR = 'evennia.commands.default.lineeditor.LineEditor'
######################################################################
# Typeclasses and other paths
######################################################################

View file

@ -1257,3 +1257,10 @@ def m_len(target):
if inherits_from(target, basestring):
return len(ANSI_PARSER.strip_mxp(target))
return len(target)
def get_line_editor():
"""
Get the line editor for this game.
"""
return variable_from_module(*settings.LINE_EDITOR.rsplit('.', 1))