def update(self, value):
        """ Update the progress bar to the desired value

        If the value is >= the maximum and the progress bar is not contained
        in another panel the parent window will be closed.

        Parameters
        ----------
        value :
            The progress value to set.
        """

        if self.progress_bar is None:
            # the developer is trying to update a progress bar which is already
            # done. Allow it, but do nothing
            return (False, False)

        self.progress_bar.update(value)

        # A bit hackish, but on Windows if another window sets focus, the
        # other window will come to the top, obscuring the progress dialog.
        # Only do this if the control is a top level window, so windows which
        # embed a progress dialog won't keep popping to the top
        # When we do embed the dialog, self.control may be None since the
        # embedding might just be grabbing the guts of the control. This happens
        # in the Traits UI ProgressEditor.

        if self.control is not None and self.control.IsTopLevel():
            self.control.Raise()

        if self.max > 0:
            percent = (float(value) - self.min)/(self.max - self.min)

            if self.show_time and (percent != 0):
                current_time = time.time()
                elapsed = self._start_time - current_time
                estimated = elapsed/percent
                remaining = estimated - elapsed

                self._set_time_label(elapsed,
                                 self._elapsed_control)
                self._set_time_label(estimated,
                                 self._estimated_control)
                self._set_time_label(remaining,
                                 self._remaining_control)

            if self.show_percent:
                self._percent_control = "%3f" % ((percent * 100) % 1)

            if value >= self.max or self._user_cancelled:
                self.close()
        else:
            if self._user_cancelled:
                self.close()

        wx.GetApp().Yield(True)

        return (not self._user_cancelled, False)

    #-------------------------------------------------------------------------
    # Private Interface
    #-------------------------------------------------------------------------
dataset/ETHPy150Open enthought/pyface/pyface/ui/wx/progress_dialog.py/ProgressDialog.update/swapped operands of `-`