How to use TextCell method in devicefarmer-stf

Best JavaScript code snippet using devicefarmer-stf

textcell.js

Source:textcell.js Github

copy

Full Screen

1// Copyright (c) Jupyter Development Team.2// Distributed under the terms of the Modified BSD License.3define([4 'jquery',5 'base/js/utils',6 'base/js/i18n',7 'notebook/js/cell',8 'base/js/security',9 'services/config',10 'notebook/js/mathjaxutils',11 'notebook/js/celltoolbar',12 'components/marked/lib/marked',13 'codemirror/lib/codemirror',14 'codemirror/mode/gfm/gfm',15 'notebook/js/codemirror-ipythongfm',16 'bidi/bidi'17], function(18 $,19 utils,20 i18n,21 cell,22 security,23 configmod,24 mathjaxutils,25 celltoolbar,26 marked,27 CodeMirror,28 gfm,29 ipgfm,30 bidi31 ) {32 "use strict";33 function encodeURIandParens(uri){return encodeURI(uri).replace('(','%28').replace(')','%29')}34 /**35 * Given a file name and a list of existing file names, returns a new file name36 * that is not in the existing list. If the file name already exists, a new one with37 * an incremented index is returned instead.38 *39 * Example:40 * addIndexToFileName('attachment.png',41 * ['attachment.png', 'attachment-3.png']) returns 'attachment-4.png'42 *43 * @param {string} fileName - original file name44 * @param {string} fileNames - other file names45 * @return {string} the original file name or one with a postfix46 * index (before the extension, if one exists)47 */48 function addIndexToFileName(fileName, fileNames) {49 if (fileNames === undefined) {50 return fileName;51 }52 var lastDot = fileName.lastIndexOf('.');53 var pre = fileName.substr(0, lastDot);54 var optionalExt = fileName.substr(lastDot);55 var indexMatch = '-(\\d+)';56 // Make the index match optional so we can match both 'fileName.png' and 'fileName-2.png'57 // The ?: makes it a non-capturing group.58 var optionalIndexMatch = '(?:' + indexMatch + ')?';59 var regex = new RegExp(pre + optionalIndexMatch + optionalExt);60 var highestIndex = 0;61 for (var existingFileName in fileNames) {62 var match = existingFileName.match(regex);63 var index = match[1];64 if (index === undefined) {65 index = 1;66 }67 else {68 index = parseInt(index);69 }70 if (index > highestIndex) {71 highestIndex = index;72 }73 }74 if (highestIndex > 0) {75 return pre + "-" + (highestIndex + 1) + optionalExt;76 }77 else {78 return fileName;79 }80 };81 var Cell = cell.Cell;82 var TextCell = function (options) {83 /**84 * Constructor85 *86 * Construct a new TextCell, codemirror mode is by default 'htmlmixed', 87 * and cell type is 'text' cell start as not redered.88 *89 * Parameters:90 * options: dictionary91 * Dictionary of keyword arguments.92 * events: $(Events) instance 93 * config: dictionary94 * keyboard_manager: KeyboardManager instance 95 * notebook: Notebook instance96 */97 options = options || {};98 // in all TextCell/Cell subclasses99 // do not assign most of members here, just pass it down100 // in the options dict potentially overwriting what you wish.101 // they will be assigned in the base class.102 this.notebook = options.notebook;103 this.events = options.events;104 this.config = options.config;105 // we cannot put this as a class key as it has handle to "this".106 Cell.apply(this, [{107 config: options.config, 108 keyboard_manager: options.keyboard_manager, 109 events: this.events}]);110 this.cell_type = this.cell_type || 'text';111 mathjaxutils = mathjaxutils;112 this.rendered = false;113 };114 TextCell.prototype = Object.create(Cell.prototype);115 TextCell.options_default = {116 cm_config : {117 mode: 'htmlmixed',118 lineWrapping : true,119 }120 };121 /**122 * Create the DOM element of the TextCell123 * @method create_element124 * @private125 */126 TextCell.prototype.create_element = function () {127 Cell.prototype.create_element.apply(this, arguments);128 var that = this;129 var cell = $("<div>").addClass('cell text_cell');130 cell.attr('tabindex','2');131 var prompt = $('<div/>').addClass('prompt input_prompt');132 cell.append(prompt);133 var inner_cell = $('<div/>').addClass('inner_cell');134 this.celltoolbar = new celltoolbar.CellToolbar({135 cell: this, 136 notebook: this.notebook});137 inner_cell.append(this.celltoolbar.element);138 var input_area = $('<div/>').addClass('input_area').attr("aria-label", i18n.msg._("Edit Markup Text here"));139 this.code_mirror = new CodeMirror(input_area.get(0), this._options.cm_config);140 // In case of bugs that put the keyboard manager into an inconsistent state,141 // ensure KM is enabled when CodeMirror is focused:142 this.code_mirror.on('focus', function () {143 if (that.keyboard_manager) {144 that.keyboard_manager.enable();145 }146 that.code_mirror.setOption('readOnly', !that.is_editable());147 });148 this.code_mirror.on('keydown', $.proxy(this.handle_keyevent,this))149 // The tabindex=-1 makes this div focusable.150 var render_area = $('<div/>').addClass('text_cell_render rendered_html')151 .attr('tabindex','-1');152 inner_cell.append(input_area).append(render_area);153 cell.append(inner_cell);154 this.element = cell;155 this.inner_cell = inner_cell;156 };157 // Cell level actions158 TextCell.prototype.add_attachment = function (key, mime_type, b64_data) {159 /**160 * Add a new attachment to this cell161 */162 this.attachments[key] = {};163 this.attachments[key][mime_type] = b64_data;164 };165 TextCell.prototype.select = function () {166 var cont = Cell.prototype.select.apply(this, arguments);167 if (cont) {168 if (this.mode === 'edit') {169 this.code_mirror.refresh();170 }171 }172 return cont;173 };174 TextCell.prototype.unrender = function () {175 var cont = Cell.prototype.unrender.apply(this);176 if (cont) {177 var text_cell = this.element;178 if (this.get_text() === this.placeholder) {179 this.set_text('');180 }181 this.refresh();182 }183 return cont;184 };185 TextCell.prototype.execute = function () {186 this.render();187 };188 /**189 * setter: {{#crossLink "TextCell/set_text"}}{{/crossLink}}190 * @method get_text191 * @return {string} CodeMirror current text value192 */193 TextCell.prototype.get_text = function() {194 return this.code_mirror.getValue();195 };196 /**197 * @param {string} text - Codemiror text value198 * @see TextCell#get_text199 * @method set_text200 * */201 TextCell.prototype.set_text = function(text) {202 this.code_mirror.setValue(text);203 this.unrender();204 this.code_mirror.refresh();205 };206 /**207 * setter :{{#crossLink "TextCell/set_rendered"}}{{/crossLink}}208 * @method get_rendered209 * */210 TextCell.prototype.get_rendered = function() {211 return this.element.find('div.text_cell_render').html();212 };213 /**214 * @method set_rendered215 */216 TextCell.prototype.set_rendered = function(text) {217 this.element.find('div.text_cell_render').html(text);218 };219 /**220 * Create Text cell from JSON221 * @param {json} data - JSON serialized text-cell222 * @method fromJSON223 */224 TextCell.prototype.fromJSON = function (data) {225 Cell.prototype.fromJSON.apply(this, arguments);226 if (data.cell_type === this.cell_type) {227 if (data.attachments !== undefined) {228 this.attachments = data.attachments;229 }230 if (data.source !== undefined) {231 this.set_text(data.source);232 // make this value the starting point, so that we can only undo233 // to this state, instead of a blank cell234 this.code_mirror.clearHistory();235 // TODO: This HTML needs to be treated as potentially dangerous236 // user input and should be handled before set_rendered.237 this.set_rendered(data.rendered || '');238 this.rendered = false;239 this.render();240 }241 }242 };243 /** Generate JSON from cell244 * @param {bool} gc_attachments - If true, will remove unused attachments245 * from the returned JSON246 * @return {object} cell data serialised to json247 */248 TextCell.prototype.toJSON = function (gc_attachments) {249 if (gc_attachments === undefined) {250 gc_attachments = false;251 }252 var data = Cell.prototype.toJSON.apply(this);253 data.source = this.get_text();254 if (data.source == this.placeholder) {255 data.source = "";256 }257 // We deepcopy the attachments so copied cells don't share the same258 // objects259 if (Object.keys(this.attachments).length > 0) {260 if (gc_attachments) {261 // Garbage collect unused attachments : The general idea is to262 // render the text, and find used attachments like when we263 // substitute them in render()264 var that = this;265 data.attachments = {};266 // To find attachments, rendering to HTML is easier than267 // searching in the markdown source for the multiple ways you268 // can reference an image in markdown (using []() or a269 // HTML <img>)270 var text = this.get_text();271 marked(text, function (err, html) {272 html = $(security.sanitize_html_and_parse(html));273 html.find('img[src^="attachment:"]').each(function (i, h) {274 h = $(h);275 var key = h.attr('src').replace(/^attachment:/, '');276 if (that.attachments.hasOwnProperty(key)) {277 data.attachments[key] = JSON.parse(JSON.stringify(278 that.attachments[key]));279 }280 // This is to avoid having the browser do a GET request281 // on the invalid attachment: URL282 h.attr('src', '');283 });284 });285 if (data.attachments.length === 0) {286 // omit attachments dict if no attachments287 delete data.attachments;288 }289 } else {290 data.attachments = JSON.parse(JSON.stringify(this.attachments));291 }292 }293 return data;294 };295 var MarkdownCell = function (options) {296 /**297 * Constructor298 *299 * Parameters:300 * options: dictionary301 * Dictionary of keyword arguments.302 * events: $(Events) instance 303 * config: ConfigSection instance304 * keyboard_manager: KeyboardManager instance 305 * notebook: Notebook instance306 */307 options = options || {};308 var config_default = utils.mergeopt(TextCell, MarkdownCell.options_default);309 this.class_config = new configmod.ConfigWithDefaults(options.config,310 config_default, 'MarkdownCell');311 TextCell.apply(this, [$.extend({}, options, {config: options.config})]);312 this.cell_type = 'markdown';313 // Used to keep track of drag events314 this.drag_counter = 0;315 };316 MarkdownCell.options_default = {317 cm_config: {318 mode: 'ipythongfm',319 },320 placeholder: "Type *Markdown* and LaTeX: $\\alpha^2$"321 };322 MarkdownCell.prototype = Object.create(TextCell.prototype);323 MarkdownCell.prototype.set_heading_level = function (level) {324 /**325 * make a markdown cell a heading326 */327 level = level || 1;328 var source = this.get_text();329 source = source.replace(/^(#*)\s?/,330 new Array(level + 1).join('#') + ' ');331 this.set_text(source);332 this.refresh();333 if (this.rendered) {334 this.render();335 }336 };337 MarkdownCell.prototype.select = function () {338 var cont = TextCell.prototype.select.apply(this, arguments);339 if (cont) {340 this.notebook.set_insert_image_enabled(!this.rendered);341 }342 };343 MarkdownCell.prototype.unrender = function () {344 var cont = TextCell.prototype.unrender.apply(this);345 this.notebook.set_insert_image_enabled(true);346 };347 MarkdownCell.prototype.insert_inline_image_from_blob = function(blob) {348 /**349 * Insert markup for an inline image at the current cursor position.350 * This works as follow :351 * - We insert the base64-encoded blob data into the cell attachments352 * dictionary, keyed by the filename.353 * - We insert an img tag with a 'attachment:key' src that refers to354 * the attachments entry.355 *356 * Parameters:357 * file: Blob358 * The JS Blob object (e.g. from the DataTransferItem)359 */360 var that = this;361 var pos = this.code_mirror.getCursor();362 var reader = new FileReader();363 // We can get either a named file (drag'n'drop) or a blob (copy/paste)364 // We generate names for blobs365 var key;366 if (blob.name !== undefined) {367 key = encodeURIandParens(blob.name);368 // Add an index to the filename if we already have one with the same name369 key = addIndexToFileName(key, that.attachments);370 } else {371 key = '_auto_' + Object.keys(that.attachments).length;372 }373 reader.onloadend = function() {374 var d = utils.parse_b64_data_uri(reader.result);375 var blobData = d[1]376 if (blob.type != d[0]) {377 // TODO(julienr): Not sure what we should do in this case378 console.log('File type (' + blob.type + ') != data-uri ' +379 'type (' + d[0] + ')');380 }381 // If we have the same attachment already under another key, we change the key to that.382 // This ensures we don't create two attachments if pasting the same image twice.383 for (var savedKey in that.attachments) {384 var attachment = that.attachments[savedKey];385 if (attachment === undefined) continue;386 var savedBlob = attachment[blob.type];387 if (savedBlob === blobData) {388 key = savedKey;389 }390 }391 that.add_attachment(key, blob.type, blobData);392 var img_md = '![' + key + '](attachment:' + key + ')';393 that.code_mirror.replaceRange(img_md, pos);394 }395 reader.readAsDataURL(blob);396 };397 /**398 * @method render399 */400 MarkdownCell.prototype.render = function () {401 // We clear the dropzone here just in case the dragenter/leave402 // logic of bind_events wasn't 100% successful.403 this.drag_counter = 0;404 this.inner_cell.removeClass('dropzone');405 var cont = TextCell.prototype.render.apply(this);406 if (cont) {407 var that = this;408 var text = this.get_text();409 var math = null;410 if (text === "") { text = this.placeholder; }411 var text_and_math = mathjaxutils.remove_math(text);412 text = text_and_math[0];413 math = text_and_math[1];414 // Prevent marked from returning inline styles for table cells415 var renderer = new marked.Renderer();416 renderer.tablecell = function (content, flags) {417 var type = flags.header ? 'th' : 'td';418 var style = flags.align == null ? '': ' style="text-align: ' + flags.align + '"';419 var start_tag = '<' + type + style + '>';420 var end_tag = '</' + type + '>\n';421 return start_tag + content + end_tag;422 };423 marked(text, { renderer: renderer }, function (err, html) {424 html = mathjaxutils.replace_math(html, math);425 html = $(security.sanitize_html_and_parse(html));426 // add anchors to headings427 html.find(":header").addBack(":header").each(function (i, h) {428 h = $(h);429 var hash = h.text().replace(/ /g, '-');430 h.attr('id', hash);431 h.append(432 $('<a/>')433 .addClass('anchor-link')434 .attr('href', '#' + hash)435 .text('¶')436 .on('click',function(){437 setTimeout(function(){that.unrender(); that.render()}, 100)438 })439 );440 });441 // links in markdown cells should open in new tabs442 html.find("a[href]").not('[href^="#"]').attr("target", "_blank");443 // replace attachment:<key> by the corresponding entry444 // in the cell's attachments445 html.find('img[src^="attachment:"]').each(function (i, h) {446 h = $(h);447 var key = h.attr('src').replace(/^attachment:/, '');448 if (that.attachments.hasOwnProperty(key)) {449 var att = that.attachments[key];450 var mime = Object.keys(att)[0];451 h.attr('src', 'data:' + mime + ';base64,' + att[mime]);452 } else {453 h.attr('src', '');454 }455 });456 that.set_rendered(html);457 that.typeset();458 that.events.trigger("rendered.MarkdownCell", {cell: that});459 });460 }461 return cont;462 };463 /** @method bind_events **/464 MarkdownCell.prototype.bind_events = function () {465 TextCell.prototype.bind_events.apply(this);466 var that = this;467 this.element.dblclick(function () {468 var cont = that.unrender();469 if (cont) {470 that.focus_editor();471 }472 });473 var attachment_regex = /^image\/.*$/;474 // Event handlers to allow users to insert image using either475 // drag'n'drop or copy/paste476 var div = that.code_mirror.getWrapperElement();477 $(div).on('paste', function(evt) {478 var data = evt.originalEvent.clipboardData;479 var items = data.items;480 if (items !== undefined) {481 for (var i = 0; i < items.length; ++i) {482 var item = items[i];483 if (item.kind == 'file' && attachment_regex.test(item.type)) {484 // TODO(julienr): This does not stop code_mirror from pasting485 // the filename.486 evt.stopPropagation();487 evt.preventDefault();488 that.insert_inline_image_from_blob(item.getAsFile());489 }490 }491 }492 });493 // Allow drag event if the dragged file can be used as an attachment494 // If we use this.code_mirror.on to register a "dragover" handler, we495 // get an empty dataTransfer496 this.code_mirror.on("dragover", function(cm, evt) {497 if (utils.dnd_contain_file(evt)) {498 evt.preventDefault();499 }500 });501 // We want to display a visual indicator that the drop is possible.502 // The dragleave event is fired when we hover a child element (which503 // is often immediately after we got the dragenter), so we keep track504 // of the number of dragenter/dragleave we got, as discussed here :505 // https://stackoverflow.com/q/7110353/116067506 // This doesn't seem to be 100% reliable, so we clear the dropzone507 // class when the cell is rendered as well508 this.code_mirror.on("dragenter", function(cm, evt) {509 if (utils.dnd_contain_file(evt)) {510 that.drag_counter++;511 that.inner_cell.addClass('dropzone');512 }513 evt.preventDefault();514 evt.stopPropagation();515 });516 this.code_mirror.on("dragleave", function(cm, evt) {517 that.drag_counter--;518 if (that.drag_counter <= 0) {519 that.inner_cell.removeClass('dropzone');520 }521 evt.preventDefault();522 evt.stopPropagation();523 });524 this.code_mirror.on("drop", function(cm, evt) {525 that.drag_counter = 0;526 that.inner_cell.removeClass('dropzone');527 var files = evt.dataTransfer.files;528 for (var i = 0; i < files.length; ++i) {529 var file = files[i];530 if (attachment_regex.test(file.type)) {531 // Prevent the default code_mirror 'drop' event handler532 // (which inserts the file content) if this is a533 // recognized media file534 evt.stopPropagation();535 evt.preventDefault();536 that.insert_inline_image_from_blob(file);537 }538 }539 });540 };541 var RawCell = function (options) {542 /**543 * Constructor544 *545 * Parameters:546 * options: dictionary547 * Dictionary of keyword arguments.548 * events: $(Events) instance 549 * config: ConfigSection instance550 * keyboard_manager: KeyboardManager instance 551 * notebook: Notebook instance552 */553 options = options || {};554 var config_default = utils.mergeopt(TextCell, RawCell.options_default);555 this.class_config = new configmod.ConfigWithDefaults(options.config,556 config_default, 'RawCell');557 TextCell.apply(this, [$.extend({}, options, {config: options.config})]);558 this.cell_type = 'raw';559 };560 RawCell.options_default = {561 highlight_modes : {562 'diff' :{'reg':[/^diff/]}563 },564 placeholder : i18n.msg._("Write raw LaTeX or other formats here, for use with nbconvert. " +565 "It will not be rendered in the notebook. " +566 "When passing through nbconvert, a Raw Cell's content is added to the output unmodified."),567 };568 RawCell.prototype = Object.create(TextCell.prototype);569 /** @method bind_events **/570 RawCell.prototype.bind_events = function () {571 TextCell.prototype.bind_events.apply(this);572 var that = this;573 this.element.focusout(function() {574 that.auto_highlight();575 that.render();576 });577 this.code_mirror.on('focus', function() { that.unrender(); });578 };579 /** @method render **/580 RawCell.prototype.render = function () {581 var cont = TextCell.prototype.render.apply(this);582 if (cont){583 var text = this.get_text();584 if (text === "") { text = this.placeholder; }585 this.set_text(text);586 this.element.removeClass('rendered');587 this.auto_highlight();588 }589 return cont;590 };591 var textcell = {592 TextCell: TextCell,593 MarkdownCell: MarkdownCell,594 RawCell: RawCell595 };596 return textcell;...

Full Screen

Full Screen

Settings.jsx

Source:Settings.jsx Github

copy

Full Screen

1import React, { Fragment, memo } from 'react';2import { Button, Table, SegmentedControl, Checkbox, Select } from 'evergreen-ui';3import { useTranslation } from 'react-i18next';4const Settings = memo(({5 changeOutDir, customOutDir, keyframeCut, setKeyframeCut, invertCutSegments, setInvertCutSegments,6 autoSaveProjectFile, setAutoSaveProjectFile, timecodeShowFrames, setTimecodeShowFrames, askBeforeClose, setAskBeforeClose,7 AutoExportToggler, renderCaptureFormatButton, onTunerRequested, language, setLanguage,8 invertTimelineScroll, setInvertTimelineScroll, ffmpegExperimental, setFfmpegExperimental,9 enableAskForImportChapters, setEnableAskForImportChapters, enableAskForFileOpenAction, setEnableAskForFileOpenAction,10 hideNotifications, setHideNotifications, autoLoadTimecode, setAutoLoadTimecode,11 enableTransferTimestamps, setEnableTransferTimestamps,12}) => {13 const { t } = useTranslation();14 // eslint-disable-next-line react/jsx-props-no-spreading15 const Row = (props) => <Table.Row height="auto" paddingY={12} {...props} />;16 // eslint-disable-next-line react/jsx-props-no-spreading17 const KeyCell = (props) => <Table.TextCell textProps={{ whiteSpace: 'auto' }} {...props} />;18 function onLangChange(e) {19 const { value } = e.target;20 const l = value !== '' ? value : undefined;21 setLanguage(l);22 }23 // https://www.electronjs.org/docs/api/locales24 // See i18n.js25 const langNames = {26 en: 'English',27 cs: 'Čeština',28 de: 'Deutsch',29 es: 'Español',30 fr: 'Français',31 it: 'Italiano',32 nb: 'Norsk',33 pl: 'Polski',34 ru: 'русский',35 // sr: 'Cрпски',36 tr: 'Türkçe',37 zh: '中文',38 ko: '한국어',39 };40 return (41 <Fragment>42 <Row>43 <KeyCell>App language</KeyCell>44 <Table.TextCell>45 <Select value={language || ''} onChange={onLangChange}>46 <option key="" value="">{t('System language')}</option>47 {Object.keys(langNames).map((lang) => <option key={lang} value={lang}>{langNames[lang]}</option>)}48 </Select>49 </Table.TextCell>50 </Row>51 <Row>52 <KeyCell>53 {t('Working directory')}<br />54 {t('This is where working files, exported files, project files (CSV) are stored.')}55 </KeyCell>56 <Table.TextCell>57 <Button onClick={changeOutDir}>58 {customOutDir ? t('Custom working directory') : t('Same directory as input file')}59 </Button>60 <div>{customOutDir}</div>61 </Table.TextCell>62 </Row>63 <Row>64 <KeyCell>{t('Set file modification date/time of output files to:')}</KeyCell>65 <Table.TextCell>66 <SegmentedControl67 options={[{ label: t('Source file\'s time'), value: 'true' }, { label: t('Current time'), value: 'false' }]}68 value={enableTransferTimestamps ? 'true' : 'false'}69 onChange={value => setEnableTransferTimestamps(value === 'true')}70 />71 </Table.TextCell>72 </Row>73 <Row>74 <KeyCell>75 {t('Keyframe cut mode')}<br />76 <b>{t('Keyframe cut')}</b>: {t('Cut at the nearest keyframe (not accurate time.) Equiv to')} <i>ffmpeg -ss -i ...</i><br />77 <b>{t('Normal cut')}</b>: {t('Accurate time but could leave an empty portion at the beginning of the video. Equiv to')} <i>ffmpeg -i -ss ...</i><br />78 </KeyCell>79 <Table.TextCell>80 <SegmentedControl81 options={[{ label: t('Keyframe cut'), value: 'keyframe' }, { label: t('Normal cut'), value: 'normal' }]}82 value={keyframeCut ? 'keyframe' : 'normal'}83 onChange={value => setKeyframeCut(value === 'keyframe')}84 />85 </Table.TextCell>86 </Row>87 <Row>88 <KeyCell>89 <span role="img" aria-label="Yin Yang">☯️</span> {t('Choose cutting mode: Remove or keep selected segments from video when exporting?')}<br />90 <b>{t('Keep')}</b>: {t('The video inside segments will be kept, while the video outside will be discarded.')}<br />91 <b>{t('Remove')}</b>: {t('The video inside segments will be discarded, while the video surrounding them will be kept.')}92 </KeyCell>93 <Table.TextCell>94 <SegmentedControl95 options={[{ label: t('Remove'), value: 'discard' }, { label: t('Keep'), value: 'keep' }]}96 value={invertCutSegments ? 'discard' : 'keep'}97 onChange={value => setInvertCutSegments(value === 'discard')}98 />99 </Table.TextCell>100 </Row>101 <Row>102 <KeyCell>103 {t('Extract unprocessable tracks to separate files or discard them?')}<br />104 {t('(data tracks such as GoPro GPS, telemetry etc. are not copied over by default because ffmpeg cannot cut them, thus they will cause the media duration to stay the same after cutting video/audio)')}105 </KeyCell>106 <Table.TextCell>107 <AutoExportToggler />108 </Table.TextCell>109 </Row>110 <Row>111 <KeyCell>{t('Enable experimental ffmpeg features flag?')}</KeyCell>112 <Table.TextCell>113 <Checkbox114 label={t('Experimental flag')}115 checked={ffmpegExperimental}116 onChange={e => setFfmpegExperimental(e.target.checked)}117 />118 </Table.TextCell>119 </Row>120 <Row>121 <KeyCell>122 {t('Auto save project file?')}<br />123 {t('The project will be stored along with the output files as a CSV file')}124 </KeyCell>125 <Table.TextCell>126 <Checkbox127 label={t('Auto save project')}128 checked={autoSaveProjectFile}129 onChange={e => setAutoSaveProjectFile(e.target.checked)}130 />131 </Table.TextCell>132 </Row>133 <Row>134 <KeyCell>135 {t('Snapshot capture format')}136 </KeyCell>137 <Table.TextCell>138 {renderCaptureFormatButton()}139 </Table.TextCell>140 </Row>141 <Row>142 <KeyCell>{t('In timecode show')}</KeyCell>143 <Table.TextCell>144 <SegmentedControl145 options={[{ label: t('Frame numbers'), value: 'frames' }, { label: t('Millisecond fractions'), value: 'ms' }]}146 value={timecodeShowFrames ? 'frames' : 'ms'}147 onChange={value => setTimecodeShowFrames(value === 'frames')}148 />149 </Table.TextCell>150 </Row>151 <Row>152 <KeyCell>{t('Timeline trackpad/wheel sensitivity')}</KeyCell>153 <Table.TextCell>154 <Button onClick={() => onTunerRequested('wheelSensitivity')}>{t('Change value')}</Button>155 </Table.TextCell>156 </Row>157 <Row>158 <KeyCell>{t('Timeline keyboard seek speed')}</KeyCell>159 <Table.TextCell>160 <Button onClick={() => onTunerRequested('keyboardNormalSeekSpeed')}>{t('Change value')}</Button>161 </Table.TextCell>162 </Row>163 <Row>164 <KeyCell>{t('Timeline keyboard seek acceleration')}</KeyCell>165 <Table.TextCell>166 <Button onClick={() => onTunerRequested('keyboardSeekAccFactor')}>{t('Change value')}</Button>167 </Table.TextCell>168 </Row>169 <Row>170 <KeyCell>{t('Invert timeline trackpad/wheel direction?')}</KeyCell>171 <Table.TextCell>172 <Checkbox173 label={t('Invert direction')}174 checked={invertTimelineScroll}175 onChange={e => setInvertTimelineScroll(e.target.checked)}176 />177 </Table.TextCell>178 </Row>179 <Row>180 <KeyCell>{t('Ask for confirmation when closing app or file?')}</KeyCell>181 <Table.TextCell>182 <Checkbox183 label={t('Ask before closing')}184 checked={askBeforeClose}185 onChange={e => setAskBeforeClose(e.target.checked)}186 />187 </Table.TextCell>188 </Row>189 <Row>190 <KeyCell>{t('Ask about importing chapters from opened file?')}</KeyCell>191 <Table.TextCell>192 <Checkbox193 label={t('Ask about chapters')}194 checked={enableAskForImportChapters}195 onChange={e => setEnableAskForImportChapters(e.target.checked)}196 />197 </Table.TextCell>198 </Row>199 <Row>200 <KeyCell>{t('Auto load timecode from file as an offset in the timeline?')}</KeyCell>201 <Table.TextCell>202 <Checkbox203 label={t('Auto load timecode')}204 checked={autoLoadTimecode}205 onChange={e => setAutoLoadTimecode(e.target.checked)}206 />207 </Table.TextCell>208 </Row>209 <Row>210 <KeyCell>{t('Hide informational notifications?')}</KeyCell>211 <Table.TextCell>212 <Checkbox213 label={t('Check to hide notifications')}214 checked={!!hideNotifications}215 onChange={e => setHideNotifications(e.target.checked ? 'all' : undefined)}216 />217 </Table.TextCell>218 </Row>219 <Row>220 <KeyCell>{t('Ask about what to do when opening a new file when another file is already already open?')}</KeyCell>221 <Table.TextCell>222 <Checkbox223 label={t('Ask on file open')}224 checked={enableAskForFileOpenAction}225 onChange={e => setEnableAskForFileOpenAction(e.target.checked)}226 />227 </Table.TextCell>228 </Row>229 </Fragment>230 );231});...

Full Screen

Full Screen

test-results-builder.ts

Source:test-results-builder.ts Github

copy

Full Screen

...51 (52 planned_test_case: PlannedTestCaseAssociatedWithTestExecAndCampaign53 ): TestResultsSectionRow => {54 return [55 new TextCell(String(planned_test_case.campaign_id)),56 new TextCell(planned_test_case.campaign_name),57 new TextCell(String(planned_test_case.test_case_id)),58 new TextCell(planned_test_case.test_case_title),59 new TextCell(String(planned_test_case.test_exec_id)),60 new TextCell(planned_test_case.test_exec_internationalized_status),61 new TextCell(planned_test_case.test_exec_runner),62 new DateCell(planned_test_case.test_exec_date),63 ];64 }65 );66 return {67 title: new TextCell(gettext_provider.$gettext("Test Results (planned tests)")),68 headers: [69 new TextCell(gettext_provider.$gettext("Campaign ID")),70 new TextCell(gettext_provider.$gettext("Campaign Name")),71 new TextCell(gettext_provider.$gettext("Test case ID")),72 new TextCell(gettext_provider.$gettext("Test case title")),73 new TextCell(gettext_provider.$gettext("Test execution ID")),74 new TextCell(gettext_provider.$gettext("Test execution status")),75 new TextCell(gettext_provider.$gettext("Test execution runner")),76 new TextCell(gettext_provider.$gettext("Test execution date")),77 ],78 rows,79 };...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var TextCell = require('devicefarmer-stf').TextCell;2var cell = new TextCell('Hello\nWorld');3console.log(cell.minWidth());4console.log(cell.minHeight());5console.log(cell.draw(6, 3));6var TextCell = require('stf').TextCell;7var cell = new TextCell('Hello\nWorld');8console.log(cell.minWidth());9console.log(cell.minHeight());10console.log(cell.draw(6, 3));11var TextCell = require('stf-devicefarmer').TextCell;12var cell = new TextCell('Hello\nWorld');13console.log(cell.minWidth());14console.log(cell.minHeight());15console.log(cell.draw(6, 3));16var TextCell = require('stf-devicefarmer-1').TextCell;17var cell = new TextCell('Hello\nWorld');18console.log(cell.minWidth());19console.log(cell.minHeight());20console.log(cell.draw(6, 3));21var TextCell = require('stf-devicefarmer-2').TextCell;22var cell = new TextCell('Hello\nWorld');23console.log(cell.minWidth());24console.log(cell.minHeight());25console.log(cell.draw(6, 3));26var TextCell = require('stf-devicefarmer-3').TextCell;27var cell = new TextCell('Hello\nWorld');28console.log(cell.minWidth());29console.log(cell.minHeight());30console.log(cell.draw(6, 3));31var TextCell = require('stf-devicefarmer-4').TextCell;32var cell = new TextCell('Hello\nWorld');33console.log(cell.minWidth());34console.log(cell.minHeight());35console.log(cell.draw(6, 3));36var TextCell = require('stf-devicefarmer-5').TextCell;37var cell = new TextCell('Hello\nWorld');38console.log(cell.minWidth());39console.log(cell.minHeight());40console.log(cell.draw

Full Screen

Using AI Code Generation

copy

Full Screen

1var util = require('util');2var TextCell = require('devicefarmer-stf').TextCell;3var cell = new TextCell('Hello World');4console.log(cell);5console.log(cell.minWidth());6console.log(cell.minHeight());7console.log(cell.draw(10, 10));8TextCell { text: 'Hello World' }9var util = require('util');10var TextCell = require('devicefarmer-stf').TextCell;11var cell = new TextCell('Hello World');12console.log(cell);13console.log(cell.minWidth());14console.log(cell.minHeight());15console.log(cell.draw(10, 10));16console.log(cell.draw(5, 5));17TextCell { text: 'Hello World' }18var util = require('util');19var TextCell = require('devicefarmer-stf').TextCell;20var cell = new TextCell('Hello World');21console.log(cell);22console.log(cell.minWidth());23console.log(cell.minHeight());24console.log(cell.draw(10, 10));25console.log(cell.draw(5, 5));26console.log(cell.draw(7, 7));27TextCell { text: 'Hello World' }28var util = require('util');29var TextCell = require('devicefarmer-stf').TextCell;30var cell = new TextCell('Hello World');31console.log(cell);32console.log(cell.minWidth());33console.log(cell.minHeight());34console.log(cell.draw(10, 10));35console.log(cell.draw(5, 5));36console.log(cell.draw(7, 7));37console.log(cell.draw(7, 1));38TextCell { text: 'Hello World' }

Full Screen

Using AI Code Generation

copy

Full Screen

1var TextCell = require('devicefarmer-stf-client').TextCell;2var textCell = new TextCell();3textCell.sendText('text to send');4var TouchCell = require('devicefarmer-stf-client').TouchCell;5var touchCell = new TouchCell();6touchCell.tap(100, 100);7var SwipeCell = require('devicefarmer-stf-client').SwipeCell;8var swipeCell = new SwipeCell();9swipeCell.swipe(100, 100, 200, 200);10var KeyCell = require('devicefarmer-stf-client').KeyCell;11var keyCell = new KeyCell();12keyCell.pressKey('KEYCODE_HOME');13var ScreenShotCell = require('devicefarmer-stf-client').ScreenShotCell;14var screenShotCell = new ScreenShotCell();15screenShotCell.takeScreenShot();16var ScreenShotCell = require('devicefarmer-stf-client').ScreenShotCell;17var screenShotCell = new ScreenShotCell();18screenShotCell.takeScreenShot();19var InstallApkCell = require('devicefarmer-stf-client').InstallApkCell;20var installApkCell = new InstallApkCell();21installApkCell.installApk('path/to/apk');22var UninstallApkCell = require('devicefarmer-stf-client').UninstallApkCell;23var uninstallApkCell = new UninstallApkCell();24uninstallApkCell.uninstallApk('package_name');25var ScreenShotCell = require('devicefarmer-stf-client').ScreenShotCell;

Full Screen

Using AI Code Generation

copy

Full Screen

1var TextCell = require('devicefarmer-stf-client').TextCell;2var cell = new TextCell();3cell.setText("Hello World");4cell.show();5var ImageCell = require('devicefarmer-stf-client').ImageCell;6var cell = new ImageCell();7cell.show();8var ButtonCell = require('devicefarmer-stf-client').ButtonCell;9var cell = new ButtonCell();10cell.setText("Click Me");11cell.show();12cell.on('click', function() {13 console.log('Button Clicked');14});15var ButtonCell = require('devicefarmer-stf-client').ButtonCell;16var cell = new ButtonCell();17cell.setText("Click Me");18cell.show();19cell.on('click', function() {20 console.log('Button Clicked');21});22var ButtonCell = require('devicefarmer-stf-client').ButtonCell;23var cell = new ButtonCell();24cell.setText("Click Me");25cell.show();26cell.on('click', function() {27 console.log('Button Clicked');28});29var ButtonCell = require('devicefarmer-stf-client').ButtonCell;30var cell = new ButtonCell();31cell.setText("Click Me");32cell.show();33cell.on('click', function() {34 console.log('Button Clicked');35});36var ButtonCell = require('devicefarmer-stf-client').ButtonCell;37var cell = new ButtonCell();38cell.setText("Click Me");39cell.show();40cell.on('click', function() {41 console.log('Button Clicked');42});43var ButtonCell = require('devicefarmer-stf-client').ButtonCell;44var cell = new ButtonCell();45cell.setText("Click Me");46cell.show();47cell.on('click', function() {48 console.log('Button Clicked');49});50var ButtonCell = require('devicefar

Full Screen

Using AI Code Generation

copy

Full Screen

1var TextCell = require('devicefarmer-stf-client').TextCell;2var textCell = new TextCell('test');3textCell.tap();4var TouchCell = require('devicefarmer-stf-client').TouchCell;5var touchCell = new TouchCell('test');6touchCell.tap();7var TouchCell = require('devicefarmer-stf-client').TouchCell;8var touchCell = new TouchCell('test');9touchCell.tap();10var TouchCell = require('devicefarmer-stf-client').TouchCell;11var touchCell = new TouchCell('test');12touchCell.tap();13var TouchCell = require('devicefarmer-stf-client').TouchCell;14var touchCell = new TouchCell('test');15touchCell.tap();16var TouchCell = require('devicefarmer-stf-client').TouchCell;17var touchCell = new TouchCell('test');18touchCell.tap();19var TouchCell = require('devicefarmer-stf-client').TouchCell;20var touchCell = new TouchCell('test');21touchCell.tap();22var TouchCell = require('devicefarmer-stf-client').TouchCell;23var touchCell = new TouchCell('test');24touchCell.tap();25var TouchCell = require('devicefarmer-stf-client').TouchCell;26var touchCell = new TouchCell('test');27touchCell.tap();28var TouchCell = require('devicefarmer-stf-client').TouchCell;29var touchCell = new TouchCell('test');30touchCell.tap();

Full Screen

Using AI Code Generation

copy

Full Screen

1var TextCell = require('devicefarmer-stf').TextCell;2var textCell = new TextCell();3textCell.setText("Hello World");4textCell.sendText();5var TextCell = require('devicefarmer-stf').TextCell;6var textCell = new TextCell();7textCell.setText("Hello World");8textCell.sendText();9var TextCell = require('devicefarmer-stf').TextCell;10var textCell = new TextCell();11textCell.setText("Hello World");12textCell.sendText();13var TextCell = require('devicefarmer-stf').TextCell;14var textCell = new TextCell();15textCell.setText("Hello World");16textCell.sendText();17var TextCell = require('devicefarmer-stf').TextCell;18var textCell = new TextCell();19textCell.setText("Hello World");20textCell.sendText();21var TextCell = require('devicefarmer-stf').TextCell;22var textCell = new TextCell();23textCell.setText("Hello World");24textCell.sendText();25var TextCell = require('devicefarmer-stf').TextCell;26var textCell = new TextCell();27textCell.setText("Hello World");28textCell.sendText();29var TextCell = require('devicefarmer-stf').TextCell;30var textCell = new TextCell();31textCell.setText("Hello World");32textCell.sendText();33var TextCell = require('devicefarmer-stf').TextCell;34var textCell = new TextCell();35textCell.setText("Hello World");36textCell.sendText();

Full Screen

Using AI Code Generation

copy

Full Screen

1var TextCell = require('devicefarmer-stf-client/lib/units/device/adb/textcell');2var textCell = new TextCell();3textCell.start();4textCell.on('data', function(data) {5 console.log(data);6});7textCell.on('error', function(err) {8 console.log(err);9});10textCell.on('close', function() {11 console.log('close');12});13textCell.on('end', function() {14 console.log('end');15});16var TouchCell = require('devicefarmer-stf-client/lib/units/device/adb/touchcell');17var touchCell = new TouchCell();18touchCell.start();19touchCell.on('data', function(data) {20 console.log(data);21});22touchCell.on('error', function(err) {23 console.log(err);24});25touchCell.on('close', function() {26 console.log('close');27});28touchCell.on('end', function() {29 console.log('end');30});31var ScreenShotCell = require('devicefarmer-stf-client/lib/units/device/adb/screenshotcell');32var screenShotCell = new ScreenShotCell();33screenShotCell.start();34screenShotCell.on('data', function(data) {35 console.log(data);36});37screenShotCell.on('error', function(err) {38 console.log(err);39});40screenShotCell.on('close', function() {41 console.log('close');42});43screenShotCell.on('end', function() {44 console.log('end');45});46var ScreenShotCell = require('devicefarmer-stf-client/lib/units/device/adb/screenshotcell');47var screenShotCell = new ScreenShotCell();48screenShotCell.start();49screenShotCell.on('data', function(data) {50 console.log(data);51});52screenShotCell.on('error', function(err) {53 console.log(err);54});55screenShotCell.on('close', function() {56 console.log('close');57});58screenShotCell.on('end', function() {59 console.log('end');60});61var ScreenShotCell = require('devicefarmer-stf-client/lib/units/device/adb/screenshotcell');

Full Screen

Using AI Code Generation

copy

Full Screen

1var TextCell = require('devicefarmer-stf').TextCell;2var cell = new TextCell("Hello World!");3cell.get(function(err, text) {4 console.log("Text: " + text);5});6var ImageCell = require('devicefarmer-stf').ImageCell;7var cell = new ImageCell();8cell.get(function(err, image) {9 console.log("Image: " + image);10});11var CommandCell = require('devicefarmer-stf').CommandCell;12var cell = new CommandCell("ls -l");13cell.get(function(err, text) {14 console.log("Text: " + text);15});16var DeviceInfoCell = require('devicefarmer-stf').DeviceInfoCell;17var cell = new DeviceInfoCell();18cell.get(function(err, info) {19 console.log("Info: " + info);20});21var BatteryInfoCell = require('devicefarmer-stf').BatteryInfoCell;22var cell = new BatteryInfoCell();23cell.get(function(err, info) {24 console.log("Info: " + info);25});26var NetworkInfoCell = require('devicefarmer-stf').NetworkInfoCell;27var cell = new NetworkInfoCell();28cell.get(function(err, info) {29 console.log("Info: " + info);30});31var MemoryInfoCell = require('devicefarmer-stf').MemoryInfoCell;32var cell = new MemoryInfoCell();33cell.get(function(err, info) {34 console.log("Info: " + info);35});

Full Screen

Using AI Code Generation

copy

Full Screen

1var TextCell = require('devicefarmer-stf-client/lib/protocol/TextCell');2var textCell = new TextCell();3textCell.setText('Hello');4textCell.setGravity(1);5textCell.setTextSize(20);6textCell.setTextColor(0xff0000ff);7textCell.setBold(true);8textCell.setItalic(true);9textCell.setUnderline(true);10textCell.setStrikeThrough(true);11textCell.setLinkColor(0xffff0000);12var ImageCell = require('devicefarmer-stf-client/lib/protocol/ImageCell');13var imageCell = new ImageCell();14imageCell.setGravity(1);15imageCell.setWidth(100);16imageCell.setHeight(100);17imageCell.setRadius(20);18imageCell.setBorderWidth(2);19imageCell.setBorderColor(0xff0000ff);20imageCell.setLinkColor(0xffff0000);21var ButtonCell = require('devicefarmer-stf-client/lib/protocol/ButtonCell');22var buttonCell = new ButtonCell();23buttonCell.setText('Hello');24buttonCell.setGravity(1);25buttonCell.setTextSize(20);26buttonCell.setTextColor(0xff0000ff);27buttonCell.setBold(true);28buttonCell.setItalic(true);29buttonCell.setUnderline(true);30buttonCell.setStrikeThrough(true);31buttonCell.setLinkColor(0xffff0000);32buttonCell.setRadius(20);33buttonCell.setBorderWidth(2);34buttonCell.setBorderColor(0xff0000ff);35buttonCell.setBgColor(0xff00ff00);36buttonCell.setBgColorPressed(0xffff00ff);37buttonCell.setBgColorSelected(0xffffff00);38var Table = require('devicefarmer-stf-client/lib/protocol/Table');39var table = new Table();40table.setBgColor(0xff00ff00);41table.setPadding(10);42table.setSpacing(10);43table.setGravity(1);44table.setMinHeight(100);45table.setMinWidth(100);46table.setRadius(20);47table.setBorderWidth(2);48table.setBorderColor(

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 devicefarmer-stf 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