Revision 789a3763 image_creator/output/__init__.py
b/image_creator/output/__init__.py | ||
---|---|---|
85 | 85 |
yield |
86 | 86 |
return generator |
87 | 87 |
|
88 |
|
|
89 |
class CombinedOutput(Output): |
|
90 |
|
|
91 |
def __init__(self, outputs=[]): |
|
92 |
self._outputs = outputs |
|
93 |
|
|
94 |
def add(self, output): |
|
95 |
self._outputs.append(output) |
|
96 |
|
|
97 |
def remove(self, output): |
|
98 |
self._outputs.remove(output) |
|
99 |
|
|
100 |
def error(self, msg, new_line=True): |
|
101 |
for out in self._outputs: |
|
102 |
out.error(msg, new_line) |
|
103 |
|
|
104 |
def warn(self, msg, new_line=True): |
|
105 |
for out in self._outputs: |
|
106 |
out.warn(msg, new_line) |
|
107 |
|
|
108 |
def success(self, msg, new_line=True): |
|
109 |
for out in self._outputs: |
|
110 |
out.success(msg, new_line) |
|
111 |
|
|
112 |
def output(self, msg='', new_line=True): |
|
113 |
for out in self._outputs: |
|
114 |
out.output(msg, new_line) |
|
115 |
|
|
116 |
def cleanup(self): |
|
117 |
for out in self._outputs: |
|
118 |
out.cleanup() |
|
119 |
|
|
120 |
def clear(self): |
|
121 |
for out in self._outputs: |
|
122 |
out.clear() |
|
123 |
|
|
124 |
class _Progress(object): |
|
125 |
|
|
126 |
def __init__(self, size, title, bar_type='default'): |
|
127 |
self.progresses = [] |
|
128 |
for out in self.output._outputs: |
|
129 |
self.progresses.append(out.Progress(size, title, bar_type)) |
|
130 |
|
|
131 |
def goto(self, dest): |
|
132 |
for progress in self.progresses: |
|
133 |
progress.goto(dest) |
|
134 |
|
|
135 |
def next(self): |
|
136 |
for progress in self.progresses: |
|
137 |
progress.next() |
|
138 |
|
|
139 |
def success(self, result): |
|
140 |
for progress in self.progresses: |
|
141 |
progress.success(result) |
|
142 |
|
|
88 | 143 |
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai : |
Also available in: Unified diff