How to use pinchin method in ATX

Best Python code snippet using ATX

toolkit.py

Source:toolkit.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2################################################################################3## Form generated from reading UI file 'toolkit_ui.ui'4##5## Created by: Qt User Interface Compiler version 5.15.06##7## WARNING! All changes made in this file will be lost when recompiling UI file!8################################################################################9from PySide2.QtCore import (QCoreApplication, QDate, QDateTime, QMetaObject,10 QObject, QPoint, QRect, QSize, QTime, QUrl, Qt)11from PySide2.QtGui import (QBrush, QColor, QConicalGradient, QCursor, QFont,12 QFontDatabase, QIcon, QKeySequence, QLinearGradient, QPalette, QPainter,13 QPixmap, QRadialGradient)14from PySide2.QtWidgets import *15from . import rsrc_rc16class Ui_ToolbarPanel(object):17 def setupUi(self, ToolbarPanel):18 if not ToolbarPanel.objectName():19 ToolbarPanel.setObjectName(u"ToolbarPanel")20 ToolbarPanel.resize(30, 600)21 sizePolicy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)22 sizePolicy.setHorizontalStretch(0)23 sizePolicy.setVerticalStretch(0)24 sizePolicy.setHeightForWidth(ToolbarPanel.sizePolicy().hasHeightForWidth())25 ToolbarPanel.setSizePolicy(sizePolicy)26 ToolbarPanel.setMinimumSize(QSize(30, 337))27 ToolbarPanel.setMaximumSize(QSize(30, 600))28 ToolbarPanel.setBaseSize(QSize(30, 403))29 ToolbarPanel.setWindowTitle(u"guiscrcpy")30 icon = QIcon()31 icon.addFile(u":/res/ui/guiscrcpy_logo.png", QSize(), QIcon.Normal, QIcon.Off)32 ToolbarPanel.setWindowIcon(icon)33 ToolbarPanel.setWindowOpacity(1.000000000000000)34 ToolbarPanel.setStyleSheet(u"QDialog{\n"35"width: 30px\n"36"}\n"37"QPushButton {\n"38" \n"39"\n"40"border-radius: 1px;\n"41" background-color: qlineargradient(spread:pad, x1:0, y1:0.915182, x2:0, y2:0.926, stop:0.897059 rgba(41, 41, 41, 255), stop:1 rgba(30, 30, 30, 255));\n"42"color: rgb(0, 0, 0);\n"43" \n"44" }\n"45"\n"46"QPushButton:pressed {\n"47"border-radius: 5px;\n"48" \n"49"background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(0, 255, 255, 255), stop:1 rgba(0, 255, 152, 255));\n"50"color: rgb(0, 0, 0);\n"51" }\n"52"QPushButton:hover {\n"53"border-radius: 5px;\n"54" \n"55" background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(0, 199, 199, 255), stop:1 rgba(0, 190, 113, 255));\n"56"color: rgb(0, 0, 0);\n"57" }\n"58"")59 self.layoutWidget = QWidget(ToolbarPanel)60 self.layoutWidget.setObjectName(u"layoutWidget")61 self.layoutWidget.setGeometry(QRect(0, 0, 33, 601))62 self.verticalLayout = QVBoxLayout(self.layoutWidget)63 self.verticalLayout.setSpacing(0)64 self.verticalLayout.setMargin(0)65 self.verticalLayout.setObjectName(u"verticalLayout")66 self.verticalLayout.setSizeConstraint(QLayout.SetMaximumSize)67 self.verticalLayout.setContentsMargins(0, 0, 0, 0)68 self.screenfreeze = QPushButton(self.layoutWidget)69 self.screenfreeze.setObjectName(u"screenfreeze")70 self.screenfreeze.setEnabled(True)71 sizePolicy1 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)72 sizePolicy1.setHorizontalStretch(0)73 sizePolicy1.setVerticalStretch(0)74 sizePolicy1.setHeightForWidth(self.screenfreeze.sizePolicy().hasHeightForWidth())75 self.screenfreeze.setSizePolicy(sizePolicy1)76 self.screenfreeze.setMouseTracking(True)77 self.screenfreeze.setTabletTracking(True)78 self.screenfreeze.setAutoFillBackground(False)79 self.screenfreeze.setStyleSheet(u"")80 icon1 = QIcon()81 icon1.addFile(u":/icons/icons/cross-mark-on-a-black-circle-background.svg", QSize(), QIcon.Normal, QIcon.Off)82 self.screenfreeze.setIcon(icon1)83 self.screenfreeze.setFlat(True)84 self.verticalLayout.addWidget(self.screenfreeze)85 self.fullscreenUI = QPushButton(self.layoutWidget)86 self.fullscreenUI.setObjectName(u"fullscreenUI")87 self.fullscreenUI.setEnabled(True)88 sizePolicy1.setHeightForWidth(self.fullscreenUI.sizePolicy().hasHeightForWidth())89 self.fullscreenUI.setSizePolicy(sizePolicy1)90 self.fullscreenUI.setMouseTracking(True)91 self.fullscreenUI.setTabletTracking(True)92 self.fullscreenUI.setAutoFillBackground(False)93 self.fullscreenUI.setStyleSheet(u"")94 icon2 = QIcon()95 icon2.addFile(u":/icons/icons/increase-size-option.svg", QSize(), QIcon.Normal, QIcon.Off)96 self.fullscreenUI.setIcon(icon2)97 self.fullscreenUI.setFlat(True)98 self.verticalLayout.addWidget(self.fullscreenUI)99 self.notif_pull = QPushButton(self.layoutWidget)100 self.notif_pull.setObjectName(u"notif_pull")101 self.notif_pull.setEnabled(True)102 sizePolicy1.setHeightForWidth(self.notif_pull.sizePolicy().hasHeightForWidth())103 self.notif_pull.setSizePolicy(sizePolicy1)104 self.notif_pull.setMouseTracking(True)105 self.notif_pull.setTabletTracking(True)106 self.notif_pull.setAutoFillBackground(False)107 self.notif_pull.setStyleSheet(u"")108 icon3 = QIcon()109 icon3.addFile(u":/icons/icons/bell-musical-tool.svg", QSize(), QIcon.Normal, QIcon.Off)110 self.notif_pull.setIcon(icon3)111 self.notif_pull.setFlat(True)112 self.verticalLayout.addWidget(self.notif_pull)113 self.notif_collapse = QPushButton(self.layoutWidget)114 self.notif_collapse.setObjectName(u"notif_collapse")115 self.notif_collapse.setEnabled(True)116 sizePolicy1.setHeightForWidth(self.notif_collapse.sizePolicy().hasHeightForWidth())117 self.notif_collapse.setSizePolicy(sizePolicy1)118 self.notif_collapse.setMouseTracking(True)119 self.notif_collapse.setTabletTracking(True)120 self.notif_collapse.setAutoFillBackground(False)121 self.notif_collapse.setStyleSheet(u"")122 icon4 = QIcon()123 icon4.addFile(u":/icons/icons/bell-musical-tool(2).svg", QSize(), QIcon.Normal, QIcon.Off)124 self.notif_collapse.setIcon(icon4)125 self.notif_collapse.setFlat(True)126 self.verticalLayout.addWidget(self.notif_collapse)127 self.clipD2PC = QPushButton(self.layoutWidget)128 self.clipD2PC.setObjectName(u"clipD2PC")129 self.clipD2PC.setEnabled(True)130 sizePolicy1.setHeightForWidth(self.clipD2PC.sizePolicy().hasHeightForWidth())131 self.clipD2PC.setSizePolicy(sizePolicy1)132 self.clipD2PC.setMouseTracking(True)133 self.clipD2PC.setTabletTracking(True)134 self.clipD2PC.setAutoFillBackground(False)135 self.clipD2PC.setStyleSheet(u"")136 icon5 = QIcon()137 icon5.addFile(u":/icons/icons/copy-document.svg", QSize(), QIcon.Normal, QIcon.Off)138 self.clipD2PC.setIcon(icon5)139 self.clipD2PC.setFlat(True)140 self.verticalLayout.addWidget(self.clipD2PC)141 self.clipPC2D = QPushButton(self.layoutWidget)142 self.clipPC2D.setObjectName(u"clipPC2D")143 self.clipPC2D.setEnabled(True)144 sizePolicy1.setHeightForWidth(self.clipPC2D.sizePolicy().hasHeightForWidth())145 self.clipPC2D.setSizePolicy(sizePolicy1)146 self.clipPC2D.setMouseTracking(True)147 self.clipPC2D.setTabletTracking(True)148 self.clipPC2D.setAutoFillBackground(False)149 self.clipPC2D.setStyleSheet(u"")150 icon6 = QIcon()151 icon6.addFile(u":/icons/icons/copy-document(1).svg", QSize(), QIcon.Normal, QIcon.Off)152 self.clipPC2D.setIcon(icon6)153 self.clipPC2D.setFlat(True)154 self.verticalLayout.addWidget(self.clipPC2D)155 self.vup = QPushButton(self.layoutWidget)156 self.vup.setObjectName(u"vup")157 self.vup.setEnabled(True)158 sizePolicy1.setHeightForWidth(self.vup.sizePolicy().hasHeightForWidth())159 self.vup.setSizePolicy(sizePolicy1)160 self.vup.setMouseTracking(True)161 self.vup.setTabletTracking(True)162 self.vup.setAutoFillBackground(False)163 self.vup.setStyleSheet(u"")164 icon7 = QIcon()165 icon7.addFile(u":/icons/icons/volume-up-interface-symbol.svg", QSize(), QIcon.Normal, QIcon.Off)166 self.vup.setIcon(icon7)167 self.vup.setFlat(True)168 self.verticalLayout.addWidget(self.vup)169 self.vdown = QPushButton(self.layoutWidget)170 self.vdown.setObjectName(u"vdown")171 self.vdown.setEnabled(True)172 sizePolicy1.setHeightForWidth(self.vdown.sizePolicy().hasHeightForWidth())173 self.vdown.setSizePolicy(sizePolicy1)174 self.vdown.setMouseTracking(True)175 self.vdown.setTabletTracking(True)176 self.vdown.setAutoFillBackground(False)177 self.vdown.setStyleSheet(u"")178 icon8 = QIcon()179 icon8.addFile(u":/icons/icons/reduced-volume.svg", QSize(), QIcon.Normal, QIcon.Off)180 self.vdown.setIcon(icon8)181 self.vdown.setFlat(True)182 self.verticalLayout.addWidget(self.vdown)183 self.powerUI = QPushButton(self.layoutWidget)184 self.powerUI.setObjectName(u"powerUI")185 self.powerUI.setEnabled(True)186 sizePolicy1.setHeightForWidth(self.powerUI.sizePolicy().hasHeightForWidth())187 self.powerUI.setSizePolicy(sizePolicy1)188 self.powerUI.setMouseTracking(True)189 self.powerUI.setTabletTracking(True)190 self.powerUI.setAutoFillBackground(False)191 self.powerUI.setStyleSheet(u"")192 icon9 = QIcon()193 icon9.addFile(u":/icons/icons/power.svg", QSize(), QIcon.Normal, QIcon.Off)194 self.powerUI.setIcon(icon9)195 self.powerUI.setIconSize(QSize(16, 16))196 self.powerUI.setCheckable(False)197 self.powerUI.setFlat(True)198 self.verticalLayout.addWidget(self.powerUI)199 self.home = QPushButton(self.layoutWidget)200 self.home.setObjectName(u"home")201 self.home.setEnabled(True)202 sizePolicy1.setHeightForWidth(self.home.sizePolicy().hasHeightForWidth())203 self.home.setSizePolicy(sizePolicy1)204 self.home.setMouseTracking(True)205 self.home.setTabletTracking(True)206 self.home.setAutoFillBackground(False)207 self.home.setStyleSheet(u"")208 icon10 = QIcon()209 icon10.addFile(u":/icons/icons/home.svg", QSize(), QIcon.Normal, QIcon.Off)210 self.home.setIcon(icon10)211 self.home.setFlat(True)212 self.verticalLayout.addWidget(self.home)213 self.back = QPushButton(self.layoutWidget)214 self.back.setObjectName(u"back")215 self.back.setEnabled(True)216 sizePolicy1.setHeightForWidth(self.back.sizePolicy().hasHeightForWidth())217 self.back.setSizePolicy(sizePolicy1)218 self.back.setMouseTracking(True)219 self.back.setTabletTracking(True)220 self.back.setAutoFillBackground(False)221 self.back.setStyleSheet(u"")222 icon11 = QIcon()223 icon11.addFile(u":/icons/icons/chevron-sign-left.svg", QSize(), QIcon.Normal, QIcon.Off)224 self.back.setIcon(icon11)225 self.back.setFlat(True)226 self.verticalLayout.addWidget(self.back)227 self.menuUI = QPushButton(self.layoutWidget)228 self.menuUI.setObjectName(u"menuUI")229 self.menuUI.setEnabled(True)230 sizePolicy1.setHeightForWidth(self.menuUI.sizePolicy().hasHeightForWidth())231 self.menuUI.setSizePolicy(sizePolicy1)232 self.menuUI.setMouseTracking(True)233 self.menuUI.setTabletTracking(True)234 self.menuUI.setAutoFillBackground(False)235 self.menuUI.setStyleSheet(u"")236 icon12 = QIcon()237 icon12.addFile(u":/icons/icons/reorder-option.svg", QSize(), QIcon.Normal, QIcon.Off)238 self.menuUI.setIcon(icon12)239 self.menuUI.setFlat(True)240 self.verticalLayout.addWidget(self.menuUI)241 self.appswi = QPushButton(self.layoutWidget)242 self.appswi.setObjectName(u"appswi")243 self.appswi.setEnabled(True)244 sizePolicy1.setHeightForWidth(self.appswi.sizePolicy().hasHeightForWidth())245 self.appswi.setSizePolicy(sizePolicy1)246 self.appswi.setMouseTracking(True)247 self.appswi.setTabletTracking(True)248 self.appswi.setAutoFillBackground(False)249 self.appswi.setStyleSheet(u"")250 icon13 = QIcon()251 icon13.addFile(u":/icons/icons/four-black-squares.svg", QSize(), QIcon.Normal, QIcon.Off)252 self.appswi.setIcon(icon13)253 self.appswi.setFlat(True)254 self.verticalLayout.addWidget(self.appswi)255 self.pinchinUI = QPushButton(self.layoutWidget)256 self.pinchinUI.setObjectName(u"pinchinUI")257 self.pinchinUI.setEnabled(False)258 sizePolicy1.setHeightForWidth(self.pinchinUI.sizePolicy().hasHeightForWidth())259 self.pinchinUI.setSizePolicy(sizePolicy1)260 icon14 = QIcon()261 icon14.addFile(u":/icons/icons/zoom-in.svg", QSize(), QIcon.Normal, QIcon.Off)262 self.pinchinUI.setIcon(icon14)263 self.pinchinUI.setFlat(True)264 self.verticalLayout.addWidget(self.pinchinUI)265 self.pinchoutUI = QPushButton(self.layoutWidget)266 self.pinchoutUI.setObjectName(u"pinchoutUI")267 self.pinchoutUI.setEnabled(False)268 sizePolicy1.setHeightForWidth(self.pinchoutUI.sizePolicy().hasHeightForWidth())269 self.pinchoutUI.setSizePolicy(sizePolicy1)270 icon15 = QIcon()271 icon15.addFile(u":/icons/icons/zoom-out.svg", QSize(), QIcon.Normal, QIcon.Off)272 self.pinchoutUI.setIcon(icon15)273 self.pinchoutUI.setFlat(True)274 self.verticalLayout.addWidget(self.pinchoutUI)275 self.potraitUI = QPushButton(self.layoutWidget)276 self.potraitUI.setObjectName(u"potraitUI")277 self.potraitUI.setEnabled(True)278 sizePolicy1.setHeightForWidth(self.potraitUI.sizePolicy().hasHeightForWidth())279 self.potraitUI.setSizePolicy(sizePolicy1)280 self.potraitUI.setToolTipDuration(2)281 icon16 = QIcon()282 icon16.addFile(u":/icons/icons/vertical-resizing-option.svg", QSize(), QIcon.Normal, QIcon.Off)283 self.potraitUI.setIcon(icon16)284 self.potraitUI.setFlat(True)285 self.verticalLayout.addWidget(self.potraitUI)286 self.landscapeUI = QPushButton(self.layoutWidget)287 self.landscapeUI.setObjectName(u"landscapeUI")288 self.landscapeUI.setEnabled(True)289 sizePolicy1.setHeightForWidth(self.landscapeUI.sizePolicy().hasHeightForWidth())290 self.landscapeUI.setSizePolicy(sizePolicy1)291 self.landscapeUI.setToolTipDuration(2)292 icon17 = QIcon()293 icon17.addFile(u":/icons/icons/horizontal-resize-option.svg", QSize(), QIcon.Normal, QIcon.Off)294 self.landscapeUI.setIcon(icon17)295 self.landscapeUI.setFlat(True)296 self.verticalLayout.addWidget(self.landscapeUI)297 self.tk_device_id = QPushButton(self.layoutWidget)298 self.tk_device_id.setObjectName(u"tk_device_id")299 self.tk_device_id.setEnabled(True)300 sizePolicy1.setHeightForWidth(self.tk_device_id.sizePolicy().hasHeightForWidth())301 self.tk_device_id.setSizePolicy(sizePolicy1)302 self.tk_device_id.setMinimumSize(QSize(0, 2))303 self.tk_device_id.setMaximumSize(QSize(16777215, 20))304 self.tk_device_id.setToolTipDuration(2)305 self.tk_device_id.setFlat(True)306 self.verticalLayout.addWidget(self.tk_device_id)307 self.label_2 = QLabel(self.layoutWidget)308 self.label_2.setObjectName(u"label_2")309 sizePolicy2 = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)310 sizePolicy2.setHorizontalStretch(0)311 sizePolicy2.setVerticalStretch(0)312 sizePolicy2.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth())313 self.label_2.setSizePolicy(sizePolicy2)314 font = QFont()315 font.setFamily(u"Noto Sans")316 font.setPointSize(18)317 font.setBold(True)318 font.setWeight(75)319 self.label_2.setFont(font)320 self.label_2.setScaledContents(True)321 self.label_2.setAlignment(Qt.AlignCenter)322 self.verticalLayout.addWidget(self.label_2)323 self.label = QLabel(self.layoutWidget)324 self.label.setObjectName(u"label")325 sizePolicy2.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth())326 self.label.setSizePolicy(sizePolicy2)327 self.label.setFont(font)328 self.label.setScaledContents(True)329 self.label.setAlignment(Qt.AlignCenter)330 self.verticalLayout.addWidget(self.label)331 self.retranslateUi(ToolbarPanel)332 QMetaObject.connectSlotsByName(ToolbarPanel)333 # setupUi334 def retranslateUi(self, ToolbarPanel):335 self.screenfreeze.setText("")336#if QT_CONFIG(tooltip)337 self.fullscreenUI.setToolTip(QCoreApplication.translate("ToolbarPanel", u"Fullscreen", None))338#endif // QT_CONFIG(tooltip)339 self.fullscreenUI.setText("")340#if QT_CONFIG(tooltip)341 self.notif_pull.setToolTip(QCoreApplication.translate("ToolbarPanel", u"Expand notification panel", None))342#endif // QT_CONFIG(tooltip)343 self.notif_pull.setText("")344#if QT_CONFIG(tooltip)345 self.notif_collapse.setToolTip(QCoreApplication.translate("ToolbarPanel", u"Expand notification panel", None))346#endif // QT_CONFIG(tooltip)347 self.notif_collapse.setText("")348#if QT_CONFIG(tooltip)349 self.clipD2PC.setToolTip(QCoreApplication.translate("ToolbarPanel", u"Copy device clipbioard to PC", None))350#endif // QT_CONFIG(tooltip)351 self.clipD2PC.setText("")352#if QT_CONFIG(tooltip)353 self.clipPC2D.setToolTip(QCoreApplication.translate("ToolbarPanel", u"Copy PC clipboard to Device", None))354#endif // QT_CONFIG(tooltip)355 self.clipPC2D.setText("")356#if QT_CONFIG(tooltip)357 self.vup.setToolTip(QCoreApplication.translate("ToolbarPanel", u"Volume Up", None))358#endif // QT_CONFIG(tooltip)359 self.vup.setText("")360 self.vdown.setText("")361#if QT_CONFIG(tooltip)362 self.powerUI.setToolTip(QCoreApplication.translate("ToolbarPanel", u"Power on/off", None))363#endif // QT_CONFIG(tooltip)364 self.powerUI.setText("")365#if QT_CONFIG(tooltip)366 self.home.setToolTip(QCoreApplication.translate("ToolbarPanel", u"Home key", None))367#endif // QT_CONFIG(tooltip)368 self.home.setText("")369#if QT_CONFIG(tooltip)370 self.back.setToolTip(QCoreApplication.translate("ToolbarPanel", u"Back key", None))371#endif // QT_CONFIG(tooltip)372 self.back.setText("")373#if QT_CONFIG(tooltip)374 self.menuUI.setToolTip(QCoreApplication.translate("ToolbarPanel", u"Menu key", None))375#endif // QT_CONFIG(tooltip)376 self.menuUI.setText("")377#if QT_CONFIG(tooltip)378 self.appswi.setToolTip(QCoreApplication.translate("ToolbarPanel", u"press the APP_SWITCH button", None))379#endif // QT_CONFIG(tooltip)380 self.appswi.setText("")381#if QT_CONFIG(tooltip)382 self.pinchinUI.setToolTip(QCoreApplication.translate("ToolbarPanel", u"Pinch in the screen", None))383#endif // QT_CONFIG(tooltip)384 self.pinchinUI.setStyleSheet("")385 self.pinchinUI.setText("")386#if QT_CONFIG(tooltip)387 self.pinchoutUI.setToolTip(QCoreApplication.translate("ToolbarPanel", u"Pinch out in the screen", None))388#endif // QT_CONFIG(tooltip)389 self.pinchoutUI.setStyleSheet("")390 self.pinchoutUI.setText("")391#if QT_CONFIG(tooltip)392 self.potraitUI.setToolTip(QCoreApplication.translate("ToolbarPanel", u"Potrait", None))393#endif // QT_CONFIG(tooltip)394 self.potraitUI.setStyleSheet("")395 self.potraitUI.setText("")396#if QT_CONFIG(tooltip)397 self.landscapeUI.setToolTip(QCoreApplication.translate("ToolbarPanel", u"Landscape", None))398#endif // QT_CONFIG(tooltip)399 self.landscapeUI.setStyleSheet("")400 self.landscapeUI.setText("")401#if QT_CONFIG(tooltip)402 self.tk_device_id.setToolTip(QCoreApplication.translate("ToolbarPanel", u"Landscape", None))403#endif // QT_CONFIG(tooltip)404 self.tk_device_id.setStyleSheet("")405 self.tk_device_id.setText("")406 self.label_2.setText(QCoreApplication.translate("ToolbarPanel", u"....", None))407 self.label.setText(QCoreApplication.translate("ToolbarPanel", u"::::", None))408 pass...

Full Screen

Full Screen

settings.py

Source:settings.py Github

copy

Full Screen

1# -*- coding: utf-8 -*- 2import re3import sys4import time5from lettuce import *6from uiautomator.myDevice import device as d7from lettuce.regex import *8#作者提供的 False为un-freeze rotation有误9#Fasle为打开自动旋转,默认为关闭自动旋转10@step(u'打开自动旋转屏幕$')11def freezeRotation(step):12 d.freeze_rotation(False)13 d.wait.idle()14@step(u'关闭自动旋转屏幕$')15def freezeRotation(step):16 d.freeze_rotation()17 d.wait.idle() 18@step(u'点亮屏幕$')19def screenon(step):20 d.screen.on()21 d.wait.idle() 22@step(u'熄灭屏幕$')23def screenoff(step):24 d.screen.off()25 d.wait.idle() 26 27#保存.xml到相对路径28#用法举例:29#保存在当前lettuce执行目录下,文件名字为layout.xml30# 下载界面结构文件保存为【layout.xml】31# 下载界面结构文件保存为【./layout.xml】32#保存在当前lettuce执行目录下的tools目录下,文件名字为layout.xml33# 下载界面结构文件保存为【tools/layout.xml】34# 下载界面结构文件保存为【./tools/layout.xml】35@step(u'下载界面结构文件保存为【%s】$' % (mode_text))36def dumpHierarchy(step,path):37 d.dump(path)38 d.wait.idle() 39# open notification, can not work until Android 4.3. 40@step(u'打开通知栏$')41def oepnNotification(step):42 d.open("notification")43 d.wait.idle() 44# open quick settings, can not work until Android 4.3. 45@step(u'打开快速设置$')46def oepnQuickSetting(step):47 d.open.quick_settings()48 d.wait.idle()49 50@step(u'等待窗口空闲$')51def waitForIdle(step):52 d.wait.idle()53@step(u'等待窗口空闲超时时间【%s】毫秒$' % (mode_int))54def waitForIdle(step, time):55 d.wait.idle(timeout=time)56#支持页面元素resourceId等57@step(u'清除页面元素【%s】中的文字$' % (mode_pvs))58def clearTextField(step, cond):59 elements = get_dict_from_cond(cond)60 d(**elements).clear_text() 61 d.wait.idle()62@step(u'在页面元素【%s】添加文本【%s】$' % (mode_pvs, mode_text))63def setText(step, cond, text):64 elements = get_dict_from_cond(cond)65 d(**elements).set_text(text)66 d.wait.idle()67 68@step(u'从两点【%s】和【%s】分别滑动至另外两点【%s】和【%s】$' % (mode_position,mode_position,mode_position,mode_position))69def gesture(step, sx1, sy1, sx2, sy2, ex1, ey1, ex2, ey2):70 d(className="android.widget.EditText").gesture((sx1, sy1), (sx2, sy2)) \71 .to((ex1, ey1), (ex2, ey2)) 72 d.wait.idle()73 74# notes : pinch can not be set until Android 4.3.75@step(u'从左右边缘同时滑向中心$')76def pinchIn(step):77 d().pinch.In(percent=100, steps=10)78 d.wait.idle()79@step(u'从中心同时滑向左右两边$')80def pinchOut(step):81 d().pinch.Out(percent=100, steps=10)82 d.wait.idle()83@step(u'分别以左右距边缘位置百分之【%s】处,按照步长【%s】同时滑向中心$' % (mode_int,mode_int))84def pinchIn(step, per, stepcond):85 d().pinch.In(percent=per,steps=stepcond)86 d.wait.idle()87@step(u'从中心以步长【%s】同时滑向左右距边缘位置百分之【%s】处$' % (mode_int,mode_int))88def pinchOut(step, stepcond, per):89 d().pinch.Out(percent=per,steps=stepcond)90 d.wait.idle()91 92@step(u'以页面元素【%s】为范围,从左右边缘同时滑向中心$' % (mode_pvs))93def pinchIn(step, cond):94 elements = get_dict_from_cond(cond)95 d(**elements).pinch.In(percent=100, steps=10)96 d.wait.idle()97@step(u'以页面元素【%s】为范围,从中心同时滑向左右两边$' % (mode_pvs))98def pinchOut(step, cond):99 elements = get_dict_from_cond(cond)100 d(**elements).pinch.Out(percent=100, steps=10)101 d.wait.idle()102 103@step(u'等待【%s】毫秒,不做任何操作$' % (mode_int))104def silent_wait(step, millisec):105 sec = (float(millisec))/1000106 time.sleep(sec)...

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