Exemple #1
0
 def _present(self,message):
     self.lines = self.lines[1:]
     if not (message == ""):            
         message = self.prompt + message.strip()
     if '' in self.lines:
         # insert at the position of the oldest blank line
         self.lines.insert(max(1,self.lines.index('')),message)
     else:
         # otherwise append at the end
         self.lines.append(message)
     self.marker(224)
     TextPresenter._present(self,"\n".join(self.lines))
Exemple #2
0
 def _present(self, message):
     self.lines = self.lines[1:]
     if not (message == ""):
         message = self.prompt + message.strip()
     if '' in self.lines:
         # insert at the position of the oldest blank line
         self.lines.insert(max(1, self.lines.index('')), message)
     else:
         # otherwise append at the end
         self.lines.append(message)
     self.marker(224)
     TextPresenter._present(self, "\n".join(self.lines))
Exemple #3
0
 def __init__(self,
              numlines=5,        # number of lines that may be simultaneously displayed
              autoclear=3,       # interval at which to shift up old messages (one line at a time), in seconds or None
              prompt = '',       # the prompt to prepend to every non-empty message
              *args,**kwargs):
     if not ("height" in kwargs):
         kwargs["height"] = numlines
     TextPresenter.__init__(self,*args,**kwargs)
     self.numlines = numlines
     self.lines = ['']*self.numlines
     self.prompt = prompt
     if autoclear is not None:
         taskMgr.doMethodLater(autoclear,self._autoclear,'Scroll.autoclear')
Exemple #4
0
 def __init__(
         self,
         numlines=5,  # number of lines that may be simultaneously displayed
         autoclear=3,  # interval at which to shift up old messages (one line at a time), in seconds or None
         prompt='',  # the prompt to prepend to every non-empty message
         *args,
         **kwargs):
     if not ("height" in kwargs):
         kwargs["height"] = numlines
     TextPresenter.__init__(self, *args, **kwargs)
     self.numlines = numlines
     self.lines = [''] * self.numlines
     self.prompt = prompt
     if autoclear is not None:
         taskMgr.doMethodLater(autoclear, self._autoclear,
                               'Scroll.autoclear')
Exemple #5
0
 def _unpresent(self):        
     self.lines = ['']*self.numlines        
     TextPresenter._unpresent(self)
     self.marker(225)
Exemple #6
0
import ConfigParser
from engine import Engine
import os
import pygame
import sys

from Ball import Ball
from TextPresenter import TextPresenter

config = ConfigParser.ConfigParser()
config.readfp(open('config.cfg'))

engine = Engine(config)
ball = Ball(config)
tp = TextPresenter(config)
engine.entities.append(ball)
engine.entities.append(tp)

while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            sys.exit()

    engine.update()
Exemple #7
0
 def _unpresent(self):
     self.lines = [''] * self.numlines
     TextPresenter._unpresent(self)
     self.marker(225)