126
126
raise NotImplementedError(self.get_password)
128
def make_output_stream(self, encoding=None, encoding_type=None):
129
"""Get a stream for sending out bulk text data.
131
This is used for commands that produce bulk text, such as log or diff
132
output, as opposed to user interaction. This should work even for
133
non-interactive user interfaces. Typically this goes to a decorated
134
version of stdout, but in a GUI it might be appropriate to send it to a
135
window displaying the text.
137
:param encoding: Unicode encoding for output; default is the
138
terminal encoding, which may be different from the user encoding.
139
(See get_terminal_encoding.)
141
:param encoding_type: How to handle encoding errors:
142
replace/strict/escape/exact. Default is replace.
144
# XXX: is the caller supposed to close the resulting object?
146
encoding = osutils.get_terminal_encoding()
147
if encoding_type is None:
148
encoding_type = 'replace'
149
out_stream = self._make_output_stream_explicit(encoding, encoding_type)
152
def _make_output_stream_explicit(self, encoding, encoding_type):
153
raise NotImplementedError("%s doesn't support make_output_stream"
154
% (self.__class__.__name__))
128
156
def nested_progress_bar(self):
129
157
"""Return a nested progress bar.
180
208
raise NotImplementedError(self.get_boolean)
210
def get_integer(self, prompt):
211
"""Get an integer from the user.
213
:param prompt: a message to prompt the user with. Could be a multi-line
214
prompt but without a terminating \n.
216
:return: A signed integer.
218
raise NotImplementedError(self.get_integer)
182
220
def make_progress_view(self):
183
221
"""Construct a new ProgressView object for this UI.
267
305
def get_boolean(self, prompt):
268
306
return self.responses.pop(0)
308
def get_integer(self, prompt):
309
return self.responses.pop(0)
270
311
def get_password(self, prompt='', **kwargs):
271
312
return self.responses.pop(0)
273
314
def get_username(self, prompt, **kwargs):
274
315
return self.responses.pop(0)
276
317
def assert_all_input_consumed(self):
277
318
if self.responses:
278
319
raise AssertionError("expected all input in %r to be consumed"