branch : pmacs2
This commit is contained in:
moculus 2009-03-10 14:43:04 +00:00
parent c1dd1c1430
commit 6a975d9a2e
2 changed files with 9 additions and 8 deletions

View File

@ -3,14 +3,13 @@ from buffer.color import ColorDataBuffer
# console is another singleton # console is another singleton
console = None console = None
class ConsoleBuffer(ColorDataBuffer): class ConsoleBuffer(Buffer):
btype = 'console' btype = 'console'
#modename = 'ipython' modename = 'ipython'
modename = 'colortext'
bannerlines = [ bannerlines = [
'[r:d:*]# Python Console\n', '# Python Console\n',
"[r:d:*]# Evaluate python expressions in the editor's context (self)\n", "# Evaluate python expressions in the editor's context (self)\n",
'[r:d:*]# Press Control-] to exit\n', '# Press Control-] to exit\n',
] ]
banner = ''.join(bannerlines) banner = ''.join(bannerlines)
def __new__(cls, *args, **kwargs): def __new__(cls, *args, **kwargs):
@ -19,8 +18,10 @@ class ConsoleBuffer(ColorDataBuffer):
b = object.__new__(ConsoleBuffer, *args, **kwargs) b = object.__new__(ConsoleBuffer, *args, **kwargs)
console = b console = b
return console return console
def __init__(self):
Buffer.__init__(self)
self.set_data(self.banner, force=True)
def __init__(self): ColorDataBuffer.__init__(self, '*Console*', self.banner)
def clear(self): console.set_data(self.banner, force=True) def clear(self): console.set_data(self.banner, force=True)
def name(self): return '*Console*' def name(self): return '*Console*'
def changed(self): return False def changed(self): return False

View File

@ -23,7 +23,7 @@ class ConsoleExec(method.Method):
if a.window().buffer is not b: if a.window().buffer is not b:
a.switch_buffer(b) a.switch_buffer(b)
p = a.get_mini_buffer_prompt() p = a.get_mini_buffer_prompt()
b.insert_string(b.get_buffer_end(), '[c:d:*]' + p + '[d:d]' + s + '\n', force=True) b.insert_string(b.get_buffer_end(), p + s + '\n', force=True)
if w.mode.saved_input: if w.mode.saved_input:
s = w.mode.saved_input + '\n' + s s = w.mode.saved_input + '\n' + s