'set(value) - Set progress bar position'

def set(self, value, max=None):

    if (max is not None):
        self.maxval = max
        bar = self.d.GetDialogItemAsControl(3)
        if (max <= 0):
            bar.SetControlData(0, kControlProgressBarIndeterminateTag, '\x01')
        else:
            bar.SetControlData(0, kControlProgressBarIndeterminateTag, '\x00')
    if (value < 0):
        value = 0
    elif (value > self.maxval):
        value = self.maxval
    self.curval = value
    self._update(value)
