pmacs3/buffer/console.py

32 lines
1.2 KiB
Python

from buffer import Buffer, ACT_NORM
from buffer.color import ColorDataBuffer
# console is another singleton
console = None
class ConsoleBuffer(ColorDataBuffer):
btype = 'console'
#modename = 'ipython'
modename = 'colortext'
bannerlines = [
'[r:d:*]# Python Console\n',
"[r:d:*]# Evaluate python expressions in the editor's context (self)\n",
'[r:d:*]# Press Control-] to exit\n',
]
banner = ''.join(bannerlines)
def __new__(cls, *args, **kwargs):
global console
if console is None:
b = object.__new__(ConsoleBuffer, *args, **kwargs)
console = b
return console
def __init__(self): ColorDataBuffer.__init__(self, '*Console*', self.banner)
def clear(self): console.set_data(self.banner, force=True)
def name(self): return '*Console*'
def changed(self): return False
def close(self): global console; console = None
def readonly(self): return True
def input_insert_lines(self, p, lines, act=ACT_NORM, force=False): pass
def output_insert_lines(self, p, lines, act=ACT_NORM, force=False): pass
def result_insert_lines(self, p, lines, act=ACT_NORM, force=False): pass