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
77851b7e
Commit
77851b7e
authored
Jun 16, 2015
by
carlosperate
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Electron: Add basic application menu.
Good foundation to expand in the future.
parent
452fafd1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
137 additions
and
17 deletions
+137
-17
.gitignore
.gitignore
+2
-6
package/electron/app/appmenu.js
package/electron/app/appmenu.js
+107
-0
package/electron/app/main.js
package/electron/app/main.js
+26
-9
package/electron/tasks/build.js
package/electron/tasks/build.js
+2
-2
No files found.
.gitignore
View file @
77851b7e
...
@@ -90,12 +90,8 @@ cef_debug.log
...
@@ -90,12 +90,8 @@ cef_debug.log
/upload
/upload
/releases
/releases
/arduexec
/arduexec
/ardublockly_server_run.bat
ardublockly_server_run.*
/ardublockly_server_run.sh
ardublockly_run.*
/ardublockly_server_run.command
/ardublockly_run.bat
/ardublockly_run.sh
/ardublockly_run.command
# The documentation is built with the GitHub wiki data
# The documentation is built with the GitHub wiki data
/Documentation
/Documentation
...
...
package/electron/app/appmenu.js
0 → 100644
View file @
77851b7e
'
use strict
'
;
var
app
=
require
(
'
app
'
);
var
Menu
=
require
(
'
menu
'
);
var
MenuItem
=
require
(
'
menu-item
'
);
var
BrowserWindow
=
require
(
'
browser-window
'
);
var
dialog
=
require
(
'
dialog
'
);
var
shell
=
require
(
'
shell
'
);
module
.
exports
.
setArdublocklyMenu
=
function
(
devMode
)
{
if
(
typeof
(
devMode
)
===
'
undefined
'
)
devMode
=
false
;
var
ardublocklyMenu
=
[
getFileMenuData
(),
getHelpMenuData
(),
];
if
(
devMode
)
{
ardublocklyMenu
.
push
(
getDevMenuData
());
}
Menu
.
setApplicationMenu
(
Menu
.
buildFromTemplate
(
ardublocklyMenu
));
};
var
getFileMenuData
=
function
()
{
return
{
label
:
'
File
'
,
submenu
:
[
{
label
:
'
Open
'
,
accelerator
:
'
CmdOrCtrl+O
'
,
click
:
functionNotImplemented
},
{
label
:
'
Save as
'
,
accelerator
:
'
CmdOrCtrl+S
'
,
click
:
functionNotImplemented
},
{
label
:
'
Quit
'
,
accelerator
:
'
CmdOrCtrl+Q
'
,
click
:
function
()
{
app
.
quit
();
}
}
]
};
};
var
getHelpMenuData
=
function
()
{
return
{
label
:
'
Help
'
,
submenu
:
[
{
label
:
'
Website
'
,
click
:
function
()
{
shell
.
openExternal
(
'
http://ardublockly.embeddedlog.com
'
);
}
},
{
label
:
'
Source code
'
,
click
:
function
()
{
shell
.
openExternal
(
'
https://github.com/carlosperate/ardublockly
'
);
}
},
{
type
:
'
separator
'
},
{
label
:
'
About
'
,
click
:
functionNotImplemented
}
]
};
};
var
getDevMenuData
=
function
()
{
return
{
label
:
'
Development
'
,
submenu
:
[
{
label
:
'
Reload
'
,
accelerator
:
'
CmdOrCtrl+R
'
,
click
:
function
()
{
BrowserWindow
.
getFocusedWindow
().
reloadIgnoringCache
();
}
},
{
label
:
'
Toggle DevTools
'
,
accelerator
:
'
Alt+CmdOrCtrl+I
'
,
click
:
function
()
{
BrowserWindow
.
getFocusedWindow
().
toggleDevTools
();
}
},
{
label
:
'
Restart server and page
'
,
accelerator
:
'
Shift+CmdOrCtrl+R
'
,
click
:
function
()
{
BrowserWindow
.
getFocusedWindow
().
toggleDevTools
();
}
}
]
};
};
var
functionNotImplemented
=
function
()
{
console
.
log
(
"
test
"
);
dialog
.
showMessageBox
({
type
:
"
info
"
,
title
:
"
Dialog
"
,
buttons
:
[
"
ok
"
,],
message
:
"
This functionality has not yet been implemented.
"
});
};
package/electron/app/main.js
View file @
77851b7e
'
use strict
'
;
'
use strict
'
;
var
app
=
require
(
'
app
'
);
var
app
=
require
(
'
app
'
);
var
appMenu
=
require
(
'
./appmenu.js
'
);
var
BrowserWindow
=
require
(
'
browser-window
'
);
var
BrowserWindow
=
require
(
'
browser-window
'
);
var
env
=
require
(
'
./vendor/electron_boilerplate/env_config
'
);
var
env
=
require
(
'
./vendor/electron_boilerplate/env_config
'
);
var
devHelper
=
require
(
'
./vendor/electron_boilerplate/dev_helper
'
);
var
windowStateKeeper
=
require
(
'
./vendor/electron_boilerplate/window_state
'
);
var
windowStateKeeper
=
require
(
'
./vendor/electron_boilerplate/window_state
'
);
var
mainWindow
;
// Global reference of the window object must be maintain, or the window will
// be closed automatically when the javascript object is garbage collected.
var
mainWindow
=
null
;
// Preserver of the window size and position between app launches.
// Preserver of the window size and position between app launches.
var
mainWindowState
=
windowStateKeeper
(
'
main
'
,
{
var
mainWindowState
=
windowStateKeeper
(
'
main
'
,
{
width
:
1
0
00
,
width
:
1
2
00
,
height
:
600
height
:
765
});
});
app
.
on
(
'
ready
'
,
function
()
{
app
.
on
(
'
ready
'
,
function
()
{
mainWindow
=
new
BrowserWindow
({
mainWindow
=
new
BrowserWindow
({
x
:
mainWindowState
.
x
,
x
:
mainWindowState
.
x
,
y
:
mainWindowState
.
y
,
y
:
mainWindowState
.
y
,
width
:
mainWindowState
.
width
,
width
:
mainWindowState
.
width
,
height
:
mainWindowState
.
height
,
height
:
mainWindowState
.
height
,
"
node-integration
"
:
false
title
:
'
Ardublockly
'
,
type
:
'
desktop
'
,
'
node-integration
'
:
false
,
'
web-preferences
'
:
{
'
web-security
'
:
true
,
'
java
'
:
false
,
'
text-areas-are-resizable
'
:
false
,
'
webgl
'
:
false
,
'
webaudio
'
:
true
,
'
plugins
'
:
false
}
});
});
if
(
mainWindowState
.
isMaximized
)
{
if
(
mainWindowState
.
isMaximized
)
{
mainWindow
.
maximize
();
mainWindow
.
maximize
();
}
}
mainWindow
.
loadUrl
(
'
http://localhost:8000/ardublockly
'
);
if
(
env
.
name
===
'
development
'
)
{
if
(
env
.
name
===
'
development
'
)
{
devHelper
.
setDevMenu
(
);
appMenu
.
setArdublocklyMenu
(
true
);
mainWindow
.
openDevTools
();
mainWindow
.
openDevTools
();
}
else
{
appMenu
.
setArdublocklyMenu
();
}
}
mainWindow
.
loadUrl
(
'
http://localhost:8000/ardublockly
'
);
mainWindow
.
on
(
'
close
'
,
function
()
{
mainWindow
.
on
(
'
close
'
,
function
()
{
mainWindowState
.
saveState
(
mainWindow
);
mainWindowState
.
saveState
(
mainWindow
);
mainWindow
=
null
;
});
});
});
});
app
.
on
(
'
window-all-closed
'
,
function
()
{
app
.
on
(
'
window-all-closed
'
,
function
()
{
// Might need to add OS X exception
// https://github.com/atom/electron/issues/1357
app
.
quit
();
app
.
quit
();
});
});
package/electron/tasks/build.js
View file @
77851b7e
...
@@ -16,14 +16,14 @@ var paths = {
...
@@ -16,14 +16,14 @@ var paths = {
jsCodeToTranspile
:
[
jsCodeToTranspile
:
[
'
app/**/*.js
'
,
'
app/**/*.js
'
,
'
!app/main.js
'
,
'
!app/main.js
'
,
'
!app/
spec
.js
'
,
'
!app/
*
.js
'
,
'
!app/node_modules/**
'
,
'
!app/node_modules/**
'
,
'
!app/bower_components/**
'
,
'
!app/bower_components/**
'
,
'
!app/vendor/**
'
'
!app/vendor/**
'
],
],
toCopy
:
[
toCopy
:
[
'
app/main.js
'
,
'
app/main.js
'
,
'
app/
spec
.js
'
,
'
app/
*
.js
'
,
'
app/node_modules/**
'
,
'
app/node_modules/**
'
,
'
app/bower_components/**
'
,
'
app/bower_components/**
'
,
'
app/vendor/**
'
,
'
app/vendor/**
'
,
...
...
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