(self)
Commit a dataset to the output immediately (if available locally) or
        schedule download background and an eventual send.

        During the download the widget is in blocking state
        (OWWidget.isBlocking)
Commit a dataset to the output immediately (if available locally) or
        schedule download background and an eventual send.
Commit a dataset to the output immediately ( if available locally ) or schedule download background and an eventual send .
def commit(self):
        """
        Commit a dataset to the output immediately (if available locally) or
        schedule download background and an eventual send.

        During the download the widget is in blocking state
        (OWWidget.isBlocking)
        """
        di = self.selected_dataset()
        if di is not None:
            self.Error.clear()

            if self.__awaiting_state is not None:
                # disconnect from the __commit_complete
                self.__awaiting_state.watcher.done.disconnect(
                    self.__commit_complete)
                # .. and connect to update_cached_state
                # self.__awaiting_state.watcher.done.connect(
                #     self.__update_cached_state)
                # TODO: There are possible pending __progress_advance queued
                self.__awaiting_state.pb.advance.disconnect(
                    self.__progress_advance)
                self.progressBarFinished()
                self.__awaiting_state = None

            if not di.islocal:
                pr = progress()
                callback = lambda pr=pr: pr.advance.emit()
                pr.advance.connect(self.__progress_advance, Qt.QueuedConnection)

                self.progressBarInit()
                self.setStatusMessage("Fetching...")
                self.setBlocking(True)

                f = self._executor.submit(
                    ensure_local, self.INDEX_URL, di.file_path,
                    self.local_cache_path, force=di.outdated,
                    progress_advance=callback)
                w = FutureWatcher(f, parent=self)
                w.done.connect(self.__commit_complete)
                self.__awaiting_state = _FetchState(f, w, pr)
            else:
                self.setStatusMessage("")
                self.setBlocking(False)
                self.commit_cached(di.file_path)
        else:
            self.load_and_output(None)
def commit ( self ) : di = self . selected_dataset ( ) if di is not None : self . Error . clear ( ) if self . __awaiting_state is not None : # disconnect from the __commit_complete self . __awaiting_state . watcher . done . disconnect ( self . __commit_complete ) # .. and connect to update_cached_state # self.__awaiting_state.watcher.done.connect( #     self.__update_cached_state) # TODO: There are possible pending __progress_advance queued self . __awaiting_state . pb . advance . disconnect ( self . __progress_advance ) self . progressBarFinished ( ) self . __awaiting_state = None if not di . islocal : pr = progress ( ) callback = lambda pr = pr : pr . advance . emit ( ) pr . advance . connect ( self . __progress_advance , Qt . QueuedConnection ) self . progressBarInit ( ) self . setStatusMessage ( "Fetching..." ) self . setBlocking ( True ) f = self . _executor . submit ( ensure_local , self . INDEX_URL , di . file_path , self . local_cache_path , force = di . outdated , progress_advance = callback ) w = FutureWatcher ( f , parent = self ) w . done . connect ( self . __commit_complete ) self . __awaiting_state = _FetchState ( f , w , pr ) else : self . setStatusMessage ( "" ) self . setBlocking ( False ) self . commit_cached ( di . file_path ) else : self . load_and_output ( None )