def get_ui_instance(): global myui if myui == None: for (name, ctr, default, comment) in _config_items: exported.add_config(name, ctr(name, default, 1, comment)) myui = Cursesui() return myui
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() if os.name == "posix": fnt = tkFont.Font(family="Courier", size=12) else: fnt = tkFont.Font(family="Fixedsys", size=12) 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
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