Commit 6af1ba3b authored by Pieterjan Vanhoof's avatar Pieterjan Vanhoof Committed by GitHub

Merge pull request #151 from stratisproject/ui

Add copy/paste to OS X
parents 26a88ea4 e1447686
...@@ -9,8 +9,6 @@ const path = require('path'); ...@@ -9,8 +9,6 @@ const path = require('path');
const url = require('url'); const url = require('url');
const os = require('os'); const os = require('os');
var apiProcess;
let serve; let serve;
const args = process.argv.slice(1); const args = process.argv.slice(1);
serve = args.some(val => val === "--serve"); serve = args.some(val => val === "--serve");
...@@ -71,7 +69,8 @@ function createWindow() { ...@@ -71,7 +69,8 @@ function createWindow() {
req.write(''); req.write('');
req.end(); req.end();
} }
}); }
);
} }
// This method will be called when Electron has finished // This method will be called when Electron has finished
...@@ -86,7 +85,10 @@ app.on('ready', function () { ...@@ -86,7 +85,10 @@ app.on('ready', function () {
} }
createTray(); createTray();
createWindow(); createWindow();
}) if (os.platform() === 'darwin'){
createMenu();
}
});
// Quit when all windows are closed. // Quit when all windows are closed.
app.on('window-all-closed', function () { app.on('window-all-closed', function () {
...@@ -107,18 +109,19 @@ app.on('activate', function () { ...@@ -107,18 +109,19 @@ app.on('activate', function () {
}); });
function startApi() { function startApi() {
var apiProcess;
const exec = require('child_process').exec; const exec = require('child_process').exec;
//Start Breeze Daemon //Start Breeze Daemon
let apipath = path.join(__dirname, './/assets//daemon//Breeze.Daemon'); let apiPath = path.join(__dirname, './/assets//daemon//Breeze.Daemon');
apiPath = apiPath.replace(/ /g, '// ');
if (os.platform() === 'win32') { if (os.platform() === 'win32') {
apipath = path.join(__dirname, '.\\assets\\daemon\\Breeze.Daemon.exe'); apiPath = path.join(__dirname, '.\\assets\\daemon\\Breeze.Daemon.exe');
//Handle spaces in paths
apiPath = apiPath.replace(/ /g, '\\ ');
} }
//Handle spaces in paths apiProcess = exec(apiPath + ' light -testnet', {
apipath = apipath.replace(/ /g, '\\ ');
apiProcess = exec(apipath + ' light -testnet', {
detached: true detached: true
}, (error, stdout, stderr) => { }, (error, stdout, stderr) => {
if (error) { if (error) {
...@@ -168,3 +171,29 @@ function writeLog(msg) { ...@@ -168,3 +171,29 @@ function writeLog(msg) {
function writeLogError(msg) { function writeLogError(msg) {
console.error(msg); console.error(msg);
}; };
function createMenu() {
const Menu = electron.Menu;
// Create the Application's main menu
var menuTemplate = [{
label: "Application",
submenu: [
{ label: "About Application", selector: "orderFrontStandardAboutPanel:" },
{ type: "separator" },
{ label: "Quit", accelerator: "Command+Q", click: function() { app.quit(); }}
]}, {
label: "Edit",
submenu: [
{ label: "Undo", accelerator: "CmdOrCtrl+Z", selector: "undo:" },
{ label: "Redo", accelerator: "Shift+CmdOrCtrl+Z", selector: "redo:" },
{ type: "separator" },
{ label: "Cut", accelerator: "CmdOrCtrl+X", selector: "cut:" },
{ label: "Copy", accelerator: "CmdOrCtrl+C", selector: "copy:" },
{ label: "Paste", accelerator: "CmdOrCtrl+V", selector: "paste:" },
{ label: "Select All", accelerator: "CmdOrCtrl+A", selector: "selectAll:" }
]}
];
Menu.setApplicationMenu(Menu.buildFromTemplate(menuTemplate));
};
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