def jobState(): currentData = printer.get_current_data() return jsonify({ "job": currentData["job"], "progress": currentData["progress"], "state": currentData["state"]["text"] })
def printerState(): if not printer.is_operational(): return make_response("Printer is not operational", 409) # process excludes excludes = [] if "exclude" in request.values: excludeStr = request.values["exclude"] if len(excludeStr.strip()) > 0: excludes = filter(lambda x: x in ["temperature", "sd", "state"], map(lambda x: x.strip(), excludeStr.split(","))) result = {} # add temperature information if not "temperature" in excludes: result.update({"temperature": _getTemperatureData(lambda x: x)}) # add sd information if not "sd" in excludes and settings().getBoolean(["feature", "sdSupport"]): result.update({"sd": {"ready": printer.is_sd_ready()}}) # add state information if not "state" in excludes: state = printer.get_current_data()["state"] result.update({"state": state}) return jsonify(result)
def printerState(): if not printer.is_operational(): return make_response("Printer is not operational", 409) # process excludes excludes = [] if "exclude" in request.values: excludeStr = request.values["exclude"] if len(excludeStr.strip()) > 0: excludes = [ x for x in [x.strip() for x in excludeStr.split(",")] if x in ["temperature", "sd", "state"] ] result = {} processor = lambda x: x if not printerProfileManager.get_current_or_default()["heatedBed"]: processor = _delete_bed # add temperature information if not "temperature" in excludes: result.update({"temperature": _get_temperature_data(processor)}) # add sd information if not "sd" in excludes and settings().getBoolean(["feature", "sdSupport" ]): result.update({"sd": {"ready": printer.is_sd_ready()}}) # add state information if not "state" in excludes: state = printer.get_current_data()["state"] result.update({"state": state}) return jsonify(result)
def jobState(): currentData = printer.get_current_data() response = { "job": currentData["job"], "progress": currentData["progress"], "state": currentData["state"]["text"], } if currentData["state"]["error"]: response["error"] = currentData["state"]["error"] return jsonify(**response)
def printerState(): if not printer.is_operational(): return make_response("Printer is not operational", 409) # process excludes excludes = [] if "exclude" in request.values: excludeStr = request.values["exclude"] if len(excludeStr.strip()) > 0: excludes = filter(lambda x: x in ["temperature", "sd", "state"], map(lambda x: x.strip(), excludeStr.split(","))) result = {} # add temperature information if not "temperature" in excludes: processor = lambda x: x heated_bed = printerProfileManager.get_current_or_default( )["heatedBed"] heated_chamber = printerProfileManager.get_current_or_default( )["heatedChamber"] filbox = printerProfileManager.get_current_or_default()["filbox"] if not heated_bed and not heated_chamber and not filbox: processor = _keep_tools elif not heated_bed: processor = _delete_bed elif not heated_chamber: processor = _delete_chamber elif not filbox: processor = _delete_filbox result.update({"temperature": _get_temperature_data(processor)}) # add sd information if not "sd" in excludes and settings().getBoolean(["feature", "sdSupport" ]): result.update({"sd": {"ready": printer.is_sd_ready()}}) # add state information if not "state" in excludes: state = printer.get_current_data()["state"] result.update({"state": state}) return jsonify(result)
def printerState(): if not printer.is_operational(): return make_response("Printer is not operational", 409) # process excludes excludes = [] if "exclude" in request.values: excludeStr = request.values["exclude"] if len(excludeStr.strip()) > 0: excludes = filter(lambda x: x in ["temperature", "sd", "state"], map(lambda x: x.strip(), excludeStr.split(","))) result = {} # add temperature information if not "temperature" in excludes: processor = lambda x: x heated_bed = printerProfileManager.get_current_or_default()["heatedBed"] heated_chamber = printerProfileManager.get_current_or_default()["heatedChamber"] if not heated_bed and not heated_chamber: processor = _keep_tools elif not heated_bed: processor = _delete_bed elif not heated_chamber: processor = _delete_chamber result.update({"temperature": _get_temperature_data(processor)}) # add sd information if not "sd" in excludes and settings().getBoolean(["feature", "sdSupport"]): result.update({"sd": {"ready": printer.is_sd_ready()}}) # add state information if not "state" in excludes: state = printer.get_current_data()["state"] result.update({"state": state}) return jsonify(result)