From ad3357d16afcf152ad67982ae7910061dd2db67c Mon Sep 17 00:00:00 2001 From: openbuilds-engineer Date: Tue, 21 May 2019 14:09:53 +0200 Subject: [PATCH] Update --- CHANGELOG.txt | 1 + index.js | 56 ++++++++++++++++++++++++++++++++++++++++++++++++--- package.json | 2 +- 3 files changed, 55 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 22f29ad..688090e 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,4 @@ +v1.0.169: MacOS: Top Menu and Copy/Paste fixes v1.0.169: Added Estimated Time to Serial Log on GCODE Load. v1.0.168: Improved Grbl Flashing Tool and Moved to "Wizards and Tools", Improved Inch Mode 3D viewer, fix bug in Continious Jog v1.0.167: Improved Memory management for 3D Viewer, Added Inch Mode (Issue#59), Moved Steps/mm Calibration Tools to "Wizards and Tools" menu, diff --git a/index.js b/index.js index 15a695c..1b56c03 100644 --- a/index.js +++ b/index.js @@ -55,6 +55,8 @@ var lastsentuploadprogress = 0; // Electron app const electron = require('electron'); const electronApp = electron.app; + + if (isElectron()) { console.log("Local User Data: " + electronApp.getPath('userData')) electronApp.commandLine.appendSwitch('ignore-gpu-blacklist', 'true') @@ -62,7 +64,7 @@ if (isElectron()) { electronApp.commandLine.appendSwitch('enable-zero-copy', 'true') electronApp.commandLine.appendSwitch('disable-software-rasterizer', 'true') electronApp.commandLine.appendSwitch('enable-native-gpu-memory-buffers', 'true') - // Removing max-old-space-size switch (Introduced in 1.0.168 and removed in 1.0.169) due it causing High CPU load on some PCs. + // Removing max-old-space-size switch (Introduced in 1.0.168 and removed in 1.0.169) due it causing High CPU load on some PCs. //electronApp.commandLine.appendSwitch('js-flags', '--max-old-space-size=8192') console.log('Command Line Arguments for Electron: Set OK') } @@ -492,10 +494,12 @@ app.get('/workspace', (req, res) => { app.post('/upload', function(req, res) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); - // console.log(req) + //console.log(req) uploadprogress = 0 var form = new formidable.IncomingForm(); - form.parse(req, function(err, fields, files) {}); + form.parse(req, function(err, fields, files) { + // console.log(files); + }); form.on('fileBegin', function(name, file) { console.log('Uploading ' + file.name); @@ -2174,6 +2178,10 @@ if (isElectron()) { function createApp() { createTrayIcon(); + if (process.platform == 'darwin') { + console.log("Creating MacOS Menu") + createMenu() + } if (process.platform == 'win32' && process.argv.length >= 2) { var openFilePath = process.argv[1]; if (openFilePath !== "") { @@ -2199,6 +2207,48 @@ if (isElectron()) { } + function createMenu() { + + var template = [{ + label: "Application", + submenu: [{ + label: "Quit", + accelerator: "Command+Q", + click: function() { + if (appIcon) { + appIcon.destroy(); + } + electronApp.exit(0); + } + }] + }, { + label: "Edit", + submenu: [{ + 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(template)); + } + function createTrayIcon() { if (process.platform !== 'darwin') { appIcon = new Tray( diff --git a/package.json b/package.json index 36cd93c..0a7b3b2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "OpenBuildsCONTROL", - "version": "1.0.169", + "version": "1.0.170", "license": "AGPL-3.0", "description": "Machine Interface Driver for OpenBuilds", "author": "github.com/openbuilds ",