mirror of
https://github.com/Doodle3D/doodle3d-client.git
synced 2024-11-22 09:17:56 +01:00
Disable settings button if printer is busy or no control access.
This commit is contained in:
parent
cc2bcf962c
commit
98e0418eb8
@ -26,6 +26,11 @@ var settings = {
|
||||
}
|
||||
|
||||
|
||||
//wrapper to prevent scoping issues in showSettings()
|
||||
function openSettingsWindow() {
|
||||
settingsWindow.showSettings();
|
||||
}
|
||||
|
||||
function SettingsWindow() {
|
||||
this.wifiboxURL;
|
||||
this.wifiboxCGIBinURL
|
||||
|
@ -160,11 +160,8 @@ function initButtonBehavior() {
|
||||
loadSettings();
|
||||
});
|
||||
}*/
|
||||
btnSettings.bind('touchstart mousedown',function () {
|
||||
//e.preventDefault();
|
||||
//console.log("btnSettings clicked");
|
||||
settingsWindow.showSettings();
|
||||
});
|
||||
enableButton(btnSettings, openSettingsWindow);
|
||||
|
||||
// btnSettings.on('touchend', function(e) {
|
||||
// e.preventDefault();
|
||||
// console.log("btnSettings touchend");
|
||||
@ -350,9 +347,9 @@ function setState(newState,newHasControl) {
|
||||
|
||||
// thermometer
|
||||
switch(newState) {
|
||||
case Printer.IDLE_STATE:
|
||||
case Printer.BUFFERING_STATE:
|
||||
case Printer.PRINTING_STATE:
|
||||
case Printer.IDLE_STATE: /* fall-through */
|
||||
case Printer.BUFFERING_STATE: /* fall-through */
|
||||
case Printer.PRINTING_STATE: /* fall-through */
|
||||
case Printer.STOPPING_STATE:
|
||||
thermometer.show();
|
||||
break;
|
||||
@ -371,6 +368,22 @@ function setState(newState,newHasControl) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* settings button */
|
||||
switch(newState) {
|
||||
case Printer.IDLE_STATE:
|
||||
enableButton(btnSettings, openSettingsWindow);
|
||||
break;
|
||||
case Printer.WIFIBOX_DISCONNECTED_STATE: /* fall-through */
|
||||
case Printer.BUFFERING_STATE: /* fall-through */
|
||||
case Printer.PRINTING_STATE: /* fall-through */
|
||||
case Printer.STOPPING_STATE:
|
||||
disableButton(btnSettings);
|
||||
break;
|
||||
default:
|
||||
enableButton(btnSettings, openSettingsWindow);
|
||||
break;
|
||||
}
|
||||
|
||||
if(newState == Printer.WIFIBOX_DISCONNECTED_STATE) {
|
||||
message.set("Lost connection to WiFi box",Message.ERROR);
|
||||
} else if(prevState == Printer.WIFIBOX_DISCONNECTED_STATE) {
|
||||
@ -380,6 +393,12 @@ function setState(newState,newHasControl) {
|
||||
} else if(prevState == Printer.DISCONNECTED_STATE && newState == Printer.IDLE_STATE ||
|
||||
prevState == Printer.UNKNOWN_STATE && newState == Printer.IDLE_STATE) {
|
||||
message.set("Printer connected",Message.INFO,true);
|
||||
} else if(prevState == Printer.PRINTING_STATE && newState == Printer.STOPPING_STATE) {
|
||||
console.log("stopmsg show");
|
||||
message.set("Printer stopping",Message.INFO,false);
|
||||
} else if(prevState == Printer.STOPPING_STATE && newState == Printer.IDLE_STATE) {
|
||||
console.log("stopmsg hide");
|
||||
message.hide();
|
||||
}
|
||||
|
||||
state = newState;
|
||||
|
@ -107,6 +107,19 @@ $(function() {
|
||||
}
|
||||
});
|
||||
|
||||
function enableButton(elem, handler) {
|
||||
//var elem = $('#'+domId);
|
||||
elem.removeClass("disabled");
|
||||
elem.unbind('touchstart mousedown');
|
||||
elem.bind('touchstart mousedown', handler);
|
||||
}
|
||||
|
||||
function disableButton(elem) {
|
||||
//var elem = $('#'+domId);
|
||||
elem.addClass("disabled");
|
||||
elem.unbind('touchstart mousedown');
|
||||
}
|
||||
|
||||
function showOrHideThermo() {
|
||||
console.log("f:showOrHideThermo()");
|
||||
if (showOrHide) {
|
||||
|
Loading…
Reference in New Issue
Block a user