WIP. slicing working again.
This commit is contained in:
parent
fa1bad7b7c
commit
44671cfb40
11 changed files with 183 additions and 148 deletions
|
|
@ -262,17 +262,20 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
|||
# self.commands(["G91", "G1 %s%.4f F%d" % (axis.upper(), amount, movement_speed), "G90", "?"])
|
||||
|
||||
def home(self, axes):
|
||||
if not isinstance(axes, (list, tuple)):
|
||||
if isinstance(axes, (str, unicode)):
|
||||
axes = [axes]
|
||||
else:
|
||||
raise ValueError("axes is neither a list nor a string: {axes}".format(axes=axes))
|
||||
if(settings().getBoolean(["feature", "grbl"])):
|
||||
self.commands(["$H", "G92X0Y0Z0", "G90", "G21"])
|
||||
else:
|
||||
if not isinstance(axes, (list, tuple)):
|
||||
if isinstance(axes, (str, unicode)):
|
||||
axes = [axes]
|
||||
else:
|
||||
raise ValueError("axes is neither a list nor a string: {axes}".format(axes=axes))
|
||||
|
||||
validated_axes = filter(lambda x: x in PrinterInterface.valid_axes, map(lambda x: x.lower(), axes))
|
||||
if len(axes) != len(validated_axes):
|
||||
raise ValueError("axes contains invalid axes: {axes}".format(axes=axes))
|
||||
validated_axes = filter(lambda x: x in PrinterInterface.valid_axes, map(lambda x: x.lower(), axes))
|
||||
if len(axes) != len(validated_axes):
|
||||
raise ValueError("axes contains invalid axes: {axes}".format(axes=axes))
|
||||
|
||||
self.commands(["G91", "G28 %s" % " ".join(map(lambda x: "%s0" % x.upper(), validated_axes)), "G90"])
|
||||
self.commands(["G91", "G28 %s" % " ".join(map(lambda x: "%s0" % x.upper(), validated_axes)), "G90"])
|
||||
|
||||
def extrude(self, amount):
|
||||
if not isinstance(amount, (int, long, float)):
|
||||
|
|
@ -329,6 +332,11 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
|||
self._comm.setTemperatureOffset(offsets)
|
||||
self._stateMonitor.set_temp_offsets(offsets)
|
||||
|
||||
def position(self, x, y):
|
||||
printer_profile = self._printerProfileManager.get_current_or_default()
|
||||
movement_speed = min(printer_profile["axes"]["x"]["speed"], printer_profile["axes"]["y"]["speed"])
|
||||
self.commands(["G90", "G0 X%.3f Y%.3f F%d" % (x, y, movement_speed), "?"])
|
||||
|
||||
def _convert_rate_value(self, factor, min=0, max=200):
|
||||
if not isinstance(factor, (int, float, long)):
|
||||
raise ValueError("factor is not a number")
|
||||
|
|
@ -503,6 +511,9 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
|||
else:
|
||||
return self._comm.isSdReady()
|
||||
|
||||
def is_locked(self):
|
||||
return self._comm is not None and self._comm.isLocked()
|
||||
|
||||
#~~ sd file handling
|
||||
|
||||
def get_sd_files(self):
|
||||
|
|
@ -743,7 +754,8 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
|||
"error": self.is_error(),
|
||||
"paused": self.is_paused(),
|
||||
"ready": self.is_ready(),
|
||||
"sdReady": self.is_sd_ready()
|
||||
"sdReady": self.is_sd_ready(),
|
||||
"locked": self.is_locked()
|
||||
}
|
||||
|
||||
#~~ comm.MachineComPrintCallback implementation
|
||||
|
|
@ -869,10 +881,6 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
|||
|
||||
|
||||
#
|
||||
# def position(self, x, y):
|
||||
# printer_profile = self._printerProfileManager.get_current_or_default()
|
||||
# movement_speed = min(printer_profile["axes"]["x"]["speed"], printer_profile["axes"]["y"]["speed"])
|
||||
# self.commands(["G90", "G0 X%.3f Y%.3f F%d" % (x, y, movement_speed), "?"])
|
||||
#
|
||||
# def home(self, axes):
|
||||
# if(settings().getBoolean(["feature", "grbl"])):
|
||||
|
|
|
|||
|
|
@ -600,22 +600,13 @@ class Server():
|
|||
|
||||
upload_suffixes = dict(name=s.get(["server", "uploads", "nameSuffix"]), path=s.get(["server", "uploads", "pathSuffix"]))
|
||||
|
||||
#<<<<<<< HEAD
|
||||
# upload_suffixes = dict(name=settings().get(["server", "uploads", "nameSuffix"]), path=settings().get(["server", "uploads", "pathSuffix"]))
|
||||
# self._tornado_app = Application(self._router.urls + [
|
||||
# (r"/downloads/timelapse/([^/]*\.mpg)", util.tornado.LargeResponseHandler, dict(path=settings().getBaseFolder("timelapse"), as_attachment=True)),
|
||||
# (r"/downloads/files/local/([^/]*\.(gco|gcode|g|svg))", util.tornado.LargeResponseHandler, dict(path=settings().getBaseFolder("uploads"), as_attachment=True)),
|
||||
# (r"/serve/files/local/([^/]*\.(gco|gcode|g|nc|svg))", util.tornado.LargeResponseHandler, dict(path=settings().getBaseFolder("uploads"), as_attachment=False)),
|
||||
# (r"/downloads/logs/([^/]*)", util.tornado.LargeResponseHandler, dict(path=settings().getBaseFolder("logs"), as_attachment=True, access_validation=util.tornado.access_validation_factory(app, loginManager, util.flask.admin_validator))),
|
||||
# (r"/downloads/camera/current", util.tornado.UrlForwardHandler, dict(url=settings().get(["webcam", "snapshot"]), as_attachment=True, access_validation=util.tornado.access_validation_factory(app, loginManager, util.flask.user_validator))),
|
||||
# (r".*", util.tornado.UploadStorageFallbackHandler, dict(fallback=util.tornado.WsgiInputContainer(app.wsgi_app), file_prefix="octoprint-file-upload-", file_suffix=".tmp", suffixes=upload_suffixes))
|
||||
# ])
|
||||
#=======
|
||||
server_routes = self._router.urls + [
|
||||
# various downloads
|
||||
(r"/downloads/timelapse/([^/]*\.mpg)", util.tornado.LargeResponseHandler, dict(path=s.getBaseFolder("timelapse"), as_attachment=True)),
|
||||
(r"/downloads/files/local/(.*)", util.tornado.LargeResponseHandler, dict(path=s.getBaseFolder("uploads"), as_attachment=True, path_validation=util.tornado.path_validation_factory(lambda path: not os.path.basename(path).startswith("."), status_code=404))),
|
||||
(r"/downloads/logs/([^/]*)", util.tornado.LargeResponseHandler, dict(path=s.getBaseFolder("logs"), as_attachment=True, access_validation=util.tornado.access_validation_factory(app, loginManager, util.flask.admin_validator))),
|
||||
# serve instead of downloads for preview // as_attachment=False
|
||||
(r"/serve/files/local/([^/]*\.(gco|gcode|g|nc|svg))", util.tornado.LargeResponseHandler, dict(path=s.getBaseFolder("uploads"), as_attachment=False)),
|
||||
# camera snapshot
|
||||
(r"/downloads/camera/current", util.tornado.UrlForwardHandler, dict(url=s.get(["webcam", "snapshot"]), as_attachment=True, access_validation=util.tornado.access_validation_factory(app, loginManager, util.flask.user_validator))),
|
||||
# generated webassets
|
||||
|
|
@ -1130,7 +1121,6 @@ class Server():
|
|||
|
||||
all_less_bundle = Bundle(*less_app, output="webassets/packed_app.less", filters="less_importrewrite")
|
||||
|
||||
print('#####', js_app_bundle)
|
||||
assets.register("js_libs", js_libs_bundle)
|
||||
assets.register("js_app", js_app_bundle)
|
||||
assets.register("css_libs", css_libs_bundle)
|
||||
|
|
|
|||
|
|
@ -15,12 +15,9 @@ from octoprint.server.util.flask import restricted_access, get_json_command_from
|
|||
from octoprint.server.api import api
|
||||
from octoprint.events import Events
|
||||
import octoprint.filemanager
|
||||
#<<<<<<< HEAD
|
||||
#import shutil
|
||||
#=======
|
||||
import shutil
|
||||
import octoprint.filemanager.util
|
||||
import octoprint.slicing
|
||||
#>>>>>>> upstream/maintenance
|
||||
|
||||
|
||||
#~~ GCODE file handling
|
||||
|
|
@ -289,12 +286,7 @@ def gcodeFileCommand(filename, target):
|
|||
"select": [],
|
||||
"slice": []
|
||||
}
|
||||
#<<<<<<< HEAD
|
||||
# command, data, response = util.getJsonCommandFromRequest(request, valid_commands)
|
||||
#=======
|
||||
|
||||
command, data, response = get_json_command_from_request(request, valid_commands)
|
||||
#>>>>>>> upstream/maintenance
|
||||
if response is not None:
|
||||
return response
|
||||
|
||||
|
|
@ -355,7 +347,7 @@ def gcodeFileCommand(filename, target):
|
|||
del data["profile"]
|
||||
else:
|
||||
profile = None
|
||||
|
||||
##
|
||||
if "printerProfile" in data.keys() and data["printerProfile"]:
|
||||
printerProfile = data["printerProfile"]
|
||||
del data["printerProfile"]
|
||||
|
|
@ -428,39 +420,55 @@ def gcodeFileCommand(filename, target):
|
|||
def gcodeConvertCommand():
|
||||
target = FileDestinations.LOCAL;
|
||||
|
||||
#if not _verifyFileExists(target, filename):
|
||||
# return make_response("File not found on '%s': %s" % (target, filename), 404)
|
||||
|
||||
# valid file commands, dict mapping command name to mandatory parameters
|
||||
valid_commands = {
|
||||
"convert": []
|
||||
}
|
||||
command, data, response = util.getJsonCommandFromRequest(request, valid_commands)
|
||||
command, data, response = get_json_command_from_request(request, valid_commands)
|
||||
if response is not None:
|
||||
return response
|
||||
|
||||
# TODO stripping non-ascii is a hack - svg contains lots of non-ascii in <text> tags. Fix this!
|
||||
import re
|
||||
svg = ''.join(i for i in data['svg'] if ord(i)<128) # strip non-ascii chars like €
|
||||
del data['svg']
|
||||
|
||||
appendGcodeFiles = data['gcodeFilesToAppend']
|
||||
del data['gcodeFilesToAppend']
|
||||
|
||||
def appendCallback(location, path, sources):
|
||||
output_path = fileManager.get_absolute_path(location, path)
|
||||
with open(output_path,'ab') as wfd:
|
||||
for f in sources:
|
||||
path = fileManager.get_absolute_path(f['origin'], f['name'])
|
||||
wfd.write( "\n; "+ f['name'] + "\n")
|
||||
|
||||
with open(path,'rb') as fd:
|
||||
shutil.copyfileobj(fd, wfd, 1024*1024*10)
|
||||
|
||||
wfd.write( "\nM05\n") # ensure that the laser is off.
|
||||
# def appendCallback(location, path, sources, **kwargs):
|
||||
# if '_error' in kwargs:
|
||||
# result = kwargs['_error']
|
||||
# return make_response("Could not slice: {result}".format(result=result), 500)
|
||||
# else:
|
||||
# output_path = fileManager.path_on_disk(location, path)
|
||||
# # append additioal gcodes
|
||||
# with open(output_path,'ab') as wfd:
|
||||
# for f in sources:
|
||||
# path = fileManager.path_on_disk(f['origin'], f['name'])
|
||||
# wfd.write( "\n; "+ f['name'] + "\n")
|
||||
#
|
||||
# with open(path,'rb') as fd:
|
||||
# shutil.copyfileobj(fd, wfd, 1024*1024*10)
|
||||
#
|
||||
# wfd.write( "\nM05\n") # ensure that the laser is off.
|
||||
# #files = {}
|
||||
# #location = url_for(".readGcodeFile", target=target, filename=gcode_name, _external=True)
|
||||
# #result = {
|
||||
## "name": gcode_name,
|
||||
## "origin": FileDestinations.LOCAL,
|
||||
## "refs": {
|
||||
## "resource": location,
|
||||
## "download": url_for("index", _external=True) + "downloads/files/" + target + "/" + gcode_name
|
||||
## }
|
||||
## }
|
||||
#
|
||||
# #r = make_response(jsonify(result), 202)
|
||||
# #r.headers["Location"] = location
|
||||
# #return r
|
||||
|
||||
|
||||
|
||||
if command == "convert":
|
||||
# TODO stripping non-ascii is a hack - svg contains lots of non-ascii in <text> tags. Fix this!
|
||||
import re
|
||||
svg = ''.join(i for i in data['svg'] if ord(i)<128) # strip non-ascii chars like €
|
||||
del data['svg']
|
||||
|
||||
import os
|
||||
name, _ = os.path.splitext(data['gcode'])
|
||||
|
|
@ -480,11 +488,8 @@ def gcodeConvertCommand():
|
|||
fileManager.add_file(target, filename, fileObj, links=None, allow_overwrite=True)
|
||||
|
||||
slicer = "svgtogcode";
|
||||
if "slicer" in data.keys() and data["slicer"]:
|
||||
slicer = data["slicer"]
|
||||
del data["slicer"]
|
||||
slicer_instance = slicingManager.get_slicer(slicer)
|
||||
if slicer_instance.get_slicer_properties()["same_device"] and (printer.isPrinting() or printer.isPaused()):
|
||||
if slicer_instance.get_slicer_properties()["same_device"] and (printer.is_printing() or printer.is_paused()):
|
||||
# slicer runs on same device as OctoPrint, slicing while printing is hence disabled
|
||||
return make_response("Cannot convert while lasering due to performance reasons".format(**locals()), 409)
|
||||
|
||||
|
|
@ -496,6 +501,7 @@ def gcodeConvertCommand():
|
|||
name, _ = os.path.splitext(filename)
|
||||
gcode_name = name + ".gco"
|
||||
|
||||
# append number if file exists
|
||||
name, ext = os.path.splitext(gcode_name)
|
||||
i = 1;
|
||||
while(fileManager.file_exists(target, gcode_name)):
|
||||
|
|
@ -504,7 +510,7 @@ def gcodeConvertCommand():
|
|||
|
||||
# prohibit overwriting the file that is currently being printed
|
||||
currentOrigin, currentFilename = _getCurrentFile()
|
||||
if currentFilename == gcode_name and currentOrigin == target and (printer.isPrinting() or printer.isPaused()):
|
||||
if currentFilename == gcode_name and currentOrigin == target and (printer.is_printing() or printer.is_paused()):
|
||||
make_response("Trying to slice into file that is currently being printed: %s" % gcode_name, 409)
|
||||
|
||||
if "profile" in data.keys() and data["profile"]:
|
||||
|
|
@ -512,35 +518,82 @@ def gcodeConvertCommand():
|
|||
del data["profile"]
|
||||
else:
|
||||
profile = None
|
||||
##
|
||||
if "printerProfile" in data.keys() and data["printerProfile"]:
|
||||
printerProfile = data["printerProfile"]
|
||||
del data["printerProfile"]
|
||||
else:
|
||||
printerProfile = None
|
||||
|
||||
if "position" in data.keys() and data["position"] and isinstance(data["position"], dict) and "x" in data["position"] and "y" in data["position"]:
|
||||
position = data["position"]
|
||||
del data["position"]
|
||||
else:
|
||||
position = None
|
||||
|
||||
select_after_slicing = False
|
||||
if "select" in data.keys() and data["select"] in valid_boolean_trues:
|
||||
if not printer.is_operational():
|
||||
return make_response("Printer is not operational, cannot directly select for printing", 409)
|
||||
select_after_slicing = True
|
||||
|
||||
print_after_slicing = False
|
||||
if "print" in data.keys() and data["print"] in valid_boolean_trues:
|
||||
if not printer.is_operational():
|
||||
return make_response("Printer is not operational, cannot directly start printing", 409)
|
||||
select_after_slicing = print_after_slicing = True
|
||||
|
||||
override_keys = [k for k in data if k.startswith("profile.") and data[k] is not None]
|
||||
overrides = dict()
|
||||
for key in override_keys:
|
||||
overrides[key[len("profile."):]] = data[key]
|
||||
|
||||
ok, result = fileManager.slice(slicer, target, filename, target, gcode_name, profile=profile, overrides=overrides,
|
||||
callback=appendCallback, callback_args=[target, gcode_name, appendGcodeFiles])
|
||||
|
||||
if ok:
|
||||
files = {}
|
||||
location = url_for(".readGcodeFile", target=target, filename=gcode_name, _external=True)
|
||||
result = {
|
||||
"name": gcode_name,
|
||||
"origin": FileDestinations.LOCAL,
|
||||
"refs": {
|
||||
"resource": location,
|
||||
"download": url_for("index", _external=True) + "downloads/files/" + target + "/" + gcode_name
|
||||
}
|
||||
}
|
||||
def slicing_done(target, gcode_name, select_after_slicing, print_after_slicing, append_these_files):
|
||||
# append additioal gcodes
|
||||
output_path = fileManager.path_on_disk(target, gcode_name)
|
||||
with open(output_path,'ab') as wfd:
|
||||
for f in append_these_files:
|
||||
path = fileManager.path_on_disk(f['origin'], f['name'])
|
||||
wfd.write( "\n; "+ f['name'] + "\n")
|
||||
|
||||
r = make_response(jsonify(result), 202)
|
||||
r.headers["Location"] = location
|
||||
return r
|
||||
else:
|
||||
return make_response("Could not slice: {result}".format(result=result), 500)
|
||||
with open(path,'rb') as fd:
|
||||
shutil.copyfileobj(fd, wfd, 1024*1024*10)
|
||||
|
||||
wfd.write( "\nM05\n") # ensure that the laser is off.
|
||||
|
||||
if select_after_slicing or print_after_slicing:
|
||||
sd = False
|
||||
filenameToSelect = fileManager.path_on_disk(target, gcode_name)
|
||||
printer.select_file(filenameToSelect, sd, True)
|
||||
|
||||
try:
|
||||
fileManager.slice(slicer, target, filename, target, gcode_name,
|
||||
profile=profile,
|
||||
printer_profile_id=printerProfile,
|
||||
position=position,
|
||||
overrides=overrides,
|
||||
callback=slicing_done,
|
||||
callback_args=[target, gcode_name, select_after_slicing, print_after_slicing, appendGcodeFiles])
|
||||
except octoprint.slicing.UnknownProfile:
|
||||
return make_response("Profile {profile} doesn't exist".format(**locals()), 400)
|
||||
|
||||
files = {}
|
||||
location = url_for(".readGcodeFile", target=target, filename=gcode_name, _external=True)
|
||||
result = {
|
||||
"name": gcode_name,
|
||||
"origin": FileDestinations.LOCAL,
|
||||
"refs": {
|
||||
"resource": location,
|
||||
"download": url_for("index", _external=True) + "downloads/files/" + target + "/" + gcode_name
|
||||
}
|
||||
}
|
||||
|
||||
r = make_response(jsonify(result), 202)
|
||||
r.headers["Location"] = location
|
||||
return r
|
||||
|
||||
return NO_CONTENT
|
||||
|
||||
|
||||
|
||||
@api.route("/files/<string:target>/<path:filename>", methods=["DELETE"])
|
||||
@restricted_access
|
||||
|
|
|
|||
|
|
@ -289,7 +289,6 @@ class SlicingManager(object):
|
|||
on_progress_args=on_progress_args,
|
||||
on_progress_kwargs=on_progress_kwargs
|
||||
)
|
||||
|
||||
if not ok:
|
||||
callback_kwargs.update(dict(_error=result))
|
||||
elif result is not None and isinstance(result, dict) and "analysis" in result:
|
||||
|
|
|
|||
|
|
@ -196,6 +196,7 @@ function DataUpdater(allViewModels) {
|
|||
gcodeUploadProgressBar.text(gettext("Slicing ..."));
|
||||
}
|
||||
} else if (type == "SlicingDone") {
|
||||
console.log("slicingDone Event: payload: ", payload);
|
||||
gcodeUploadProgress.removeClass("progress-striped").removeClass("active");
|
||||
gcodeUploadProgressBar.css("width", "0%");
|
||||
gcodeUploadProgressBar.text("");
|
||||
|
|
|
|||
|
|
@ -179,6 +179,7 @@ $(function() {
|
|||
self.isError(data.flags.error);
|
||||
self.isReady(data.flags.ready);
|
||||
self.isLoading(data.flags.loading);
|
||||
self.isLocked(data.flags.locked);
|
||||
};
|
||||
|
||||
self.onEventSettingsUpdated = function (payload) {
|
||||
|
|
|
|||
|
|
@ -791,26 +791,6 @@ $(function() {
|
|||
self.requestData();
|
||||
};
|
||||
|
||||
//<<<<<<< HEAD
|
||||
// self.onSlicingDone = function(payload) {
|
||||
// var url = API_BASEURL + "files/" + payload.gcode_location + "/" + payload.gcode;
|
||||
// var data = {refs: {resource: url}};
|
||||
// self.loadFile(data, false); // loads gcode into gcode viewer
|
||||
//
|
||||
// var callback = function(e) {
|
||||
// e.preventDefault();
|
||||
// self.loadFile(data, true); // starts print
|
||||
//
|
||||
// };
|
||||
// self.printerState.show_safety_glasses_warning(callback);
|
||||
//
|
||||
// };
|
||||
//
|
||||
// self.onMetadataAnalysisFinished = function(payload) {
|
||||
// self.requestData();
|
||||
// };
|
||||
//}
|
||||
//=======
|
||||
self.onEventUpdatedFiles = function(payload) {
|
||||
if (payload.type == "gcode") {
|
||||
self.requestData();
|
||||
|
|
@ -820,11 +800,23 @@ $(function() {
|
|||
self.onEventSlicingDone = function(payload) {
|
||||
self.requestData();
|
||||
};
|
||||
self.onEventSlicingDone = function (payload) {
|
||||
var url = API_BASEURL + "files/" + payload.gcode_location + "/" + payload.gcode;
|
||||
var data = {refs: {resource: url}};
|
||||
self.loadFile(data, false); // loads gcode into gcode viewer
|
||||
|
||||
self.onEventMetadataAnalysisFinished = function(payload) {
|
||||
var callback = function (e) {
|
||||
e.preventDefault();
|
||||
self.loadFile(data, true); // starts print
|
||||
|
||||
};
|
||||
self.printerState.show_safety_glasses_warning(callback);
|
||||
|
||||
};
|
||||
|
||||
self.onEventMetadataAnalysisFinished = function(payload) {
|
||||
self.requestData();
|
||||
};
|
||||
//>>>>>>> upstream/maintenance
|
||||
|
||||
self.onEventMetadataStatisticsUpdated = function(payload) {
|
||||
self.requestData();
|
||||
|
|
|
|||
|
|
@ -298,43 +298,6 @@ $(function() {
|
|||
self.filesize(undefined);
|
||||
self.sd(undefined);
|
||||
}
|
||||
|
||||
//<<<<<<< HEAD
|
||||
// self.show_safety_glasses_warning = function(callback){
|
||||
// $('#confirmation_dialog .confirmation_dialog_message').html();
|
||||
// jQuery('<div/>', {
|
||||
// class: "safety_glasses_heads_up"
|
||||
// }).appendTo("#confirmation_dialog .confirmation_dialog_message");
|
||||
// jQuery('<div/>', {
|
||||
// class: "safety_glasses_warning",
|
||||
// text: gettext("The laser will now start. Protect yourself and everybody in the room appropriately before proceeding!")
|
||||
// }).appendTo("#confirmation_dialog .confirmation_dialog_message");
|
||||
// //$("#confirmation_dialog .confirmation_dialog_message").text(gettext("The laser will now start. Protect yourself and everybody in the room appropriately before proceeding!"));
|
||||
// $("#confirmation_dialog .confirmation_dialog_acknowledge").unbind("click");
|
||||
// $("#confirmation_dialog .confirmation_dialog_acknowledge").click(
|
||||
// function(e){
|
||||
// if(typeof callback === 'function'){
|
||||
// callback(e);
|
||||
// $("#confirmation_dialog").modal("hide");
|
||||
// $("#confirmation_dialog .confirmation_dialog_message").html('');
|
||||
// }
|
||||
// });
|
||||
// $("#confirmation_dialog").modal("show");
|
||||
//
|
||||
// };
|
||||
//
|
||||
// self.print_with_safety_glasses_warning = function(){
|
||||
// var callback = function(e) {
|
||||
// e.preventDefault();
|
||||
// self.print();
|
||||
// };
|
||||
// self.show_safety_glasses_warning(callback);
|
||||
// };
|
||||
//
|
||||
// self.print = function() {
|
||||
// var restartCommand = function() {
|
||||
// self._jobCommand("restart");
|
||||
//=======
|
||||
self.estimatedPrintTime(data.estimatedPrintTime);
|
||||
self.lastPrintTime(data.lastPrintTime);
|
||||
|
||||
|
|
@ -361,12 +324,43 @@ $(function() {
|
|||
self.filepos(data.filepos);
|
||||
self.printTime(data.printTime);
|
||||
self.printTimeLeft(data.printTimeLeft);
|
||||
//>>>>>>> upstream/maintenance
|
||||
};
|
||||
|
||||
self._processZData = function(data) {
|
||||
self.currentHeight(data);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
self.show_safety_glasses_warning = function (callback) {
|
||||
$('#confirmation_dialog .confirmation_dialog_message').html();
|
||||
jQuery('<div/>', {
|
||||
class: "safety_glasses_heads_up"
|
||||
}).appendTo("#confirmation_dialog .confirmation_dialog_message");
|
||||
jQuery('<div/>', {
|
||||
class: "safety_glasses_warning",
|
||||
text: gettext("The laser will now start. Protect yourself and everybody in the room appropriately before proceeding!")
|
||||
}).appendTo("#confirmation_dialog .confirmation_dialog_message");
|
||||
//$("#confirmation_dialog .confirmation_dialog_message").text(gettext("The laser will now start. Protect yourself and everybody in the room appropriately before proceeding!"));
|
||||
$("#confirmation_dialog .confirmation_dialog_acknowledge").unbind("click");
|
||||
$("#confirmation_dialog .confirmation_dialog_acknowledge").click(
|
||||
function (e) {
|
||||
if (typeof callback === 'function') {
|
||||
callback(e);
|
||||
$("#confirmation_dialog").modal("hide");
|
||||
$("#confirmation_dialog .confirmation_dialog_message").html('');
|
||||
}
|
||||
});
|
||||
$("#confirmation_dialog").modal("show");
|
||||
|
||||
};
|
||||
|
||||
self.print_with_safety_glasses_warning = function () {
|
||||
var callback = function (e) {
|
||||
e.preventDefault();
|
||||
self.print();
|
||||
};
|
||||
self.show_safety_glasses_warning(callback);
|
||||
};
|
||||
|
||||
//<<<<<<< HEAD
|
||||
// };
|
||||
|
|
|
|||
|
|
@ -221,6 +221,7 @@ $(function() {
|
|||
self.isError(data.flags.error);
|
||||
self.isReady(data.flags.ready);
|
||||
self.isLoading(data.flags.loading);
|
||||
self.isLocked(data.flags.locked);
|
||||
};
|
||||
|
||||
self.updateFilterRegex = function() {
|
||||
|
|
|
|||
|
|
@ -262,7 +262,6 @@ class MachineCom(object):
|
|||
|
||||
oldState = self.getStateString()
|
||||
self._state = newState
|
||||
print('Changing monitoring state from \'%s\' to \'%s\'' % (oldState, self.getStateString()))
|
||||
self._log('Changing monitoring state from \'%s\' to \'%s\'' % (oldState, self.getStateString()))
|
||||
self._callback.on_comm_state_change(newState)
|
||||
|
||||
|
|
|
|||
|
|
@ -131,12 +131,9 @@ class MachineCom(object):
|
|||
baudrate = 0
|
||||
else:
|
||||
baudrate = settingsBaudrate
|
||||
print('#####1', callbackObject)
|
||||
if callbackObject == None:
|
||||
callbackObject = MachineComPrintCallback()
|
||||
|
||||
print('#####2', callbackObject)
|
||||
|
||||
self._port = port
|
||||
self._baudrate = baudrate
|
||||
self._callback = callbackObject
|
||||
|
|
@ -298,7 +295,7 @@ class MachineCom(object):
|
|||
return self._state == self.STATE_OPERATIONAL or self._state == self.STATE_PRINTING or self._state == self.STATE_PAUSED or self._state == self.STATE_TRANSFERING_FILE
|
||||
|
||||
|
||||
def is_locked(self):
|
||||
def isLocked(self):
|
||||
return self._state == self.STATE_LOCKED
|
||||
|
||||
def isPrinting(self):
|
||||
|
|
|
|||
Loading…
Reference in a new issue