Table of Contents

Class: MPicoEditor mudlib/mpico.py

This is the mpico editor itself and encapsulates all functionality. It's highly undocumented--but getting there.

Base Classes   
MudObject
Methods   
__init__
addToClipboard
arrowDown
arrowLeft
arrowRight
arrowUp
backspaceCharacter
changed
clearClipboard
cursorPosition
cutText
deleteCharFromBuffer
deleteCharacter
deleteLineFromBuffer
drawAll
drawBody
drawCommands
drawHeader
drawLine
drawStatus
flush
getBufLen
getBuffer
getClientEOL
getClientHeight
getClientWidth
getClipboardContents
getFilename
getLine
getLineNo
getLineWidth
initialize
insertCR
insertCharacters
insertLineIntoBuffer
markChanged
moveCursor
pageDown
pageUp
processInput
prompt
refresh
setBuffer
setLine
setMethodOnExit
switchHelpMode
uncutText
write
  __init__ 
__init__ ( self )

  addToClipboard 
addToClipboard ( self,  line )

Adds a line to the clipped buffer.

  arrowDown 
arrowDown ( self,  toedge=None )

If the user hits the down arrow key....

  arrowLeft 
arrowLeft ( self )

If the user hits the left arrow key....

  arrowRight 
arrowRight ( self )

When the user hits the right arrow key....

  arrowUp 
arrowUp ( self,  toedge=None )

If the user hits the up arrow key....

  backspaceCharacter 
backspaceCharacter ( self )

Deletes the previous character.

  changed 
changed ( self )

Has this buffer been changed since the last saving? Returns a 1 if it has and a 0 if it hasn't.

  clearClipboard 
clearClipboard ( self )

If they move after cutting text, then that text moves to the clipboard_buffer and this buffer gets cleared.

  cursorPosition 
cursorPosition ( self )

If the user hits ctrl-c (cursor position)....

  cutText 
cutText ( self )

Deletes the whole line we're on (cut) and puts it in the clipboard thingy.

  deleteCharFromBuffer 
deleteCharFromBuffer (
        self,
        y=-1,
        x=-1,
        )

Deletes a character from the buffer.

  deleteCharacter 
deleteCharacter ( self )

Deletes the character the cursor is on.

  deleteLineFromBuffer 
deleteLineFromBuffer ( self,  lineno=-1 )

Deletes a line from the buffer.

  drawAll 
drawAll ( self )

Calls all the draw functions to refresh the screen and Then flushes the buffer.

  drawBody 
drawBody ( self,  fromline=1 )

Draws the visible portion of the text_buffer into the screen.

  drawCommands 
drawCommands ( self )

Draws the commands at the bottom of the screen.

  drawHeader 
drawHeader ( self )

Draws the header line on the top of the screen.

  drawLine 
drawLine ( self,  lineno=-1 )

Redraws a line of the text_buffer.

  drawStatus 
drawStatus ( self,  status='' )

Draws the status bar and text (if there is any).

  flush 
flush ( self,  s='' )

Sends everything in the output buffer over the socket and then clears the output buffer.

  getBufLen 
getBufLen ( self )

Returns the length of the text buffer.

  getBuffer 
getBuffer ( self )

Returns self.text_buffer which is a list of strings. Call this when you're saving the buffer because this is the stuff you want to save.

  getClientEOL 
getClientEOL ( self )

Retrieves the EOL sequence of the client.

  getClientHeight 
getClientHeight ( self )

Retrieves the height of the client (default is 22).

  getClientWidth 
getClientWidth ( self )

Retrieves the width of the client (default is 72).

  getClipboardContents 
getClipboardContents ( self )

Returns the clipboard contents as an array of strings.

  getFilename 
getFilename ( self )

Returns the filename.

  getLine 
getLine ( self,  lineno=-1 )

Returns the line at that index in the buffer and if no index is specified, it returns the line the cursor is on.

  getLineNo 
getLineNo ( self )

Returns the current line number in relation to the text_buffer. So the first line is 0 and the last line is len(text_buffer) - 1.

  getLineWidth 
getLineWidth ( self,  lineno=-1 )

Returns the width of the line at the given index in the buffer. If no index is specified, it returns the width of the line the cursor is currently on.

  initialize 
initialize (
        self,
        filename="",
        text="",
        )

Initializes the processors, sets us into CxC mode, and loads the file (if any). Then it draws the screen.

Parameters

filename
(string) the name of the file being edited
text
(string) the initial text in the editing buffer

Exceptions   
Exception, "Can't switch into character mode."
  insertCR 
insertCR ( self )

Inserts a carriage return.

  insertCharacters 
insertCharacters ( self,  data )

Retrieve the current line, insert the data, and set it in the buffer. Then redraw the important part of the screen.

  insertLineIntoBuffer 
insertLineIntoBuffer (
        self,
        data,
        lineno=-1,
        )

Inserts data into the buffer.

  markChanged 
markChanged ( self,  status )

Sets whether this buffer has been changed or not.

  moveCursor 
moveCursor (
        self,
        y=-1,
        x=-1,
        )

Moves the cursor to the location so that it can print material there.

  pageDown 
pageDown ( self,  lineno=-1 )

If the user hits ctrl-v (page down)....

  pageUp 
pageUp ( self,  lineno=-1 )

If the user hits ctrl-y (page up)....

  processInput 
processInput ( self,  what )

Invoked by the player's mind to process each incoming character.

  prompt 
prompt ( self )

Invoked by the player's mind after each input line is processed. We don't do anything here because we don't require a prompt to be printed to the screen.

  refresh 
refresh ( self )

Refreshes the entire screen (in case something got garbled?). As a slight side effect, it also checks to make sure we're in character mode. The reason for this is due to refresh being the function that gets called on Naws events which could happen if the player comes back from linkdeath.

  setBuffer 
setBuffer (
        self,
        filename,
        text,
        )

Sets the text_buffer and the filename.

  setLine 
setLine (
        self,
        data,
        lineno=-1,
        )

Replaces a line in the buffer with a given line. If no index is specified, it replaces the line the cursor is on.

  setMethodOnExit 
setMethodOnExit (
        self,
        methodToInvokeOnExit,
        optionalParam=None,
        )

Sets a method to be invoked when this editor exits normally. The method invoked upon normal exit and will be passed a string containing the contents of the input buffer and, if provided, the optional parameter.

  switchHelpMode 
switchHelpMode ( self,  mode=constants.FALSE )

Switches us in and out of help mode. Help is mostly just another text buffer, so we just swap them out.

# FIXME - this is not yet implemented.

  uncutText 
uncutText ( self )

Takes the material in the clipboard buffer and tosses it into the document.

  write 
write ( self,  output )

Adds output to the output buffer for sending to the client.


Table of Contents

This document was automatically generated on Thu Jan 24 08:57:43 2002 by HappyDoc version 2.0