20
20
# Boston, MA 02111-1307, USA.
22
22
class Result(object):
28
def __init__(self, value):
34
def __cmp__(self, other):
35
if isinstance(other, int) or isinstance(other, Result):
36
return cmp(int(self), int(other))
28
def __init__(self, value):
34
def __cmp__(self, other):
35
if isinstance(other, int) or isinstance(other, Result):
36
return cmp(int(self), int(other))
41
41
HIDE = Result(Result.HIDE)
42
42
DONE = Result(Result.DONE)
44
44
class Prompt(Result):
45
def __init__(self, prompt, autocomplete={}):
46
Result.__init__(self, Result.PROMPT)
45
def __init__(self, prompt, autocomplete={}):
46
Result.__init__(self, Result.PROMPT)
49
self.autocomplete = autocomplete
49
self.autocomplete = autocomplete
51
51
class Suspend(Result):
53
Result.__init__(self, Result.SUSPEND)
56
def register(self, cb, *args):
57
self._callbacks.append([cb, args])
60
for cb in self._callbacks:
53
Result.__init__(self, Result.SUSPEND)
56
def register(self, cb, *args):
57
self._callbacks.append([cb, args])
60
for cb in self._callbacks: