How to use get_render_resolution method in Airtest

Best Python code snippet using Airtest

playblast_001.py

Source:playblast_001.py Github

copy

Full Screen

1import os2import traceback3import tempfile4import shutil56import pymel.core as pm7import system.quicktime as quicktime8reload(quicktime)9import digital37.maya.general.scene as scene10reload(scene)1112class PlayBlast(scene.Scene,quicktime.Quicktime):13 '''14 playblast15 '''16 def __init__(self):17 pass18 19 def set_pb_name(self,pb_name):20 self.PB_Name = pb_name21 22 # use outputDir to replace maya scene's full path name's 'anim'23 # example: scenes/shot/ep01/ep01_sc0010/anim/project_an_ep01_sc0010.mb24 # scenes/shot/ep01/ep01_sc0010/outputDir/project_an_ep01_sc0010.mov25 def set_pb_name_by_folder(self,outputDir='playblast'):26 self.get_scene_name()27 # self.Scene_Name_Full_Path defined in scene.Scene28 if self.Scene_Name_Full_Path:29 self.set_pb_name( self.Scene_Name_Full_Path_Without_Ext.replace( '/anim/', ('/%s/' % outputDir) ) )30 else:31 return False32 33 def evalDeferred_playblast(self,fileName,width,height,fp):34 try:35 pm.evalDeferred( 'pm.playblast(format="iff",sequenceTime=0,clearCache=1,viewer=0,\36 showOrnaments=1,fp='+str(fp)+',percent=100,compression="jpg",\37 widthHeight=('+str(width)+','+str(height)+'),\38 forceOverwrite=1,quality=100,filename=\"' + fileName + '\")' )39 except:40 self.Log.error('evalDeferred_playblast error')41 self.Log.error(traceback.format_exc())42 43 def eval_playblast(self,fileName,width,height,fp):44 try:45 pm.playblast(format='iff',sequenceTime=0,clearCache=1,viewer=0,\46 showOrnaments=1,fp=fp,percent=100,compression="jpg",\47 widthHeight=(width,height),\48 forceOverwrite=1,quality=100,filename=fileName)49 except:50 self.Log.error('eval_playblast error')51 self.Log.error(traceback.format_exc())52 53 def before_playblast(self,outputDir=None,width=None,height=None):54 '''55 do before playBlast56 '''57 # get playBlast image's name58 self.get_scene_name()59 if self.Name_By_Folder:60 self.set_pb_name_by_folder(outputDir)61 else:62 if not outputDir:63 fd,outputDir = tempfile.mkdtemp()64 fObj = os.fdopen(fd,'w')65 fObj.write( '' )66 fObj.close()67 #print outputDir68 # set image's name to output folder69 self.set_pb_name( os.path.abspath(os.path.join(outputDir,self.Scene_Name_Short_Without_Ext)))70 71 # get playBack range72 self.MinTime, self.MaxTime = self.get_playback_info()73 74 # get image's width and height75 # if not set width and height, then use rendering settings76 # get render settings's width and height77 if not width:78 import digital37.maya.lighting.get_render_resolution as get_render_resolution79 width,height = get_render_resolution.rename()80 self.Width = width81 self.Height = height82 83 def do_playblast(self,imageName=None):84 '''85 do plabyBlast 86 '''87 if not imageName:88 #set temp images name89 fd,imageName = tempfile.mkstemp(prefix='PlayBlast')90 fObj = os.fdopen(fd,'w')91 fObj.write( '' )92 fObj.close() 93 self.Images = imageName94 95 print 'self.Images:%s' % self.Images96 pm.playblast(format='iff',sequenceTime=0,clearCache=1,viewer=0,\97 showOrnaments=1,fp=1,percent=100,compression="jpg",\98 widthHeight=(self.Width,self.Height),\99 forceOverwrite=1,quality=100,filename=self.Images)100 101 def after_playblast(self):102 '''103 do after playBlast104 '''105 # make movie from image sequence106 # add frame number and extension to make movie107 if self.Make_Movie: 108 self.make_mov( (self.Images + ('.%s.jpeg' % self.MinTime)), self.MinTime, self.MaxTime )109 110 def playBlast_with_mov(self,nameByFolder=False,outputDir='playblast',imageName=None,111 width=None,height=None,quicktime_settings_file=None,quicktime_time=None):112 # check images name's path is relative with scene's name or not113 self.Name_By_Folder = nameByFolder114 self.Make_Movie = True115 if quicktime_settings_file:116 self.set_quicktime_settings(quicktime_settings_file)117 self.set_time(quicktime_time)118 # TODO 128 will be return in some pc when do playblast119 self.set_subprocess_returnCode([0,128])120 121 self.before_playblast(outputDir, width, height)122 self.do_playblast(imageName)123 self.after_playblast()124 125 else:126 self.Log.error('can not get quicktime_settings file')127 128 129 def playBlast(self,nameByFolder=False,outputDir='playblast',imageName=None,130 width=None,height=None):131 self.Make_Movie = False132 # check images name's path is relative with scene's name or not133 self.Name_By_Folder = nameByFolder134 self.before_playblast(outputDir, width, height)135 self.do_playblast(imageName)136 self.after_playblast()137 138 def do_after_execute_cmd(self):139 '''override do_after_execute_cmd in system module140 '''141 self.Log.debug( 'PlayBlast:Success\r\n' )142 # copy movie143 # check folder exists or not144 self.create_dir( os.path.dirname(self.PB_Name + '.mov') )145 shutil.copy( (self.Images + '.mov'), (self.PB_Name + '.mov') )146 cmd = 'start '147 cmd += self.PB_Name + '.mov'148 try:149 os.system(cmd)150 except:151 self.Log.error( traceback.format_exc() )152 self.Log.debug("PlayBlast: %s",(self.PB_Name + '.mov') )153 154def main(log=None,nameByFolder=False,outputDir='playblast',imageName=None,155 width=None,height=None,makeMovie=False,quicktime_settings_file=None,quicktime_time=None):156 a = PlayBlast()157 if not log:158 a.get_stream_logger()159 if makeMovie:160 a.playBlast_with_mov(nameByFolder, outputDir, imageName, width, height, quicktime_settings_file,quicktime_time)161 else:162 a.playBlast(nameByFolder, outputDir, imageName, width, height)163 164if __name__ == '__main__' :165 #pass166 #main(None,None,None,None,None,None,False,'D:/RND/project/pipelineProject/quicktime/quicktime_export_settings.xml') ...

Full Screen

Full Screen

device.py

Source:device.py Github

copy

Full Screen

...44 def uninstall_app(self, package):45 self._raise_not_implemented_error()46 def get_current_resolution(self):47 self._raise_not_implemented_error()48 def get_render_resolution(self):49 self._raise_not_implemented_error()50 def get_ip_address(self):51 self._raise_not_implemented_error()52 def _raise_not_implemented_error(self):53 platform = self.__class__.__name__...

Full Screen

Full Screen

test1.py

Source:test1.py Github

copy

Full Screen

...13uuid = device.uuid14print(f'uuid {uuid}')15display_info = device.get_display_info()16print(f'display info {display_info}')17resolution = device.get_render_resolution()18print(f'resolution {resolution}')19ip_address = device.get_ip_address()20print(f'ip address {ip_address}')21top_activity = device.get_top_activity()22print(f'top activity {top_activity}')23is_keyboard = device.is_keyboard_shown()24print(f'is keyboard show {is_keyboard}')25print(G.DEVICE_LIST)26uri = 'Android://127.0.0.1:5037/l7wgwg9puo8xeyzt'27device: Android = connect_device(uri)28print(G.DEVICE_LIST)29connect_device(uri)30result = shell('cat /proc/meminfo')31print(result)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Airtest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful