예제 #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 detectFlixGuiState():

    if exists('newShowButton.png'):
        return 'show'
    elif exists('newSequenceButton.png'):
        return 'sequence'
    elif exists('newEpisodeButton.png'):
        return 'episode'
    elif exists('startCleanVersion.png'):
        return 'version'
    elif exists('projectBrowserBtn.png'):
        return 'edit'
    else:
        return 'unknown'
예제 #3
0
def oneOrTheOther(one, other, timeout):
    """helper function to check if one image or the other exists before a timeout

    one -- First image (.png) to look for
    other -- Second image (.png) to look for
    timeout -- Time in seconds before failing
    """
    timeout += time.time()
    while True:
        if exists(one):
            return 0
        if exists(other):
            return 1
        elif time.time() > timeout:
            return 2
예제 #4
0
def openInPhotoshopCheck(testInfo, panel):
    """Checker function to verify if the panel in Flix was edited properly

    panel -- Image (.png) of the original panel that was edited
    """
    log('## openInPhotoshopCheck:')

    panelName = panel.split('.')[0]
    if not exists(panelName + '_edited.png', 5):
        testInfo.failed('openInPhotoshopCheck: Could not find %s edited in Flix.' % panelName)
    else:
        log('- %s was edited.' % panelName)

    sikuliUtils.saveVersion(testInfo, 'Edited 1 panel in Photoshop.')

    """
    # Check there's one more panel in the beats directory
    allPanels = pythonHelper.findBeat(testInfo, 'p')
    if (allPanels - len(testInfo.allPanels['p'])) != 1:
        testInfo.failed('openInPhotoshopCheck: Could not find 1 new panel in the beats directory.')
    else:
        log('- Found all 1 new panel in the beats directory.')
    #testInfo.allPanels['p'] = allPanels
    """

    # Check it didn't create more panels in the current shotEdit
    newPanels = checkUtils.newPanelsInShotEdit(testInfo,
                                               {'p': 0},
                                               methodName='openInPhotoshopCheck',
                                               beats=['p'])

    checkUtils.checkPanelDir(testInfo, newPanels, ['multitrack', 'jpg', 'xml'], 'openInPhotoshopCheck')

    log('All checks performed for openInPhotoshop.')
예제 #5
0
 def createSequenceCheck(self):
     """Checker function to verify a new sequence has been created"""
     log('## createSequenceCheck')
 
     if exists('flixPopupOK.png', 3):
         self.projectBrowser.testInfo.failed('createSequenceCheck: Got '
                                             'the \'Sequence already exists\' error message.')
         click('flixPopupOK.png')
         return 1
     # if not exists('%sSequence.png' % self.projectBrowser.testInfo.sequence, 5):
     #     self.projectBrowser.testInfo.failed('createSequenceCheck: Failed to find '
     #                                         'the \'%s/%s\' sequence in the Project Browser.' % (
     #         self.projectBrowser.testInfo.show, self.projectBrowser.testInfo.sequence))
     # else:
     #     log('- %s sequence found in the Project Browser.' % self.projectBrowser.testInfo.sequence)
 
     # path = self.projectBrowser.testInfo.getEditorialDir()
     if pyUtils.waitForFile(self.projectBrowser.editorialDir, 'fle', 10) == 0:
         self.projectBrowser.testInfo.failed('createSequenceCheck: Could not find the fle folder '
                                             'under the seq.%s.story/flix/editorial directory.'
                                             % self.projectBrowser.testInfo.sequence)
         return 1
     else:
         log('- FLE directory found for the new sequence.')
 
     log('All checks performed for createSequence.')
예제 #6
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
예제 #7
0
 def createNewPanelsCheck(self, n):
     """Checker function to verify the n new panels were created
 
     n -- Number of panels created
     """
     log('## createNewPanelsCheck')
 
     if not exists('%sblankPanels.png' % n):
         self.editTools.testInfo.failed('createNewPanelsCheck: Could not find the %s new created panels on screen.' % n)
     else:
         log('- Found all %s new panels on screen.' % n)
 
     sikuliUtils.saveVersion(self.editTools.testInfo, 'Created %s new blank panels.' % n)
 
     """
     # Check there's n more panels in the beats directory
     allPanels = pythonHelper.findBeat(self.editTools.testInfo, 'p')
     if (allPanels - len(self.editTools.testInfo.allPanels['p'])) != n:
         self.editTools.testInfo.failed('createNewPanelsCheck: Expected %s new panels in the beats directory, found %s instead.' % (n, allPanels - len(self.editTools.testInfo.allPanels['p'])))
     else:
         log('- Found all %s new panels in the beats directory.' % n)
     """
 
     # Check there's n more panels in the current shotEdit
     newPanels = checkUtils.newPanelsInShotEdit(self.editTools.testInfo,
                                                {'p': n},
                                                beats=['p'],
                                                methodName='createNewPanelsCheck')
 
     checkUtils.checkPanelDir(self.editTools.testInfo, newPanels, ['multitrack', 'jpg', 'xml'], 'createNewPanelsCheck')
 
     log('All checks performed for createNewPanels.')
예제 #8
0
    def __checkGuide(self, methodName):
        """Checks the PDF for the guide corresponding to the method name has been opened

        :param methodName: Name of the method calling me (e.g. "openUserGuideCheck")
        :return: None
        """
        log("## %s" % methodName)

        if methodName == "openGettingStartedGuideCheck":
            guideName = "Getting Started Guide"
            button = "gsgPdf.png"
        elif methodName == "openUserGuideCheck":
            guideName = "User Guide"
            button = "ugPdf.png"
        elif methodName == "openTechnicalGuideCheck":
            guideName = "Technical Guide"
            button = "tgPdf.png"
        else:
            log("checkGuide: Unknown method, exiting...", "error")
            return

        if not exists(button, 5):
            self.projectBrowser.testInfo.failed("%s: Could not find the %s." % (methodName, guideName))
        else:
            log("- Found the Getting Started Guide PDF in the Help menu.")
            sikuliUtils.closeChromeTab()

        click("projectBrowserHelpBtn.png")
        log("All checks performed for %s" % methodName.strip("Check"))
예제 #9
0
    def importAudioCheck(self, timeout):
        log('## importAudioCheck')
    
        if not exists('importAudioOK.png', timeout):
            self.importDrawing.testInfo.failed('importAudioCheck: No popup found after %s seconds.' % timeout)
        else:
            log('- Found popup after importing audio.')
            click('importAudioOK.png')
    
        sikuliUtils.saveVersion(self.importDrawing.testInfo, 'Imported audio.')
    
        # Check mp3 file is in the editorial directory
        checkUtils.newAudioFile(self.importDrawing.testInfo, methodName='importAudioCheck')

        # Check mp3 is in the shotEdit
        shotEdit = self.importDrawing.testInfo.getShotEdit()
        if shotEdit:
            mp3Found = pyUtils.findOccurences('.mp3', shotEdit)
            if mp3Found != 1:
                self.importDrawing.testInfo.failed('importAudioCheck: Expected 1 audio file in the shotEdit, '
                                                   'found %s instead.' % mp3Found)
            else:
                log('- Found imported audio file in the current shotEdit.')
                self.importDrawing.testInfo.editAudio = 1
        else:
            self.importDrawing.testInfo.failed('importAudioCheck: shotEdit not found, cannot check for audio.')
    
        log('All checks performed for importAudio.')
예제 #10
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)
예제 #11
0
def waitUntilGone(image, timeout):
    """Method to wait until an image goes away (convenient for processing thumbnails)"""
    endTime = time.time() + timeout
    while True:
        if not exists(image):
            return 1
        elif time.time() > endTime:
            return 0
        else:
            wait(3)
예제 #12
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()
예제 #13
0
def allExist(images):
    """Helper function to check if all the provided images in the list can be found

    images -- list of images (.png) to look for on the screen
    """
    for i in images:
        if not exists(i, 10):
            return i
        log('Found panel %s.' % i, 'debug')
    return 0
예제 #14
0
def clearPopup(timeout=3):
    """Clicks OK on the 'Plugin Successfully Executed' popup"""
    
    sikuli.App.focus('Google Chrome')
    if exists('flixPopupOK', timeout):
        # make sure Flix's got focus
        sikuli.App.focus('Google Chrome')
        click('flixPopupOK')
        return 1
    return 0
예제 #15
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'])
예제 #16
0
def waitForResync():

    timeout = 120
    startTime = time.time()

    while time.time() <= startTime + timeout:
        hover(sikuli.Pattern('flixSettings.png').targetOffset(25, 0))
        if exists('doneSyncing.png', 5):
            return 1

    log('waitForResync: There are still files syncing after %s seconds.' % timeout)
    return 0
예제 #17
0
 def loadSequenceCheck(self):
     """Checker function to verify Flix navigated to the version level"""
     log('## loadSequenceCheck')
 
     if not exists('startCleanVersion.png', 5):
         self.projectBrowser.testInfo.failed('loadSequenceCheck: Cannot find the '
                                             'Start Clean Version button, probably not at the sequence level.')
     else:
         log('- At the version level.')
         self.projectBrowser.currentLevel = "version"
 
     log('All checks performed for loadSequence.')
예제 #18
0
 def createEpisodeCheck(self):
     log('## createEpisodeCheck')
 
     if exists('flixPopupOK.png', 3):
         self.projectBrowser.testInfo.failed('createEpisodeCheck: Got the '
                                             '\'Episode already exists\' error message.', True)
         click('flixPopupOK.png')
     if not exists('%sEpisode.png' % self.projectBrowser.testInfo.episode, 5):
         self.projectBrowser.testInfo.failed('createEpisodeCheck: Failed to find the \'%s/%s\' '
                                             'episode in the Project Browser.' %
                                             (self.projectBrowser.testInfo.show,
                                              self.projectBrowser.testInfo.episode))
     else:
         log('- %s episode found in the Project Browser.' % self.projectBrowser.testInfo.episode)
 
     if not os.path.exists(self.projectBrowser.testInfo.getEpisodeDir()):
         self.projectBrowser.testInfo.failed('createEpisodeCheck: Could not find the episode directory on disk.')
     else:
         log('- Found the episode directory on disk.')
 
     log('All checks performed for createEpisode.')
예제 #19
0
파일: work.py 프로젝트: renewday/sds
def check_hold():

    p = Pattern("C:\Users\ly\Pictures\\holding.png")
    click(p)
    time.sleep(1)
    p = Pattern("C:\Users\ly\Pictures\\holding2.png")
    click(p)
    time.sleep(1)
    if exists("C:\Users\ly\Pictures\\holding3.png"):
        return 1
    else:
        return 0
예제 #20
0
    def __checkStartProcessing(self):
        """Waits 10sec for the 'Processing' panel to make sure the SBP import process has started

        :return: 1 if Processing panel is found, 0 otherwise
        """
        if sikuli.exists("processing.png", 10):
            log("- Flix has started processing panels.")
            return 1
        else:
            self.fromSbp.testInfo.failed("sbpToFlixCheck: Flix has not started processing panels after 10sec, "
                                         "probably failed to parse the XML. Exiting...")
            return 0
예제 #21
0
 def selectEditorialProjectCheck(self):
     """Checker function to verify the show/sequence was selected in the editorial GUI"""
     log('## selectEditorialProjectCheck')
 
     if not exists('examiningSequence.png', 5):
         self.projectBrowser.testInfo.failed(
                 'selectEditorialProjectCheck: Could not find the \'Examining '
                 'sequence\' bit in the editorial GUI log.')
     else:
         log('- Found log in editorial GUI.')
 
     log('All checks performed for selectEditorialProject.')
예제 #22
0
 def loadEpisodeCheck(self):
     """Checker function to verify Flix navigated to the sequence level"""
     log('## loadEpisodeCheck')
 
     if not exists('newSequenceButton.png', 5):
         self.projectBrowser.testInfo.failed('loadEpisode: Cannot find the '
                                             'New Sequences button, probably not at the sequence level.')
     else:
         log('- At the sequence level.')
         self.projectBrowser.currentLevel = "sequence"
 
     log('All checks performed for loadEpisode.')
예제 #23
0
    def loadShowCheck(self):
        """Checker function to verify whether it's possible to navigate to a show"""
        log('## loadShowCheck')
    
        # if (not self.projectBrowser.testInfo.episode and not exists('newSequenceButton.png', 5)) or \
        #         (self.projectBrowser.testInfo.episode and not exists('newEpisodeButton.png', 5)):
        #     self.projectBrowser.testInfo.failed('loadShowCheck: Could not get past the show level.', True)
        # elif exists('errorSwitchingToShow.png', 1):
        #     self.projectBrowser.testInfo.failed('loadShowCheck: Got \'Error switching to show\' error message.', True)
        # else:
        #     log('- Sequence/Episode level accessed.')

        if self.projectBrowser.testInfo.episode and exists('newEpisodeButton.png', 5):
            log("- Episode level accessed.")
            self.projectBrowser.currentLevel = "episode"
        elif not self.projectBrowser.testInfo.episode and exists("newSequenceButton.png", 5):
            log("- Sequence level accessed.")
            self.projectBrowser.currentLevel = "sequence"
        elif exists('errorSwitchingToShow.png', 1):
            self.projectBrowser.testInfo.failed('loadShowCheck: Got \'Error switching to show\' error message.', True)

        log('All checks performed for loadShow.')
예제 #24
0
 def saveToBranchCheck(self, branch):
     log('## saveToBranchCheck:')
 
     # Not sure what to check here...already done as part of saveVersionCheck
     if not exists('%s%sVersion.png' % (self.projectBrowser.testInfo.sequence, branch), 10):
         self.projectBrowser.testInfo.failed('saveToBranchCheck: Could not find the Project Browser '
                                             'icon indicating this is a version of the %s branch.' % branch)
         log('imageToCheck: %s%sVersion.png' % (self.projectBrowser.testInfo.sequence, branch))
     else:
         log('- Found %s version Project Browser icon.' % branch)
         self.projectBrowser.testInfo.currentBranch = branch
         self.projectBrowser.testInfo.incrementEditVersion()
 
     log('All checks performed for saveToBranch.')
예제 #25
0
    def openHelpMenuCheck(self):
        """Checks whether the Help menu has been open in the Project Browser

        :return: None
        """
        log('## openHelpMenuCheck')

        if not exists("contactSupportBtn.png", 5):
            self.projectBrowser.testInfo.failed("openHelpMenuCheck: Could not find the Contact Support button.")
        else:
            log("- Found the Contact Support button in the Help menu.")

        click("projectBrowserHelpBtn.png")
        log("All checks performed for openHelpMenu")
예제 #26
0
 def switchToBranchCheck(self, branch):
     log('## switchToBranchCheck')
 
     # Not sure what can be checked here...
     if not exists('%s%sVersion.png' % (self.projectBrowser.testInfo.sequence, branch), 60):
         self.projectBrowser.testInfo.failed('switchToBranchCheck: Could not find the Project Browser icon '
                                             'indicating this is a version of the %s '
                                             'branch (may need to increase the timeout).' % branch)
         log('imageToCheck: %s%sVersion.png' % (self.projectBrowser.testInfo.sequence, branch))
     else:
         log('- Found %s version Project Browser icon.' % branch)
     self.projectBrowser.testInfo.currentBranch = branch
 
     log('All checks performed for switchToBranch.')
예제 #27
0
파일: work.py 프로젝트: renewday/sds
def buy(code, index, hold):
    print "index"
    print index
    print hold
    try:
        #p = Pattern(pathprefix+'buyselection.png')
        p = Pattern(pathprefix + 'jiaoyiweituo.png')
        doubleClick(p)
        time.sleep(1)
        p = Pattern(pathprefix + 'mairu.png')
        doubleClick(p)
        p = Pattern(pathprefix + 'daima.png')
        click(p)
        click(p)
        click(p)
        paste(code)

        p = Pattern(pathprefix + 'putongweituo.png')
        click(p)
        p = Pattern(pathprefix + 'shijiacangwei.png')
        click(p)
        time.sleep(3)
        if hold == 0:
            if index == 0:
                p = Pattern(pathprefix + '13.png')
                click(p)
            elif index == 1:
                p = Pattern(pathprefix + 'all.png')
                click(p)
        elif hold == 1:
            if index == 0:
                p = Pattern(pathprefix + 'all.png')
                click(p)

        p = Pattern(pathprefix + 'xiadan.png')
        click(p)
        time.sleep(3)
        if exists(pathprefix + 'zhengquandaimabunengweikong.png'):
            p = Pattern(pathprefix + 'confirm.png')
            click(p)
            raise
        p = Pattern(pathprefix + 'confirm.png')
        click(p)
        return True
    except:
        return False
예제 #28
0
    def createCleanVersionCheck(self):
        """Checks whether a new clean version was created

        :return: None
        """
        log('## createCleanVersionCheck')
    
        if not exists('%sNewVersion.png' % self.projectBrowser.testInfo.sequence, 5):
            self.projectBrowser.testInfo.failed(
                    'createCleanVersionCheck: Could not find the '
                    'Project Browser icon indicating this is a clean version.')
        else:
            log('- Found clean version Project Browser icon.')
            self.projectBrowser.showing = False
    
        self.projectBrowser.testInfo.resetEdit()
    
        log('All checks performed for createCleanVersion.')
예제 #29
0
 def openEditorialGUICheck(self, timeout):
     """Checker function to verify the Editorial GUI is open"""
     log('## openEditorialGUICheck')
 
     if not exists('toAvidToFlix.png', timeout):
         self.launch.testInfo.failed('openEditorialGUICheck: '
                                     'Could not find the \'To Avid\' and \'To Flix\' buttons.')
     else:
         log('- Editorial GUI open.')
 
     # # if not exists('toAvidToFlix.png', timeout):
     # #     self.launch.testInfo.failed('openEditorialGUICheck: Could not find the \'To Avid\' and \'To Flix\' buttons.')
     # if not exists('projectBrowserBtn.png', timeout):
     #     self.launch.testInfo.failed('openEditorialGUICheck: Could not find the Project Browser button.')
     # else:
     #     log('- Editorial GUI open.')
 
     log('All checks performed for openEditorialGUICheck.')
예제 #30
0
def popupCheck(testInfo, timeout, methodName="methodName"):

    # Wait for the OK popup
    attempts = 10
    for attempt in range(0, attempts):
        currentTime = int(timeout * (attempt + 1) / attempts)
        if not sikuliUtils.clearPopup(timeout / attempts):
            # Maybe it's the fail popup
            if exists("flixPopupClose.png"):
                testInfo.failed("%s: plugin failed after %s seconds." % (methodName, currentTime))
                click("flixPopupClose.png")
                return 0
            elif attempt == attempts:
                testInfo.failed("%s: No successful popup after %s seconds." % (methodName, timeout))
                testInfo.failed("%s: No error popup either, probably needs to increase the timeout value." % methodName)
                return 0
        else:
            log("- Found successful popup after less than %s seconds." % currentTime)
            return 1
예제 #31
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)
예제 #32
0
def reloadFlix(image):
    """Method to reload Flix.

    Can be useful to find things like plugins when Flix isn't in its default state any more.
    After reloading the page, it will try to look for the image.
    It returns 1 if it found it, 0 if it didn't.
    """
    """
    # In case the edit wasn't saved already
    if exists('saveEdit.png'):
        click('saveEdit.png'); wait(1)
    """
    closeChromeTab()
    # type('t', sikuli.KeyModifier.CTRL | sikuli.KeyModifier.SHIFT)
    ctrlType('t', sikuli.KeyModifier.SHIFT)

    if exists(image, 10):
        wait(2)
        return 1
    else:
        return 0
예제 #33
0
파일: work.py 프로젝트: renewday/sds
def sell(code):
    try:
        #p = Pattern(pathprefix+'sellselection.png')
        p = Pattern(pathprefix + 'jiaoyiweituo.png')
        doubleClick(p)
        time.sleep(1)
        p = Pattern(pathprefix + 'maichu.png')
        doubleClick(p)
        time.sleep(2)

        p = Pattern(pathprefix + 'daima.png')
        click(p)
        click(p)
        click(p)
        paste(code)

        p = Pattern(pathprefix + 'putongweituo.png')
        click(p)
        p = Pattern(pathprefix + 'shijiacangwei.png')
        click(p)
        time.sleep(3)
        p = Pattern(pathprefix + 'all.png')
        click(p)

        p = Pattern(pathprefix + 'xiadan.png')
        click(p)
        time.sleep(3)
        if exists(pathprefix + 'daimanotbeempty.png'):
            p = Pattern(pathprefix + 'confirm.png')
            click(p)
            raise
        p = Pattern(pathprefix + 'confirm.png')
        click(p)
        return True
    except:
        print sys.exc_info()[0], sys.exc_info()[1]
        return False
예제 #34
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