Beispiel #1
0
    def download_files(self, objects, filesizes, bucket_name):

        c = self.progress_thread_count
        self.progress_thread_count += 1
        self.upload_thread_count += 1

        progress_thread = ProgressWindow((objects, 'All files'),
                                         filesizes,
                                         c,
                                         download=True)
        download_thread = DownloadThread(objects, bucket_name,
                                         self.oci_manager, c)

        download_thread.file_downloaded.connect(progress_thread.next_file)
        download_thread.bytes_downloaded.connect(progress_thread.set_progress)
        download_thread.all_files_downloaded.connect(self.delete_threads)
        progress_thread.cancel_signal.connect(self.thread_cancelled)
        download_thread.download_failed.connect(progress_thread.retry_handler)
        progress_thread.retry.clicked.connect(download_thread.start)

        self.progress_threads[c] = progress_thread
        self.upload_threads[c] = download_thread

        self.progress_threads[c].show()
        self.upload_threads[c].start()
    def update(self):
        """
        Try to download new images and update wallpaper.
        """

        print "Updating..."
        download_thread = DownloadThread(self, self.ui_controller, self.config)
        download_thread.start()
Beispiel #3
0
    def run(self):
        try:
            self._tcpServer = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            self._tcpServer.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR,
                                       1)
            self._tcpServer.bind((self._config.ip, self._config.port))
        except socket.error:
            self._log.error(
                "There was an error when trying to bind the server")
            exit(2)
        finally:
            self._log.info("Waiting for connections ...")

        while True:
            self._tcpServer.listen(4)
            (conn, (ip, port)) = self._tcpServer.accept()
            newthread = DownloadThread(conn, self._config)
            newthread.start()
            self.threads.append(newthread)