~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/ui/__init__.py

Fixed garbage in progress/warning interactions

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
        """
70
70
        raise NotImplementedError(self.nested_progress_bar)
71
71
 
 
72
    def clear_term(self):
 
73
        """Prepare the terminal for output.
 
74
 
 
75
        This will, for example, clear text progress bars, and leave the
 
76
        cursor at the leftmost position."""
 
77
        raise NotImplementedError(self.clear_term)
 
78
 
72
79
 
73
80
class SilentUIFactory(UIFactory):
74
81
    """A UI Factory which never prints anything.
90
97
                klass=bzrlib.progress.DummyProgress)
91
98
        return self._progress_bar_stack.get_nested()
92
99
 
 
100
    def clear_term(self):
 
101
        pass
 
102
 
 
103
 
 
104
def clear_decorator(func, *args, **kwargs):
 
105
    """Decorator that clears the term"""
 
106
    ui_factory.clear_term()
 
107
    func(*args, **kwargs)
 
108
 
93
109
 
94
110
ui_factory = SilentUIFactory()
95
111
"""IMPORTANT: never import this symbol directly. ONLY ever access it as