Exemplo n.º 1
0
    def stop(self, wait=True):
        self.stopped = True
        if self.options:
            if self.options['profile'] and \
               self.options['profile_persistence'] == 'clone-first':
                self.options['profile'].cleanup()
        if self.download_manager:
            self.download_manager.cancel()
        if self.thread:
            self.thread.quit()

        if wait:
            if self.download_manager:
                self.download_manager.wait(raise_if_error=False)
            if self.thread:
                # wait for thread(s) completion - this is the case when
                # user close the application
                self.thread.wait()
                for thread in self.pending_threads:
                    thread.wait()
            self.thread = None
        elif self.thread:
            # do not block, just keep track of the thread - we got here
            # when user uses the stop button.
            self.pending_threads.append(self.thread)
            self.thread.finished.connect(self._remove_pending_thread)

        if self.test_runner:
            self.test_runner.finish(None)
        self.running_state_changed.emit(False)
        log('Stopped')
Exemplo n.º 2
0
 def bisection_finished(self, bisection, resultcode):
     dialog = None
     if resultcode == Bisection.USER_EXIT:
         msg = "Bisection stopped."
     elif resultcode == Bisection.NO_DATA:
         msg = "Unable to find enough data to bisect."
         dialog = QMessageBox.warning
     elif resultcode == Bisection.EXCEPTION:
         msg = "Error: %s" % self.worker.error[1]
         dialog = QMessageBox.critical
     else:
         fetch_config = self.worker.fetch_config
         if fetch_config.can_go_integration() and not getattr(bisection, "no_more_merge", False):
             if isinstance(bisection.handler, NightlyHandler):
                 handler = bisection.handler
                 fetch_config.set_repo(fetch_config.get_nightly_repo(handler.bad_date))
                 QTimer.singleShot(0, self.worker.bisect_further)
             else:
                 # check merge, try to bisect further
                 QTimer.singleShot(0, self.worker.check_merge)
             return
         msg = "The bisection is done."
     if dialog:
         dialog(self.mainwindow, "End of the bisection", msg)
     else:
         log(msg)
     self.stop()
Exemplo n.º 3
0
    def stop(self, wait=True):
        self.stopped = True
        if self.options:
            if self.options["profile"] and self.options[
                    "profile_persistence"] == "clone-first":
                self.options["profile"].cleanup()
        if self.download_manager:
            self.download_manager.cancel()
        if self.thread:
            self.thread.quit()

        if wait:
            if self.download_manager:
                self.download_manager.wait(raise_if_error=False)
            if self.thread:
                # wait for thread(s) completion - this is the case when
                # user close the application
                self.thread.wait()
                for thread in self.pending_threads:
                    thread.wait()
            self.thread = None
        elif self.thread:
            # do not block, just keep track of the thread - we got here
            # when user uses the stop button.
            self.pending_threads.append(self.thread)
            self.thread.finished.connect(self._remove_pending_thread)

        if self.test_runner:
            self.test_runner.finish(None)
        self.running_state_changed.emit(False)
        log("Stopped")
Exemplo n.º 4
0
 def bisection_finished(self, bisection, resultcode):
     dialog = None
     if resultcode == Bisection.USER_EXIT:
         msg = "Bisection stopped."
     elif resultcode == Bisection.NO_DATA:
         msg = "Unable to find enough data to bisect."
         dialog = QMessageBox.warning
     elif resultcode == Bisection.EXCEPTION:
         msg = "Error: %s" % self.worker.error[1]
         dialog = QMessageBox.critical
     else:
         fetch_config = self.worker.fetch_config
         if fetch_config.can_go_inbound() and not \
                 getattr(bisection, 'no_more_merge', False):
             if isinstance(bisection.handler, NightlyHandler):
                 handler = bisection.handler
                 fetch_config.set_repo(
                     fetch_config.get_nightly_repo(handler.bad_date))
                 QTimer.singleShot(0, self.worker.bisect_further)
             else:
                 # check merge, try to bisect further
                 QTimer.singleShot(0, self.worker.check_merge)
             return
         msg = "The bisection is done."
     if dialog:
         dialog(self.mainwindow, "End of the bisection", msg)
     else:
         log(msg)
     self.stop()