2009-02-22 21:51:31 -05:00
|
|
|
from buffer import Buffer, ACT_NORM
|
2008-10-29 10:58:06 -04:00
|
|
|
|
|
|
|
# console is another singleton
|
|
|
|
console = None
|
|
|
|
class ConsoleBuffer(Buffer):
|
|
|
|
btype = 'console'
|
2009-02-22 21:51:31 -05:00
|
|
|
#modename = 'ipython'
|
|
|
|
modename = 'colortext'
|
2008-10-29 10:58:06 -04:00
|
|
|
def __new__(cls, *args, **kwargs):
|
|
|
|
global console
|
|
|
|
if console is None:
|
|
|
|
b = object.__new__(ConsoleBuffer, *args, **kwargs)
|
|
|
|
console = b
|
|
|
|
return console
|
|
|
|
def __init__(self):
|
|
|
|
Buffer.__init__(self)
|
|
|
|
self.clear()
|
|
|
|
def clear(self):
|
2009-02-22 21:51:31 -05:00
|
|
|
#lines = ['# Python Console\n',
|
|
|
|
# "# Evaluate python expressions in the editor's context (self)\n",
|
|
|
|
# '# Press Control-] to exit\n']
|
|
|
|
lines = ['[r:d:*]# Python Console\n',
|
2009-02-22 17:48:22 -05:00
|
|
|
"# Evaluate python expressions in the editor's context (self)\n",
|
|
|
|
'# Press Control-] to exit\n']
|
2008-10-29 10:58:06 -04:00
|
|
|
console.set_data(''.join(lines), force=True)
|
|
|
|
def name(self):
|
|
|
|
return '*Console*'
|
|
|
|
def changed(self):
|
|
|
|
return False
|
|
|
|
def close(self):
|
|
|
|
global console
|
|
|
|
console = None
|
|
|
|
def readonly(self):
|
|
|
|
return True
|
2009-02-22 21:51:31 -05:00
|
|
|
|
|
|
|
#new
|
|
|
|
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
|