How to use setConnection method in fMBT

Best Python code snippet using fMBT_python

bob_guide_rig.py

Source:bob_guide_rig.py Github

copy

Full Screen

...196 # Inputs & Set Connections197 # =========================198 # Spine199 spineGlobalSrtInput = spineComponentGuide.getInputByName('globalSRT')200 spineGlobalSrtInput.setConnection(mainSrtOffsetOutput)201 spineRigScaleInput = spineComponentGuide.getInputByName('rigScale')202 spineRigScaleInput.setConnection(mainSrtRigScaleOutput)203 # Neck204 neckGlobalSrtInput = neckComponentGuide.getInputByName('globalSRT')205 neckGlobalSrtInput.setConnection(mainSrtOffsetOutput)206 neckSpineEndInput = neckComponentGuide.getInputByName('neckBase')207 neckSpineEndInput.setConnection(spineEndOutput)208 # Head209 headGlobalSrtInput = headComponentGuide.getInputByName('globalSRT')210 headGlobalSrtInput.setConnection(mainSrtOffsetOutput)211 headBaseInput = headComponentGuide.getInputByName('neckRef')212 headBaseInput.setConnection(neckEndOutput)213 headBaseInput = headComponentGuide.getInputByName('worldRef')214 headBaseInput.setConnection(mainSrtOffsetOutput)215 # Clavicle Left216 clavicleLeftGlobalSrtInput = clavicleLeftComponentGuide.getInputByName('globalSRT')217 clavicleLeftGlobalSrtInput.setConnection(mainSrtOffsetOutput)218 clavicleLeftSpineEndInput = clavicleLeftComponentGuide.getInputByName('spineEnd')219 clavicleLeftSpineEndInput.setConnection(spineEndOutput)220 # Clavicle Right221 clavicleRightGlobalSrtInput = clavicleRightComponentGuide.getInputByName('globalSRT')222 clavicleRightGlobalSrtInput.setConnection(mainSrtOffsetOutput)223 clavicleRightSpineEndInput = clavicleRightComponentGuide.getInputByName('spineEnd')224 clavicleRightSpineEndInput.setConnection(spineEndOutput)225 # Arm Left226 armLeftGlobalSrtInput = armLeftComponentGuide.getInputByName('globalSRT')227 armLeftGlobalSrtInput.setConnection(mainSrtOffsetOutput)228 armLeftRigScaleInput = armLeftComponentGuide.getInputByName('rigScale')229 armLeftRigScaleInput.setConnection(mainSrtRigScaleOutput)230 armLeftClavicleEndInput = armLeftComponentGuide.getInputByName('root')231 armLeftClavicleEndInput.setConnection(clavicleLeftEndOutput)232 # Arm Right233 armRightGlobalSrtInput = armRightComponentGuide.getInputByName('globalSRT')234 armRightGlobalSrtInput.setConnection(mainSrtOffsetOutput)235 armRightRigScaleInput = armRightComponentGuide.getInputByName('rigScale')236 armRightRigScaleInput.setConnection(mainSrtRigScaleOutput)237 armRightClavicleEndInput = armRightComponentGuide.getInputByName('root')238 armRightClavicleEndInput.setConnection(clavicleRightEndOutput)239 # Hand Left240 handLeftGlobalSrtInput = handLeftComponentGuide.getInputByName('globalSRT')241 handLeftGlobalSrtInput.setConnection(mainSrtOffsetOutput)242 handLeftArmEndInput = handLeftComponentGuide.getInputByName('armEnd')243 handLeftArmEndInput.setConnection(armLeftWristOutput)244 # Hand Right245 handRightGlobalSrtInput = handRightComponentGuide.getInputByName('globalSRT')246 handRightGlobalSrtInput.setConnection(mainSrtOffsetOutput)247 handRightArmEndInput = handRightComponentGuide.getInputByName('armEnd')248 handRightArmEndInput.setConnection(armRightWristOutput)249 # Leg Left250 legLeftGlobalSrtInput = legLeftComponentGuide.getInputByName('globalSRT')251 legLeftGlobalSrtInput.setConnection(mainSrtOffsetOutput)252 legLeftRigScaleInput = legLeftComponentGuide.getInputByName('rigScale')253 legLeftRigScaleInput.setConnection(mainSrtRigScaleOutput)254 legLeftPelvisInput = legLeftComponentGuide.getInputByName('pelvisInput')255 legLeftPelvisInput.setConnection(spinePelvisOutput)256 legLeftPelvisInput = legLeftComponentGuide.getInputByName('ikTarget')257 legLeftPelvisInput.setConnection(footLeftIkTargetOutput)258 # Leg Right259 legRightGlobalSrtInput = legRightComponentGuide.getInputByName('globalSRT')260 legRightGlobalSrtInput.setConnection(mainSrtOffsetOutput)261 legRightRigScaleInput = legRightComponentGuide.getInputByName('rigScale')262 legRightRigScaleInput.setConnection(mainSrtRigScaleOutput)263 legRightPelvisInput = legRightComponentGuide.getInputByName('pelvisInput')264 legRightPelvisInput.setConnection(spinePelvisOutput)265 legRightPelvisInput = legRightComponentGuide.getInputByName('ikTarget')266 legRightPelvisInput.setConnection(footRightIkTargetOutput)267 # Foot Left268 footLeftGlobalSrtInput = footLeftComponentGuide.getInputByName('globalSRT')269 footLeftGlobalSrtInput.setConnection(mainSrtOffsetOutput)270 footLeftIkHandleInput = footLeftComponentGuide.getInputByName('ikHandle')271 footLeftIkHandleInput.setConnection(legLeftIkHandleOutput)272 footLeftLegEndInput = footLeftComponentGuide.getInputByName('legEnd')273 footLeftLegEndInput.setConnection(legLeftLegEndOutput)274 footLeftLegEndFKInput = footLeftComponentGuide.getInputByName('legEndFK')275 footLeftLegEndFKInput.setConnection(legLeftLegEndFKOutput)276 # Foot Right277 footRightGlobalSrtInput = footRightComponentGuide.getInputByName('globalSRT')278 footRightGlobalSrtInput.setConnection(mainSrtOffsetOutput)279 footRightIkHandleInput = footRightComponentGuide.getInputByName('ikHandle')280 footRightIkHandleInput.setConnection(legRightIkHandleOutput)281 footRightLegEndInput = footRightComponentGuide.getInputByName('legEnd')282 footRightLegEndInput.setConnection(legRightLegEndOutput)283 footRightLegEndFKInput = footRightComponentGuide.getInputByName('legEndFK')284 footRightLegEndFKInput.setConnection(legRightLegEndFKOutput)285 Profiler.getInstance().pop()286if __name__ == "__main__":287 from kraken import plugins288 try:289 Profiler.getInstance().push('bob_guide_build')290 bipedGuide = BobGuideRig('char_bob_guide')291 builder = plugins.getBuilder()292 builder.build(bipedGuide)293 finally:294 Profiler.getInstance().pop()...

Full Screen

Full Screen

database.py

Source:database.py Github

copy

Full Screen

1import psycopg2, os2class Database_Client():3 def setConnection(self):4 try:5 self.connection = psycopg2.connect(user=os.getenv("ENV_USER"),6 password=os.getenv("ENV_PASSWD"),7 host=os.getenv("ENV_HOST"),8 port=os.getenv("ENV_PORT"),9 database=os.getenv("ENV_DATABASE"))10 11 return self.connection12 except (Exception, psycopg2.Error) as error:13 return("Failed to connection", error)14 def insert_client(self,request_client:dict()):15 try:16 postgres_insert_query = f""" 17 INSERT INTO cliente (documento,nome_completo,data_nascimento,email,telefone,ativo)18 VALUES (19 '{request_client["documento"]}',20 '{request_client["nome_completo"]}',21 '{request_client["nascimento"]}',22 '{request_client["email"]}',23 '{request_client["telefone"]}',24 1);"""25 26 cursor = self.setConnection().cursor()27 cursor.execute(postgres_insert_query)28 self.connection.commit()29 count = cursor.rowcount30 cursor.close()31 return(f"{count} Record inserted successfully into client table")32 except (Exception, psycopg2.Error) as error:33 return("Failed to INSERT record into CLIENT table")34 def update_cliente(self, request_client:dict()):35 try:36 postgres_update_query =f""" update37 cliente 38 set 39 documento = '{request_client["documento"]}',40 data_nascimento = '{request_client["nascimento"]}',41 email = '{request_client["email"]}',42 telefone = '{request_client["telefone"]}'43 where44 nome_completo = '{request_client["nome"]}'"""45 cursor = self.setConnection().cursor()46 cursor.execute(postgres_update_query)47 self.connection.commit()48 count = cursor.rowcount49 cursor.close()50 return(f"{count} Record updated successfully into CLIENT table")51 except (Exception, psycopg2.Error) as error:52 return("Failed to UPDATE into CLIENT table", error)53 def select_client(self, request_client:dict()):54 try:55 postgres_select_query = f""" select * from cliente where nome_completo = {request_client["nome"]} """56 cursor = self.setConnection().cursor()57 cursor.execute(postgres_select_query)58 clients = cursor.fetchall()59 return clients60 except (Exception, psycopg2.Error) as error:61 return("Failed to SELECT into CLIENT table", error)62 def delete_client(self, request_client:dict()):63 try:64 postgres_delete_query = f""" UPDATE 65 cliente66 SET 67 ativo = 068 WHERE69 nome_completo = '{request_client:dict()["nome"]}'70 AND71 documento = '{request_client:dict()["documento"]}'72 """73 cursor = self.setConnection().cursor()74 cursor.execute(postgres_delete_query)75 self.connection.commit()76 count = cursor.rowcount77 cursor.close()78 return(f"{count} Record updated successfully into CLIENT table")79 except (Exception, psycopg2.Error) as error:80 return("Failed to DELETE into CLIENT table", error)81class Database_Disc():82 def setConnection(self):83 try:84 self.connection = psycopg2.connect(user=os.getenv('ENV_USER'),85 password=os.getenv("ENV_PASSWD"),86 host=os.getenv("ENV_HOST"),87 port=os.getenv("ENV_PORT"),88 database=os.getenv("ENV_DATABASE"))89 90 return self.connection91 except (Exception, psycopg2.Error) as error:92 return("Failed to connection", error)93 def insert_disc(self,request_disc:dict()):94 try:95 postgres_insert_query = f""" 96 INSERT INTO discos (nome,artista,ano_lancamento,estilo,quantidade)97 VALUES (98 '{request_disc["nome"]}',99 '{request_disc["artista"]}',100 '{request_disc["ano_lancamento"]}',101 '{request_disc["estilo"]}',102 {request_disc["quantidade"]}103 );"""104 105 cursor = self.setConnection().cursor()106 cursor.execute(postgres_insert_query)107 self.connection.commit() 108 count = cursor.rowcount109 cursor.close()110 return(f"{count} Record inserted successfully into DISC table")111 except (Exception, psycopg2.Error) as error:112 return("Failed to INSERT into DISC table", error)113 def update_disc(self, request_disc:dict()):114 try:115 postgres_update_query =f""" update116 discos117 set118 artista = '{request_disc["artista"]}',119 ano_lancamento = '{request_disc["ano_lancamento"]}',120 estilo = '{request_disc["estilo"]}',121 quantidade = {request_disc["quantidade"]}122 where123 nome = '{request_disc["nome"]}'"""124 cursor = self.setConnection().cursor()125 cursor.execute(postgres_update_query)126 self.connection.commit()127 count = cursor.rowcount128 cursor.close()129 return(f"{count} Record updated successfully into DISC table")130 except (Exception, psycopg2.Error) as error:131 return("Failed to UPDATE into DISC table", error)132 def select_disc(self,request_disc:dict()):133 try:134 postgres_select_query = f""" select * 135 from 136 discos 137 where 138 nome = '{request_disc["nome"]}' """139 cursor = self.setConnection().cursor()140 cursor.execute(postgres_select_query)141 clients = cursor.fetchall()142 return clients143 except (Exception, psycopg2.Error) as error:144 return("Failed to SELECT into DISC table", error)145 146 def delete_disc(self, request_disc:dict()):147 try:148 postgres_delete_query = f""" UPDATE 149 discos150 SET 151 quantidade = 0152 WHERE153 nome = '{request_disc["nome"]}'154 AND155 artista = '{request_disc["artista"]}'156 """157 cursor = self.setConnection().cursor()158 cursor.execute(postgres_delete_query)159 self.connection.commit()160 count = cursor.rowcount161 cursor.close()162 return(f"{count} Record updated successfully into CLIENT table")163 except (Exception, psycopg2.Error) as error:164 return("Failed to DELETE into DISC table", error)165class Pedido():166 def setConnection(self):167 try:168 self.connection = psycopg2.connect(user=os.getenv('ENV_USER'),169 password=os.getenv("ENV_PASSWD"),170 host=os.getenv("ENV_HOST"),171 port=os.getenv("ENV_PORT"),172 database=os.getenv("ENV_DATABASE"))173 174 return self.connection175 except (Exception, psycopg2.Error) as error:176 return("Failed to connection", error)177 def insert_purchase(self, request_disc:dict()):178 try: 179 postgres_insert_query = f""" 180 INSERT INTO pedido (cliente,disco,quantidade,data_pedido)181 VALUES (182 '{request_disc["nome_cliente"]}',183 '{request_disc["nome_disco"]}',184 '{request_disc["quantidade"]}',185 '{request_disc["data_pedido"]}'186 );"""187 188 cursor = self.setConnection().cursor()189 cursor.execute(postgres_insert_query)190 self.connection.commit() 191 count = cursor.rowcount192 cursor.close()193 return(f"{count} Record inserted successfully into PEDIDO table")194 except (Exception, psycopg2.Error) as error:195 return("Failed to INSERT into PEDIDO table", error)196 def select_pedido(self,request_pedido:str):197 try:198 postgres_select_query = f""" select quantidade 199 from 200 discos 201 where 202 nome = '{request_pedido}' """203 cursor = self.setConnection().cursor()204 cursor.execute(postgres_select_query)205 clients = cursor.fetchone()206 return clients207 except (Exception, psycopg2.Error) as error:208 return("Failed to SELECT into PEDIDO table", error)209 210 def update_pedido(self, quantidade:int,nome:str()):211 try:212 postgres_delete_query = f""" UPDATE 213 discos214 SET 215 quantidade = {quantidade}216 WHERE217 nome = '{nome}'218 """219 cursor = self.setConnection().cursor()220 cursor.execute(postgres_delete_query)221 self.connection.commit()222 count = cursor.rowcount223 cursor.close()224 return(f"pedido efetuado com sucesso")225 except (Exception, psycopg2.Error) as error:226 return("Failed to UPDATE into PEDIDO table", error)227 228 def select_client(self, request_client:dict()):229 try:230 postgres_select_query = f"""SELECT * FROM pedido231 WHERE232 data_pedido 233 BETWEEN '{request_client["date_init"]}' AND '{request_client["date_end"]}' """234 cursor = self.setConnection().cursor()235 cursor.execute(postgres_select_query)236 clients = cursor.fetchall()237 return clients238 except (Exception, psycopg2.Error) as error:...

Full Screen

Full Screen

app.py

Source:app.py Github

copy

Full Screen

...6app = Flask(__name__)7app.secret_key = 'my unobvious secret key'8@app.route('/logout/')9def logout():10 flash(setConnection(["stop"]))11 return render_template('bye.html')12@app.route('/invoice/<trip_id>')13def invoice(trip_id):14 trip=setConnection(["read_tripByID",trip_id])15 return render_template('invoice.html',trip=trip)16@app.route('/expenseReport/')17def expenseReport():18 Expenditure()19 return redirect(url_for('index'))20@app.route('/ProfitLossReport/')21def ProfitLossReport():22 liabilityasset()23 return redirect(url_for('index'))24@app.route('/MaintenanceReport/')25def MaintenanceReport():26 Maintenance()27 return redirect(url_for('index'))28 29@app.route('/driver_on_vehicle/', methods=['POST'])30def driver_on_vehicle():31 if request.method == 'POST':32 lis = ["write_driverOnVehicle",request.form["veh_no"],request.form["driver_name"]]33 flash(setConnection(lis))34 return redirect(url_for('index'))35@app.route('/start_trip/<veh_no>', methods=['POST'])36def start_trip(veh_no):37 if request.method == 'POST':38 lis = ["write_trips",veh_no,request.form["customer_name"],request.form["source"],request.form["destination"],request.form["cost"],request.form["freight"]]39 flash(setConnection(lis))40 return redirect(url_for('vehicle',veh_no=veh_no))41@app.route('/stop_trip/<veh_no>/<trip_id>', methods=['POST'])42def stop_trip(veh_no,trip_id):43 if request.method == 'POST':44 lis = ["update_trip",trip_id]45 flash(setConnection(lis))46 return redirect(url_for('vehicle',veh_no=veh_no))47@app.route('/add_trip_details/<veh_no>/<trip_id>', methods=['POST'])48def add_trip_details(veh_no,trip_id):49 if request.method == 'POST':50 lis = ["write_trip_details",trip_id,request.form["amt"],request.form["date_of_tran"],request.form["place"],request.form["reason"]]51 flash(setConnection(lis))52 return redirect(url_for('vehicle',veh_no=veh_no))53@app.route('/deleteVehicle/<veh_no>', methods=['POST'])54def deleteVehicle(veh_no):55 if request.method == 'POST':56 flash(setConnection(["delete_vehicles",veh_no])) 57 return redirect(url_for('index'))58@app.route('/deleteDriver/<driver_id>', methods=['POST'])59def deleteDriver(driver_id):60 if request.method == 'POST':61 flash(setConnection(["delete_drivers",driver_id])) 62 return redirect(url_for('index'))63@app.route('/insurance/<veh_no>', methods=['POST'])64def insurance(veh_no):65 if request.method == 'POST':66 lis = ["write_insurances",veh_no,request.form["ins_no"],request.form["validf"],request.form["validu"],request.form["cost"],request.form["icomp"]]67 flash(setConnection(lis)) 68 return redirect(url_for('vehicle',veh_no=veh_no))69@app.route('/permit/<veh_no>', methods=['POST'])70def permit(veh_no):71 if request.method == 'POST': 72 lis = ["write_permits",veh_no,request.form["pno"],request.form["validf"],request.form["validu"],request.form["cost"]]73 flash(setConnection(lis)) 74 return redirect(url_for('vehicle',veh_no=veh_no))75@app.route('/loan/<veh_no>', methods=['POST'])76def loan(veh_no):77 if request.method == 'POST':78 lis = ["write_loans",veh_no,request.form["lno"],request.form["costt"],request.form["lcomp"],request.form["dur"],request.form["intr"]]79 flash(setConnection(lis)) 80 return redirect(url_for('vehicle',veh_no=veh_no))81@app.route('/maintenance/<veh_no>', methods=['POST'])82def maintenance(veh_no):83 if request.method == 'POST': 84 lis = ["write_maintenance",veh_no,request.form["rmk"],request.form["plc"],request.form["cost"],request.form["vend"],request.form["dom"]]85 flash(setConnection(lis)) 86 return redirect(url_for('vehicle',veh_no=veh_no))87 88@app.route('/tax/<veh_no>', methods=['POST'])89def tax(veh_no):90 if request.method == 'POST':91 lis = ["write_taxes",veh_no,request.form["tno"],request.form["validf"],request.form["validu"],request.form["cost"]]92 flash(setConnection(lis)) 93 return redirect(url_for('vehicle',veh_no=veh_no))94@app.route('/add_customer/', methods=['POST'])95def add_customer():96 if request.method == 'POST':97 lis = ["write_customers",request.form["Cus_name"],request.form["Comp_name"],request.form["Cus_contact"],request.form["Cus_address"]]98 flash(setConnection(lis)) 99 return redirect(url_for('index'))100@app.route('/add_driver/', methods=['POST'])101def add_driver():102 if request.method == 'POST':103 lis = ["write_drivers",request.form["driver_name"],request.form["License_no"],request.form["contact_no"]]104 flash(setConnection(lis)) 105 return redirect(url_for('index'))106@app.route('/add_vehicle/', methods=['POST'])107def add_vehicle():108 if request.method == 'POST':109 lis = ["write_vehicles",request.form["veh_no"],request.form["chassis_no"],request.form["vehicle_class"],request.form["vehicle_capacity"]]110 flash(setConnection(lis))111 return redirect(url_for('index'))112@app.route('/add_dependent/<driver_id>', methods=['POST'])113def add_dependent(driver_id):114 if request.method == 'POST':115 lis = ["write_dependents",driver_id,request.form["nm"],request.form["rel"],request.form["cnt"]]116 flash(setConnection(lis)) 117 return redirect(url_for('driver',driver_id=driver_id))118@app.route('/add_salary/<driver_id>', methods=['POST'])119def add_salary(driver_id):120 if request.method == 'POST':121 lis = ["write_salary",driver_id,request.form["salary"]]122 flash(setConnection(lis)) 123 return redirect(url_for('driver',driver_id=driver_id))124@app.route('/pay_loan/<veh_no>/<loan_no>', methods=['POST'])125def pay_loan(veh_no,loan_no):126 if request.method == 'POST':127 lis = ["write_loanPayRegister",loan_no,request.form["emi"]]128 flash(setConnection(lis)) 129 return redirect(url_for('vehicle',veh_no=veh_no))130@app.route('/')131def index():132 vehicles=setConnection(["read_vehicles"])133 drivers=setConnection(["read_drivers"])134 customers=setConnection(["read_customers"])135 return render_template('Mainboot.html',vehicles=vehicles,drivers=drivers,customers=customers)136@app.route('/driver/<driver_id>')137def driver(driver_id):138 driver=setConnection(["read_driver",driver_id])139 dependents=setConnection(["read_dependents",driver_id])140 return render_template('Driver.html',driver=driver,dependents=dependents)141@app.route('/vehicle/<veh_no>')142def vehicle(veh_no):143 vehicle=setConnection(["read_vehicle",veh_no])144 customers=setConnection(["read_customers"])145 tripDetail=setConnection(["read_tripDetails",veh_no])146 loanProgress=setConnection(["read_loans",veh_no])147 loanStatus=setConnection(["read_loanStatus",veh_no])148 status=setConnection(["read_trips",veh_no])149 status.append(0)150 loanProgress.append(0)151 return render_template('Vehicle.html',loanStatus=loanStatus,loanProgress=loanProgress,vehicle=vehicle,customers=customers,tripDetail=tripDetail,status=status)152if __name__ == '__main__':...

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