Commit 461a911a authored by carlosperate's avatar carlosperate

Linter fixes on Electron code.

parent 54dd1b3e
......@@ -20,14 +20,14 @@ module.exports.setArdublocklyMenu = function(devMode) {
if (typeof(devMode)==='undefined') devMode = false;
var ardublocklyMenu = [];
if (process.platform == "darwin") {
if (process.platform == 'darwin') {
ardublocklyMenu.push(getMacMenuData());
}
ardublocklyMenu.push(getFileMenuData());
ardublocklyMenu.push(getEditMenuData());
ardublocklyMenu.push(getProgramMenuData());
ardublocklyMenu.push(getExamplesMenuData());
if (process.platform == "darwin") {
if (process.platform == 'darwin') {
ardublocklyMenu.push(getWindowMenuData());
}
ardublocklyMenu.push(getHelpMenuData());
......@@ -54,7 +54,7 @@ var getMacMenuData = function() {
click: function() {
BrowserWindow.getFocusedWindow()
.webContents
.executeJavaScript("Ardublockly.openSettings()");
.executeJavaScript('Ardublockly.openSettings()');
}
}, {
type: 'separator'
......@@ -100,13 +100,13 @@ var getFileMenuData = function() {
accelerator: 'CmdOrCtrl+O',
click: function() {
dialog.showMessageBox({
type: "info",
title: "Dialog",
buttons: ["ok",],
message: "This functionality has not yet been "+
"implemented in the window menu.\nYou can " +
"still open a blocks file using the 'Open' " +
"button on the main interface."
type: 'info',
title: 'Dialog',
buttons: ['ok',],
message: 'This functionality has not yet been '+
'implemented in the window menu.\nYou can ' +
'still open a blocks file using the "Open" ' +
'button on the main interface.'
});
}
}, {
......@@ -115,7 +115,7 @@ var getFileMenuData = function() {
click: function() {
BrowserWindow.getFocusedWindow()
.webContents
.executeJavaScript("Ardublockly.saveXmlFileAs()");
.executeJavaScript('Ardublockly.saveXmlFileAs()');
}
}, {
label: 'Save Arduino Sketch as',
......@@ -124,14 +124,14 @@ var getFileMenuData = function() {
BrowserWindow.getFocusedWindow()
.webContents
.executeJavaScript(
"Ardublockly.saveSketchFileAs()");
'Ardublockly.saveSketchFileAs()');
}
}
]
};
// On MacOS the Quit option is in the app menu, so only add it if not mac
if (process.platform != "darwin") {
if (process.platform != 'darwin') {
fileMenu.submenu.push(
{
type: 'separator'
......@@ -168,7 +168,7 @@ var getEditMenuData = function() {
click: function() {
BrowserWindow.getFocusedWindow()
.webContents
.executeJavaScript("Ardublockly.blocklyCut()");
.executeJavaScript('Ardublockly.blocklyCut()');
}
}, {
label: 'Copy',
......@@ -176,7 +176,7 @@ var getEditMenuData = function() {
click: function() {
BrowserWindow.getFocusedWindow()
.webContents
.executeJavaScript("Ardublockly.blocklyCopy()");
.executeJavaScript('Ardublockly.blocklyCopy()');
}
}, {
label: 'Paste',
......@@ -184,7 +184,7 @@ var getEditMenuData = function() {
click: function() {
BrowserWindow.getFocusedWindow()
.webContents
.executeJavaScript("Ardublockly.blocklyPaste()");
.executeJavaScript('Ardublockly.blocklyPaste()');
}
}, {
label: 'Delete',
......@@ -192,7 +192,7 @@ var getEditMenuData = function() {
click: function() {
BrowserWindow.getFocusedWindow()
.webContents
.executeJavaScript("Ardublockly.blocklyDelete()");
.executeJavaScript('Ardublockly.blocklyDelete()');
}
}, {
label: 'Delete All',
......@@ -200,14 +200,14 @@ var getEditMenuData = function() {
click: function() {
BrowserWindow.getFocusedWindow()
.webContents
.executeJavaScript("Ardublockly.discardAllBlocks()");
.executeJavaScript('Ardublockly.discardAllBlocks()');
}
}
]
};
// On MacOS Preferences is in the app menu, so only add it if not mac
if (process.platform != "darwin") {
if (process.platform != 'darwin') {
editMenud.submenu.push(
{
type: 'separator'
......@@ -217,7 +217,7 @@ var getEditMenuData = function() {
click: function() {
BrowserWindow.getFocusedWindow()
.webContents
.executeJavaScript("Ardublockly.openSettings()");
.executeJavaScript('Ardublockly.openSettings()');
}
}
);
......@@ -290,7 +290,7 @@ var getProgramMenuData = function() {
click: function() {
BrowserWindow.getFocusedWindow()
.webContents
.executeJavaScript("Ardublockly.ideSendOpen()");
.executeJavaScript('Ardublockly.ideSendOpen()');
}
}, {
label: 'Verify',
......@@ -298,7 +298,7 @@ var getProgramMenuData = function() {
click: function() {
BrowserWindow.getFocusedWindow()
.webContents
.executeJavaScript("Ardublockly.ideSendVerify()");
.executeJavaScript('Ardublockly.ideSendVerify()');
}
}, {
label: 'Upload program',
......@@ -306,7 +306,7 @@ var getProgramMenuData = function() {
click: function() {
BrowserWindow.getFocusedWindow()
.webContents
.executeJavaScript("Ardublockly.ideSendUpload()");
.executeJavaScript('Ardublockly.ideSendUpload()');
}
}
]
......@@ -408,7 +408,7 @@ var getDevMenuData = function() {
BrowserWindow.getFocusedWindow()
.webContents
.executeJavaScript(
"$('.button-collapse').sideNav('show')");
'$(".button-collapse").sideNav("show")');
}
}, {
type: 'separator'
......@@ -422,10 +422,10 @@ var getDevMenuData = function() {
var functionNotImplemented = function() {
dialog.showMessageBox({
type: "info",
title: "Dialog",
buttons: ["ok",],
message: "This functionality has not yet been implemented."
type: 'info',
title: 'Dialog',
buttons: ['ok',],
message: 'This functionality has not yet been implemented.'
});
};
......
......@@ -29,8 +29,7 @@ var mainWindowState = windowStateKeeper('main', {
height: 765
});
app.on('ready', function () {
// Finding project path
app.on('ready', function() {
var projectRootPath = projectRootLocator.getProjectRootPath();
// Setting up logging system
......@@ -79,7 +78,7 @@ app.on('ready', function () {
}
mainWindow.webContents.on('did-fail-load',
function (event, errorCode, errorDescription) {
function(event, errorCode, errorDescription) {
winston.warn('Page failed to load (' + errorCode + '). The ' +
'server is probably not yet running. Trying again in 200 ms.');
setTimeout(function() {
......@@ -88,7 +87,7 @@ app.on('ready', function () {
}
);
mainWindow.webContents.on('did-finish-load', function () {
mainWindow.webContents.on('did-finish-load', function() {
mainWindow.show();
if (splashWindow !== null) {
splashWindow.close();
......@@ -98,16 +97,16 @@ app.on('ready', function () {
mainWindow.loadUrl('http://localhost:8000/ardublockly');
mainWindow.on('close', function () {
mainWindow.on('close', function() {
mainWindowState.saveState(mainWindow);
mainWindow = null;
});
});
app.on('window-all-closed', function () {
app.on('window-all-closed', function() {
server.stopServer();
// Might need to add OS X exception
// https://github.com/atom/electron/issues/1357
// https://github.com/atom/electron/issues/1357
app.quit();
});
......
......@@ -12,7 +12,7 @@ var winston = require('winston');
var jetpack = require('fs-jetpack');
var env = require('./vendor/electron_boilerplate/env_config');
var tag = '[Project Root Locator] '
var tag = '[Project Root Locator] ';
var ardublocklyRootDir = null;
......
......@@ -27,7 +27,7 @@ function getServerExecLocation() {
var ardublocklyProjRootDir = projectRootLocator.getProjectRootJetpack();
// Then, work out the location of the python executable files
if (process.platform == "darwin") {
if (process.platform == 'darwin') {
var arduexecDir = ardublocklyProjRootDir.dir('server');
} else {
var arduexecDir = ardublocklyProjRootDir.dir('arduexec/server');
......@@ -35,25 +35,25 @@ function getServerExecLocation() {
// Finally, work out the name of the executable
var arduexecFileName = 'start';
if (process.platform == "win32") {
if (process.platform == 'win32') {
arduexecFileName += '.exe';
}
var executableLocation = arduexecDir.path(arduexecFileName);
winston.info(tag + 'Server executable: ' + executableLocation);
return executableLocation;
};
}
function ardublocklyNotFound(working_dir) {
dialog.showMessageBox({
type: "warning",
title: "Server Error",
buttons: ["ok"],
message: "The Ardublockly folder could not be found within the " +
"execution directory:\n" + working_dir + "\nThe application " +
"won't be able to function properly."
type: 'warning',
title: 'Server Error',
buttons: ['ok'],
message: 'The Ardublockly folder could not be found within the ' +
'execution directory:\n' + working_dir + '\nThe application ' +
'will not be able to function properly.'
});
};
}
module.exports.startServer = function() {
if (serverProcess === null) {
......@@ -64,15 +64,15 @@ module.exports.startServer = function() {
serverExecLocation, ['--findprojectroot', '--nobrowser']);
// Setting the listeners
serverProcess.stdout.on('data', function (data) {
serverProcess.stdout.on('data', function(data) {
winston.info('[Ardublockly server] ' + data);
});
serverProcess.stderr.on('data', function (data) {
serverProcess.stderr.on('data', function(data) {
winston.error('[Ardublockly server] ' + data);
});
serverProcess.on('close', function (code) {
serverProcess.on('close', function(code) {
if (code !== 0) {
winston.info('[Ardublockly server] Process exited with code ' +
code);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment