def METHOD_NAME(self, dlg):
    # ccd = self.main_data.ccd
    exp = self.exposureTime.value
    dlg.pauseSettings()
    # ccd.exposureTime.value = exp
    f = model.ProgressiveFuture()
    f.task_canceller = lambda l: True  # To allow cancelling while it's running
    f.set_running_or_notify_cancel()  # Indicate the work is starting now
    dlg.showProgress(f)
    d = []
    for i in range(10):
        left = (10 - i) * exp
        f.set_progress(end=time.time() + left)
        # d.append(ccd.data.get())
        time.sleep(exp)
        if f.cancelled():
            dlg.resumeSettings()
            return
    f.set_result(None)  # Indicate it's over
    if d:
        dataio.hdf5.export(self.filename.value, d)
    dlg.Destroy()