Best Python code snippet using fMBT_python
qfi_ALT.py
Source: qfi_ALT.py
1#!/usr/bin/python32# -*- coding: utf-8 -*-3from PyQt5.QtGui import QTransform4from PyQt5.QtCore import pyqtSignal, QPointF, Qt5from PyQt5.QtSvg import QGraphicsSvgItem6from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QGraphicsItem, QFrame7import math8from qfi import qfi_rc9class qfi_ALT (QGraphicsView):10 viewUpdate = pyqtSignal()11 def __init__(self,winParent):12 QGraphicsView.__init__(self)13 self.winParent=winParent14 self.viewUpdate.connect(self.updateView)15 16 self.m_altitude = 017 self.m_pressure = 2818 self.m_originalHeight = 24019 self.m_originalWidth = 24020 self.m_originalAltCtr = QPointF(120,120)21 self.m_face1Z = -5022 self.m_face2Z = -4023 self.m_face3Z = -3024 self.m_hand1Z = -2025 self.m_hand2Z = -1026 self.m_caseZ = 1027 self.setStyleSheet("background: transparent; border: none");28 self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)29 self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)30 self.setInteractive(False)31 self.m_scene = QGraphicsScene(self)32 33 self.setScene(self.m_scene)34 self.init()35 36 def init (self):37 self.m_scaleX = self.width() / self.m_originalWidth38 self.m_scaleY = self.height() / self.m_originalHeight39 self.m_itemFace_1 = QGraphicsSvgItem(":/qfi/images/alt/alt_face_1.svg")40 self.m_itemFace_1.setCacheMode (QGraphicsItem.NoCache)41 self.m_itemFace_1.setZValue( self.m_face1Z )42 self.m_itemFace_1.setTransform( QTransform.fromScale( self.m_scaleX, self.m_scaleY ), True )43 self.m_itemFace_1.setTransformOriginPoint( self.m_originalAltCtr )44 self.m_scene.addItem (self.m_itemFace_1)45 self.m_itemFace_2 = QGraphicsSvgItem(":/qfi/images/alt/alt_face_2.svg")46 self.m_itemFace_2.setCacheMode (QGraphicsItem.NoCache)47 self.m_itemFace_2.setZValue( self.m_face2Z )48 self.m_itemFace_2.setTransform( QTransform.fromScale( self.m_scaleX, self.m_scaleY ), True )49 self.m_itemFace_2.setTransformOriginPoint( self.m_originalAltCtr )50 self.m_scene.addItem (self.m_itemFace_2)51 self.m_itemFace_3 = QGraphicsSvgItem(":/qfi/images/alt/alt_face_3.svg")52 self.m_itemFace_3.setCacheMode (QGraphicsItem.NoCache)53 self.m_itemFace_3.setZValue( self.m_face3Z )54 self.m_itemFace_3.setTransform( QTransform.fromScale( self.m_scaleX, self.m_scaleY ), True )55 self.m_itemFace_3.setTransformOriginPoint( self.m_originalAltCtr )56 self.m_scene.addItem (self.m_itemFace_3)57 self.m_itemHand_1 = QGraphicsSvgItem(":/qfi/images/alt/alt_hand_1.svg")58 self.m_itemHand_1.setCacheMode (QGraphicsItem.NoCache)59 self.m_itemHand_1.setZValue( self.m_hand1Z )60 self.m_itemHand_1.setTransform( QTransform.fromScale( self.m_scaleX, self.m_scaleY ), True )61 self.m_itemHand_1.setTransformOriginPoint( self.m_originalAltCtr )62 self.m_scene.addItem (self.m_itemHand_1)63 self.m_itemHand_2 = QGraphicsSvgItem(":/qfi/images/alt/alt_hand_2.svg")64 self.m_itemHand_2.setCacheMode (QGraphicsItem.NoCache)65 self.m_itemHand_2.setZValue( self.m_hand2Z )66 self.m_itemHand_2.setTransform( QTransform.fromScale( self.m_scaleX, self.m_scaleY ), True )67 self.m_itemHand_2.setTransformOriginPoint( self.m_originalAltCtr )68 self.m_scene.addItem (self.m_itemHand_2)69 self.m_itemCase = QGraphicsSvgItem(":/qfi/images/alt/alt_case.svg")70 self.m_itemCase.setCacheMode (QGraphicsItem.NoCache)71 self.m_itemCase.setZValue( self.m_caseZ )72 self.m_itemCase.setTransform( QTransform.fromScale( self.m_scaleX, self.m_scaleY ), True )73 self.m_itemCase.setTransformOriginPoint( self.m_originalAltCtr )74 self.m_scene.addItem (self.m_itemCase)75 self.centerOn (self.width()/2, self.height()/2)76 self.updateView()77 def reinit(self):78 if (self.m_scene):79 self.m_scene.clear()80 self.init()81 def update(self):82 self.updateView()83 def setAltitude (self, altitude):84 self.m_altitude = altitude85 def setPressure (self, pressure):86 self.m_pressure = pressure87 if (self.m_pressure < 28):88 self.m_pressure = 2889 if (self.m_pressure > 31.5):90 self.m_pressure = 31.591 def resizeEvent (self, event):92 QGraphicsView.resizeEvent (self,event)93 self.reinit()94 def reset (self):95 self.m_itemFace_1 = None96 self.m_itemFace_2 = None97 self.m_itemFace_3 = None98 self.m_itemHand_1 = None99 self.m_itemHand_2 = None100 self.m_itemCase = None101 self.m_altitude = 0.0102 self.m_pressure = 28.0103 def updateView(self):104 altitude = math.ceil(self.m_altitude + 0.5)105 angleH1 = self.m_altitude * 0.036106 angleH2 = ( altitude % 1000 ) * 0.36107 angleF1 = (self.m_pressure - 28.0 ) * 100.0108 angleF3 = self.m_altitude * 0.0036109 self.m_itemHand_1.setRotation(angleH1)110 self.m_itemHand_2.setRotation(angleH2)111 self.m_itemFace_1.setRotation(- angleF1)112 self.m_itemFace_3.setRotation(angleF3)...
qfi_TC.py
Source: qfi_TC.py
...44 self.m_scaleX = self.width() / self.m_originalWidth;45 self.m_scaleY = self.height() / self.m_originalHeight;46 self.reset();47 self.m_itemBack = QGraphicsSvgItem( ":/qfi/images/tc/tc_back.svg" );48 self.m_itemBack.setCacheMode( QGraphicsItem.NoCache );49 self.m_itemBack.setZValue( self.m_backZ );50 self.m_itemBack.setTransform( QTransform.fromScale( self.m_scaleX, self.m_scaleY ), True );51 self.m_scene.addItem( self.m_itemBack );52 self.m_itemBall = QGraphicsSvgItem( ":/qfi/images/tc/tc_ball.svg" );53 self.m_itemBall.setCacheMode( QGraphicsItem.NoCache );54 self.m_itemBall.setZValue( self.m_ballZ );55 self.m_itemBall.setTransform( QTransform.fromScale( self.m_scaleX, self.m_scaleY ), True );56 self.m_itemBall.setTransformOriginPoint( self.m_originalBallCtr );57 self.m_scene.addItem( self.m_itemBall );58 self.m_itemFace_1 = QGraphicsSvgItem( ":/qfi/images/tc/tc_face_1.svg" );59 self.m_itemFace_1.setCacheMode( QGraphicsItem.NoCache );60 self.m_itemFace_1.setZValue( self.m_face1Z );61 self.m_itemFace_1.setTransform( QTransform.fromScale( self.m_scaleX, self.m_scaleY ), True );62 self.m_scene.addItem( self.m_itemFace_1 );63 self.m_itemFace_2 = QGraphicsSvgItem( ":/qfi/images/tc/tc_face_2.svg" );64 self.m_itemFace_2.setCacheMode( QGraphicsItem.NoCache );65 self.m_itemFace_2.setZValue( self.m_face2Z );66 self.m_itemFace_2.setTransform( QTransform.fromScale( self.m_scaleX, self.m_scaleY ), True );67 self.m_scene.addItem( self.m_itemFace_2 );68 self.m_itemMark = QGraphicsSvgItem( ":/qfi/images/tc/tc_mark.svg" );69 self.m_itemMark.setCacheMode( QGraphicsItem.NoCache );70 self.m_itemMark.setZValue( self.m_markZ );71 self.m_itemMark.setTransform( QTransform.fromScale( self.m_scaleX, self.m_scaleY ), True );72 self.m_itemMark.setTransformOriginPoint( self.m_originalMarkCtr );73 self.m_scene.addItem( self.m_itemMark );74 self.m_itemCase = QGraphicsSvgItem( ":/qfi/images/tc/tc_case.svg" );75 self.m_itemCase.setCacheMode( QGraphicsItem.NoCache );76 self.m_itemCase.setZValue( self.m_caseZ );77 self.m_itemCase.setTransform( QTransform.fromScale( self.m_scaleX, self.m_scaleY ), True );78 self.m_scene.addItem( self.m_itemCase );79 self.centerOn( self.width()/2 , self.height()/2 );80 self.updateView();81 def reinit(self):82 if (self.m_scene):83 self.m_scene.clear()84 self.init()85 def update(self):86 self.updateView()87 def setTurnRate(self, turnRate):88 self.m_turnRate = turnRate;89 if (self.m_turnRate < -6):...
Check out the latest blogs from LambdaTest on this topic:
The purpose of developing test cases is to ensure the application functions as expected for the customer. Test cases provide basic application documentation for every function, feature, and integrated connection. Test case development often detects defects in the design or missing requirements early in the development process. Additionally, well-written test cases provide internal documentation for all application processing. Test case development is an important part of determining software quality and keeping defects away from customers.
Traditional software testers must step up if they want to remain relevant in the Agile environment. Agile will most probably continue to be the leading form of the software development process in the coming years.
With the rising demand for new services and technologies in the IT, manufacturing, healthcare, and financial sector, QA/ DevOps engineering has become the most important part of software companies. Below is a list of some characteristics to look for when interviewing a potential candidate.
Unit testing is typically software testing within the developer domain. As the QA role expands in DevOps, QAOps, DesignOps, or within an Agile team, QA testers often find themselves creating unit tests. QA testers may create unit tests within the code using a specified unit testing tool, or independently using a variety of methods.
In my last blog, I investigated both the stateless and the stateful class of model-based testing. Both have some advantages and disadvantages. You can use them for different types of systems, depending on whether a stateful solution is required or a stateless one is enough. However, a better solution is to use an aggregate technique that is appropriate for each system. Currently, the only aggregate solution is action-state testing, introduced in the book Paradigm Shift in Software Testing. This method is implemented in Harmony.
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!