class SharedProgressBar(object):
    def __init__(self, number_of_items):
        self.bar = ProgressBar(0, number_of_items, 77)
        self.number_of_items = number_of_items
        self.counter = 0
        self.old_bar_string = ""

    def update(self):
        self.counter += 1
        if self.old_bar_string != str(self.bar):
            sys.stdout.write(str(self.bar) + '\r')
            sys.stdout.flush()
            self.old_bar_string = str(self.bar)
        self.bar.updateAmount(self.counter)

    def flush(self):
        self.bar.updateAmount(self.number_of_items)
        sys.stdout.write(str(self.bar) + '\r')
        sys.stdout.flush()
class SharedProgressBar(object):
    def __init__(self, number_of_items):
        self.bar = ProgressBar(0, number_of_items, 77)
        self.number_of_items = number_of_items
        self.counter = 0
        self.old_bar_string = ""

    def update(self):
        self.counter += 1
        if self.old_bar_string != str(self.bar):
            sys.stdout.write(str(self.bar) + '\r')
            sys.stdout.flush()
            self.old_bar_string = str(self.bar)
        self.bar.updateAmount(self.counter)

    def flush(self):
        self.bar.updateAmount(self.number_of_items)
        sys.stdout.write(str(self.bar) + '\r')
        sys.stdout.flush()
 def __init__(self, number_of_items):
     self.bar = ProgressBar(0, number_of_items, 77)
     self.number_of_items = number_of_items
     self.counter = 0
     self.old_bar_string = ""
 def __init__(self, number_of_items):
     self.bar = ProgressBar(0, number_of_items, 77)
     self.number_of_items = number_of_items
     self.counter = 0
     self.old_bar_string = ""