Пример #1
0
def find_program(pid):
    desktop = Atspi.get_desktop(0)

    child_count = desktop.get_child_count()
    for i in range(child_count):
        child = desktop.get_child_at_index(i)
        if child.get_process_id() == pid:
            return child
Пример #2
0
    def getDesktop(self, i):
        """
                Gets a reference to the i-th desktop.

                @@param i: Which desktop to get
                @@type i: integer
                @@return: Desktop reference
                @@rtype: Accessibility.Desktop
                """
        if not self.has_implementations:
            self._set_default_registry()
        return Atspi.get_desktop(i)
Пример #3
0
        def getDesktop(self, i):
                """
                Gets a reference to the i-th desktop.

                @@param i: Which desktop to get
                @@type i: integer
                @@return: Desktop reference
                @@rtype: Accessibility.Desktop
                """
                if not self.has_implementations:
                        self._set_default_registry ()
                return Atspi.get_desktop(i)
Пример #4
0
def get_app(name):
    desktop = Atspi.get_desktop(0)
    start = time.time()
    timeout = 5
    app = None
    while app is None and (time.time() - start) < timeout:
        gen = (child for _i, child in children(desktop)
               if child and child.get_name() == name)
        app = next(gen, None)
        if app is None:
            time.sleep(0.6)
    return app
Пример #5
0
def run(path, name= None):
    name = name or f"{path}-test-{str(random.randint(0, 100000000))}"
    process = subprocess.Popen([path, '--name', name])
    desktop = Atspi.get_desktop(0)
    start = time.time()
    timeout = 5
    app = None
    while app is None and (time.time() - start) < timeout:
        gen = (child for _i, child in children(desktop) if child and child.get_name() == name)
        app = next(gen, None)
        if app is None:
            time.sleep(0.6)
    return (process, app)
Пример #6
0
def get_root():
    return Node(Atspi.get_desktop(0))
Пример #7
0
def get_root():
    return Node(Atspi.get_desktop(0))