def __init__(self, handler, delay=500, tag=None): """ctor for IdleTime class.""" # For use by handlers... self.count = 0 # The number of times handler has been called. self.starting_time = None # Time that the timer started. self.time = None # Time that the handle is called. self.tag = tag # An arbitrary string/object for use during debugging. # For use by the IdleTime class... self.delay = delay # The argument to self.timer.start: # 0 for idle time, otherwise a delay in msec. self.enabled = False # True: run the timer continuously. self.handler = handler # The user-provided idle-time handler. self.waiting_for_idle = False # True if we have already waited for the minimum delay\ # Create the timer, but do not fire it. self.timer = QtCore.QTimer() self.timer.timeout.connect(self.at_idle_time) # Add this instance to the global idle_timers.list. # This reference prevents this instance from being destroyed. g.app.idle_timers.append(self)
def __init__(self) -> None: """Ctor for the base BackgroundProcessManager class.""" self.data: Any = None # a ProcessData instance. self.process_queue: List = [] # List of g.Bunches. self.pid: Any = None # The process id of the running process. self.lock = thread.allocate_lock() self.process_return_data: List[str] = None # #2528: A timer that runs independently of idle time. self.timer = None if QtCore: self.timer = QtCore.QTimer() self.timer.timeout.connect(self.on_idle)