How to use shell method in lisa

Best Python code snippet using lisa_python

nf-shell.js

Source:nf-shell.js Github

copy

Full Screen

1/*2 * Licensed to the Apache Software Foundation (ASF) under one or more3 * contributor license agreements. See the NOTICE file distributed with4 * this work for additional information regarding copyright ownership.5 * The ASF licenses this file to You under the Apache License, Version 2.06 * (the "License"); you may not use this file except in compliance with7 * the License. You may obtain a copy of the License at8 *9 * http://www.apache.org/licenses/LICENSE-2.010 *11 * Unless required by applicable law or agreed to in writing, software12 * distributed under the License is distributed on an "AS IS" BASIS,13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.14 * See the License for the specific language governing permissions and15 * limitations under the License.16 */17/* global nf */18$(document).ready(function () {19 // configure the dialog20 $('#shell-dialog').modal({21 overlayBackground: true22 });23 // register a listener when the frame is closed24 $('#shell-close-button').click(function () {25 // close the shell26 $('#shell-dialog').modal('hide');27 });28 // register a listener when the frame is undocked29 $('#shell-undock-button').click(function () {30 var uri = $('#shell-iframe').attr('src');31 if (!nf.Common.isBlank(uri)) {32 // open the page and close the shell33 window.open(uri);34 // close the shell35 $('#shell-dialog').modal('hide');36 }37 });38 // add hover effects39 nf.Common.addHoverEffect('#shell-undock-button', 'undock-normal', 'undock-hover');40 nf.Common.addHoverEffect('#shell-close-button', 'close-normal', 'close-hover');41});42nf.Shell = (function () {43 return {44 /**45 * Shows a page in the shell.46 * 47 * @argument {string} uri The URI to show48 * @argument {boolean} canUndock Whether or not the shell is undockable49 */50 showPage: function (uri, canUndock) {51 // if the context menu is on this page, attempt to close52 if (nf.Common.isDefinedAndNotNull(nf.ContextMenu)) {53 nf.ContextMenu.hide();54 }55 56 return $.Deferred(function (deferred) {57 var shell = $('#shell');58 // default undockable to true59 if (nf.Common.isNull(canUndock) || nf.Common.isUndefined(canUndock)) {60 canUndock = true;61 }62 // remove the previous contents of the shell63 shell.empty();64 // register a new close handler65 $('#shell-dialog').modal('setHandler', {66 close: function () {67 deferred.resolve();68 }69 });70 // show the custom processor ui71 $('#shell-dialog').modal('show');72 // conditionally show the undock button73 if (canUndock) {74 $('#shell-undock-button').show();75 } else {76 $('#shell-undock-button').hide();77 }78 // create an iframe to hold the custom ui79 var shellIframe = $('<iframe/>', {80 id: 'shell-iframe',81 frameBorder: '0',82 src: uri83 }).css({84 width: shell.width(),85 height: shell.height()86 }).appendTo(shell);87 // add a window resize listener88 $(window).resize(function () {89 shellIframe.css({90 width: shell.width(),91 height: shell.height()92 });93 });94 }).promise();95 },96 97 /**98 * Shows the specified content in the shell. When the shell is closed, the content99 * will be hidden and returned to its previous location in the dom.100 * 101 * @argument {string} domId The id of the element to show in the shell102 */103 showContent: function (domId) {104 // if the context menu is on this page, attempt to close105 if (nf.Common.isDefinedAndNotNull(nf.ContextMenu)) {106 nf.ContextMenu.hide();107 }108 109 return $.Deferred(function (deferred) {110 var content = $(domId);111 if (content.length) {112 var shell = $('#shell');113 // remove the previous contents of the shell114 shell.empty();115 // get the parent of the content and detach it116 var parent = content.parent();117 content.detach();118 // register a new close handler119 $('#shell-dialog').modal('setHandler', {120 close: function () {121 deferred.resolve();122 // detach the content and add it back to the parent123 content.hide().detach().appendTo(parent);124 }125 });126 // hide the undock button127 $('#shell-undock-button').hide();128 // create the content container129 var contentContainer = $('<div>').css({130 width: shell.width(),131 height: shell.height()132 }).append(content).appendTo(shell);133 // show the content134 $('#shell-dialog').modal('show');135 content.show();136 // add a window resize listener137 $(window).resize(function () {138 contentContainer.css({139 width: shell.width(),140 height: shell.height()141 });142 });143 }144 }).promise();145 }146 };...

Full Screen

Full Screen

JmolAdapter.js

Source:JmolAdapter.js Github

copy

Full Screen

1Clazz.declarePackage ("J.api");2Clazz.load (["J.c.QS"], "J.api.JmolAdapter", ["java.util.Hashtable", "JU.PT", "J.api.JmolViewer", "JU.Elements", "JV.JC"], function () {3c$ = Clazz.declareType (J.api, "JmolAdapter");4c$.getShellEnumeration = Clazz.defineMethod (c$, "getShellEnumeration", 5function (i) {6return J.c.QS.getItem (i);7}, "~N");8c$.getNewDfCoefMap = Clazz.defineMethod (c$, "getNewDfCoefMap", 9function () {10return J.c.QS.getNewDfCoefMap ();11});12c$.getElementSymbol = Clazz.defineMethod (c$, "getElementSymbol", 13function (elementNumber) {14return JU.Elements.elementSymbolFromNumber (elementNumber);15}, "~N");16c$.getElementNumber = Clazz.defineMethod (c$, "getElementNumber", 17function (elementSymbol) {18return JU.Elements.elementNumberFromSymbol (elementSymbol, false);19}, "~S");20c$.getNaturalIsotope = Clazz.defineMethod (c$, "getNaturalIsotope", 21function (elementNumber) {22return JU.Elements.getNaturalIsotope (elementNumber);23}, "~N");24c$.isHetero = Clazz.defineMethod (c$, "isHetero", 25function (group3) {26return JV.JC.isHetero (group3);27}, "~S");28c$.getQuantumShellTag = Clazz.defineMethod (c$, "getQuantumShellTag", 29function (id) {30return J.c.QS.getQuantumShellTag (id);31}, "~N");32c$.getQuantumShellTagID = Clazz.defineMethod (c$, "getQuantumShellTagID", 33function (tag) {34return J.c.QS.getQuantumShellTagID (tag);35}, "~S");36c$.getQuantumShellTagIDSpherical = Clazz.defineMethod (c$, "getQuantumShellTagIDSpherical", 37function (tag) {38return J.c.QS.getQuantumShellTagIDSpherical (tag);39}, "~S");40c$.getBondingRadius = Clazz.defineMethod (c$, "getBondingRadius", 41function (atomicNumberWithIsotope, charge) {42return JU.Elements.getBondingRadius (atomicNumberWithIsotope, charge);43}, "~N,~N");44Clazz.defineMethod (c$, "getAtomSetCollectionFromReader", 45function (name, type, bufferedReader, htParams) {46if (htParams == null) htParams = new java.util.Hashtable ();47if (!htParams.containsKey ("vwr")) htParams.put ("vwr", J.api.JmolViewer.allocateViewer (null, this));48var a = this.getAtomSetCollectionReader (name, type, bufferedReader, htParams);49if (Clazz.instanceOf (a, String)) return a;50return this.getAtomSetCollection (a);51}, "~S,~S,~O,java.util.Map");52Clazz.defineMethod (c$, "openBufferedReader", 53function (name, bufferedReader) {54return this.getAtomSetCollectionFromReader (name, null, bufferedReader, null);55}, "~S,java.io.BufferedReader");56Clazz.defineMethod (c$, "openBufferedReader", 57function (name, bufferedReader, htParams) {58return this.getAtomSetCollectionFromReader (name, null, bufferedReader, htParams);59}, "~S,java.io.BufferedReader,java.util.Map");60Clazz.defineMethod (c$, "openBufferedReader", 61function (name, type, bufferedReader) {62return this.getAtomSetCollectionFromReader (name, type, bufferedReader, null);63}, "~S,~S,java.io.BufferedReader");64c$.canonizeAlphaDigit = Clazz.defineMethod (c$, "canonizeAlphaDigit", 65 function (ch) {66return (JU.PT.isLetterOrDigit (ch) ? ch : '\0');67}, "~S");68c$.canonizeInsertionCode = Clazz.defineMethod (c$, "canonizeInsertionCode", 69function (insertionCode) {70return J.api.JmolAdapter.canonizeAlphaDigit (insertionCode);71}, "~S");72c$.canonizeAlternateLocationID = Clazz.defineMethod (c$, "canonizeAlternateLocationID", 73function (altLoc) {74return J.api.JmolAdapter.canonizeAlphaDigit (altLoc);75}, "~S");76Clazz.defineStatics (c$,77"ORDER_COVALENT_SINGLE", 1,78"ORDER_COVALENT_DOUBLE", 2,79"ORDER_COVALENT_TRIPLE", 3,80"ORDER_AROMATIC", 515,81"ORDER_AROMATIC_SINGLE", 513,82"ORDER_AROMATIC_DOUBLE", 514,83"ORDER_HBOND", 2048,84"ORDER_STEREO_NEAR", 1025,85"ORDER_STEREO_FAR", 1041,86"ORDER_PARTIAL01", 33,87"ORDER_PARTIAL12", 66,88"ORDER_PARTIAL23", 97,89"ORDER_PARTIAL32", 100,90"ORDER_UNSPECIFIED", 17,91"ORDER_PYMOL_SINGLE", 65536,92"ORDER_PYMOL_MULT", 98304);93c$.SHELL_S = c$.prototype.SHELL_S = J.c.QS.S.id;94c$.SHELL_P = c$.prototype.SHELL_P = J.c.QS.P.id;95c$.SHELL_SP = c$.prototype.SHELL_SP = J.c.QS.SP.id;96c$.SHELL_L = c$.prototype.SHELL_L = J.c.QS.SP.id;97c$.SHELL_D_SPHERICAL = c$.prototype.SHELL_D_SPHERICAL = J.c.QS.D_SPHERICAL.id;98c$.SHELL_D_CARTESIAN = c$.prototype.SHELL_D_CARTESIAN = J.c.QS.D_CARTESIAN.id;99c$.SHELL_F_SPHERICAL = c$.prototype.SHELL_F_SPHERICAL = J.c.QS.F_SPHERICAL.id;100c$.SHELL_F_CARTESIAN = c$.prototype.SHELL_F_CARTESIAN = J.c.QS.F_CARTESIAN.id;101c$.SHELL_G_SPHERICAL = c$.prototype.SHELL_G_SPHERICAL = J.c.QS.G_SPHERICAL.id;102c$.SHELL_G_CARTESIAN = c$.prototype.SHELL_G_CARTESIAN = J.c.QS.G_CARTESIAN.id;103c$.SHELL_H_SPHERICAL = c$.prototype.SHELL_H_SPHERICAL = J.c.QS.H_SPHERICAL.id;104c$.SHELL_H_CARTESIAN = c$.prototype.SHELL_H_CARTESIAN = J.c.QS.H_CARTESIAN.id;105c$.SUPPORTED_BASIS_FUNCTIONS = c$.prototype.SUPPORTED_BASIS_FUNCTIONS = "SPLDF";106c$.NOTE_SCRIPT_FILE = c$.prototype.NOTE_SCRIPT_FILE = "NOTE: file recognized as a script file: ";107Clazz.defineStatics (c$,108"cellParamNames", ["_cell_length_a", "_cell_length_b", "_cell_length_c", "_cell_angle_alpha", "_cell_angle_beta", "_cell_angle_gamma"]); ...

Full Screen

Full Screen

cp.js

Source:cp.js Github

copy

Full Screen

1var shell = require('..');2var assert = require('assert'),3 path = require('path'),4 fs = require('fs');5// Node shims for < v0.76fs.existsSync = fs.existsSync || path.existsSync;7shell.config.silent = true;8function numLines(str) {9 return typeof str === 'string' ? str.match(/\n/g).length : 0;10}11shell.rm('-rf', 'tmp');12shell.mkdir('tmp');13//14// Invalids15//16shell.cp();17assert.ok(shell.error());18shell.cp('file1');19assert.ok(shell.error());20shell.cp('-f');21assert.ok(shell.error());22shell.rm('-rf', 'tmp/*');23shell.cp('-@', 'resources/file1', 'tmp/file1'); // option not supported, files OK24assert.ok(shell.error());25assert.equal(fs.existsSync('tmp/file1'), false);26shell.cp('-Z', 'asdfasdf', 'tmp/file2'); // option not supported, files NOT OK27assert.ok(shell.error());28assert.equal(fs.existsSync('tmp/file2'), false);29shell.cp('asdfasdf', 'tmp'); // source does not exist30assert.ok(shell.error());31assert.equal(numLines(shell.error()), 1);32assert.equal(fs.existsSync('tmp/asdfasdf'), false);33shell.cp('asdfasdf1', 'asdfasdf2', 'tmp'); // sources do not exist34assert.ok(shell.error());35assert.equal(numLines(shell.error()), 2);36assert.equal(fs.existsSync('tmp/asdfasdf1'), false);37assert.equal(fs.existsSync('tmp/asdfasdf2'), false);38shell.cp('asdfasdf1', 'asdfasdf2', 'resources/file1'); // too many sources (dest is file)39assert.ok(shell.error());40shell.cp('resources/file1', 'resources/file2'); // dest already exists41assert.ok(shell.error());42shell.cp('resources/file1', 'resources/file2', 'tmp/a_file'); // too many sources43assert.ok(shell.error());44assert.equal(fs.existsSync('tmp/a_file'), false);45//46// Valids47//48// simple - to dir49shell.cp('resources/file1', 'tmp');50assert.equal(shell.error(), null);51assert.equal(fs.existsSync('tmp/file1'), true);52// simple - to file53shell.cp('resources/file2', 'tmp/file2');54assert.equal(shell.error(), null);55assert.equal(fs.existsSync('tmp/file2'), true);56// simple - file list57shell.rm('-rf', 'tmp/*');58shell.cp('resources/file1', 'resources/file2', 'tmp');59assert.equal(shell.error(), null);60assert.equal(fs.existsSync('tmp/file1'), true);61assert.equal(fs.existsSync('tmp/file2'), true);62// simple - file list, array syntax63shell.rm('-rf', 'tmp/*');64shell.cp(['resources/file1', 'resources/file2'], 'tmp');65assert.equal(shell.error(), null);66assert.equal(fs.existsSync('tmp/file1'), true);67assert.equal(fs.existsSync('tmp/file2'), true);68shell.cp('resources/file2', 'tmp/file3');69assert.equal(fs.existsSync('tmp/file3'), true);70shell.cp('-f', 'resources/file2', 'tmp/file3'); // file exists, but -f specified71assert.equal(shell.error(), null);72assert.equal(fs.existsSync('tmp/file3'), true);73// wildcard74shell.rm('tmp/file1', 'tmp/file2');75shell.cp('resources/file*', 'tmp');76assert.equal(shell.error(), null);77assert.equal(fs.existsSync('tmp/file1'), true);78assert.equal(fs.existsSync('tmp/file2'), true);79//recursive, nothing exists80shell.rm('-rf', 'tmp/*');81shell.cp('-R', 'resources/cp', 'tmp');82assert.equal(shell.error(), null);83assert.equal(shell.ls('-R', 'resources/cp') + '', shell.ls('-R', 'tmp/cp') + '');84//recursive, nothing exists, source ends in '/' (see Github issue #15)85shell.rm('-rf', 'tmp/*');86shell.cp('-R', 'resources/cp/', 'tmp/');87assert.equal(shell.error(), null);88assert.equal(shell.ls('-R', 'resources/cp') + '', shell.ls('-R', 'tmp') + '');89//recursive, everything exists, no force flag90shell.rm('-rf', 'tmp/*');91shell.cp('-R', 'resources/cp', 'tmp');92shell.cp('-R', 'resources/cp', 'tmp');93assert.equal(shell.error(), null); // crash test only94//recursive, everything exists, with force flag95shell.rm('-rf', 'tmp/*');96shell.cp('-R', 'resources/cp', 'tmp');97'changing things around'.to('tmp/cp/dir_a/z');98assert.notEqual(shell.cat('resources/cp/dir_a/z'), shell.cat('tmp/cp/dir_a/z')); // before cp99shell.cp('-Rf', 'resources/cp', 'tmp');100assert.equal(shell.error(), null);101assert.equal(shell.cat('resources/cp/dir_a/z'), shell.cat('tmp/cp/dir_a/z')); // after cp102//recursive, creates dest dir since it's only one level deep (see Github issue #44)103shell.rm('-rf', 'tmp/*');104shell.cp('-r', 'resources/issue44/*', 'tmp/dir2');105assert.equal(shell.error(), null);106assert.equal(shell.ls('-R', 'resources/issue44') + '', shell.ls('-R', 'tmp/dir2') + '');107assert.equal(shell.cat('resources/issue44/main.js'), shell.cat('tmp/dir2/main.js'));108//recursive, does *not* create dest dir since it's too deep (see Github issue #44)109shell.rm('-rf', 'tmp/*');110shell.cp('-r', 'resources/issue44/*', 'tmp/dir2/dir3');111assert.ok(shell.error());112assert.equal(fs.existsSync('tmp/dir2'), false);...

Full Screen

Full Screen

WebNavigationFrames.jsm

Source:WebNavigationFrames.jsm Github

copy

Full Screen

1/* This Source Code Form is subject to the terms of the Mozilla Public2 * License, v. 2.0. If a copy of the MPL was not distributed with this3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */4"use strict";5const EXPORTED_SYMBOLS = ["WebNavigationFrames"];6var Ci = Components.interfaces;7/* exported WebNavigationFrames */8/**9 * Retrieve the DOMWindow associated to the docShell passed as parameter.10 *11 * @param {nsIDocShell} docShell - the docShell that we want to get the DOMWindow from.12 * @returns {nsIDOMWindow} - the DOMWindow associated to the docShell.13 */14function docShellToWindow(docShell) {15 return docShell.QueryInterface(Ci.nsIInterfaceRequestor)16 .getInterface(Ci.nsIDOMWindow);17}18/**19 * The FrameDetail object which represents a frame in WebExtensions APIs.20 *21 * @typedef {Object} FrameDetail22 * @inner23 * @property {number} frameId - Represents the numeric id which identify the frame in its tab.24 * @property {number} parentFrameId - Represents the numeric id which identify the parent frame.25 * @property {string} url - Represents the current location URL loaded in the frame.26 * @property {boolean} errorOccurred - Indicates whether an error is occurred during the last load27 * happened on this frame (NOT YET SUPPORTED).28 */29/**30 * A generator function which iterates over a docShell tree, given a root docShell.31 *32 * @param {nsIDocShell} docShell - the root docShell object33 */34function* iterateDocShellTree(docShell) {35 let docShellsEnum = docShell.getDocShellEnumerator(36 docShell.typeContent, docShell.ENUMERATE_FORWARDS);37 while (docShellsEnum.hasMoreElements()) {38 yield docShellsEnum.getNext();39 }40}41/**42 * Returns the frame ID of the given window. If the window is the43 * top-level content window, its frame ID is 0. Otherwise, its frame ID44 * is its outer window ID.45 *46 * @param {Window} window - The window to retrieve the frame ID for.47 * @returns {number}48 */49function getFrameId(window) {50 if (window.parent === window) {51 return 0;52 }53 let utils = window.getInterface(Ci.nsIDOMWindowUtils);54 return utils.outerWindowID;55}56/**57 * Returns the frame ID of the given window's parent.58 *59 * @param {Window} window - The window to retrieve the parent frame ID for.60 * @returns {number}61 */62function getParentFrameId(window) {63 if (window.parent === window) {64 return -1;65 }66 return getFrameId(window.parent);67}68function getDocShellFrameId(docShell) {69 if (!docShell) {70 return undefined;71 }72 return getFrameId(docShell.QueryInterface(Ci.nsIInterfaceRequestor)73 .getInterface(Ci.nsIDOMWindow));74}75/**76 * Convert a docShell object into its internal FrameDetail representation.77 *78 * @param {nsIDocShell} docShell - the docShell object to be converted into a FrameDetail JSON object.79 * @returns {FrameDetail} the FrameDetail JSON object which represents the docShell.80 */81function convertDocShellToFrameDetail(docShell) {82 let window = docShellToWindow(docShell);83 return {84 frameId: getFrameId(window),85 parentFrameId: getParentFrameId(window),86 url: window.location.href,87 };88}89/**90 * Search for a frame starting from the passed root docShell and91 * convert it to its related frame detail representation.92 *93 * @param {number} frameId - the frame ID of the frame to retrieve, as94 * described in getFrameId.95 * @param {nsIDocShell} rootDocShell - the root docShell object96 * @returns {nsIDocShell?} the docShell with the given frameId, or null97 * if no match.98 */99function findDocShell(frameId, rootDocShell) {100 for (let docShell of iterateDocShellTree(rootDocShell)) {101 if (frameId == getFrameId(docShellToWindow(docShell))) {102 return docShell;103 }104 }105 return null;106}107var WebNavigationFrames = {108 iterateDocShellTree,109 findDocShell,110 getFrame(docShell, frameId) {111 let result = findDocShell(frameId, docShell);112 if (result) {113 return convertDocShellToFrameDetail(result);114 }115 return null;116 },117 getFrameId,118 getParentFrameId,119 getAllFrames(docShell) {120 return Array.from(iterateDocShellTree(docShell), convertDocShellToFrameDetail);121 },122 getDocShellFrameId,...

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