• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python pyatspi.Registry类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pyatspi.Registry的典型用法代码示例。如果您正苦于以下问题:Python Registry类的具体用法?Python Registry怎么用?Python Registry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Registry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: reclaimScripts

    def reclaimScripts(self):
        """Compares the list of known scripts to the list of known apps,
        deleting any scripts as necessary.
        """

        from pyatspi import Registry

        try:
            desktop = Registry.getDesktop(0)
        except:
            debug.printException(debug.LEVEL_FINEST)
            return

        appList = self.appScripts.keys()
        appList = filter(lambda a: a!= None and a not in desktop, appList)
        for app in appList:
            appScript = self.appScripts.pop(app)
            _eventManager.deregisterScriptListeners(appScript)
            del appScript

            try:
                toolkitScripts = self.toolkitScripts.pop(app)
            except KeyError:
                pass
            else:
                for toolkitScript in toolkitScripts.values():
                    _eventManager.deregisterScriptListeners(toolkitScript)
                    del toolkitScript

            del app
开发者ID:thnguyn2,项目名称:ECE_527_MP,代码行数:30,代码来源:script_manager.py


示例2: reclaimScripts

    def reclaimScripts(self):
        """Compares the list of known scripts to the list of known apps,
        deleting any scripts as necessary.
        """

        from pyatspi import Registry

        try:
            desktop = Registry.getDesktop(0)
        except:
            debug.printException(debug.LEVEL_FINEST)
            return

        appList = list(self.appScripts.keys())
        appList = [a for a in appList if a != None and a not in desktop]
        for app in appList:
            appScript = self.appScripts.pop(app)
            del appScript

            try:
                toolkitScripts = self.toolkitScripts.pop(app)
            except KeyError:
                pass
            else:
                for toolkitScript in list(toolkitScripts.values()):
                    del toolkitScript

            del app
开发者ID:pvagner,项目名称:orca,代码行数:28,代码来源:script_manager.py


示例3: reclaimScripts

    def reclaimScripts(self):
        """Compares the list of known scripts to the list of known apps,
        deleting any scripts as necessary.
        """

        from pyatspi import Registry

        try:
            desktop = Registry.getDesktop(0)
        except:
            debug.printException(debug.LEVEL_FINEST)
            return

        appList = self.scripts.keys()
        appList = filter(lambda a: a!= None and a not in desktop, appList)
        for app in appList:
            script = self.scripts.pop(app)
            _eventManager.deregisterListeners(script)
            del app
            del script
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:20,代码来源:script_manager.py


示例4: absoluteMotionWithTrajectory

def absoluteMotionWithTrajectory(source_x, source_y, dest_x, dest_y, mouseDelay=None, check=True):
    """
    Synthetize mouse absolute motion with trajectory. The 'trajectory' means that the whole motion
    is divided into several atomic movements which are synthetized separately.
    """
    if check:
        checkCoordinates(source_x, source_y)
        checkCoordinates(dest_x, dest_y)
    logger.log("Mouse absolute motion with trajectory to (%s,%s)" % (dest_x, dest_y))

    dx = float(dest_x - source_x)
    dy = float(dest_y - source_y)
    max_len = max(abs(dx), abs(dy))
    if max_len == 0:
        # actually, no motion requested
        return
    dx /= max_len
    dy /= max_len
    act_x = float(source_x)
    act_y = float(source_y)

    for _ in range(0, int(max_len)):
        act_x += dx
        act_y += dy
        if mouseDelay:
            doDelay(mouseDelay)
        registry.generateMouseEvent(int(act_x), int(act_y), name='abs')

    if mouseDelay:
        doDelay(mouseDelay)
    else:
        doDelay()
开发者ID:martiinsiimon,项目名称:dogtail,代码行数:32,代码来源:rawinput.py


示例5: relativeMotion

def relativeMotion(x, y, mouseDelay=None):
    logger.log("Mouse relative motion of (%s,%s)" % (x, y))
    registry.generateMouseEvent(x, y, 'rel')
    if mouseDelay:
        doDelay(mouseDelay)
    else:
        doDelay()
开发者ID:Lorquas,项目名称:dogtail,代码行数:7,代码来源:rawinput.py


示例6: test_image_video_mix

    def test_image_video_mix(self):
        files = ["1sec_simpsons_trailer.mp4", "flat_colour2_640x480.png",
                 "flat_colour4_1600x1200.jpg", "flat_colour1_640x480.png",
                 "flat_colour3_320x180.png", "flat_colour5_1600x1200.jpg"]
        samples = self.import_media_multiple(files)
        seektime = self.search_by_text("0:00:00.000", self.pitivi, roleName="text")
        timeline = self.get_timeline()
        tpos = timeline.position

        #One video, one image
        for sample in samples[1:]:
            self.insert_clip(sample)
            self.insert_clip(samples[0])

        end = self.search_clip_end(30, seektime, timeline)
        cend = end / 11.139
        dogtail.rawinput.absoluteMotion(tpos[0] + cend - 2, tpos[1] + 30)
        registry.generateKeyboardEvent(dogtail.rawinput.keyNameToKeyCode("Shift_L"), None, KEY_PRESS)
        dogtail.rawinput.press(tpos[0] + cend - 2, tpos[1] + 30)
        sleep(0.5)
        dogtail.rawinput.absoluteMotion(tpos[0] + cend - 40, tpos[1] + 30)
        sleep(0.5)
        dogtail.rawinput.release(tpos[0] + cend - 40, tpos[1] + 30)
        registry.generateKeyboardEvent(dogtail.rawinput.keyNameToKeyCode("Shift_L"), None, KEY_RELEASE)
        self.nextb.click()
        self.assertNotEqual(seektime.text, "0:00:11.139")
开发者ID:cymacs,项目名称:pitivi,代码行数:26,代码来源:test_timeline.py


示例7: mouse_event

    def mouse_event(x, y, button, eventType):
        """
        > Description
            Generates a mouse press or release event on a specific pixel on the screen

        > Parameters
            x (int): the x coordinate where the event will be generated
            y (int): the y coordinate where the event will be generated
            button (str): A string indicating which mouse button to press/release. One of 'left', 'right' or 'middle'
            eventType (str): A string indicating the event type. One of 'press' or 'release'

        > Returns
            None

        > Example
            # this example could demonstrate a drag and drop of a file

            # press the left mouse button at 100, 100
            Macro.mouse_event(100, 100, 'left', 'press')
            # move the cursor to 400, 400
            Macro.move_cursor_to(400, 400)
            # then, release the mouse
            Macro.mouse_event(400, 400, 'left', 'press')
        """
        buttonToNo = {'left':1, 'right':2, 'middle':3 }
        controller.generateMouseEvent(x, y, 'b' + str(buttonToNo[button]) + ('p' if eventType == 'press' else 'r'))
开发者ID:hakermania,项目名称:MacroPolo,代码行数:26,代码来源:macropolo.py


示例8: test_image_video_mix

    def test_image_video_mix(self):
        files = [
            "tears of steel.webm",
            "flat_colour2_640x480.png",
            "flat_colour4_1600x1200.jpg",
            "flat_colour1_640x480.png",
            "flat_colour3_320x180.png",
            "flat_colour5_1600x1200.jpg",
        ]
        samples = self.import_media_multiple(files)
        timecode_widget = self.viewer.child(name="timecode_entry").child(roleName="text")
        tpos = self.timeline.position

        # One video, one image
        for sample in samples[1:]:
            self.insert_clip(sample)
            self.insert_clip(samples[0])

        sleep(0.3)
        end = self.search_clip_end(30, timecode_widget, self.timeline)
        cend = end / 11.139
        dogtail.rawinput.absoluteMotion(tpos[0] + cend - 2, tpos[1] + 30)
        registry.generateKeyboardEvent(dogtail.rawinput.keyNameToKeyCode("Shift_L"), None, KEY_PRESS)
        dogtail.rawinput.press(tpos[0] + cend - 2, tpos[1] + 30)
        sleep(0.5)
        dogtail.rawinput.absoluteMotion(tpos[0] + cend - 40, tpos[1] + 30)
        sleep(0.5)
        dogtail.rawinput.release(tpos[0] + cend - 40, tpos[1] + 30)
        registry.generateKeyboardEvent(dogtail.rawinput.keyNameToKeyCode("Shift_L"), None, KEY_RELEASE)
        self.goToEnd_button.click()
        self.assertNotEqual(timecode_widget.text, "0:00:11.139")
开发者ID:luisbg,项目名称:PiTiVi,代码行数:31,代码来源:test_timeline.py


示例9: import_media_multiple

    def import_media_multiple(self, files):
        dogtail.rawinput.pressKey("Esc")  # Ensure the welcome dialog is closed
        self.import_button.click()

        import_dialog = self.pitivi.child(name="Select One or More Files",
                                          roleName="file chooser", recursive=False)

        path_toggle = import_dialog.child(
            name="Type a file name", roleName="toggle button")
        if not path_toggle.checked:
            path_toggle.click()

        dir_path = os.path.realpath(__file__).split(
            "dogtail_scripts/")[0] + "samples/"
        import_dialog.child(roleName='text').text = dir_path
        time.sleep(0.2)
        dogtail.rawinput.pressKey("Enter")

        # We are now in the samples directory, select various items.
        # We use Ctrl click to select multiple items. However, since the first
        # row of the filechooser is always selected by default, we must not use
        # ctrl when selecting the first item of our list, in order to deselect.
        ctrl_code = dogtail.rawinput.keyNameToKeyCode("Control_L")
        file_list = import_dialog.child(name="Files", roleName="table")
        first = True
        for f in files:
            time.sleep(0.5)
            file_list.child(name=f).click()
            if first:
                registry.generateKeyboardEvent(ctrl_code, None, KEY_PRESS)
                first = False
        registry.generateKeyboardEvent(ctrl_code, None, KEY_RELEASE)
        import_dialog.button('Add').click()

        current_search_text = self.medialibrary.child(
            name="media_search_entry", roleName="text").text.lower()
        if current_search_text != "":
            # Failure to find some icons might be because of search filtering.
            # The following avoids searching for files that can't be found.
            for f in files:
                if current_search_text not in f.lower():
                    files.remove(f)
        # Check if non-filtered items are now visible in the media library.
        samples = []
        for i in range(5):
            # The time it takes for icons to appear is unpredictable,
            # therefore we try up to 5 times to look for them
            icons = self.medialibrary.findChildren(
                GenericPredicate(roleName="icon"))
            for icon in icons:
                for f in files:
                    if icon.text == f:
                        samples.append(icon)
                        files.remove(f)
            if len(files) == 0:
                break
            time.sleep(0.5)
        return samples
开发者ID:Jactry,项目名称:pitivi,代码行数:58,代码来源:common.py


示例10: doubleClick

def doubleClick(x, y, button=1, check=True):
    """
    Synthesize a mouse button double-click at (x,y)
    """
    if check:
        checkCoordinates(x, y)
    logger.log("Mouse button %s doubleclick at (%s,%s)" % (button, x, y))
    registry.generateMouseEvent(x, y, 'b%sd' % button)
    doDelay()
开发者ID:Lorquas,项目名称:dogtail,代码行数:9,代码来源:rawinput.py


示例11: press

def press(x, y, button=1, check=True):
    """
    Synthesize a mouse button press at (x,y)
    """
    if check:
        checkCoordinates(x, y)
    logger.log("Mouse button %s press at (%s,%s)" % (button, x, y))
    registry.generateMouseEvent(x, y, name='b%sp' % button)
    doDelay()
开发者ID:martiinsiimon,项目名称:dogtail,代码行数:9,代码来源:rawinput.py


示例12: release

def release(x, y, button=1, check=True):
    """
    Synthesize a mouse button release at (x,y)
    """
    if check:
        checkCoordinates(x, y)
    logger.log("Mouse button %s release at (%s,%s)" % (button, x, y))
    registry.generateMouseEvent(x, y, 'b%sr' % button)
    doDelay()
开发者ID:Lorquas,项目名称:dogtail,代码行数:9,代码来源:rawinput.py


示例13: click

def click(x, y, button=1, check=True):
    """
    Synthesize a mouse button click at (x,y)
    """
    if check:
        checkCoordinates(x, y)
    logger.log("Mouse button %s click at (%s,%s)" % (button, x, y))
    registry.generateMouseEvent(x, y, 'b%sc' % button)
    doDelay(config.actionDelay)
开发者ID:Lorquas,项目名称:dogtail,代码行数:9,代码来源:rawinput.py


示例14: pressKey

def pressKey(keyName):
    """
    Presses (and releases) the key specified by keyName.
    keyName is the English name of the key as seen on the keyboard. Ex: 'enter'
    Names are looked up in Gdk.KEY_ If they are not found there, they are
    looked up by uniCharToKeySym().
    """
    keySym = keyNameToKeySym(keyName)
    registry.generateKeyboardEvent(keySym, None, KEY_SYM)
    doTypingDelay()
开发者ID:Lorquas,项目名称:dogtail,代码行数:10,代码来源:rawinput.py


示例15: relativeMotion

def relativeMotion(x, y, mouseDelay=None):
    """
    Synthetize a relative motion from actual position.
    Note: Does not check if the end coordinates are positive.
    """
    logger.log("Mouse relative motion of (%s,%s)" % (x, y))
    registry.generateMouseEvent(x, y, name='rel')
    if mouseDelay:
        doDelay(mouseDelay)
    else:
        doDelay()
开发者ID:martiinsiimon,项目名称:dogtail,代码行数:11,代码来源:rawinput.py


示例16: absoluteMotion

def absoluteMotion(x, y, mouseDelay=None, check=True):
    """
    Synthesize mouse absolute motion to (x,y)
    """
    if check:
        checkCoordinates(x, y)
    logger.log("Mouse absolute motion to (%s,%s)" % (x, y))
    registry.generateMouseEvent(x, y, 'abs')
    if mouseDelay:
        doDelay(mouseDelay)
    else:
        doDelay()
开发者ID:Lorquas,项目名称:dogtail,代码行数:12,代码来源:rawinput.py


示例17: ripple_roll

 def ripple_roll(self, from_percent, to_percent):
     dogtail.rawinput.click(self.getTimelineX(from_percent), self.getTimelineY(0))
     sleep(0.1)
     registry.generateKeyboardEvent(dogtail.rawinput.keyNameToKeyCode("Shift_L"), None, KEY_PRESS)
     try:
         dogtail.rawinput.press(self.getTimelineX(from_percent), self.getTimelineY(0))
         dogtail.rawinput.absoluteMotion(self.getTimelineX(to_percent), self.getTimelineY(0))
         sleep(0.1)
         dogtail.rawinput.release(self.getTimelineX(to_percent), self.getTimelineY(0))
     finally:
         registry.generateKeyboardEvent(dogtail.rawinput.keyNameToKeyCode("Shift_L"), None, KEY_RELEASE)
     sleep(0.1)
开发者ID:brion,项目名称:pitivi,代码行数:12,代码来源:test_timeline.py


示例18: key_down

 def key_down(self, key):
     """
     This is a more specific function than keyboard(). It can send specific
     key-pressed events, in case you want to do keyboard combinations, like Alt+F4
     The argument can only be a string. If you want to send (e.g.) Alt+F4 then you
     should call it as:
     key_down("Alt")
     key_down("F4")
     time.sleep(0.2)
     key_up("Alt")
     key_up("F4")
     """
     if key in key_list:
         controller.generateKeyboardEvent(key_codes[key_list.index(key)], None, KEY_PRESS)
开发者ID:om-nomnom,项目名称:MacroPolo,代码行数:14,代码来源:macropolo.py


示例19: move_cursor_to

    def move_cursor_to(x, y):
        """
        > Description
            Moves the cursor to the x, y coordinates

        > Parameters
            x (int): the x coordinate to move the cursor to
            y (int): the y coordinate to move the cursor to

        > Returns
            None

        > Example
            # move the cursor to 100, 100
            Macro.move_cursor_to(100, 100)
        """
        controller.generateMouseEvent(x, y, MOUSE_ABS)
开发者ID:hakermania,项目名称:MacroPolo,代码行数:17,代码来源:macropolo.py


示例20: right_click_to

    def right_click_to(x, y):
        """
        > Description
            Right clicks the mouse at x, y

        > Parameters
            x (int): the x coordinate to right click to
            y (int): the y coordinate to right click to

        > Returns
            None

        > Example
            # right click to 100, 100
            Macro.right_click_to(100, 100)
        """
        if(x >= 0 and y >= 0):
            controller.generateMouseEvent(x, y, 'b3c')
开发者ID:hakermania,项目名称:MacroPolo,代码行数:18,代码来源:macropolo.py



注:本文中的pyatspi.Registry类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pyaudio.get_sample_size函数代码示例发布时间:2022-05-25
下一篇:
Python pyatspi.findDescendant函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap