pmacs3/minibuffer.py

29 lines
795 B
Python
Raw Normal View History

2007-06-04 23:05:33 -04:00
import buffer2
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
2007-06-04 23:05:33 -04:00
class MiniBuffer(buffer2.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:
mini = object.__new__(MiniBuffer, *args, **kwargs)
return mini
# the callback function should take one argument (window)
def __init__(self, func, method=None, tabber=None, modename=None):
2007-06-04 23:05:33 -04:00
buffer2.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