Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ardublockly
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
ardublockly
Commits
461a911a
Commit
461a911a
authored
Sep 04, 2015
by
carlosperate
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Linter fixes on Electron code.
parent
54dd1b3e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
49 deletions
+48
-49
package/electron/app/appmenu.js
package/electron/app/appmenu.js
+28
-28
package/electron/app/main.js
package/electron/app/main.js
+6
-7
package/electron/app/rootlocator.js
package/electron/app/rootlocator.js
+1
-1
package/electron/app/servermgr.js
package/electron/app/servermgr.js
+13
-13
No files found.
package/electron/app/appmenu.js
View file @
461a911a
...
@@ -20,14 +20,14 @@ module.exports.setArdublocklyMenu = function(devMode) {
...
@@ -20,14 +20,14 @@ module.exports.setArdublocklyMenu = function(devMode) {
if
(
typeof
(
devMode
)
===
'
undefined
'
)
devMode
=
false
;
if
(
typeof
(
devMode
)
===
'
undefined
'
)
devMode
=
false
;
var
ardublocklyMenu
=
[];
var
ardublocklyMenu
=
[];
if
(
process
.
platform
==
"
darwin
"
)
{
if
(
process
.
platform
==
'
darwin
'
)
{
ardublocklyMenu
.
push
(
getMacMenuData
());
ardublocklyMenu
.
push
(
getMacMenuData
());
}
}
ardublocklyMenu
.
push
(
getFileMenuData
());
ardublocklyMenu
.
push
(
getFileMenuData
());
ardublocklyMenu
.
push
(
getEditMenuData
());
ardublocklyMenu
.
push
(
getEditMenuData
());
ardublocklyMenu
.
push
(
getProgramMenuData
());
ardublocklyMenu
.
push
(
getProgramMenuData
());
ardublocklyMenu
.
push
(
getExamplesMenuData
());
ardublocklyMenu
.
push
(
getExamplesMenuData
());
if
(
process
.
platform
==
"
darwin
"
)
{
if
(
process
.
platform
==
'
darwin
'
)
{
ardublocklyMenu
.
push
(
getWindowMenuData
());
ardublocklyMenu
.
push
(
getWindowMenuData
());
}
}
ardublocklyMenu
.
push
(
getHelpMenuData
());
ardublocklyMenu
.
push
(
getHelpMenuData
());
...
@@ -54,7 +54,7 @@ var getMacMenuData = function() {
...
@@ -54,7 +54,7 @@ var getMacMenuData = function() {
click
:
function
()
{
click
:
function
()
{
BrowserWindow
.
getFocusedWindow
()
BrowserWindow
.
getFocusedWindow
()
.
webContents
.
webContents
.
executeJavaScript
(
"
Ardublockly.openSettings()
"
);
.
executeJavaScript
(
'
Ardublockly.openSettings()
'
);
}
}
},
{
},
{
type
:
'
separator
'
type
:
'
separator
'
...
@@ -100,13 +100,13 @@ var getFileMenuData = function() {
...
@@ -100,13 +100,13 @@ var getFileMenuData = function() {
accelerator
:
'
CmdOrCtrl+O
'
,
accelerator
:
'
CmdOrCtrl+O
'
,
click
:
function
()
{
click
:
function
()
{
dialog
.
showMessageBox
({
dialog
.
showMessageBox
({
type
:
"
info
"
,
type
:
'
info
'
,
title
:
"
Dialog
"
,
title
:
'
Dialog
'
,
buttons
:
[
"
ok
"
,],
buttons
:
[
'
ok
'
,],
message
:
"
This functionality has not yet been
"
+
message
:
'
This functionality has not yet been
'
+
"
implemented in the window menu.
\n
You can
"
+
'
implemented in the window menu.
\n
You can
'
+
"
still open a blocks file using the 'Open'
"
+
'
still open a blocks file using the "Open"
'
+
"
button on the main interface.
"
'
button on the main interface.
'
});
});
}
}
},
{
},
{
...
@@ -115,7 +115,7 @@ var getFileMenuData = function() {
...
@@ -115,7 +115,7 @@ var getFileMenuData = function() {
click
:
function
()
{
click
:
function
()
{
BrowserWindow
.
getFocusedWindow
()
BrowserWindow
.
getFocusedWindow
()
.
webContents
.
webContents
.
executeJavaScript
(
"
Ardublockly.saveXmlFileAs()
"
);
.
executeJavaScript
(
'
Ardublockly.saveXmlFileAs()
'
);
}
}
},
{
},
{
label
:
'
Save Arduino Sketch as
'
,
label
:
'
Save Arduino Sketch as
'
,
...
@@ -124,14 +124,14 @@ var getFileMenuData = function() {
...
@@ -124,14 +124,14 @@ var getFileMenuData = function() {
BrowserWindow
.
getFocusedWindow
()
BrowserWindow
.
getFocusedWindow
()
.
webContents
.
webContents
.
executeJavaScript
(
.
executeJavaScript
(
"
Ardublockly.saveSketchFileAs()
"
);
'
Ardublockly.saveSketchFileAs()
'
);
}
}
}
}
]
]
};
};
// On MacOS the Quit option is in the app menu, so only add it if not mac
// 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
(
fileMenu
.
submenu
.
push
(
{
{
type
:
'
separator
'
type
:
'
separator
'
...
@@ -168,7 +168,7 @@ var getEditMenuData = function() {
...
@@ -168,7 +168,7 @@ var getEditMenuData = function() {
click
:
function
()
{
click
:
function
()
{
BrowserWindow
.
getFocusedWindow
()
BrowserWindow
.
getFocusedWindow
()
.
webContents
.
webContents
.
executeJavaScript
(
"
Ardublockly.blocklyCut()
"
);
.
executeJavaScript
(
'
Ardublockly.blocklyCut()
'
);
}
}
},
{
},
{
label
:
'
Copy
'
,
label
:
'
Copy
'
,
...
@@ -176,7 +176,7 @@ var getEditMenuData = function() {
...
@@ -176,7 +176,7 @@ var getEditMenuData = function() {
click
:
function
()
{
click
:
function
()
{
BrowserWindow
.
getFocusedWindow
()
BrowserWindow
.
getFocusedWindow
()
.
webContents
.
webContents
.
executeJavaScript
(
"
Ardublockly.blocklyCopy()
"
);
.
executeJavaScript
(
'
Ardublockly.blocklyCopy()
'
);
}
}
},
{
},
{
label
:
'
Paste
'
,
label
:
'
Paste
'
,
...
@@ -184,7 +184,7 @@ var getEditMenuData = function() {
...
@@ -184,7 +184,7 @@ var getEditMenuData = function() {
click
:
function
()
{
click
:
function
()
{
BrowserWindow
.
getFocusedWindow
()
BrowserWindow
.
getFocusedWindow
()
.
webContents
.
webContents
.
executeJavaScript
(
"
Ardublockly.blocklyPaste()
"
);
.
executeJavaScript
(
'
Ardublockly.blocklyPaste()
'
);
}
}
},
{
},
{
label
:
'
Delete
'
,
label
:
'
Delete
'
,
...
@@ -192,7 +192,7 @@ var getEditMenuData = function() {
...
@@ -192,7 +192,7 @@ var getEditMenuData = function() {
click
:
function
()
{
click
:
function
()
{
BrowserWindow
.
getFocusedWindow
()
BrowserWindow
.
getFocusedWindow
()
.
webContents
.
webContents
.
executeJavaScript
(
"
Ardublockly.blocklyDelete()
"
);
.
executeJavaScript
(
'
Ardublockly.blocklyDelete()
'
);
}
}
},
{
},
{
label
:
'
Delete All
'
,
label
:
'
Delete All
'
,
...
@@ -200,14 +200,14 @@ var getEditMenuData = function() {
...
@@ -200,14 +200,14 @@ var getEditMenuData = function() {
click
:
function
()
{
click
:
function
()
{
BrowserWindow
.
getFocusedWindow
()
BrowserWindow
.
getFocusedWindow
()
.
webContents
.
webContents
.
executeJavaScript
(
"
Ardublockly.discardAllBlocks()
"
);
.
executeJavaScript
(
'
Ardublockly.discardAllBlocks()
'
);
}
}
}
}
]
]
};
};
// On MacOS Preferences is in the app menu, so only add it if not mac
// 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
(
editMenud
.
submenu
.
push
(
{
{
type
:
'
separator
'
type
:
'
separator
'
...
@@ -217,7 +217,7 @@ var getEditMenuData = function() {
...
@@ -217,7 +217,7 @@ var getEditMenuData = function() {
click
:
function
()
{
click
:
function
()
{
BrowserWindow
.
getFocusedWindow
()
BrowserWindow
.
getFocusedWindow
()
.
webContents
.
webContents
.
executeJavaScript
(
"
Ardublockly.openSettings()
"
);
.
executeJavaScript
(
'
Ardublockly.openSettings()
'
);
}
}
}
}
);
);
...
@@ -290,7 +290,7 @@ var getProgramMenuData = function() {
...
@@ -290,7 +290,7 @@ var getProgramMenuData = function() {
click
:
function
()
{
click
:
function
()
{
BrowserWindow
.
getFocusedWindow
()
BrowserWindow
.
getFocusedWindow
()
.
webContents
.
webContents
.
executeJavaScript
(
"
Ardublockly.ideSendOpen()
"
);
.
executeJavaScript
(
'
Ardublockly.ideSendOpen()
'
);
}
}
},
{
},
{
label
:
'
Verify
'
,
label
:
'
Verify
'
,
...
@@ -298,7 +298,7 @@ var getProgramMenuData = function() {
...
@@ -298,7 +298,7 @@ var getProgramMenuData = function() {
click
:
function
()
{
click
:
function
()
{
BrowserWindow
.
getFocusedWindow
()
BrowserWindow
.
getFocusedWindow
()
.
webContents
.
webContents
.
executeJavaScript
(
"
Ardublockly.ideSendVerify()
"
);
.
executeJavaScript
(
'
Ardublockly.ideSendVerify()
'
);
}
}
},
{
},
{
label
:
'
Upload program
'
,
label
:
'
Upload program
'
,
...
@@ -306,7 +306,7 @@ var getProgramMenuData = function() {
...
@@ -306,7 +306,7 @@ var getProgramMenuData = function() {
click
:
function
()
{
click
:
function
()
{
BrowserWindow
.
getFocusedWindow
()
BrowserWindow
.
getFocusedWindow
()
.
webContents
.
webContents
.
executeJavaScript
(
"
Ardublockly.ideSendUpload()
"
);
.
executeJavaScript
(
'
Ardublockly.ideSendUpload()
'
);
}
}
}
}
]
]
...
@@ -408,7 +408,7 @@ var getDevMenuData = function() {
...
@@ -408,7 +408,7 @@ var getDevMenuData = function() {
BrowserWindow
.
getFocusedWindow
()
BrowserWindow
.
getFocusedWindow
()
.
webContents
.
webContents
.
executeJavaScript
(
.
executeJavaScript
(
"
$('.button-collapse').sideNav('show')
"
);
'
$(".button-collapse").sideNav("show")
'
);
}
}
},
{
},
{
type
:
'
separator
'
type
:
'
separator
'
...
@@ -422,10 +422,10 @@ var getDevMenuData = function() {
...
@@ -422,10 +422,10 @@ var getDevMenuData = function() {
var
functionNotImplemented
=
function
()
{
var
functionNotImplemented
=
function
()
{
dialog
.
showMessageBox
({
dialog
.
showMessageBox
({
type
:
"
info
"
,
type
:
'
info
'
,
title
:
"
Dialog
"
,
title
:
'
Dialog
'
,
buttons
:
[
"
ok
"
,],
buttons
:
[
'
ok
'
,],
message
:
"
This functionality has not yet been implemented.
"
message
:
'
This functionality has not yet been implemented.
'
});
});
};
};
...
...
package/electron/app/main.js
View file @
461a911a
...
@@ -29,8 +29,7 @@ var mainWindowState = windowStateKeeper('main', {
...
@@ -29,8 +29,7 @@ var mainWindowState = windowStateKeeper('main', {
height
:
765
height
:
765
});
});
app
.
on
(
'
ready
'
,
function
()
{
app
.
on
(
'
ready
'
,
function
()
{
// Finding project path
var
projectRootPath
=
projectRootLocator
.
getProjectRootPath
();
var
projectRootPath
=
projectRootLocator
.
getProjectRootPath
();
// Setting up logging system
// Setting up logging system
...
@@ -79,7 +78,7 @@ app.on('ready', function () {
...
@@ -79,7 +78,7 @@ app.on('ready', function () {
}
}
mainWindow
.
webContents
.
on
(
'
did-fail-load
'
,
mainWindow
.
webContents
.
on
(
'
did-fail-load
'
,
function
(
event
,
errorCode
,
errorDescription
)
{
function
(
event
,
errorCode
,
errorDescription
)
{
winston
.
warn
(
'
Page failed to load (
'
+
errorCode
+
'
). The
'
+
winston
.
warn
(
'
Page failed to load (
'
+
errorCode
+
'
). The
'
+
'
server is probably not yet running. Trying again in 200 ms.
'
);
'
server is probably not yet running. Trying again in 200 ms.
'
);
setTimeout
(
function
()
{
setTimeout
(
function
()
{
...
@@ -88,7 +87,7 @@ app.on('ready', 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
();
mainWindow
.
show
();
if
(
splashWindow
!==
null
)
{
if
(
splashWindow
!==
null
)
{
splashWindow
.
close
();
splashWindow
.
close
();
...
@@ -98,13 +97,13 @@ app.on('ready', function () {
...
@@ -98,13 +97,13 @@ app.on('ready', function () {
mainWindow
.
loadUrl
(
'
http://localhost:8000/ardublockly
'
);
mainWindow
.
loadUrl
(
'
http://localhost:8000/ardublockly
'
);
mainWindow
.
on
(
'
close
'
,
function
()
{
mainWindow
.
on
(
'
close
'
,
function
()
{
mainWindowState
.
saveState
(
mainWindow
);
mainWindowState
.
saveState
(
mainWindow
);
mainWindow
=
null
;
mainWindow
=
null
;
});
});
});
});
app
.
on
(
'
window-all-closed
'
,
function
()
{
app
.
on
(
'
window-all-closed
'
,
function
()
{
server
.
stopServer
();
server
.
stopServer
();
// Might need to add OS X exception
// Might need to add OS X exception
// https://github.com/atom/electron/issues/1357
// https://github.com/atom/electron/issues/1357
...
...
package/electron/app/rootlocator.js
View file @
461a911a
...
@@ -12,7 +12,7 @@ var winston = require('winston');
...
@@ -12,7 +12,7 @@ var winston = require('winston');
var
jetpack
=
require
(
'
fs-jetpack
'
);
var
jetpack
=
require
(
'
fs-jetpack
'
);
var
env
=
require
(
'
./vendor/electron_boilerplate/env_config
'
);
var
env
=
require
(
'
./vendor/electron_boilerplate/env_config
'
);
var
tag
=
'
[Project Root Locator]
'
var
tag
=
'
[Project Root Locator]
'
;
var
ardublocklyRootDir
=
null
;
var
ardublocklyRootDir
=
null
;
...
...
package/electron/app/servermgr.js
View file @
461a911a
...
@@ -27,7 +27,7 @@ function getServerExecLocation() {
...
@@ -27,7 +27,7 @@ function getServerExecLocation() {
var
ardublocklyProjRootDir
=
projectRootLocator
.
getProjectRootJetpack
();
var
ardublocklyProjRootDir
=
projectRootLocator
.
getProjectRootJetpack
();
// Then, work out the location of the python executable files
// Then, work out the location of the python executable files
if
(
process
.
platform
==
"
darwin
"
)
{
if
(
process
.
platform
==
'
darwin
'
)
{
var
arduexecDir
=
ardublocklyProjRootDir
.
dir
(
'
server
'
);
var
arduexecDir
=
ardublocklyProjRootDir
.
dir
(
'
server
'
);
}
else
{
}
else
{
var
arduexecDir
=
ardublocklyProjRootDir
.
dir
(
'
arduexec/server
'
);
var
arduexecDir
=
ardublocklyProjRootDir
.
dir
(
'
arduexec/server
'
);
...
@@ -35,25 +35,25 @@ function getServerExecLocation() {
...
@@ -35,25 +35,25 @@ function getServerExecLocation() {
// Finally, work out the name of the executable
// Finally, work out the name of the executable
var
arduexecFileName
=
'
start
'
;
var
arduexecFileName
=
'
start
'
;
if
(
process
.
platform
==
"
win32
"
)
{
if
(
process
.
platform
==
'
win32
'
)
{
arduexecFileName
+=
'
.exe
'
;
arduexecFileName
+=
'
.exe
'
;
}
}
var
executableLocation
=
arduexecDir
.
path
(
arduexecFileName
);
var
executableLocation
=
arduexecDir
.
path
(
arduexecFileName
);
winston
.
info
(
tag
+
'
Server executable:
'
+
executableLocation
);
winston
.
info
(
tag
+
'
Server executable:
'
+
executableLocation
);
return
executableLocation
;
return
executableLocation
;
}
;
}
function
ardublocklyNotFound
(
working_dir
)
{
function
ardublocklyNotFound
(
working_dir
)
{
dialog
.
showMessageBox
({
dialog
.
showMessageBox
({
type
:
"
warning
"
,
type
:
'
warning
'
,
title
:
"
Server Error
"
,
title
:
'
Server Error
'
,
buttons
:
[
"
ok
"
],
buttons
:
[
'
ok
'
],
message
:
"
The Ardublockly folder could not be found within the
"
+
message
:
'
The Ardublockly folder could not be found within the
'
+
"
execution directory:
\n
"
+
working_dir
+
"
\n
The application
"
+
'
execution directory:
\n
'
+
working_dir
+
'
\n
The application
'
+
"
won't be able to function properly.
"
'
will not be able to function properly.
'
});
});
}
;
}
module
.
exports
.
startServer
=
function
()
{
module
.
exports
.
startServer
=
function
()
{
if
(
serverProcess
===
null
)
{
if
(
serverProcess
===
null
)
{
...
@@ -64,15 +64,15 @@ module.exports.startServer = function() {
...
@@ -64,15 +64,15 @@ module.exports.startServer = function() {
serverExecLocation
,
[
'
--findprojectroot
'
,
'
--nobrowser
'
]);
serverExecLocation
,
[
'
--findprojectroot
'
,
'
--nobrowser
'
]);
// Setting the listeners
// Setting the listeners
serverProcess
.
stdout
.
on
(
'
data
'
,
function
(
data
)
{
serverProcess
.
stdout
.
on
(
'
data
'
,
function
(
data
)
{
winston
.
info
(
'
[Ardublockly server]
'
+
data
);
winston
.
info
(
'
[Ardublockly server]
'
+
data
);
});
});
serverProcess
.
stderr
.
on
(
'
data
'
,
function
(
data
)
{
serverProcess
.
stderr
.
on
(
'
data
'
,
function
(
data
)
{
winston
.
error
(
'
[Ardublockly server]
'
+
data
);
winston
.
error
(
'
[Ardublockly server]
'
+
data
);
});
});
serverProcess
.
on
(
'
close
'
,
function
(
code
)
{
serverProcess
.
on
(
'
close
'
,
function
(
code
)
{
if
(
code
!==
0
)
{
if
(
code
!==
0
)
{
winston
.
info
(
'
[Ardublockly server] Process exited with code
'
+
winston
.
info
(
'
[Ardublockly server] Process exited with code
'
+
code
);
code
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment