def _setupConfiguration(self): """ Goes through and sets up all the engine-specific configuration pieces. """ c = self._managers["config"] # this one doesn't seem to do anything # c.add("variablechar", config.CharConfig("variablechar", "$", 0, "denotes variables")) cops = config.options c.add("repeathistory", config.BoolConfig("repeathistory", utils.convert_boolean(cops.get("repeathistory", 1)), 0, "Whether (yes) or not (no) we record repeated user input in the " + "history buffer. For example, if you type \"north\" and then " + "\"north\" again, if repeathistory is on, we record both. " + "Otherwise we would only record the first one.")) c.add("commandchar", config.CharConfig("commandchar", config.options.get("commandchar", "#"), 0, "The character used to denote a command.")) c.add("debugmode", config.BoolConfig("debugmode", utils.convert_boolean(cops.get("debugmode", 0)), 0, "Debug mode helps you to figure out how your commands are being " + "evaluated.")) c.add("promptdetection", config.BoolConfig("promptdetection", utils.convert_boolean(cops.get("promptdetection", 0)), 0, "Prompt detection is done in net.py when mud data comes in. " + "This toggles whether we detect prompts or not. This won't help " + "you unless you have a plugin which requires it.")) c.add("ansicolor", config.BoolConfig("ansicolor", utils.convert_boolean(cops.get("ansicolor", 1)), 1, "Allows you to enable or disable ansi color handling.")) c.add("mudecho", config.BoolConfig("mudecho", utils.convert_boolean(cops.get("mudecho", 1)), 0, "Whether (1) or not (0) we're echoing user input to the ui.")) c.add("datadir", config.StringConfig("datadir", config.options["datadir"], 0, "Default directory to find config files etc.")) c.add("splitchar", config.CharConfig("splitchar", config.options.get("splitchar", ";"), 0, "The character used to split commands in a single input.")) self._sessions["common"].setupCommonSession()
def setupCommonSession(self): import config c = self._engine.getConfigManager() if type(config.options["snoopdefault"]) is list: config.options["snoopdefault"] = config.options["snoopdefault"][0] tc = config.BoolConfig( "snoop", utils.convert_boolean(config.options['snoopdefault']), 0, "Whether or not you see the data from this session when it's not " "active.") c.add("snoop", tc, self) tc = config.BoolConfig( "verbatim", 0, 0, "Whether we're in verbatim mode where we pass the user text " "straight to the mud without massaging it.") c.add("verbatim", tc, self)
def load(): """ Initializes the module by binding all the commands.""" global sm modutils.load_commands(commands_dict) sm = SpeedwalkManager() exported.add_manager("speedwalk", sm) exported.hook_register("user_filter_hook", sm.userfilter, 80) exported.hook_register("write_hook", sm.persist) from lyntin import config for mem in exported.get_active_sessions(): tc = config.BoolConfig("speedwalk", 1, 1, "Allows you to turn on and turn off speedwalk handling.") exported.add_config("speedwalk", tc, mem)
def load(): """ Initializes the module by binding all the commands.""" global sm modutils.load_commands(commands_dict) sm = SubstituteManager() exported.add_manager("substitute", sm) exported.hook_register("mud_filter_hook", sm.mudfilter, 50) exported.hook_register("write_hook", sm.persist) from lyntin import config for mem in exported.get_active_sessions(): tc = config.BoolConfig("ignoresubs", 0, 1, "Allows you to turn on and turn off substitutions.") exported.add_config("ignoresubs", tc, mem)
def load(): """ Initializes the module by binding all the commands.""" global am, var_module modutils.load_commands(commands_dict) am = ActionManager() exported.add_manager("action", am) exported.hook_register("mud_filter_hook", am.mudfilter, 75) exported.hook_register("write_hook", am.persist) exported.hook_register("variable_change_hook", am.variableChange) from lyntin import config for mem in exported.get_active_sessions(): # we need a separate BoolConfig for each session tc = config.BoolConfig("ignoreactions", 0, 1, "Allows you to turn off action handling.") exported.add_config("ignoreactions", tc, mem)
def __init__(self): """ Initializes.""" base.BaseUI.__init__(self) # internal ui queue self._event_queue = queue.Queue() # map of session -> (bold, foreground, background) self._currcolors = {} # ses -> string self._unfinishedcolor = {} self._viewhistory = 0 self._do_i_echo = 1 # holds a map of window names -> window references self._windows = {} # instantiate all the widgets self._tk = Tk() self._tk.geometry("800x600") self.settitle() fnt = tkinter.font.Font(family="FixedSys", size=10) self._entry = CommandEntry(self._tk, self, fg='white', bg='black', insertbackground='yellow', font=fnt, insertwidth='2') self._entry.pack(side='bottom', fill='both') self._topframe = Frame(self._tk) self._topframe.pack(side='top', fill='both', expand=1) self._txt = ScrolledText(self._topframe, fg='white', bg='black', font=fnt, height=20) self._txt.pack(side='bottom', fill='both', expand=1) self._txt.bind("<KeyPress>", self._ignoreThis) self._txtbuffer = ScrolledText(self._topframe, fg='white', bg='black', font=fnt, height=20) self._txtbuffer.bind("<KeyPress-Escape>", self.escape) self._txtbuffer.bind("<KeyPress>", self._ignoreThis) self._entry.focus_set() self._initColorTags() self.dequeue() exported.hook_register("config_change_hook", self.configChangeHandler) exported.hook_register("to_user_hook", self.write) # FIXME - fix this explanation. this is just terrible. tc = config.BoolConfig( "saveinputhighlight", 0, 1, "Allows you to change the behavior of the command entry. When " "saveinputhighlight is off, we discard whatever is on the entry " "line. When it is on, we will retain the contents allowing you " "to press the enter key to do whatever you typed again.") exported.add_config("saveinputhighlight", tc) self._quit = 0