Merge pull request #11653 from vladest/fix_sriptslog_multiply_window

Fix scriptslog multiply window
This commit is contained in:
Melissa Brown 2017-11-10 11:11:46 -08:00 committed by GitHub
commit f7eb57a54c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -10,13 +10,24 @@
(function() { // BEGIN LOCAL_SCOPE
//check if script already running.
var scriptData = ScriptDiscoveryService.getRunning();
var scripts = scriptData.filter(function (datum) { return datum.name === 'debugWindow.js'; });
if (scripts.length >= 2) {
//2nd instance of the script is too much
ScriptDiscoveryService.stopScript(scripts[1].url);
return;
}
// Set up the qml ui
var qml = Script.resolvePath('debugWindow.qml');
var window = new OverlayWindow({
title: 'Debug Window',
source: qml,
width: 400, height: 900,
});
window.setPosition(25, 50);
window.closed.connect(function() { Script.stop(); });