Write new profile setting to settings.json file when changed

This commit is contained in:
mmcwilliams 2018-02-07 13:44:24 -05:00
parent 4a3a99acb6
commit 4dccefc126
2 changed files with 19 additions and 0 deletions

View File

@ -31,6 +31,7 @@ devices.profile = function (profile) {
for (let key of keys) { for (let key of keys) {
mcopy.cfg[key] = keys[key] mcopy.cfg[key] = keys[key]
} }
ipcRenderer.send('profile', { profile })
}; };
devices.listen = function () { devices.listen = function () {
'use strict'; 'use strict';
@ -72,6 +73,10 @@ devices.ready = function (event, arg) {
$('#devices').append(opt); $('#devices').append(opt);
} }
} }
if (arg && arg.profile) {
$('#profile').val(arg.profile)
//devices.profile(arg.profile)
}
return event.returnValue = true; return event.returnValue = true;
}; };

View File

@ -41,6 +41,18 @@ let menu
mcopy.cfg = require('./data/cfg.json') mcopy.cfg = require('./data/cfg.json')
mcopy.settings = {} mcopy.settings = {}
dev.init = function () {
dev.listen()
}
dev.listen = function () {
ipcMain.on('profile', (event, arg) => {
console.log(`Saving profile ${arg.profile}`)
settings.update('profile', arg.profile)
settings.save()
})
}
dev.enumerate = function (err, devices) { dev.enumerate = function (err, devices) {
if (err) { if (err) {
log.info(err, 'SERIAL', false, true) log.info(err, 'SERIAL', false, true)
@ -535,6 +547,8 @@ var init = function () {
light.init() light.init()
proj.init() proj.init()
cam.init() cam.init()
dev.init()
//transfer.init() //transfer.init()
//capture.init() //capture.init()