Best Python code snippet using robotframework-androidlibrary_python
ADBHelper.js
Source:ADBHelper.js
1cordova.define("ADBMobile.ADBHelper", function(require, exports, module) { /*************************************************************************2 *3 * ADOBE CONFIDENTIAL4 * ___________________5 *6 * Copyright 2013 Adobe Systems Incorporated7 * All Rights Reserved.8 *9 * NOTICE: All information contained herein is, and remains10 * the property of Adobe Systems Incorporated and its suppliers,11 * if any. The intellectual and technical concepts contained12 * herein are proprietary to Adobe Systems Incorporated and its13 * suppliers and are protected by trade secret or copyright law.14 * Dissemination of this information or reproduction of this material15 * is strictly forbidden unless prior written permission is obtained16 * from Adobe Systems Incorporated.17 *18 **************************************************************************/19var ADB = (function () {20 var ADB = (typeof exports !== 'undefined') && exports || {};21 22 ADB.doNothing = function () {};23 24 var PLUGIN_NAME = "ADBMobile_PhoneGap";25 var fTRACK_APP_STATE_WITH_CDATA = "myMethod";26 27 ADB.optedIn = 1;28 ADB.optedOut = 2;29 ADB.optUnknown = 3;30 ADB.trackAppState = function (stateName) {31 return cordova.exec(ADB.doNothing, ADB.doNothing, "ADBMobile_PhoneGap", "myMethod", [stateName]);32 };33 34 ADB.getVersion = function(success, fail) {35 return cordova.exec(success, fail, "ADBMobile_PhoneGap", "getVersion", [null]);36 }37 38 ADB.getPrivacyStatus = function(success, fail) {39 return cordova.exec(success, fail, "ADBMobile_PhoneGap", "getPrivacyStatus", [null]);40 }41 42 ADB.setPrivacyStatus = function (privacyStatus) {43 return cordova.exec(ADB.doNothing, ADB.doNothing, "ADBMobile_PhoneGap", "setPrivacyStatus", [privacyStatus]);44 };45 46 ADB.getLifetimeValue = function(success, fail) {47 return cordova.exec(success, fail, "ADBMobile_PhoneGap", "getLifetimeValue", [null]);48 }49 ADB.getUserIdentifier = function(success, fail) {50 return cordova.exec(success, fail, "ADBMobile_PhoneGap", "getUserIdentifier", [null]);51 }52 53 ADB.setUserIdentifier = function (userIdentifier) {54 return cordova.exec(ADB.doNothing, ADB.doNothing, "ADBMobile_PhoneGap", "setUserIdentifier", [userIdentifier]);55 };56 ADB.getDebugLogging = function(success, fail) {57 return cordova.exec(success, fail, "ADBMobile_PhoneGap", "getDebugLogging", [null]);58 }59 ADB.setDebugLogging = function(debugLogging) {60 return cordova.exec(ADB.doNothing, ADB.doNothing, "ADBMobile_PhoneGap", "setDebugLogging", [debugLogging]);61 }62 ADB.keepLifecycleSessionAlive = function(success, fail) {63 return cordova.exec(success, fail, "ADBMobile_PhoneGap", "keepLifecycleSessionAlive", [null]);64 }65 ADB.collectLifecycleData = function(success, fail) {66 return cordova.exec(success, fail, "ADBMobile_PhoneGap", "collectLifecycleData", [null]);67 }68 69 ADB.trackState = function(stateName, cData) {70 return cordova.exec(ADB.doNothing, ADB.doNothing, "ADBMobile_PhoneGap", "trackState", [stateName, cData]);71 }72 ADB.trackAction = function(action, cData) {73 return cordova.exec(ADB.doNothing, ADB.doNothing, "ADBMobile_PhoneGap", "trackAction", [action, cData]);74 }75 76 ADB.trackActionFromBackground = function(action, cData) {77 return cordova.exec(ADB.doNothing, ADB.doNothing, "ADBMobile_PhoneGap", "trackActionFromBackground", [action, cData]);78 }79 ADB.trackLocation = function(lat, long, cData) {80 return cordova.exec(ADB.doNothing, ADB.doNothing, "ADBMobile_PhoneGap", "trackLocation", [lat, long, cData]);81 }82 83 ADB.trackLifetimeValueIncrease = function(amount, cData) {84 return cordova.exec(ADB.doNothing, ADB.doNothing, "ADBMobile_PhoneGap", "trackLifetimeValueIncrease", [amount, cData]);85 }86 ADB.trackTimedActionStart = function(action, cData) {87 return cordova.exec(ADB.doNothing, ADB.doNothing, "ADBMobile_PhoneGap", "trackTimedActionStart", [action, cData]);88 }89 ADB.trackTimedActionUpdate = function(action, cData) {90 return cordova.exec(ADB.doNothing, ADB.doNothing, "ADBMobile_PhoneGap", "trackTimedActionUpdate", [action, cData]);91 }92 ADB.trackTimedActionEnd = function(action) {93 return cordova.exec(ADB.doNothing, ADB.doNothing, "ADBMobile_PhoneGap", "trackTimedActionEnd", [action]);94 }95 ADB.trackingTimedActionExists = function(success, fail, action) {96 return cordova.exec(success, fail, "ADBMobile_PhoneGap", "trackingTimedActionExists", [action]);97 }98 ADB.trackingIdentifier = function(success, fail) {99 return cordova.exec(success, fail, "ADBMobile_PhoneGap", "trackingIdentifier", []);100 }101 ADB.trackingClearQueue = function(success, fail) {102 return cordova.exec(success, fail, "ADBMobile_PhoneGap", "trackingClearQueue", []);103 }104 ADB.trackingGetQueueSize = function(success, fail) {105 return cordova.exec(success, fail, "ADBMobile_PhoneGap", "trackingGetQueueSize", []);106 }107 108 ADB.targetLoadRequest = function(success, fail, name, defaultContent, parameters) {109 return cordova.exec(success, fail, "ADBMobile_PhoneGap", "targetLoadRequest", [name, defaultContent, parameters]);110 }111 ADB.targetLoadOrderConfirmRequest = function(success, fail, name, orderId, orderTotal, productPurchaseId, parameters) {112 return cordova.exec(success, fail, "ADBMobile_PhoneGap", "targetLoadOrderConfirmRequest", [name, orderId, orderTotal, productPurchaseId, parameters]);113 }114 return ADB;115}());...
GUI.py
Source:GUI.py
1from tkinter import *2import tkinter.messagebox3'''4funclist=[[ Open , Save , Saveas , Print , Close ]5,[ Redo , Undo , Copy , Cut , Paste , Delete , Deselect , Text , Netname ] 6,[ Zoomin , Zoomout , Zoomfit , Results ]7,[ DCOppoint , ACOppoint , DCSweep , ACsweep , DCTransferfunction , ACTransferfunction ]8,[ Wire , Resistor , Capacitor , Inductor , Ground , Voltagesouce , Currentsouce , Opamp ]9,[ Preferences ]10,[ About]]11'''12root = Tk()13itemlist=[]14# minimum window size15root.minsize(width=500, height=500)16#Canvas17c = Canvas(root,height = 400,width = 500)18saveicon = PhotoImage(file="Resources/Icons/save.png")19newicon = PhotoImage(file="Resources/Icons/new.png")20resicon = PhotoImage(file="Resources/Icons/Res(2).png")21ressym = PhotoImage(file = "Resources/Icons/Res.png")22#drag functions23def ddrag(event):24 print("catch")25 #print(w.find_closest(event.x, event.y)[0])26 #if (w.find_closest(event.x, event.y)[0] != cd) :27 global cd28 cd = w.find_closest(event.x, event.y)[0]29def ddrop(event):30 print("relase")31 global cd32 cd = 033#command functions34def Close():35 print("Close")36 root.destroy()37def About():38 print("help yourself")39def donothing():40 41 #rect1 = c.create_rectangle(0,0,50,50, fill = "blue")42 newitem = c.create_image(50,50, image = ressym)43 44 print("nothing")45def newcom():46 global itemlist47 #newitem = c.create_image(50,50, image = ressym)48 newitem = c.create_rectangle(0,0,50,50, fill = "blue")49 itemlist.append(newitem)50def motion(event):51 x, y = event.x, event.y52 print(itemlist[0])53 if cd != 0:54 w.coords(1,event.x, event.y,event.x+(w.coords(1)[2]-w.coords(1)[0]), event.y+(w.coords(1)[2]-w.coords(1)[0]))55 #print('{}, {}'.format(x, y))56 #status = ('{}, {}'.format(x, y))57 58#Toolbar59toolbar = Frame(root,bd =2,relief = RAISED)60new = Button(toolbar,command = donothing,compound=CENTER,image=newicon)61save = Button(toolbar,command = donothing,compound=CENTER,image=saveicon)62resistor = Button(toolbar,command = donothing,compound=CENTER,image=resicon)63new.pack(side = LEFT,padx = 2,pady =2)64save.pack(side = LEFT,padx = 2,pady =2)65resistor.pack(side = LEFT,padx = 2,pady =2)66toolbar.pack(side=TOP,fill = X)67c.pack(fill = X)68#Status bar69statusbar = Label (root , text =("status"),bd = 1, relief = SUNKEN,anchor = W)70statusbar.pack(side = BOTTOM,fill = X)71#command functions list72funclist=[[ donothing , donothing , donothing , donothing , Close ]73,[ donothing , donothing , donothing , donothing , donothing , donothing , donothing , donothing , donothing ] 74,[ donothing , donothing , donothing , donothing ]75,[ donothing , donothing , donothing , donothing , donothing , donothing ]76,[ donothing , newcom , donothing , donothing , donothing , donothing , donothing , donothing ]77,[ donothing ]78,[ About]]79#create menu bar80menu = Menu(root)81root.config(menu=menu)82l = []83menu_commands = [["Open","Save","Save as","Print","Close"]84,["Redo","Undo","Copy","Cut","Paste","Delete","Deselect","Text","Net name"] 85,["Zoom in","Zoom out","Zoom fit","Results"]86,["DC Op point","AC Op point","DC Sweep","AC sweep","DC Transfer function","AC Transfer function"]87,["Wire","Resistor","Capacitor","Inductor","Ground","Voltage souce","Current souce","Opamp"]88,["Preferences"]89,["About"]]90menulist=["File","Edit","View","Simulate","Components","Tools","Help"]91#create menus92for i in range(len(menulist)):93 submenu = Menu(menu)94 l.append(submenu)95#create menu commands96g =097for i in l:98 menu.add_cascade(label = menulist[g],menu = i)99 m = 0100 for n in menu_commands[g]:101 i.add_command(label=n,command = funclist[g][m] )102 m+=1103 g+=1104#105#binding106if (len(itemlist) > 1) :107 c.tag_bind(1,"<Button-1>", ddrag)108 c.tag_bind(1,"<ButtonRelease-1>", ddrop)109root.bind('<Motion>', motion)...
menu.py
Source:menu.py
1# !/usr/bin/python32from tkinter import *3def donothing():4 filewin = Toplevel(root)5 button = Button(filewin, text="Hey Nice Job")6 button.pack()7 8root = Tk()9root.geometry("500x500")10menubar = Menu(root)11filemenu = Menu(menubar, tearoff=0)12filemenu.add_command(label="New", command=donothing)13filemenu.add_command(label="Open", command=donothing)14filemenu.add_command(label="Save", command=donothing)15filemenu.add_command(label="Save as...", command=donothing)16filemenu.add_command(label="Close", command=donothing)17filemenu.add_command(label="Ganesh", command=donothing)18filemenu.add_separator()19filemenu.add_command(label="Exit", command=root.quit)20menubar.add_cascade(label="File", menu=filemenu)21editmenu = Menu(menubar, tearoff=0)22editmenu.add_command(label="Undo", command=donothing)23editmenu.add_separator()24editmenu.add_command(label="Cut", command=donothing)25editmenu.add_command(label="Copy", command=donothing)26editmenu.add_command(label="Paste", command=donothing)27editmenu.add_command(label="Delete", command=donothing)28editmenu.add_command(label="Select All", command=donothing)29menubar.add_cascade(label="Edit", menu=editmenu)30helpmenu = Menu(menubar, tearoff=0)31helpmenu.add_command(label="Help Index", command=donothing)32helpmenu.add_command(label="About...", command=donothing)33menubar.add_cascade(label="Help", menu=helpmenu)34root.config(menu=menubar)...
tuttest.py
Source:tuttest.py
1from Tkinter import *2def donothing():3 filewin = Toplevel(root)4 button = Button(filewin, text="Do nothing button")5 button.pack()6 7root = Tk()8menubar = Menu(root)9filemenu = Menu(menubar, tearoff=0)10filemenu.add_command(label="New", command=donothing)11filemenu.add_command(label="Open", command=donothing)12filemenu.add_command(label="Save", command=donothing)13filemenu.add_command(label="Save as...", command=donothing)14filemenu.add_command(label="Close", command=donothing)1516filemenu.add_separator()1718filemenu.add_command(label="Exit", command=root.quit)19menubar.add_cascade(label="File", menu=filemenu)20editmenu = Menu(menubar, tearoff=0)21editmenu.add_command(label="Undo", command=donothing)2223editmenu.add_separator()2425editmenu.add_command(label="Cut", command=donothing)26editmenu.add_command(label="Copy", command=donothing)27editmenu.add_command(label="Paste", command=donothing)28editmenu.add_command(label="Delete", command=donothing)29editmenu.add_command(label="Select All", command=donothing)3031menubar.add_cascade(label="Edit", menu=editmenu)32helpmenu = Menu(menubar, tearoff=0)33helpmenu.add_command(label="Help Index", command=donothing)34helpmenu.add_command(label="About...", command=donothing)35menubar.add_cascade(label="Help", menu=helpmenu)3637root.config(menu=menubar)
...
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!!