Module bzTools :: Class bzDisplay
[frames] | no frames]

Class bzDisplay

source code

This object is a facility to display message in a multiline form. It is typically used to split long text strings into several lines of text.

Exemple:
   # initialisation
   aDisplay = bzDisplay()
   aDisplay.QueueMessage ('Hi there ..','JiBe')
   aDisplay.QueueMessage ('Hi Jibe, nice to see you in here. How are you ?','LOD')
   aDisplay.QueueMessage ('I'm fine, thank you .. what about you ?','JiBe')
   
   # display 
   print aDisplay.GetDisplay (nb_lines = 8, nb_car=  28)
will give the following result:
   JiBe: Hi there ..
   LOD: Hi Jibe, nice to see you in
   here. How are you ?
   JiBe: I'm fine, thank you ..
   what about you ?


Instance Methods
bzDisplay
__init__(self)
Returns: N/A
source code
 
__repr__(self) source code
 
__cesurate__(self, string, maxLigne, maxCar) source code
 
QueueMessage(self, message, pseudo='')
Append a message to the list of message to be displayed.
source code
Array of nb_lines String
GetDisplay(self, nb_lines=8, nb_car=36)
Compute a list of character string showing received messages
source code
 
Clear(self)
Cleans the display
source code
Instance Variables
list of [string, string]. messages
list of message [pseudo, text].
Method Details

__init__(self)
(Constructor)

source code 
Returns: bzDisplay
N/A

QueueMessage(self, message, pseudo='')

source code 
Append a message to the list of message to be displayed. This fonction is typically called when a new incoming message has been received
Parameters:
  • pseudo (String.) - The pseudo of the player who sent the message.
  • message (String) - The message itself.

GetDisplay(self, nb_lines=8, nb_car=36)

source code 

Compute a list of character string showing received messages

Messages are cesurated so that lines never end in the mid of a word. Messages are formatted so that each received messages starts at the beginning of a line. If messages are too numerous to be displayed on nb_lines lines, only the last nb_lines lines are processed.

This fonction is typically called when a refresh of a displayed is needed
Parameters:
  • nb_lines (Integer.) - The pseudo of the player who sent the message.
  • nb_car (Integer) - The message itself.
Returns: Array of nb_lines String
a list of formatted strings ..