How to use check_checkbox method in lettuce_webdriver

Best Python code snippet using lettuce_webdriver_python

abc_helper.py

Source:abc_helper.py Github

copy

Full Screen

1# -*- coding:utf-8 -*-2# Require Header3import os4import json5from functools import partial6# Sys Header7import traceback8import subprocess9# Maya Header10import maya.cmds as cmds11import maya.mel as mel12import maya.OpenMayaUI as omui13import plugin.Qt as Qt14# 识别当前的使用的Qt库 从而导入正确的库15if Qt.__binding__.startswith('PyQt'):16 from sip import wrapinstance as wrapInstance17 from Qt.QtCore import pyqtSignal as Signal18elif Qt.__binding__ == 'PySide':19 from shiboken import wrapInstance20 from Qt.QtCore import Signal21 from PySide.QtCore import *22 from PySide.QtGui import *23 import pysideuic as uic24 import xml.etree.ElementTree as xml25 from cStringIO import StringIO26else:27 from shiboken2 import wrapInstance28 from Qt.QtCore import Signal29 from PySide2.QtCore import *30 from PySide2.QtGui import *31 from PySide2.QtWidgets import *32 import pyside2uic as uic33 import xml.etree.ElementTree as xml34 from cStringIO import StringIO35DIR = os.path.dirname(__file__)36GUI_STATE_PATH = os.path.join(DIR, "json" ,'GUI_STATE.json')37from abc_helper_ui import UI_Interface38class abc_helper(UI_Interface):39 def __init__(self,dock="dock"):40 super(abc_helper,self).__init__(dock=dock)41 # 窗口设置按钮功能42 self.Maya_Dock.clicked.connect(partial(self.Dockable_Window_Fun,dock="dock"))43 self.Maya_Undock.clicked.connect(partial(self.Dockable_Window_Fun,dock="undock"))44 if mel.eval("getApplicationVersionAsFloat;")>=2017:45 self.Maya_Workspace.clicked.connect(partial(self.Dockable_Window_Fun,dock="workspace"))46 else:47 self.Maya_Workspace.setEnabled(False)48 self.Default_Setting.clicked.connect(partial(self.Dockable_Window_Fun,save=False))49 self.NamespaceEditor_BTN.clicked.connect(self.NamespaceEditor_BTN_Fun)50 self.Hypershade_BTN.clicked.connect(self.Hypershade_BTN_Fun)51 self.Alembic_Import_BTN.clicked.connect(self.Alembic_Import_BTN_Fun)52 self.Cnvert_BTN.clicked.connect(self.Cnvert_BTN_Fun)53 self.Transfer_BTN.clicked.connect(self.Transfer_BTN_Fun)54 self.Alembic_Export_BTN.clicked.connect(self.Alembic_Export_BTN_Fun)55 def Dockable_Window_Fun(self,dock="undock",save=True):56 # 保存当前UI界面57 if save == True:58 self.DOCK = dock59 self.closeEvent(self.event)60 # 检测不同的UI 全部删除61 try:62 if cmds.window(self.undockWindow,query=True,exists=True) :63 cmds.deleteUI(self.undockWindow)64 except:65 pass66 try:67 if cmds.dockControl(self.dockControl,query=True,exists=True) :68 cmds.deleteUI(self.dockControl)69 except:70 pass71 try:72 if cmds.workspaceControl(self.workspaceCtrl,query=True,exists=True) :73 cmds.deleteUI(self.workspaceCtrl)74 except:75 pass76 if save == False:77 os.remove(GUI_STATE_PATH)78 79 global abc_helper_UI 80 abc_helper_UI = abc_helper(dock=dock)81 abc_helper_UI.show()82 def NamespaceEditor_BTN_Fun(self):83 cmds.NamespaceEditor()84 self.Save_Json_Fun() 85 def Hypershade_BTN_Fun(self):86 cmds.HypershadeWindow()87 self.Save_Json_Fun() 88 def Alembic_Import_BTN_Fun(self):89 cmds.AlembicImport()90 self.Save_Json_Fun() 91 def Cnvert_BTN_Fun(self):92 sel = cmds.ls(sl=True,fl=True)93 for obj in sel:94 95 shapeNode = cmds.listRelatives(obj,children=True,shapes=True)96 SGNodeList = cmds.listConnections(shapeNode[0],type="shadingEngine")97 SGNodeList = list(set(SGNodeList))98 for SGNode in SGNodeList:99 shader = cmds.listConnections(SGNode + ".surfaceShader")100 cmds.select(cl=True)101 102 cmds.hyperShade( objects=shader[0] )103 cmds.ConvertSelectionToFaces()104 faceList = cmds.ls(sl=True,fl=True)105 cmds.sets(cl=(shader[0]+"SG"))106 for face in faceList :107 if obj == face.split('.')[0]:108 cmds.select(face)109 cmds.sets(add=(shader[0]+"SG"))110 mel.eval("maintainActiveChangeSelectMode " + sel[-1] + ";")111 cmds.select(cl=True)112 cmds.headsUpMessage( u'转换成功' )113 self.Save_Json_Fun() 114 def Transfer_BTN_Fun(self):115 sel = cmds.ls(sl=True,fl=True)116 shapeNode = cmds.listRelatives(sel[0],children=True,shapes=True)117 SGNodeList = cmds.listConnections(shapeNode[0],type="shadingEngine")118 SGNodeList = list(set(SGNodeList))119 for each in SGNodeList:120 cmds.hyperShade(objects=each)121 sel_mat_face=cmds.ls(sl=True)122 123 ##剔除不是本物体的面 (按材质组选的面,有可能选择其他物体)124 mat_face_use=[] 125 for each_face in sel_mat_face:126 if each_face.find(sel[0])!=-1: ##没有找到就返回-1127 print each_face128 mat_face_use.append(each_face)129 print mat_face_use 130 ##改为目标物体的面131 mat_face_obj=[] 132 for each_new in mat_face_use:133 mat_face_obj.append( each_new.replace(sel[0],sel[1]) ) 134 cmds.select( mat_face_obj , r=True )135 cmds.hyperShade( assign = each )136 137 cmds.select(cl=True)138 cmds.headsUpMessage( u'传递成功' )139 self.Save_Json_Fun() 140 def Alembic_Export_BTN_Fun(self):141 check = self.Check_CheckBox(self.UV_CB.isChecked())142 cmds.optionVar(iv=('Alembic_exportUVWrite',check))143 check = self.Check_CheckBox(self.Face_CB.isChecked())144 cmds.optionVar(iv=('Alembic_exportWriteFaceSets',check))145 check = self.Check_CheckBox(self.Verbose_CB.isChecked())146 cmds.optionVar(iv=('Alembic_exportVerbose',check))147 check = self.Check_CheckBox(self.Color_CB.isChecked())148 cmds.optionVar(iv=('Alembic_exportWriteColorSets',check))149 check = self.Check_CheckBox(self.Render_CB.isChecked())150 cmds.optionVar(iv=('Alembic_exportRenderableOnly',check))151 check = self.Check_CheckBox(self.WS__CB.isChecked())152 cmds.optionVar(iv=('Alembic_exportWorldSpace',check))153 check = self.Check_CheckBox(self.NM__CB.isChecked())154 cmds.optionVar(iv=('Alembic_exportNoNormals',check))155 check = self.Check_CheckBox(self.Vis__CB.isChecked())156 cmds.optionVar(iv=('Alembic_exportWriteVisibility',check))157 check = self.Check_CheckBox(self.Namespace_CB.isChecked())158 cmds.optionVar(iv=('Alembic_exportStripNamespaces',check))159 self.Save_Json_Fun() 160 cmds.AlembicExportSelection()161 def Check_CheckBox(self,CheckBox):162 if CheckBox:163 check = 1164 else:165 check = 0166 167 return check 168def main():169 # 检测不同的UI 全部删除170 global abc_helper_UI 171 try:172 if cmds.window(abc_helper_UI.undockWindow,query=True,exists=True) :173 cmds.deleteUI(abc_helper_UI.undockWindow)174 except:175 pass176 try:177 if cmds.dockControl(abc_helper_UI.dockControl,query=True,exists=True) :178 cmds.deleteUI(abc_helper_UI.dockControl)179 except:180 pass181 try:182 if cmds.workspaceControl(abc_helper_UI.workspaceCtrl,query=True,exists=True) :183 cmds.deleteUI(abc_helper_UI.workspaceCtrl)184 except:185 pass186 abc_helper_UI = abc_helper(dock="undock")...

Full Screen

Full Screen

main.py

Source:main.py Github

copy

Full Screen

...26 total_checked = 027 mouse = pygame.mouse.get_pos()28 for checkbox in checkboxes:29 checkbox.show_checkbox(screen)30 checkbox.check_checkbox(mouse)31 total_checked += checkbox.out_of_checkboxes32 for event in pygame.event.get():33 if event.type == QUIT:34 pygame.quit()35 if event.type == MOUSEBUTTONDOWN:36 mouse_down = 137 for checkbox in checkboxes:38 checkbox.check_checkbox(mouse)39 if not checkbox.out_of_checkboxes:40 checkbox.change_state()41 if total_checked == 3:42 created_planet = Planet(mouse[0], 600 - mouse[1], 10, 10)43 if event.type == MOUSEBUTTONUP:44 mouse_down = 045 if total_checked == 3:46 created_planet.velocity = [(mouse[0] - created_planet.x) * 3, (600 - mouse[1] - created_planet.y) * 3]47 corps.append(created_planet)48 if mouse_down and total_checked == 3:49 pygame.draw.circle(50 screen,51 (255, 255, 255),52 grid(created_planet.x, created_planet.y),...

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 lettuce_webdriver 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