update focus when changing devices
This commit is contained in:
parent
834a93adcb
commit
d51eede894
1 changed files with 21 additions and 18 deletions
|
|
@ -701,25 +701,24 @@
|
||||||
dproc = current.devproc[devicename],
|
dproc = current.devproc[devicename],
|
||||||
dev = current.device = CONF.device_from_code(code,mode),
|
dev = current.device = CONF.device_from_code(code,mode),
|
||||||
proc = current.process,
|
proc = current.process,
|
||||||
newdev = dproc === undefined;
|
newdev = dproc === undefined, // first time device is selected
|
||||||
|
predev = current.filter[mode], // previous device selection
|
||||||
|
chgdev = predev !== devicename; // device is changing
|
||||||
|
|
||||||
// first time device use, add any print profiles and set to default if present
|
// first time device use, add any print profiles and set to default if present
|
||||||
// if (newdev) {
|
if (code.profiles) {
|
||||||
// console.log('new device', code);
|
for (let profile of code.profiles) {
|
||||||
if (code.profiles) {
|
let profname = profile.processName;
|
||||||
for (let profile of code.profiles) {
|
if (!current.sproc[mode][profname]) {
|
||||||
let profname = profile.processName;
|
console.log('adding profile', profname, 'to', mode);
|
||||||
if (!current.sproc[mode][profname]) {
|
current.sproc[mode][profname] = profile;
|
||||||
console.log('adding profile', profname, 'to', mode);
|
}
|
||||||
current.sproc[mode][profname] = profile;
|
if (newdev && !current.devproc[devicename]) {
|
||||||
}
|
console.log('setting default profile for new device', devicename, 'to', profname);
|
||||||
if (newdev && !current.devproc[devicename]) {
|
current.devproc[devicename] = dproc = profname;
|
||||||
console.log('setting default profile for new device', devicename, 'to', profname);
|
|
||||||
current.devproc[devicename] = dproc = profname;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
dev.new = false;
|
dev.new = false;
|
||||||
dev.deviceName = devicename;
|
dev.deviceName = devicename;
|
||||||
|
|
@ -729,9 +728,6 @@
|
||||||
UI.deviceRound.checked = dev.bedRound;
|
UI.deviceRound.checked = dev.bedRound;
|
||||||
UI.deviceOrigin.checked = dev.outputOriginCenter || dev.originCenter;
|
UI.deviceOrigin.checked = dev.outputOriginCenter || dev.originCenter;
|
||||||
|
|
||||||
// change home default in belt mode
|
|
||||||
API.const.SPACE.view.setHome(dev.bedBelt ? Math.PI/2 : 0);
|
|
||||||
|
|
||||||
// add extruder selection buttons
|
// add extruder selection buttons
|
||||||
if (dev.extruders) {
|
if (dev.extruders) {
|
||||||
let ext = API.lists.extruders = [];
|
let ext = API.lists.extruders = [];
|
||||||
|
|
@ -821,6 +817,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
API.conf.save();
|
API.conf.save();
|
||||||
|
|
||||||
|
API.const.SPACE.view.setHome(dev.bedBelt ? Math.PI/2 : 0);
|
||||||
|
// when changing devices, update focus on widgets
|
||||||
|
if (chgdev) {
|
||||||
|
setTimeout(API.space.set_focus, 0);
|
||||||
|
}
|
||||||
|
|
||||||
UC.refresh();
|
UC.refresh();
|
||||||
|
|
||||||
if (dev.imageURL) {
|
if (dev.imageURL) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue