# Path: pyweed/signals.py
# class SignalingThread(QtCore.QThread):
#     """
#     Mixin that serves to standardize how we use signals to pass information around
#     """
#     # Signal to indicate success
#     done = QtCore.pyqtSignal(object)
# 
#     def __del__(self):
#         self.wait()
# 
# class SignalingObject(QtCore.QObject):
#     """
#     Mixin for other objects that manage threaded work, and need to signal completion
#     """
#     # Signal to indicate success
#     done = QtCore.pyqtSignal(object)


import os
import collections
import obspy
import matplotlib
import weakref
import concurrent.futures
    import doctest
from obspy import UTCDateTime
from pyweed.signals import SignalingThread, SignalingObject
from PyQt5 import QtCore, QtGui
from logging import getLogger
from pyweed.pyweed_utils import get_sncl, get_event_id, TimeWindow,\
    get_preferred_origin, get_preferred_magnitude, OUTPUT_FORMAT_EXTENSIONS,\
    get_event_description, get_arrivals, format_time_str, get_distance, get_service_url, CancelledException
from obspy.core.util.attribdict import AttribDict
from obspy.io.sac.sactrace import SACTrace
from obspy.core.stream import Stream
            for result in concurrent.futures.as_completed(self.futures):
                waveform_id = self.futures.get(result)
                if waveform_id:
                    LOGGER.debug("Loader finished: %s", waveform_id)
                    try:
                        self.progress.emit(WaveformResult(waveform_id, result.result()))
                    except Exception as e:
                        self.progress.emit(WaveformResult(waveform_id, e))
        self.futures = {}
        self.done.emit(None)

    def clearFutures(self):
        """
        Cancel any outstanding tasks
        """
        if self.futures:
            for future in self.futures:
                if not future.done():
                    LOGGER.debug("Cancelling unexecuted future")
                    future.cancel()

    def cancel(self):
        """
        User-requested cancel
        """
        self.done.disconnect()
        self.progress.disconnect()
        self.clearFutures()



# Path: pyweed/signals.py
# class SignalingThread(QtCore.QThread):
#     """
#     Mixin that serves to standardize how we use signals to pass information around
#     """
#     # Signal to indicate success
#     done = QtCore.pyqtSignal(object)
# 
#     def __del__(self):
#         self.wait()
# 
# class SignalingObject(QtCore.QObject):
#     """
#     Mixin for other objects that manage threaded work, and need to signal completion
#     """
#     # Signal to indicate success
#     done = QtCore.pyqtSignal(object)


# Path: pyweed/waveforms_handler.py
import os
import collections
import obspy
import matplotlib
import weakref
import concurrent.futures
    import doctest
from obspy import UTCDateTime
from pyweed.signals import SignalingThread, SignalingObject
from PyQt5 import QtCore, QtGui
from logging import getLogger
from pyweed.pyweed_utils import get_sncl, get_event_id, TimeWindow,\
    get_preferred_origin, get_preferred_magnitude, OUTPUT_FORMAT_EXTENSIONS,\
    get_event_description, get_arrivals, format_time_str, get_distance, get_service_url, CancelledException
from obspy.core.util.attribdict import AttribDict
from obspy.io.sac.sactrace import SACTrace
from obspy.core.stream import Stream

            for result in concurrent.futures.as_completed(self.futures):
                waveform_id = self.futures.get(result)
                if waveform_id:
                    LOGGER.debug("Loader finished: %s", waveform_id)
                    try:
                        self.progress.emit(WaveformResult(waveform_id, result.result()))
                    except Exception as e:
                        self.progress.emit(WaveformResult(waveform_id, e))
        self.futures = {}
        self.done.emit(None)

    def clearFutures(self):
        """
        Cancel any outstanding tasks
        """
        if self.futures:
            for future in self.futures:
                if not future.done():
                    LOGGER.debug("Cancelling unexecuted future")
                    future.cancel()

    def cancel(self):
        """
        User-requested cancel
        """
        self.done.disconnect()
        self.progress.disconnect()
        self.clearFutures()



class WaveformsHandler(SignalingObject):