def wait_active(self, timeout = 0): import time sleep = .05 start = time.time() parent_id = _xautpy.find_outer_parent(self.id) while(1): active_id = _xautpy.active_window() active_parent_id = _xautpy.find_outer_parent(active_id) if(parent_id == active_parent_id): return True #A crude timeout function. Using threads and interrupts #is too complicated for such a simple loop. if(timeout > 0): now = time.time() if((now - start) >= timeout): return False time.sleep(sleep)
def find_outer_parent(self): op_id = _xautpy.find_outer_parent(self.id) if op_id > 0: return window(op_id) else: return None
def is_active(self): active_id = _xautpy.active_window() return _xautpy.find_outer_parent(active_id) == _xautpy.find_outer_parent(self.id)
def is_active(self): active_id = _xautpy.active_window() return _xautpy.find_outer_parent( active_id) == _xautpy.find_outer_parent(self.id)