本文整理汇总了Python中utils.sikuliUtils.log函数的典型用法代码示例。如果您正苦于以下问题:Python log函数的具体用法?Python log怎么用?Python log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了log函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: openFlixGUI
def openFlixGUI(self, timeout):
"""Opens Flix's main GUI"""
log('##### openFlixGUI')
sikuliUtils.newChromeTab('http://127.0.0.1:35980/html/index.html#')
self.launchCheck.openFlixGUICheck(timeout)
示例2: psCurrentImage
def psCurrentImage(self, fileNames=["1"]):
"""Test method to send stills from Photoshop to an open Flix edit
:param fileNames: Array of filenames to be open in Photoshop
(without extension, files available in assets/psds directory)
:return: None
"""
log("##### psCurrentImage")
psScriptPath = "%s/psCurrentImage.jsx" % self.assetsDir
filePaths = []
for fileName in fileNames:
filePath = "%s/%s.psd" % (self.assetsDir, fileName)
if os.path.exists(filePath):
filePaths.append(filePath)
else:
log("psCurrentImage: Could not find %s in PSD assets folder; skipping..." % fileName)
if not len(filePaths):
self.testInfo.failed("psCurrentImage: No file to open in PS; exiting...")
return
if not self.__writePsScript(psScriptPath, filePaths, "Current Image"):
self.testInfo.failed("psCurrentImage: Failed to write the PS script; exiting...")
return
self.__executePsScript(psScriptPath)
# fromPs.psCurrentImageCheck(self.testInfo, len(filePaths))
self.fromPsCheck.psCurrentImageCheck(len(filePaths))
示例3: replaceStill
def replaceStill(self, mayaFile="pyramid.mb", frame=1):
"""Test method to replace the currently selected Flix panel with a still from Maya. Must make sure the current Flix
edit contains at least one panel!
Usage: fromMaya.replaceStill(self.testInfo, "pyramid.mb", 15)
:param mayaFile: Name of the Maya scene file
:param frame: Integer corresponding to the frame from the Maya scene to send to Flix
:return: None
"""
log("##### replaceStill")
mayaSettings = checkUtils.readMayaSettings(self.testInfo, mayaFile)
if not mayaSettings["inFrame"] <= frame <= mayaSettings["outFrame"]:
log(
"addStills: Frame %s not in Maya scene (In: %s Out: %s); stopping test..."
% (frame, mayaSettings["inFrame"], mayaSettings["outFrame"]),
"error",
)
return
melScriptPath = "%s/replaceStill.mel" % self.assetsPath
# Write Mel actions to execute in Maya
scriptBody = "currentTime %s;\n" 'evalDeferred("replaceStill");\n\n' % frame
self.__writeMelScript(melScriptPath, mayaFile, scriptBody)
self.__executeMelScript(melScriptPath)
# fromMaya.replaceStillCheck(self.testInfo)
self.fromMayaCheck.replaceStillCheck()
示例4: addDialogue
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)
示例5: replaceSequencerShot
def replaceSequencerShot(self, mayaFile="pyramidSequencer.mb", shotNumber=1):
"""Test method to replace the currently selected Flix panel with a shot from a Maya sequencer.
Usage: fromMaya.replaceSequencerShot(self.testInfo, "pyramidSequencer.mb", 1)
:param mayaFile: Name of the Maya scene file
:param shotNumber: Position of the shot in the sequencer
:return: None
"""
log("##### replaceSequencerShot")
mayaSettings = checkUtils.readMayaSettings(self.testInfo, mayaFile)
if shotNumber > mayaSettings["nShots"]:
shot = mayaSettings["shotNames"][0]
else:
shot = mayaSettings["shotNames"][shotNumber - 1]
duration = mayaSettings["outFrame"] - mayaSettings["inFrame"] + 1
melScriptPath = "%s/replaceSequencerShot.mel" % self.assetsPath
# Write Mel actions to execute in Maya
scriptBody = "select -add %s ;\n" 'evalDeferred("replaceSequencerShot");\n\n' % shot
self.__writeMelScript(melScriptPath, mayaFile, scriptBody)
self.__executeMelScript(melScriptPath)
# fromMaya.replaceSequencerShotCheck(self.testInfo, duration)
self.fromMayaCheck.replaceSequencerShotCheck(duration)
示例6: addSequencerShots
def addSequencerShots(self, mayaFile="pyramidSequencer.mb", nShots=1):
"""Test method to send a number of sequencer shots from Maya to the current Flix edit
Usage: fromMaya.addSequencerShot(self.testInfo, "pyramidSequencer.mb", 3)
:param mayaFile: Name of the Maya scene file
:param nShots: Number of shots to be sent from Maya to Flix
:return: None
"""
log("##### addSequencerShots")
mayaSettings = checkUtils.readMayaSettings(self.testInfo, mayaFile)
if nShots > mayaSettings["nShots"]:
shots = mayaSettings["shotNames"][0 : mayaSettings["nShots"]]
else:
shots = mayaSettings["shotNames"][0:nShots]
log("addSequencerShots: shots to be sent to Flix: %s" % shots, "debug")
melScriptPath = "%s/addSequencerShot.mel" % self.assetsPath
# Write Mel actions to execute in Maya
scriptBody = ""
duration = 0
for shot in shots:
scriptBody += "select -add %s ;\n" % shot
duration += mayaSettings["shotDurations"][shots.index(shot)]
scriptBody += 'evalDeferred("addSequencerShot");\n\n'
self.__writeMelScript(melScriptPath, mayaFile, scriptBody)
self.__executeMelScript(melScriptPath)
# fromMaya.addSequencerShotsCheck(self.testInfo, len(shots), duration)
self.fromMayaCheck.addSequencerShotsCheck(len(shots), duration)
示例7: addStills
def addStills(self, mayaFile="pyramid.mb", frames=[1, 12, 24]):
"""Test method to send stills from Maya to an open Flix edit
Usage: fromMaya.addStills(self.testInfo, "pyramid.mb", [1, 12, 24])
:param mayaFile: Name of the Maya scene file
:param frames: Array of frames for which to send panels from Maya
:return: None
"""
log("##### addStills")
mayaSettings = checkUtils.readMayaSettings(self.testInfo, mayaFile)
existingFrames = []
for frame in frames:
if mayaSettings["inFrame"] <= frame <= mayaSettings["outFrame"]:
existingFrames.append(frame)
else:
log(
"addStills: Frame %s not in Maya scene (In: %s Out: %s); skipping..."
% (frame, mayaSettings["inFrame"], mayaSettings["outFrame"]),
"error",
)
melScriptPath = "%s/addStills.mel" % self.assetsPath
# Write Mel actions to execute in Maya
scriptBody = ""
for frame in existingFrames:
# For each frame, set the keyframe, perform mayaAddStill, wait for 3sec
scriptBody += "currentTime %s;\n" 'evalDeferred("addStill");\n\n' % frame
self.__writeMelScript(melScriptPath, mayaFile, scriptBody)
self.__executeMelScript(melScriptPath)
# fromMaya.addStillsCheck(self.testInfo, existingFrames)
self.fromMayaCheck.addStillsCheck(existingFrames)
示例8: getMarkersFromShotEdit
def getMarkersFromShotEdit(self):
"""Returns a list of all the markers in the current shotEdit
:return: list of markers' shotLabels
"""
markerRecipes = []
markers = []
xml = self.getShotEdit()
if xml == 0:
log('TestInfo: cannot find panels in shot edit (xml not found).', 'error')
return markers
tree = ET.parse(xml)
root = tree.getroot()
for shot in root.findall('Shot'):
recipe = shot.get('recipeLabelName').split('[')[0]
# if '_marker_' in recipe:
# markerRecipes.append(recipe)
if self.getPanelBeat(recipe) == 'marker':
markerRecipes.append(recipe)
# Read shotLabel from multitrack
for markerRecipe in markerRecipes:
multitrack = self.getPanelMultitrack(markerRecipe)
shotLabel = pyUtils.parseMultitrack(multitrack, 'Pose', 'dialogue')
markers.append(shotLabel)
log('TestInfo: getMarkersFromShotEdit: %s' % markers, 'debug')
return markers
示例9: __writePsScript
def __writePsScript(scriptPath, filePaths, action):
"""Writes a Jsx script to open a PS file, execute actions and quit PS.
:param scriptPath: Path to the PS script to be written (.jsx)
:param filePaths: Array of filepaths to be opened in PS
:param action: Name of the Photoshop action to be executed
:return: 0 if failed, 1 if succeeded
"""
# supportedActions = ["Current Image", "Replace Current Image", "Each Frame", "Each Layer"]
# if action not in supportedActions:
# log("writePsScript: %s is not an existing or supported Flix Action; exiting...\n"
# "Supported Actions: %s" % (action, supportedActions))
# return 0
scriptContents = (
"var files = %s\n"
"for (i = 0; i < files.length; i++){\n"
"var file = File(files[i])\n"
"app.open(file)\n"
'app.doAction("%s", "Flix Actions")\n'
"app.activeDocument.close(SaveOptions.DONOTSAVECHANGES)\n"
"}\n"
"photoshop.quit()\n" % (filePaths, action)
)
try:
with open(scriptPath, "wb") as f:
log("writePsScript: creating following script: %s" % scriptPath, "debug")
f.write(scriptContents.replace("\\", "/"))
return 1
except Exception, e:
log("writePsScript: Could not write PS script.\n%s" % e)
return 0
示例10: psEachLayer
def psEachLayer(self, fileName="5layers", BG=0, FG=0):
log("##### psEachLayer")
psScriptPath = "%s/psEachLayer.jsx" % self.assetsDir
filePath = "%s/%s.psd" % (self.assetsDir, fileName)
if not os.path.exists(filePath):
self.testInfo.failed("psEachLayer: Could not find %s in PSD assets folder; exiting..." % fileName)
return
# TODO: Write a method that reads settings for each PSD to figure out how many frames it's got
nLayers = 5
if BG and FG:
scriptName = "Each Layer + FG/BG"
nLayers -= 1
elif BG and not FG:
scriptName = "Each Layer + BG"
else:
if FG and not BG:
log("psEachLayer: Can't send FG but not BG, using Flix Each Layer script instead.")
scriptName = "Each Layer"
nLayers += 1
if not self.__writePsScript(psScriptPath, [filePath], scriptName):
self.testInfo.failed("psEachLayer: Failed to write the PS script; exiting...")
return
self.__executePsScript(psScriptPath)
self.fromPsCheck.psEachLayerCheck(nLayers)
示例11: updateMarkers
def updateMarkers(self, markers):
"""Updates the markers in the current edit"""
for marker in markers:
self.editMarkers.append(marker)
self.allMarkers.append(marker)
log('TestInfo: updateMarkers: %s' % self.editMarkers, 'debug')
示例12: __getAvailablePanels
def __getAvailablePanels(self, ext):
self.importPath = '%s/assets/%ss/' % (self.testInfo.testPath, ext)
if not os.path.exists(self.importPath):
log('importDrawings: Could not find an asset directory for %s; '
'try with another file extension.' % ext, 'error')
return 0
else:
return pyUtils.findFileNames(self.importPath, "*.%s" % ext)
示例13: updateAllPanels
def updateAllPanels(self, panels):
"""Updates the panels in the sequence"""
for beats in panels:
for panel in panels[beats]:
beat = self.getPanelBeat(panel)
if beat != 'unknown':
if panel not in self.allPanels[beat]:
self.allPanels[beat].append(panel)
else:
log('TestInfo: updateAllPanels: %s\'s beat determined as unknown.' % panel, 'debug')
示例14: launchFlix
def launchFlix(self, timeout):
"""Launches Flix's main UI via its bat or sh file
path -- Path to the Flix launcher
timeout -- Time in seconds before the Project Browser will open
"""
log('##### launchFlix')
# Flix is being launched from the Test Suite before Sikuli
if self.launchCheck.launchFlixCheck(timeout) == 'login':
self.logIn(timeout)
示例15: __publishFromFlix
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()