pmacs3/minibuffer.py

29 lines
775 B
Python
Raw Normal View History

import buffer
2007-03-06 10:05:38 -05:00
class MiniBufferError(Exception):
pass
2007-03-06 10:05:38 -05:00
# minibuffer is a singleton
mini = None
class MiniBuffer(buffer.Buffer):
2007-07-19 14:37:39 -04:00
btype = 'mini'
2007-03-06 10:05:38 -05:00
def __new__(cls, *args, **kwargs):
global mini
if mini is None:
2008-03-16 16:26:32 -04:00
mini = object.__new__(MiniBuffer)
2007-03-06 10:05:38 -05:00
return mini
# the callback function should take one argument (window)
def __init__(self, func, method=None, tabber=None, modename=None):
buffer.Buffer.__init__(self)
2007-03-06 10:05:38 -05:00
self.callback = func
self.method = method
self.tabber = tabber
self.modename = modename
def name(self):
return "*Minibuffer*"
def do_callback(self):
self.callback(self.make_string())
def close(self):
global mini
mini = None