예제 #1
0
def openMayaFile(testInfo, mayaFile):

    path = '%sassets/fromMaya/%s' % (testInfo.testPath, mayaFile)

    if os.path.exists(path):
        pyUtils.revealFile(path); wait(2)
        sikuli.App.focus('fromMaya'); wait(.5)
        type(sikuli.Key.ENTER); wait(1)

        if not exists('mayaIcon.png', 30):
            log('openMayaFile: Could not find Maya open.', 'error')
            return

        closeExplorerWindow('fromMaya'); wait(1)

        sikuli.App.focus('Maya')

        wait(10) # make sure Maya's ready to do stuff

        # Make sure the Flix shelf is in focus
        if not exists('mayaFlixServer.png', 2):
            if click('mayaFlixShelf.png') == 0:
                log('openMayaFile: Could not find the Flix shelf in Maya; exiting.', 'error')
                return

    else:
        log('openMayaFile: %s does not exist, skipping.' % path, 'error')
예제 #2
0
    def addDialogue(self, dialogue="Adding dialogue to panel [panelIndex].", firstPanel=1, lastPanel=3):
        """Adds dialogue to all of the panels currently in the sequence

        :param dialogue: String to add to every panel as the dialogue
        :param firstPanel: Panel index of first panel to add dialogue to
        :param lastPanel: Panel index of last panel to add dialogue to
        :return: None
        """
        log('##### addDialogue')

        panels = []
        for i in range(firstPanel, lastPanel+1):
            panels.append(i)
        log("addDialogue: Panel indices to add dialogue to: %s" % panels, "debug")
        url = "127.0.0.1:35980/html/index.html#show=%s;seq=%s;branch=%s;edit=%s;panel=%s" % \
              (self.testInfo.show,
               self.testInfo.sequence,
               self.testInfo.currentBranch,
               self.testInfo.getEditVersion(),
               panels[0])

        sikuliUtils.newChromeTab(url, closeCurrent=True); wait(5)

        click("dialogueField.png"); wait(1)
        for panel in panels:
            # Paste the dialogue (paste better than type as it keeps special characters)
            dial = dialogue.replace("[panelIndex]", str(panel))
            sikuli.paste(unicode(dial, "utf8")); wait(1)
            sikuli.type(sikuli.Key.ENTER, sikuli.KeyModifier.SHIFT); wait(1)

        self.editToolsCheck.addDialogueCheck(panels, dialogue)
예제 #3
0
def newChromeTab(url, closeCurrent=False):
    """Opens a new Chrome tab and goes to the given URL"""
    if closeCurrent:
        closeChromeTab()
    sikuli.App.focus('Google Chrome'); wait(1)
    ctrlType('t'); wait(1)
    type(url); wait(1)
    type(sikuli.Key.ENTER)
예제 #4
0
def closeCurrentApp():

    # type('q', sikuli.KeyModifier.CTRL); wait(3)
    ctrlType('q'); wait(3)
    type(sikuli.Key.TAB); wait(.5)
    type(sikuli.Key.ENTER); wait(2)

    sikuli.App.focus('Google Chrome'); wait(1)
예제 #5
0
def ctrlType(key, modifiers=None):

    if str(sikuli.Env.getOS()) == "MAC":
        keyModifier = sikuli.KeyModifier.CMD
    else:
        keyModifier = sikuli.KeyModifier.CTRL
    if modifiers is None:
        type(key, keyModifier)
    else:
        type(key, keyModifier | modifiers)
예제 #6
0
def quitFlix(platform):
    if click('flixOptionsBtn.png'):
        wait(.5)
        type(sikuli.Key.UP); wait(.5)
        type(sikuli.Key.ENTER); wait(2)
        log('quitFlix: Flix has been killed.', 'debug')
    else:
        log('quitFlix: Flix could not be killed from Options menu; force killing it...')
        if platform == "mac":
            cmd = "ps -A | grep Applications/Flix | awk '{print $1}' | xargs kill -9"
            os.system(cmd)
예제 #7
0
    def logIn(self, timeout):
        log('##### logIn')

        click('logInScreen.png'); wait(.5)

        type(sikuli.Key.TAB); wait(.5)
        type(self.testInfo.user); wait(1)
        type(sikuli.Key.TAB); wait(.5)
        type('latte'); wait(1)
        type(sikuli.Key.ENTER)

        self.launchCheck.launchFlixCheck(timeout)
예제 #8
0
    def importPanels2(self, ext, nPanels=10):
        """Imports nPanels panels without checking image in Flix

        :param ext: extension of the files to import
        :param nPanels: Number of panels to import, 10 by default
        :return: None
        """
        log('##### importPanels2')

        if self.testInfo.OS == "mac":
            log("importPanels only supported on Windows right now. Using importDrawings instead...", "error")
            self.importDrawings(ext, nPanels)
            return

        availablePanels = self.__getAvailablePanels(ext)

        panelList = []
        while len(panelList) < nPanels:
            rest = nPanels - len(panelList)
            if rest > len(availablePanels):
                for panel in availablePanels:
                    panelList.append(panel)
            else:
                for panel in availablePanels[0:rest]:
                    panelList.append(panel)

        # Got to do it in chunks of 10 panels
        for i in range(0, len(panelList), 10):
            chunk = panelList[i:i+10]
            click('importDrawingsButton.png')

            if not exists('importFileBrowserFilename.png', 20):
                log('importPanels2: Could not find importFileBrowserFilename after 20 seconds.', 'error')
                return
            click('importFileBrowserFilename.png'); wait(1)

            if i == 0:
                type(self.importPath.replace('/', '\\')); wait(1)
                type(sikuli.Key.ENTER); wait(1)

            for panel in chunk:
                type("\"" + panel + "\" ")

            type(sikuli.Key.ENTER)
            # wait(len(chunk))

            # Wait until the 'processing' image for the first panel
            timeout = int((len(chunk) * 1.5))
            if ext == 'mov':
                timeout = 0
                for movie in chunk:
                    timeout += pyUtils.readMovSettings(self.testInfo, movie)['timeout']
            log('importPanels2: timeout set to %ssec.' % timeout, 'debug')
            wait(timeout)

        self.importDrawingCheck.importPanels2Check(ext, nPanels, panelList)
예제 #9
0
    def exportPanels(self, settings, deletePoses=False):
        log('##### exportPanels')

        if not self.testInfo.getShotEdit():
            log("Cannot use an export plugin when no edit is saved for this sequence; exiting...", "error")
            return

        if self.testInfo.OS == "mac":
            log("exportPanels is only supported on Windows at the moment. Exiting...", "error")
            return

        if deletePoses:
            pyUtils.deleteLocalPoses(self.testInfo)

        if settings['format'] == 'jpeg':
            plugin = 'exportJpegs.png'
            outputPath = self.jpgOutputDir
        elif settings['format'] == 'psd':
            plugin = 'exportPsds.png'
            outputPath = self.psdOutputDir
        else:
            self.testInfo.failed('%s is not a valid format. Must be \'psd\' or \'jpeg\'.' % settings['format'])
            return

        if os.path.isdir(outputPath):
            shutil.rmtree(outputPath)
    
        os.makedirs(outputPath)
    
        if self.testInfo.flixVersion < '5.2':
            pluginLocation = sikuliUtils.switchPlugin('export', plugin)
    
        click(settings['panels'][0])
        if len(settings['panels']) != 1:
            for panel in settings['panels'][1:]:
                sikuliUtils.ctrlClick(panel)
    
        if self.testInfo.flixVersion < '5.2':
            click(pluginLocation)
        else:
            sikuliUtils.switchPlugin('export', plugin)
    
        if not exists('exportFileBrowser.png', 10):
            self.testInfo.failed('Could not find the File Browser.')
        click('exportFileBrowserFolder.png')
    
        type(outputPath.replace('/', '\\')); wait(1)
        type(sikuli.Key.ENTER); wait(1)
        type(sikuli.Key.BACKSPACE)
        type(sikuli.Key.ENTER)
    
        self.exportCheck.exportPanelsCheck(settings)
    
        sikuliUtils.closeExplorerWindow('%ss' % settings['format'])
예제 #10
0
    def importAudio(self, filename="newWorld.mp3", timeout=100):
        log('##### importAudio')

        self.testInfo.allAudio = pyUtils.countFiles(self.mp3Dir, '*.mp3')

        path = "%s/%s" % (self.audioAssetsDir, filename)

        if not os.path.exists(path):
            log('importAudio: the audio file specified does not exist, exiting.\naudio file: %s' % path, 'error')
            return

        click('importDrawingsButton.png')

        if not exists('importFileBrowserFilename.png', 10):
            log('importAudio: Could not find importFileBrowserFilename after 10 seconds.', 'error')
        click('importFileBrowserFilename.png')

        type(path.replace('/', '\\')); wait(1)
        type(sikuli.Key.ENTER); wait(1)

        self.importDrawingCheck.importAudioCheck(timeout)
예제 #11
0
    def __publishFromFlix(self, methodName, comment, checkMethod, windowName="fcp", importAAFs=False, createSgSeq=False):
        """Method that will select the specified editorial plugin, publish with a comment and call the relevant check
        method

        :param methodName: Name of the method calling me
        :param comment: Comment to add to the publish
        :param checkMethod: Method to call to check the publish results
        :param windowName: Name of the Explorer window Flix reveals after publishing
        :param importAAFs: Set to True to import AAFs after Avid publish (not relevant for other editorial publishes)
        :param createSgSeq: Set to True to create the Flix sequence in Shotgun (only relevant for Shotgun publish)
        :return: None
        """
        log("##### toEditorial: %s" % methodName)

        if methodName == "toShotgun" and createSgSeq:
            sikuliUtils.createShotgunSequence(self.testInfo)

        if self.testInfo.flixVersion < '5.2':
            click(sikuliUtils.switchPlugin('editorial', '%s.png' % methodName)); wait(1)
        else:
            sikuliUtils.switchPlugin('editorial', '%s.png' % methodName); wait(1)

        click('publishComment.png'); wait(1)

        type(comment); wait(1)
        type(sikuli.Key.TAB); wait(.5)
        type(sikuli.Key.ENTER)

        # Assuming .5 sec/frame is enough to publish an edit to editorial
        # timeout = self.testInfo.getDurationFromShotEdit()/2
        # Assuming 2 sec/panel for stills and 1.5 sec/frame for animated panels is enough to publish an edit
        stillPanels = len(self.testInfo.editPanels["p"]) + len(self.testInfo.editPanels["s"])
        animPanels = self.testInfo.editPanels["a"]
        animFrames = 0
        for panel in animPanels:
            animFrames += self.testInfo.getPanelDurationFromShotEdit(panel)
        if methodName == "toAvid":
            stillTimeout = 2
            animFrameTimeout = 1.5
        else:
            stillTimeout = 0.5
            animFrameTimeout = 0.5
        timeout = int((stillTimeout*stillPanels) + (animFrameTimeout*animFrames))
        if timeout < 20:
            timeout = 20

        checkMethod(timeout)

        if methodName in ["toSbp", "toPremiere"]:
            sikuliUtils.closeExplorerWindow("%s" % windowName)
        elif importAAFs:
            self.launch.openEditorialGUI(10)
            self.editorialProjectBrowser.selectEditorialProject()
            self.__importToAvid()
예제 #12
0
    def importPanels(self, filebase, ext, nPanels):
        """Imports all the panels contained in the provided path

        info - dictionary containing info on the show/sequence
        filebase -- Basename for the files to import (e.g. testJpeg)
        ext -- Extension of the files to import (e.g. jpeg)
        nPanels -- Number of panels to import
        """
        log('##### importPanels')

        if self.testInfo.OS == "mac":
            log("importPanels only supported on Windows right now. Using importDrawings instead...", "error")
            self.importDrawings(ext, nPanels)
            return

        availablePanels = self.__getAvailablePanels(ext)

        panelList = []
        for n in range(1, nPanels+1):
            panelList.append('%s%s.%s' % (filebase, str(n), ext))

        log('panelList: %s' % panelList, 'debug')

        click('importDrawingsButton.png')

        if not exists('importFileBrowserFilename.png', 10):
            log('Could not find importFileBrowserFilename after 10 seconds.', 'error')
        click('importFileBrowserFilename.png')

        type(self.importPath.replace('/', '\\')); wait(1)
        type(sikuli.Key.ENTER); wait(1)

        for panel in panelList:
            type("\"" + panel + "\" ")

        type(sikuli.Key.ENTER)

        self.importDrawingCheck.importPanelsCheck(ext, nPanels, panelList)
예제 #13
0
def createShotgunSequence(testInfo):
    """Method to create a sequence in Shotgun from scratch, via their website"""
    if testInfo.show == 'qa_test':
        url = 'https://abo.shotgunstudio.com/page/1801'
        seqImage = 'sgFlx.png'
    elif testInfo.show == 'cl2':
        url = 'https://abo.shotgunstudio.com/page/1985'
        seqImage = 'sgEp001_flx.png'
    else:
        log('createShotgunSequence: Show %s not setup in Shotgun, plugin will probably fail.' % testInfo.show, 'error')
        return

    newChromeTab(url)

    # Log in if needed (assumes Chrome remembered credentials)
    if exists('sgLogin.png', 3):
        type(sikuli.Key.TAB); wait(.5)
        type(sikuli.Key.TAB); wait(.5)
        type(sikuli.Key.ENTER); wait(.5)

    if exists(seqImage):
        sikuli.rightClick(seqImage); wait(.5)
        click('sgDeleteSeq.png'); wait(1)
        type(sikuli.Key.ENTER); wait(1)
    else:
        log('createShotgunSequence: Could not find sequence %s in shotgun.' % testInfo.sequence)

    # Create the sequence from scratch
    click('sgCreateSeq.png'); wait(1)
    type(testInfo.sequence); wait(.5)
    type(sikuli.Key.TAB); wait(.5)
    type(sikuli.Key.TAB); wait(.5)
    type('basic_sequence'); wait(.5)
    type(sikuli.Key.ENTER); wait(.5)
    type(sikuli.Key.TAB); wait(.5)
    type(sikuli.Key.ENTER); wait(.5)

    if exists(seqImage):
        log('createShotgunSequence: Sequence %s successfully created in Shotgun.' % testInfo.sequence)
    else:
        log('createShotgunSequence: Sequence %s probably not created in Shotgun.' % testInfo.sequence)

    closeChromeTab()
예제 #14
0
def psEdit():
    """Helper function to prepare and exit Photoshop before and after drawing on the opened panel"""
    # use 'tab' to hide side panels to have the panel centered
    type(sikuli.Key.TAB); wait(1)

    # make photoshop full screen
    type('f'); wait(.5)
    type('f'); wait(1)

    # make sure the panel's size is 100%
    ctrlType('1'); wait(1)

    # create a new layer
    # type('n', sikuli.KeyModifier.CTRL | sikuli.KeyModifier.SHIFT); wait(1)
    ctrlType('n', sikuli.KeyModifier.SHIFT); wait(1)
    type(sikuli.Key.ENTER)

    drawCircle()

    # exit photoshop full screen
    type('f')

    # restore the side panels
    type(sikuli.Key.TAB)

    wait(1)
    # type('s', sikuli.KeyModifier.CTRL); wait(5)
    ctrlType('s'); wait(5)
    ctrlType('w'); wait(1)
예제 #15
0
 def publishToFlix2(self, comment="Publish to Flix", assetName="refsFromPremiere", toShotgun=False, branch="main", asStills=True):
     log('##### publishToFlix')
     branch = "main"
     log("publishToFlix: branch set to 'main' by default as other branches aren't supported yet")
     self.testInfo.allAudio = pyUtils.countFiles(self.mp3Dir, "*.mp3")
 
     self.launch.openEditorialGUI(20, True)
     self.editorialProjectBrowser.selectEditorialProject()
 
     click(sikuli.Pattern('toAvidToFlix.png').targetOffset(20, 0)); wait(1)
     type(sikuli.Key.TAB); wait(1)
     type(sikuli.Key.TAB); wait(1)
     type(sikuli.Key.TAB); wait(1)
 
     movPath = "%s/%s.mov" % (self.assetsDir, assetName)
     type(movPath)
 
     type(sikuli.Key.TAB); wait(1)
     edlPathBase = "%s/%s" % (self.assetsDir, assetName)
     edlPathAvid = "%s.txt" % edlPathBase
     edlPathFcp = "%s.xml" % edlPathBase
     if os.path.exists(edlPathAvid):
         edlPath = edlPathAvid
     elif os.path.exists(edlPathFcp):
         edlPath = edlPathFcp
     else:
         log("publishToFlix: Could not find EDL file for %s editorial asset." % assetName, "error")
         # Close the Editorial GUI
         sikuliUtils.closeChromeTab()
         # Come back to Flix
         self.launch.openFlixGUI(10)
         self.projectBrowser.loadShow()
         self.projectBrowser.loadSequence()
         click("loadLatestVersion.png")
         return
 
     # settings['edl'] = edlPath
     type(edlPath)
 
     type(sikuli.Key.TAB); wait(1)
     if toShotgun:
         type(sikuli.Key.SPACE); wait(1)
 
     type(sikuli.Key.TAB); wait(1)
     if branch != "main":
         type(sikuli.Key.ENTER); wait(1)
 
     type(sikuli.Key.TAB); wait(1)
     if not asStills:
         type(sikuli.Key.SPACE); wait(1)
 
     type(sikuli.Key.TAB); wait(1)
     type(comment); wait(1)
 
     type(sikuli.Key.TAB); wait(1)
     type(sikuli.Key.ENTER)
 
     loadLatestVersion = self.fromEditorialCheck.publishToFlixCheck2(comment, assetName, toShotgun, branch, asStills)
 
     # Close the Editorial GUI
     sikuliUtils.closeChromeTab()
     # Come back to Flix
     self.launch.openFlixGUI(10)
     self.projectBrowser.loadShow()
     self.projectBrowser.loadSequence()
     if branch != "main" and loadLatestVersion:
         self.projectBrowser.switchToBranch(branch)
     elif loadLatestVersion:
         click('loadLatestVersion.png')
     else:
         self.projectBrowser.createCleanVersion()
예제 #16
0
파일: work.py 프로젝트: renewday/sds
def login_web():

    try:
        browser = webdriver.Ie()
        targetFile = pathprefix + 'untitled.png'
        if os.path.exists(targetFile):
            os.remove(targetFile)
        browser.get('https://jy.yongjinbao.com.cn/winner_gj/gjzq/')

        time.sleep(10)
        handle = browser.current_window_handle
        un = browser.find_element_by_id('account_content')
        un.clear()
        un.send_keys(s_account)

        p = Pattern(pathprefix + '3.png')
        click(p)
        click(p)
        click(p)
        type(s_password)
        #if exists("C:\Users\ly\Pictures\\passworderror4.png") or exists("C:\Users\ly\Pictures\\passworderror5.png") :
        #    browser.close()
        #    return False
        vc = browser.find_element_by_id('validateCode')

        lb = browser.find_element_by_id('sendid')

        vi = browser.find_element_by_id("imgExtraCode")

        ActionChains(browser).context_click(vi).perform()
        time.sleep(1)
        p = Pattern(pathprefix + '1.png')
        click(p)
        time.sleep(5)
        p = Pattern(pathprefix + '2.png')
        find(p)
        click(p)
        time.sleep(5)
        image = Image.open(targetFile)

        vcode = pytesseract.image_to_string(image)

        time.sleep(5)
        browser.switch_to.window(handle)
        time.sleep(5)

        vc.send_keys('{}'.format(vcode))

        lb.click()
        time.sleep(2)
        if exists(pathprefix + 'vcerror.png'):
            p = Pattern(pathprefix + 'confirm.png')
            click(p)
            browser.close()
            return False
        else:
            return True
    except:
        print sys.exc_info()[0], sys.exc_info()[1]
        if exists(pathprefix + 'vcerror.png'):
            p = Pattern(pathprefix + 'confirm.png')
            click(p)
        browser.close()
        return False