From 4dccefc1260dcaf49025dea31944865805026148 Mon Sep 17 00:00:00 2001 From: mmcwilliams Date: Wed, 7 Feb 2018 13:44:24 -0500 Subject: [PATCH] Write new profile setting to settings.json file when changed --- app/lib/ui/devices.js | 5 +++++ app/main.js | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/app/lib/ui/devices.js b/app/lib/ui/devices.js index 76a639a..b7593de 100644 --- a/app/lib/ui/devices.js +++ b/app/lib/ui/devices.js @@ -31,6 +31,7 @@ devices.profile = function (profile) { for (let key of keys) { mcopy.cfg[key] = keys[key] } + ipcRenderer.send('profile', { profile }) }; devices.listen = function () { 'use strict'; @@ -72,6 +73,10 @@ devices.ready = function (event, arg) { $('#devices').append(opt); } } + if (arg && arg.profile) { + $('#profile').val(arg.profile) + //devices.profile(arg.profile) + } return event.returnValue = true; }; diff --git a/app/main.js b/app/main.js index 0a7e2f4..b452625 100644 --- a/app/main.js +++ b/app/main.js @@ -41,6 +41,18 @@ let menu mcopy.cfg = require('./data/cfg.json') 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) { if (err) { log.info(err, 'SERIAL', false, true) @@ -535,6 +547,8 @@ var init = function () { light.init() proj.init() cam.init() + dev.init() + //transfer.init() //capture.init()