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],
|
||||
dev = current.device = CONF.device_from_code(code,mode),
|
||||
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
|
||||
// if (newdev) {
|
||||
// console.log('new device', code);
|
||||
if (code.profiles) {
|
||||
for (let profile of code.profiles) {
|
||||
let profname = profile.processName;
|
||||
if (!current.sproc[mode][profname]) {
|
||||
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);
|
||||
current.devproc[devicename] = dproc = profname;
|
||||
}
|
||||
if (code.profiles) {
|
||||
for (let profile of code.profiles) {
|
||||
let profname = profile.processName;
|
||||
if (!current.sproc[mode][profname]) {
|
||||
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);
|
||||
current.devproc[devicename] = dproc = profname;
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
dev.new = false;
|
||||
dev.deviceName = devicename;
|
||||
|
|
@ -729,9 +728,6 @@
|
|||
UI.deviceRound.checked = dev.bedRound;
|
||||
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
|
||||
if (dev.extruders) {
|
||||
let ext = API.lists.extruders = [];
|
||||
|
|
@ -821,6 +817,13 @@
|
|||
}
|
||||
|
||||
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();
|
||||
|
||||
if (dev.imageURL) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue