예제 #1
0
def switchPlugin(pluginGroup, image):
    """Switches the plugin from its default to the specified one and returns plugin location on screen.

    pluginGroup -- The group to which the plugin belongs to ('editing', 'editorial', 'pdf' or 'export')
    image -- PNG image corresponding to the plugin
    """
    pluginGroupImage = pluginGroup + '_default.png'
    # If the plugin isn't default any more, reload Flix to have all plugins reset to default.
    if not exists(pluginGroupImage, 3):
        if reloadFlix(pluginGroupImage) == 0:
            log('Could not find %s for the %s plugin group.' % (pluginGroupImage, pluginGroup), 'error')
            return 0

    # hover(pluginGroupImage)
    # pluginLocation = sikuli.Env.getMouseLocation()
    # mouseDown(sikuli.Button.LEFT)
    # hover(image)
    # mouseUp(sikuli.Button.LEFT)

    hover(pluginGroupImage); wait(1) # wait for the tooltip to appear and go away
    pluginLocation = sikuli.Env.getMouseLocation()
    mouseDown(sikuli.Button.LEFT)
    # hover('projectBrowserBtn.PNG') # makes sure the tooltip isn't in the way
    click(image)

    return pluginLocation
예제 #2
0
def drawCircle():
    """Helper function to draw a circle with Sikuli"""
    # move mouse to center of the screen
    center = sikuli.Screen(0).getCenter()
    sikuli.mouseMove(center)

    radius = 100
    mLoc = sikuli.Env.getMouseLocation()
    for i in range(37):
        degInRad = i*math.pi/18
        pointX = int(math.cos(degInRad)*radius)
        pointY = int(math.sin(degInRad)*radius)
        sikuli.mouseMove(mLoc.offset(pointX ,pointY))
        if i == 0:
            mouseDown(sikuli.Button.LEFT)
    mouseUp()