Revision 1ea7fc2e image_creator/output.py

b/image_creator/output.py
70 70

  
71 71

  
72 72
class Output(object):
73

  
73 74
    def error(self, msg, new_line=True):
74 75
        error(msg, new_line, False)
75 76

  
......
82 83
    def output(self, msg='', new_line=True):
83 84
        output(msg, new_line)
84 85

  
85
    class Progress(object):
86
    def _get_progress(self):
87
        progress = self._Progress
88
        progress.output = self
89
        return progress
90

  
91
    Progress = property(_get_progress)
92

  
93
    class _Progress(object):
86 94
        def __init__(self, title, bar_type='default'):
87
            output("%s..." % title, False)
95
            self.output.output("%s..." % title, False)
88 96

  
89 97
        def goto(self, dest):
90 98
            pass
......
93 101
            pass
94 102

  
95 103
        def success(self, result):
96
            sucess(result)
104
            self.output.success(result)
97 105

  
98 106
    def progress_generator(self, message):
99 107
        def generator(n):
......
121 129

  
122 130

  
123 131
class Output_wth_progress(Output_wth_colors):
124
    class Progress(Bar):
132
    class _Progress(Bar):
125 133
        MESSAGE_LENGTH = 30
126 134

  
127 135
        template = {
......
133 141
        }
134 142

  
135 143
        def __init__(self, title, bar_type='default'):
136
            super(Output_wth_progress.Progress, self).__init__()
144
            super(Output_wth_progress._Progress, self).__init__()
137 145
            self.title = title
138 146
            self.fill = '#'
139 147
            self.bar_prefix = ' ['
......
142 150
            self.suffix = self.template[bar_type]
143 151

  
144 152
        def success(self, result):
145
            output("\r%s... \033[K" % self.title, False)
146
            success(result)
153
            self.output.output("\r%s... \033[K" % self.title, False)
154
            self.output.success(result)
147 155

  
148 156

  
149 157
class Silent(Output):
......
156 164
    def output(self, msg='', new_line=True):
157 165
        pass
158 166

  
159
    class Progress(Output.Progress):
160
        def __init__(self, title, bar_type='default'):
161
            pass
162

  
163
        def success(self, result):
164
            pass
165 167

  
166 168
class Silent_wth_colors(Silent):
167 169
    def error(self, msg, new_line=True):

Also available in: Unified diff