How to use translate_in method in SeleniumBase

Best Python code snippet using SeleniumBase

arm_cart_control_gui.py

Source:arm_cart_control_gui.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2# Form implementation generated from reading ui file 'arm_cart_control_gui.ui'3#4# Created: Mon Jan 30 02:05:49 20125# by: PyQt4 UI code generator 4.7.26#7# WARNING! All changes made in this file will be lost!8from PyQt4 import QtCore, QtGui9class Ui_Frame(object):10 def setupUi(self, Frame):11 Frame.setObjectName("Frame")12 Frame.resize(702, 476)13 Frame.setFrameShape(QtGui.QFrame.StyledPanel)14 Frame.setFrameShadow(QtGui.QFrame.Raised)15 self.layoutWidget = QtGui.QWidget(Frame)16 self.layoutWidget.setGeometry(QtCore.QRect(360, 20, 321, 311))17 self.layoutWidget.setObjectName("layoutWidget")18 self.gridLayout_2 = QtGui.QGridLayout(self.layoutWidget)19 self.gridLayout_2.setObjectName("gridLayout_2")20 self.translate_out = QtGui.QPushButton(self.layoutWidget)21 sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)22 sizePolicy.setHorizontalStretch(0)23 sizePolicy.setVerticalStretch(0)24 sizePolicy.setHeightForWidth(self.translate_out.sizePolicy().hasHeightForWidth())25 self.translate_out.setSizePolicy(sizePolicy)26 self.translate_out.setBaseSize(QtCore.QSize(80, 80))27 self.translate_out.setStyleSheet("image: url(:/icons/translate_out.png);\n"28"background-image: url(:/icons/empty.png);")29 self.translate_out.setText("")30 self.translate_out.setObjectName("translate_out")31 self.gridLayout_2.addWidget(self.translate_out, 0, 0, 1, 1)32 self.translate_up = QtGui.QPushButton(self.layoutWidget)33 sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)34 sizePolicy.setHorizontalStretch(0)35 sizePolicy.setVerticalStretch(0)36 sizePolicy.setHeightForWidth(self.translate_up.sizePolicy().hasHeightForWidth())37 self.translate_up.setSizePolicy(sizePolicy)38 self.translate_up.setBaseSize(QtCore.QSize(80, 80))39 self.translate_up.setStyleSheet("image: url(:/icons/translate_up.png);\n"40"background-image: url(:/icons/empty.png);")41 self.translate_up.setText("")42 self.translate_up.setObjectName("translate_up")43 self.gridLayout_2.addWidget(self.translate_up, 0, 1, 1, 1)44 self.translate_in = QtGui.QPushButton(self.layoutWidget)45 sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)46 sizePolicy.setHorizontalStretch(0)47 sizePolicy.setVerticalStretch(0)48 sizePolicy.setHeightForWidth(self.translate_in.sizePolicy().hasHeightForWidth())49 self.translate_in.setSizePolicy(sizePolicy)50 self.translate_in.setBaseSize(QtCore.QSize(80, 80))51 self.translate_in.setStyleSheet("image: url(:/icons/translate_in.png);\n"52"background-image: url(:/icons/empty.png);")53 self.translate_in.setText("")54 self.translate_in.setObjectName("translate_in")55 self.gridLayout_2.addWidget(self.translate_in, 0, 2, 1, 1)56 self.translate_left = QtGui.QPushButton(self.layoutWidget)57 sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)58 sizePolicy.setHorizontalStretch(0)59 sizePolicy.setVerticalStretch(0)60 sizePolicy.setHeightForWidth(self.translate_left.sizePolicy().hasHeightForWidth())61 self.translate_left.setSizePolicy(sizePolicy)62 self.translate_left.setBaseSize(QtCore.QSize(80, 80))63 self.translate_left.setStyleSheet("image: url(:/icons/translate_left.png);\n"64"background-image: url(:/icons/empty.png);")65 self.translate_left.setText("")66 self.translate_left.setObjectName("translate_left")67 self.gridLayout_2.addWidget(self.translate_left, 1, 0, 1, 1)68 self.translate_right = QtGui.QPushButton(self.layoutWidget)69 sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)70 sizePolicy.setHorizontalStretch(0)71 sizePolicy.setVerticalStretch(0)72 sizePolicy.setHeightForWidth(self.translate_right.sizePolicy().hasHeightForWidth())73 self.translate_right.setSizePolicy(sizePolicy)74 self.translate_right.setBaseSize(QtCore.QSize(80, 80))75 self.translate_right.setStyleSheet("image: url(:/icons/translate_right.png);\n"76"background-image: url(:/icons/empty.png);")77 self.translate_right.setText("")78 self.translate_right.setObjectName("translate_right")79 self.gridLayout_2.addWidget(self.translate_right, 1, 2, 1, 1)80 self.translate_down = QtGui.QPushButton(self.layoutWidget)81 sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)82 sizePolicy.setHorizontalStretch(0)83 sizePolicy.setVerticalStretch(0)84 sizePolicy.setHeightForWidth(self.translate_down.sizePolicy().hasHeightForWidth())85 self.translate_down.setSizePolicy(sizePolicy)86 self.translate_down.setBaseSize(QtCore.QSize(80, 80))87 self.translate_down.setStyleSheet("image: url(:/icons/translate_down.png);\n"88"background-image: url(:/icons/empty.png);")89 self.translate_down.setText("")90 self.translate_down.setObjectName("translate_down")91 self.gridLayout_2.addWidget(self.translate_down, 2, 1, 1, 1)92 self.frame = QtGui.QComboBox(Frame)93 self.frame.setGeometry(QtCore.QRect(420, 350, 261, 31))94 self.frame.setEditable(True)95 self.frame.setObjectName("frame")96 self.label_2 = QtGui.QLabel(Frame)97 self.label_2.setGeometry(QtCore.QRect(330, 350, 71, 31))98 self.label_2.setStyleSheet("font: 16pt;")99 self.label_2.setObjectName("label_2")100 self.widget = QtGui.QWidget(Frame)101 self.widget.setGeometry(QtCore.QRect(20, 20, 321, 311))102 self.widget.setObjectName("widget")103 self.gridLayout = QtGui.QGridLayout(self.widget)104 self.gridLayout.setObjectName("gridLayout")105 self.rotate_x_pos = QtGui.QPushButton(self.widget)106 sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)107 sizePolicy.setHorizontalStretch(0)108 sizePolicy.setVerticalStretch(0)109 sizePolicy.setHeightForWidth(self.rotate_x_pos.sizePolicy().hasHeightForWidth())110 self.rotate_x_pos.setSizePolicy(sizePolicy)111 self.rotate_x_pos.setBaseSize(QtCore.QSize(80, 80))112 self.rotate_x_pos.setStyleSheet("image: url(:/icons/roate_x_neg.png);\n"113"background-image: url(:/icons/empty.png);")114 self.rotate_x_pos.setText("")115 self.rotate_x_pos.setObjectName("rotate_x_pos")116 self.gridLayout.addWidget(self.rotate_x_pos, 0, 0, 1, 1)117 self.rotate_y_pos = QtGui.QPushButton(self.widget)118 sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)119 sizePolicy.setHorizontalStretch(0)120 sizePolicy.setVerticalStretch(0)121 sizePolicy.setHeightForWidth(self.rotate_y_pos.sizePolicy().hasHeightForWidth())122 self.rotate_y_pos.setSizePolicy(sizePolicy)123 self.rotate_y_pos.setBaseSize(QtCore.QSize(80, 80))124 self.rotate_y_pos.setStyleSheet("image: url(:/icons/rotate_y_pos.png);\n"125"background-image: url(:/icons/empty.png);")126 self.rotate_y_pos.setText("")127 self.rotate_y_pos.setObjectName("rotate_y_pos")128 self.gridLayout.addWidget(self.rotate_y_pos, 0, 1, 1, 1)129 self.rotate_x_neg = QtGui.QPushButton(self.widget)130 sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)131 sizePolicy.setHorizontalStretch(0)132 sizePolicy.setVerticalStretch(0)133 sizePolicy.setHeightForWidth(self.rotate_x_neg.sizePolicy().hasHeightForWidth())134 self.rotate_x_neg.setSizePolicy(sizePolicy)135 self.rotate_x_neg.setBaseSize(QtCore.QSize(80, 80))136 self.rotate_x_neg.setStyleSheet("image: url(:/icons/roate_x_pos.png);\n"137"background-image: url(:/icons/empty.png);")138 self.rotate_x_neg.setText("")139 self.rotate_x_neg.setObjectName("rotate_x_neg")140 self.gridLayout.addWidget(self.rotate_x_neg, 0, 2, 1, 1)141 self.rotate_z_neg = QtGui.QPushButton(self.widget)142 sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)143 sizePolicy.setHorizontalStretch(0)144 sizePolicy.setVerticalStretch(0)145 sizePolicy.setHeightForWidth(self.rotate_z_neg.sizePolicy().hasHeightForWidth())146 self.rotate_z_neg.setSizePolicy(sizePolicy)147 self.rotate_z_neg.setBaseSize(QtCore.QSize(80, 80))148 self.rotate_z_neg.setStyleSheet("image: url(:/icons/rotate_z_neg.png);\n"149"background-image: url(:/icons/empty.png);")150 self.rotate_z_neg.setText("")151 self.rotate_z_neg.setObjectName("rotate_z_neg")152 self.gridLayout.addWidget(self.rotate_z_neg, 1, 0, 1, 1)153 self.rotate_z_pos = QtGui.QPushButton(self.widget)154 sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)155 sizePolicy.setHorizontalStretch(0)156 sizePolicy.setVerticalStretch(0)157 sizePolicy.setHeightForWidth(self.rotate_z_pos.sizePolicy().hasHeightForWidth())158 self.rotate_z_pos.setSizePolicy(sizePolicy)159 self.rotate_z_pos.setBaseSize(QtCore.QSize(80, 80))160 self.rotate_z_pos.setStyleSheet("image: url(:/icons/rotate_z_pos.png);\n"161"background-image: url(:/icons/empty.png);")162 self.rotate_z_pos.setText("")163 self.rotate_z_pos.setObjectName("rotate_z_pos")164 self.gridLayout.addWidget(self.rotate_z_pos, 1, 2, 1, 1)165 self.rotate_y_neg = QtGui.QPushButton(self.widget)166 sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)167 sizePolicy.setHorizontalStretch(0)168 sizePolicy.setVerticalStretch(0)169 sizePolicy.setHeightForWidth(self.rotate_y_neg.sizePolicy().hasHeightForWidth())170 self.rotate_y_neg.setSizePolicy(sizePolicy)171 self.rotate_y_neg.setBaseSize(QtCore.QSize(80, 80))172 self.rotate_y_neg.setStyleSheet("image: url(:/icons/rotate_y_neg.png);\n"173"background-image: url(:/icons/empty.png);")174 self.rotate_y_neg.setText("")175 self.rotate_y_neg.setObjectName("rotate_y_neg")176 self.gridLayout.addWidget(self.rotate_y_neg, 2, 1, 1, 1)177 self.widget1 = QtGui.QWidget(Frame)178 self.widget1.setGeometry(QtCore.QRect(20, 350, 271, 111))179 self.widget1.setObjectName("widget1")180 self.horizontalLayout = QtGui.QHBoxLayout(self.widget1)181 self.horizontalLayout.setObjectName("horizontalLayout")182 self.label = QtGui.QLabel(self.widget1)183 self.label.setStyleSheet("font: 20pt;")184 self.label.setObjectName("label")185 self.horizontalLayout.addWidget(self.label)186 self.arm_left = QtGui.QPushButton(self.widget1)187 sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)188 sizePolicy.setHorizontalStretch(0)189 sizePolicy.setVerticalStretch(0)190 sizePolicy.setHeightForWidth(self.arm_left.sizePolicy().hasHeightForWidth())191 self.arm_left.setSizePolicy(sizePolicy)192 self.arm_left.setBaseSize(QtCore.QSize(80, 80))193 self.arm_left.setStyleSheet("image: url(:/icons/arm_left_off.png);\n"194"background-image: url(:/icons/empty.png);")195 self.arm_left.setObjectName("arm_left")196 self.horizontalLayout.addWidget(self.arm_left)197 self.arm_right = QtGui.QPushButton(self.widget1)198 sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)199 sizePolicy.setHorizontalStretch(0)200 sizePolicy.setVerticalStretch(0)201 sizePolicy.setHeightForWidth(self.arm_right.sizePolicy().hasHeightForWidth())202 self.arm_right.setSizePolicy(sizePolicy)203 self.arm_right.setBaseSize(QtCore.QSize(80, 80))204 self.arm_right.setStyleSheet("image: url(:/icons/arm_right_off.png);\n"205"background-image: url(:/icons/empty.png);")206 self.arm_right.setObjectName("arm_right")207 self.horizontalLayout.addWidget(self.arm_right)208 self.retranslateUi(Frame)209 QtCore.QMetaObject.connectSlotsByName(Frame)210 def retranslateUi(self, Frame):211 Frame.setWindowTitle(QtGui.QApplication.translate("Frame", "Frame", None, QtGui.QApplication.UnicodeUTF8))212 self.label_2.setText(QtGui.QApplication.translate("Frame", "Frame", None, QtGui.QApplication.UnicodeUTF8))213 self.label.setText(QtGui.QApplication.translate("Frame", "Arm", None, QtGui.QApplication.UnicodeUTF8))214 self.arm_left.setText(QtGui.QApplication.translate("Frame", "Left Arm", None, QtGui.QApplication.UnicodeUTF8))215 self.arm_right.setText(QtGui.QApplication.translate("Frame", "Right Arm", None, QtGui.QApplication.UnicodeUTF8))...

Full Screen

Full Screen

translate.py

Source:translate.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2# Form implementation generated from reading ui file 'translate.ui'3#4# Created by: PyQt5 UI code generator 5.13.15#6# WARNING! All changes made in this file will be lost!7from PyQt5 import QtCore, QtGui, QtWidgets8class Ui_MainWindow(object):9 def setupUi(self, MainWindow):10 MainWindow.setObjectName("MainWindow")11 MainWindow.resize(938, 537)12 self.centralwidget = QtWidgets.QWidget(MainWindow)13 self.centralwidget.setObjectName("centralwidget")14 self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)15 self.gridLayout.setObjectName("gridLayout")16 self.horizontalLayout = QtWidgets.QHBoxLayout()17 self.horizontalLayout.setContentsMargins(-1, 30, -1, 30)18 self.horizontalLayout.setObjectName("horizontalLayout")19 spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)20 self.horizontalLayout.addItem(spacerItem)21 self.label = QtWidgets.QLabel(self.centralwidget)22 font = QtGui.QFont()23 font.setFamily("微软雅黑")24 font.setPointSize(18)25 self.label.setFont(font)26 self.label.setAlignment(QtCore.Qt.AlignCenter)27 self.label.setObjectName("label")28 self.horizontalLayout.addWidget(self.label)29 spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)30 self.horizontalLayout.addItem(spacerItem1)31 self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1)32 self.horizontalLayout_2 = QtWidgets.QHBoxLayout()33 self.horizontalLayout_2.setObjectName("horizontalLayout_2")34 self.translate_in = QtWidgets.QTextEdit(self.centralwidget)35 font = QtGui.QFont()36 font.setPointSize(14)37 self.translate_in.setFont(font)38 self.translate_in.setObjectName("translate_in")39 self.horizontalLayout_2.addWidget(self.translate_in)40 spacerItem2 = QtWidgets.QSpacerItem(5, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)41 self.horizontalLayout_2.addItem(spacerItem2)42 self.translate_out = QtWidgets.QTextEdit(self.centralwidget)43 font = QtGui.QFont()44 font.setPointSize(14)45 self.translate_out.setFont(font)46 self.translate_out.setReadOnly(True)47 self.translate_out.setObjectName("translate_out")48 self.horizontalLayout_2.addWidget(self.translate_out)49 self.gridLayout.addLayout(self.horizontalLayout_2, 1, 0, 1, 1)50 self.horizontalLayout_3 = QtWidgets.QHBoxLayout()51 self.horizontalLayout_3.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint)52 self.horizontalLayout_3.setObjectName("horizontalLayout_3")53 spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)54 self.horizontalLayout_3.addItem(spacerItem3)55 self.translate_button = QtWidgets.QPushButton(self.centralwidget)56 font = QtGui.QFont()57 font.setPointSize(15)58 self.translate_button.setFont(font)59 self.translate_button.setObjectName("translate_button")60 self.horizontalLayout_3.addWidget(self.translate_button, 0, QtCore.Qt.AlignLeft)61 spacerItem4 = QtWidgets.QSpacerItem(80, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)62 self.horizontalLayout_3.addItem(spacerItem4)63 self.copy_text_button = QtWidgets.QPushButton(self.centralwidget)64 sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)65 sizePolicy.setHorizontalStretch(0)66 sizePolicy.setVerticalStretch(0)67 sizePolicy.setHeightForWidth(self.copy_text_button.sizePolicy().hasHeightForWidth())68 self.copy_text_button.setSizePolicy(sizePolicy)69 font = QtGui.QFont()70 font.setPointSize(16)71 self.copy_text_button.setFont(font)72 self.copy_text_button.setObjectName("copy_text_button")73 self.horizontalLayout_3.addWidget(self.copy_text_button)74 spacerItem5 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)75 self.horizontalLayout_3.addItem(spacerItem5)76 self.horizontalLayout_3.setStretch(0, 1)77 self.horizontalLayout_3.setStretch(2, 2)78 self.horizontalLayout_3.setStretch(4, 1)79 self.gridLayout.addLayout(self.horizontalLayout_3, 2, 0, 1, 1)80 MainWindow.setCentralWidget(self.centralwidget)81 self.menuBar = QtWidgets.QMenuBar(MainWindow)82 self.menuBar.setGeometry(QtCore.QRect(0, 0, 938, 23))83 self.menuBar.setObjectName("menuBar")84 MainWindow.setMenuBar(self.menuBar)85 self.retranslateUi(MainWindow)86 self.translate_button.clicked.connect(MainWindow.translateText)87 self.copy_text_button.clicked.connect(MainWindow.copy_text)88 self.translate_in.textChanged.connect(MainWindow.translateText)89 QtCore.QMetaObject.connectSlotsByName(MainWindow)90 def retranslateUi(self, MainWindow):91 _translate = QtCore.QCoreApplication.translate92 MainWindow.setWindowTitle(_translate("MainWindow", "Translate"))93 self.label.setText(_translate("MainWindow", "Tea·Urn翻译"))94 self.translate_in.setPlaceholderText(_translate("MainWindow", "请输入要查询的英文或者中文,句子单词均可!"))95 self.translate_button.setText(_translate("MainWindow", "翻译"))...

Full Screen

Full Screen

translator.py

Source:translator.py Github

copy

Full Screen

1import googletrans2def translate_in(lang, filename):3 with open(filename, 'r') as f:4 gt = googletrans.Translator()5 text = f.read()6 return gt.translate(text, lang).text7def append(filename, text):8 with open(filename, 'a', encoding="utf-8") as f:9 f.write("\n" + text)10if __name__ == "__main__":11 fname = r"files_manipulations\files\translate.txt"12 file_translated = r"files_manipulations\files\translated.txt"13 fr = translate_in('fr', fname)14 ko = translate_in('ko', fname)15 pt = translate_in('pt', fname)16 lst = [fr, ko, pt]17 for item in lst:...

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