store last process settings use for a selected devie
This commit is contained in:
parent
0bdbf74312
commit
027c028202
2 changed files with 21 additions and 9 deletions
28
js/kiri.js
28
js/kiri.js
|
|
@ -398,6 +398,9 @@ self.kiri.license = exports.LICENSE;
|
||||||
// custom devices by name
|
// custom devices by name
|
||||||
devices:{
|
devices:{
|
||||||
},
|
},
|
||||||
|
// map of device to last process setting (name)
|
||||||
|
devproc: {
|
||||||
|
},
|
||||||
layers:{
|
layers:{
|
||||||
layerOutline: true,
|
layerOutline: true,
|
||||||
layerTrace: true,
|
layerTrace: true,
|
||||||
|
|
@ -1925,8 +1928,8 @@ self.kiri.license = exports.LICENSE;
|
||||||
showDialog("catalog");
|
showDialog("catalog");
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadNamedSetting(e) {
|
function loadNamedSetting(e, named) {
|
||||||
var name = e ? e.target.getAttribute("load") : settings.cproc[getMode()],
|
var name = e ? e.target.getAttribute("load") : named || settings.cproc[getMode()],
|
||||||
load = settings.sproc[getMode()][name];
|
load = settings.sproc[getMode()][name];
|
||||||
if (!load) return;
|
if (!load) return;
|
||||||
for (var k in load) {
|
for (var k in load) {
|
||||||
|
|
@ -1935,8 +1938,13 @@ self.kiri.license = exports.LICENSE;
|
||||||
}
|
}
|
||||||
settings.process.processName = name;
|
settings.process.processName = name;
|
||||||
settings.cproc[getMode()] = name;
|
settings.cproc[getMode()] = name;
|
||||||
|
// associate named process with the current device
|
||||||
|
settings.devproc[currentDeviceName()] = name;
|
||||||
|
|
||||||
updateFields();
|
updateFields();
|
||||||
hideDialog();
|
if (!named) {
|
||||||
|
hideDialog();
|
||||||
|
}
|
||||||
updateSettings();
|
updateSettings();
|
||||||
if (e) triggerSettingsEvent();
|
if (e) triggerSettingsEvent();
|
||||||
}
|
}
|
||||||
|
|
@ -2116,6 +2124,10 @@ self.kiri.license = exports.LICENSE;
|
||||||
triggerSettingsEvent();
|
triggerSettingsEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function currentDeviceName() {
|
||||||
|
return settings.filter[getMode()];
|
||||||
|
}
|
||||||
|
|
||||||
function setControlsVisible(show) {
|
function setControlsVisible(show) {
|
||||||
UI.ctrlLeft.style.display = show ? 'block' : 'none';
|
UI.ctrlLeft.style.display = show ? 'block' : 'none';
|
||||||
UI.ctrlRight.style.display = show ? 'block' : 'none';
|
UI.ctrlRight.style.display = show ? 'block' : 'none';
|
||||||
|
|
@ -2874,10 +2886,6 @@ self.kiri.license = exports.LICENSE;
|
||||||
return typeof(val) !== 'undefined' ? val : dv;
|
return typeof(val) !== 'undefined' ? val : dv;
|
||||||
}
|
}
|
||||||
|
|
||||||
function currentDeviceName() {
|
|
||||||
return settings.filter[getMode()];
|
|
||||||
}
|
|
||||||
|
|
||||||
// only for local filters
|
// only for local filters
|
||||||
function updateDeviceCode(override) {
|
function updateDeviceCode(override) {
|
||||||
var oldname = getSelectedDevice(),
|
var oldname = getSelectedDevice(),
|
||||||
|
|
@ -2923,7 +2931,8 @@ self.kiri.license = exports.LICENSE;
|
||||||
|
|
||||||
var cmd = code.cmd || {},
|
var cmd = code.cmd || {},
|
||||||
set = code.settings || {},
|
set = code.settings || {},
|
||||||
local = isLocalDevice(devicename);
|
local = isLocalDevice(devicename),
|
||||||
|
dproc = settings.devproc[devicename];
|
||||||
|
|
||||||
settings.device = {
|
settings.device = {
|
||||||
bedHeight: 2.5,
|
bedHeight: 2.5,
|
||||||
|
|
@ -3019,6 +3028,9 @@ self.kiri.license = exports.LICENSE;
|
||||||
settings.filter[getMode()] = devicename;
|
settings.filter[getMode()] = devicename;
|
||||||
settings.cdev[getMode()] = dev;
|
settings.cdev[getMode()] = dev;
|
||||||
|
|
||||||
|
// restore last process associated with this device
|
||||||
|
if (dproc) loadNamedSetting(null, dproc);
|
||||||
|
|
||||||
saveSettings();
|
saveSettings();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log({error:e, device:code});
|
console.log({error:e, device:code});
|
||||||
|
|
|
||||||
2
notes.md
2
notes.md
|
|
@ -1,6 +1,6 @@
|
||||||
# Kiri:Moto todo
|
# Kiri:Moto todo
|
||||||
|
|
||||||
* store settings profile used per-device so re-loaded on device switch
|
* per-device settings: grid-print target
|
||||||
* prevent text selection of non-input
|
* prevent text selection of non-input
|
||||||
* widget general add-ons (fdm supports, cam tabs)
|
* widget general add-ons (fdm supports, cam tabs)
|
||||||
* bail on decimation if it's proving ineffective
|
* bail on decimation if it's proving ineffective
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue