diff --git a/src/octoprint/plugins/svgtogcode/__init__.py b/src/octoprint/plugins/svgtogcode/__init__.py
index 8712125c..61ed595d 100644
--- a/src/octoprint/plugins/svgtogcode/__init__.py
+++ b/src/octoprint/plugins/svgtogcode/__init__.py
@@ -253,14 +253,6 @@ class SvgToGcodePlugin(octoprint.plugin.SlicerPlugin,
##~~ TemplatePlugin API
- def get_template_vars(self):
- return dict()
-
- def get_template_folder(self):
- #import os
- #return os.path.join(os.path.dirname(os.path.realpath(__file__)), "templates")
- return os.path.join(self._basefolder, "templates")
-
def get_template_configs(self):
return [
dict(type = 'settings', name = "Svg Conversion", template='svgtogcode_settings.jinja2', custom_bindings = False),
diff --git a/src/octoprint/printer/__init__.py b/src/octoprint/printer/__init__.py
index 49aae2dd..d1f7b832 100644
--- a/src/octoprint/printer/__init__.py
+++ b/src/octoprint/printer/__init__.py
@@ -303,408 +303,6 @@ class PrinterInterface(object):
raise NotImplementedError()
def jog(self, axis, amount):
-#<<<<<<< HEAD
-# printer_profile = self._printerProfileManager.get_current_or_default()
-# movement_speed = printer_profile["axes"][axis]["speed"]
-# self.commands(["G91", "G1 %s%.4f F%d" % (axis.upper(), amount, movement_speed), "G90", "?"])
-#
-# 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"])):
-# self.commands(["$H", "G92X0Y0Z0", "G90", "G21"])
-# else:
-# self.commands(["G91", "G28 %s" % " ".join(map(lambda x: "%s0" % x.upper(), axes)), "G90"])
-#
-# def extrude(self, amount):
-# printer_profile = self._printerProfileManager.get_current_or_default()
-# extrusion_speed = printer_profile["axes"]["e"]["speed"]
-# self.commands(["G91", "G1 E%s F%d" % (amount, extrusion_speed), "G90"])
-#
-# def changeTool(self, tool):
-# try:
-# toolNum = int(tool[len("tool"):])
-# self.command("T%d" % toolNum)
-# except ValueError:
-# pass
-#
-# def setTemperature(self, type, value):
-# if type.startswith("tool"):
-# printer_profile = self._printerProfileManager.get_current_or_default()
-# extruder_count = printer_profile["extruder"]["count"]
-# if extruder_count > 1:
-# try:
-# toolNum = int(type[len("tool"):])
-# self.command("M104 T%d S%f" % (toolNum, value))
-# except ValueError:
-# pass
-# else:
-# self.command("M104 S%f" % value)
-# elif type == "bed":
-# self.command("M140 S%f" % value)
-#
-# def setTemperatureOffset(self, offsets={}):
-# if self._comm is None:
-# return
-#
-# tool, bed = self._comm.getOffsets()
-#
-# validatedOffsets = {}
-#
-# for key in offsets:
-# value = offsets[key]
-# if key == "bed":
-# bed = value
-# validatedOffsets[key] = value
-# elif key.startswith("tool"):
-# try:
-# toolNum = int(key[len("tool"):])
-# tool[toolNum] = value
-# validatedOffsets[key] = value
-# except ValueError:
-# pass
-#
-# self._comm.setTemperatureOffset(tool, bed)
-# self._stateMonitor.setTempOffsets(validatedOffsets)
-#
-# def selectFile(self, filename, sd, printAfterSelect=False):
-# if self._comm is None or (self._comm.isBusy() or self._comm.isStreaming()):
-# self._logger.info("Cannot load file: printer not connected or currently busy")
-# return
-#
-# self._printAfterSelect = printAfterSelect
-# self._comm.selectFile(filename, sd)
-# self._setProgressData(0, None, None, None)
-# self._setCurrentZ(None)
-#
-# def unselectFile(self):
-# if self._comm is not None and (self._comm.isBusy() or self._comm.isStreaming()):
-# return
-#
-# self._comm.unselectFile()
-# self._setProgressData(0, None, None, None)
-# self._setCurrentZ(None)
-#
-# def startPrint(self):
-# """
-# Starts the currently loaded print job.
-# Only starts if the printer is connected and operational, not currently printing and a printjob is loaded
-# """
-# if self._comm is None or not self._comm.isOperational() or self._comm.isPrinting():
-# return
-# if self._selectedFile is None:
-# return
-#
-# self._timeEstimationData = TimeEstimationHelper()
-# self._lastProgressReport = None
-# self._setCurrentZ(None)
-# self._comm.startPrint()
-# self._addPositionData(None, None)
-#
-# def _addPositionData(self, MPos, WPos):
-#
-# if MPos is None or WPos is None:
-# MPosString = WPosString = "-"
-# else:
-# MPosString = "X: %.4f Y: %.4f Z: %.4f" % ( MPos[0], MPos[1], MPos[2] )
-# WPosString = "X: %.4f Y: %.4f Z: %.4f" % ( WPos[0], WPos[1], WPos[2] )
-#
-#
-# self._stateMonitor.setWorkPosition(WPosString)
-# self._stateMonitor.setMachinePosition(MPosString)
-#
-# def togglePausePrint(self):
-# """
-# Pause the current printjob.
-# """
-# if self._comm is None:
-# return
-#
-# self._comm.setPause(not self._comm.isPaused())
-#
-# def cancelPrint(self, disableMotorsAndHeater=True):
-# """
-# Cancel the current printjob.
-# """
-# if self._comm is None:
-# return
-#
-# self._comm.cancelPrint()
-#
-# if disableMotorsAndHeater:
-# printer_profile = self._printerProfileManager.get_current_or_default()
-# extruder_count = printer_profile["extruder"]["count"]
-#
-# # disable motors, switch off hotends, bed and fan
-# #commands = ["M84"]
-# #commands.extend(map(lambda x: "M104 T%d S0" % x, range(extruder_count)))
-# #commands.extend(["M140 S0", "M106 S0"])
-# commands = ["M05", "G0X0Y0", "M09"]
-# self.commands(commands)
-#
-# # reset progress, height, print time
-# self._setCurrentZ(None)
-# self._setProgressData(None, None, None, None)
-#
-# # mark print as failure
-# if self._selectedFile is not None:
-# self._fileManager.log_print(FileDestinations.SDCARD if self._selectedFile["sd"] else FileDestinations.LOCAL, self._selectedFile["filename"], time.time(), self._comm.getPrintTime(), False, self._printerProfileManager.get_current_or_default()["id"])
-# payload = {
-# "file": self._selectedFile["filename"],
-# "origin": FileDestinations.LOCAL
-# }
-# if self._selectedFile["sd"]:
-# payload["origin"] = FileDestinations.SDCARD
-# eventManager().fire(Events.PRINT_FAILED, payload)
-#
-# #~~ state monitoring
-#
-# def _setCurrentZ(self, currentZ):
-# self._currentZ = currentZ
-# self._stateMonitor.setCurrentZ(self._currentZ)
-#
-# def _setState(self, state):
-# self._state = state
-# self._stateMonitor.setState({"text": self.getStateString(), "flags": self._getStateFlags()})
-#
-# def _addLog(self, log):
-# self._log.append(log)
-# self._stateMonitor.addLog(log)
-#
-# def _addMessage(self, message):
-# self._messages.append(message)
-# self._stateMonitor.addMessage(message)
-#
-# def _estimateTotalPrintTime(self, progress, printTime):
-# if not progress or not printTime or not self._timeEstimationData:
-# #self._estimationLogger.info("{progress};{printTime};;;;".format(**locals()))
-# return None
-#
-# else:
-# newEstimate = printTime / progress
-# self._timeEstimationData.update(newEstimate)
-#
-# result = None
-# if self._timeEstimationData.is_stable():
-# result = self._timeEstimationData.average_total_rolling
-#
-# #averageTotal = self._timeEstimationData.average_total
-# #averageTotalRolling = self._timeEstimationData.average_total_rolling
-# #averageDistance = self._timeEstimationData.average_distance
-#
-# #self._estimationLogger.info("{progress};{printTime};{newEstimate};{averageTotal};{averageTotalRolling};{averageDistance}".format(**locals()))
-#
-# return result
-#
-# def _setProgressData(self, progress, filepos, printTime, cleanedPrintTime):
-# estimatedTotalPrintTime = self._estimateTotalPrintTime(progress, cleanedPrintTime)
-# statisticalTotalPrintTime = None
-# totalPrintTime = estimatedTotalPrintTime
-#
-# if self._selectedFile and "estimatedPrintTime" in self._selectedFile and self._selectedFile["estimatedPrintTime"]:
-# statisticalTotalPrintTime = self._selectedFile["estimatedPrintTime"]
-# if progress and cleanedPrintTime:
-# if estimatedTotalPrintTime is None:
-# totalPrintTime = statisticalTotalPrintTime
-# else:
-# if progress < 0.5:
-# sub_progress = progress * 2
-# else:
-# sub_progress = 1.0
-# totalPrintTime = (1 - sub_progress) * statisticalTotalPrintTime + sub_progress * estimatedTotalPrintTime
-#
-# #self._printTimeLogger.info("{progress};{cleanedPrintTime};{estimatedTotalPrintTime};{statisticalTotalPrintTime};{totalPrintTime}".format(**locals()))
-#
-# self._progress = progress
-# self._printTime = printTime
-# self._printTimeLeft = totalPrintTime - cleanedPrintTime if (totalPrintTime is not None and cleanedPrintTime is not None) else None
-#
-# self._stateMonitor.setProgress({
-# "completion": self._progress * 100 if self._progress is not None else None,
-# "filepos": filepos,
-# "printTime": int(self._printTime) if self._printTime is not None else None,
-# "printTimeLeft": int(self._printTimeLeft) if self._printTimeLeft is not None else None
-# })
-#
-# if progress:
-# progress_int = int(progress * 100)
-# if self._lastProgressReport != progress_int:
-# self._lastProgressReport = progress_int
-# self._reportPrintProgressToPlugins(progress_int)
-#
-#
-# def _addTemperatureData(self, temp, bedTemp):
-# currentTimeUtc = int(time.time())
-#
-# data = {
-# "time": currentTimeUtc
-# }
-# for tool in temp.keys():
-# data["tool%d" % tool] = {
-# "actual": temp[tool][0],
-# "target": temp[tool][1]
-# }
-# if bedTemp is not None and isinstance(bedTemp, tuple):
-# data["bed"] = {
-# "actual": bedTemp[0],
-# "target": bedTemp[1]
-# }
-#
-# self._temps.append(data)
-#
-# self._temp = temp
-# self._bedTemp = bedTemp
-#
-# self._stateMonitor.addTemperature(data)
-#
-# def _setJobData(self, filename, filesize, sd):
-# if filename is not None:
-# self._selectedFile = {
-# "filename": filename,
-# "filesize": filesize,
-# "sd": sd,
-# "estimatedPrintTime": None
-# }
-# else:
-# self._selectedFile = None
-# self._stateMonitor.setJobData({
-# "file": {
-# "name": None,
-# "origin": None,
-# "size": None,
-# "date": None
-# },
-# "estimatedPrintTime": None,
-# "averagePrintTime": None,
-# "lastPrintTime": None,
-# "filament": None,
-# })
-# return
-#
-# estimatedPrintTime = None
-# lastPrintTime = None
-# averagePrintTime = None
-# date = None
-# filament = None
-# if filename:
-# # Use a string for mtime because it could be float and the
-# # javascript needs to exact match
-# if not sd:
-# date = int(os.stat(filename).st_ctime)
-#
-# try:
-# fileData = self._fileManager.get_metadata(FileDestinations.SDCARD if sd else FileDestinations.LOCAL, filename)
-# except:
-# fileData = None
-# if fileData is not None:
-# if "analysis" in fileData:
-# if estimatedPrintTime is None and "estimatedPrintTime" in fileData["analysis"]:
-# estimatedPrintTime = fileData["analysis"]["estimatedPrintTime"]
-# if "filament" in fileData["analysis"].keys():
-# filament = fileData["analysis"]["filament"]
-# if "statistics" in fileData:
-# printer_profile = self._printerProfileManager.get_current_or_default()["id"]
-# if "averagePrintTime" in fileData["statistics"] and printer_profile in fileData["statistics"]["averagePrintTime"]:
-# averagePrintTime = fileData["statistics"]["averagePrintTime"][printer_profile]
-# if "lastPrintTime" in fileData["statistics"] and printer_profile in fileData["statistics"]["lastPrintTime"]:
-# lastPrintTime = fileData["statistics"]["lastPrintTime"][printer_profile]
-#
-# if averagePrintTime is not None:
-# self._selectedFile["estimatedPrintTime"] = averagePrintTime
-# elif estimatedPrintTime is not None:
-# # TODO apply factor which first needs to be tracked!
-# self._selectedFile["estimatedPrintTime"] = estimatedPrintTime
-#
-# self._stateMonitor.setJobData({
-# "file": {
-# "name": os.path.basename(filename) if filename is not None else None,
-# "origin": FileDestinations.SDCARD if sd else FileDestinations.LOCAL,
-# "size": filesize,
-# "date": date
-# },
-# "estimatedPrintTime": estimatedPrintTime,
-# "averagePrintTime": averagePrintTime,
-# "lastPrintTime": lastPrintTime,
-# "filament": filament,
-# })
-#
-# def _sendInitialStateUpdate(self, callback):
-# try:
-# data = self._stateMonitor.getCurrentData()
-# data.update({
-# "temps": list(self._temps),
-# "logs": list(self._log),
-# "messages": list(self._messages)
-# })
-# callback.sendHistoryData(data)
-# except Exception, err:
-# import sys
-# sys.stderr.write("ERROR: %s\n" % str(err))
-# pass
-#
-# def _getStateFlags(self):
-# return {
-# "operational": self.isOperational(),
-# "locked": self.isLocked(),
-# "printing": self.isPrinting(),
-# "closedOrError": self.isClosedOrError(),
-# "error": self.isError(),
-# "paused": self.isPaused(),
-# "ready": self.isReady(),
-# "sdReady": self.isSdReady()
-# }
-#
-# #~~ callbacks triggered from self._comm
-#
-# def mcLog(self, message):
-# """
-# Callback method for the comm object, called upon log output.
-# #"""
-# self._addLog(message)
-#
-# def mcTempUpdate(self, temp, bedTemp):
-# self._addTemperatureData(temp, bedTemp)
-#
-# def mcPosUpdate(self, MPos, WPos):
-# self._addPositionData(MPos, WPos)
-#
-# def mcStateChange(self, state):
-# """
-# Callback method for the comm object, called if the connection state changes.
-# #"""
-# oldState = self._state
-#
-# # forward relevant state changes to gcode manager
-# if self._comm is not None and oldState == self._comm.STATE_PRINTING:
-# if self._selectedFile is not None:
-# if state == self._comm.STATE_OPERATIONAL:
-# self._fileManager.log_print(FileDestinations.SDCARD if self._selectedFile["sd"] else FileDestinations.LOCAL, self._selectedFile["filename"], time.time(), self._comm.getPrintTime(), True, self._printerProfileManager.get_current_or_default()["id"])
-# elif state == self._comm.STATE_CLOSED or state == self._comm.STATE_ERROR or state == self._comm.STATE_CLOSED_WITH_ERROR:
-# self._fileManager.log_print(FileDestinations.SDCARD if self._selectedFile["sd"] else FileDestinations.LOCAL, self._selectedFile["filename"], time.time(), self._comm.getPrintTime(), False, self._printerProfileManager.get_current_or_default()["id"])
-# self._analysisQueue.resume() # printing done, put those cpu cycles to good use
-# elif self._comm is not None and state == self._comm.STATE_PRINTING:
-# self._analysisQueue.pause() # do not analyse files while printing
-#
-# self._setState(state)
-#
-# def mcMessage(self, message):
-# """
-# Callback method for the comm object, called upon message exchanges via serial.
-# Stores the message in the message buffer, truncates buffer to the last 300 lines.
-# #"""
-# self._addMessage(message)
-#
-# def mcProgress(self):
-# """
-# Callback method for the comm object, called upon any change in progress of the printjob.
-# Triggers storage of new values for printTime, printTimeLeft and the current progress.
-# #"""
-#
-# self._setProgressData(self._comm.getPrintProgress(), self._comm.getPrintFilepos(), self._comm.getPrintTime(), self._comm.getCleanedPrintTime())
-#=======
"""
Jogs the specified printer ``axis`` by the specified ``amount`` in mm.
@@ -778,7 +376,6 @@ class PrinterInterface(object):
def flow_rate(self, factor):
"""
Sets the ``factor`` for the printer's flow rate.
-#>>>>>>> upstream/maintenance
Arguments:
factor (int, float): The factor for the flow rate to send to the firmware. Percentage expressed as either an
@@ -1153,13 +750,7 @@ class PrinterCallback(object):
# self._addTemperatureCallback(temperature)
# self._changeEvent.set()
#
-# def setWorkPosition(self, workPosition):
-# self._workPosition = workPosition
-# self._changeEvent.set()
-#
-# def setMachinePosition(self, machinePosition):
-# self._machinePosition = machinePosition
-# self._changeEvent.set()
+
#
# def addLog(self, log):
# self._addLogCallback(log)
diff --git a/src/octoprint/printer/standard.py b/src/octoprint/printer/standard.py
index a652e6e7..e12c658e 100644
--- a/src/octoprint/printer/standard.py
+++ b/src/octoprint/printer/standard.py
@@ -22,7 +22,7 @@ from octoprint.plugin import plugin_manager, ProgressPlugin
from octoprint.printer import PrinterInterface, PrinterCallback, UnknownScript
from octoprint.printer.estimation import TimeEstimationHelper
from octoprint.settings import settings
-from octoprint.util import comm as comm
+from octoprint.util import comm_acc as comm
from octoprint.util import InvariantContainer
@@ -256,6 +256,10 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
printer_profile = self._printerProfileManager.get_current_or_default()
movement_speed = printer_profile["axes"][axis]["speed"]
self.commands(["G91", "G1 %s%.4f F%d" % (axis.upper(), amount, movement_speed), "G90"])
+# def jog(self, axis, amount):
+# printer_profile = self._printerProfileManager.get_current_or_default()
+# movement_speed = printer_profile["axes"][axis]["speed"]
+# self.commands(["G91", "G1 %s%.4f F%d" % (axis.upper(), amount, movement_speed), "G90", "?"])
def home(self, axes):
if not isinstance(axes, (list, tuple)):
@@ -846,6 +850,411 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
def on_comm_force_disconnect(self):
self.disconnect()
+ def on_comm_pos_update(self, MPos, WPos):
+ self._add_position_data(MPos, WPos)
+
+ def _add_position_data(self, MPos, WPos):
+ if MPos is None or WPos is None:
+ MPosString = WPosString = "-"
+ else:
+ MPosString = "X: %.4f Y: %.4f Z: %.4f" % ( MPos[0], MPos[1], MPos[2] )
+ WPosString = "X: %.4f Y: %.4f Z: %.4f" % ( WPos[0], WPos[1], WPos[2] )
+
+ self._stateMonitor.setWorkPosition(WPosString)
+ self._stateMonitor.setMachinePosition(MPosString)
+
+
+
+ #<<<<<<< HEAD
+
+
+#
+# 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"])):
+# self.commands(["$H", "G92X0Y0Z0", "G90", "G21"])
+# else:
+# self.commands(["G91", "G28 %s" % " ".join(map(lambda x: "%s0" % x.upper(), axes)), "G90"])
+#
+# def extrude(self, amount):
+# printer_profile = self._printerProfileManager.get_current_or_default()
+# extrusion_speed = printer_profile["axes"]["e"]["speed"]
+# self.commands(["G91", "G1 E%s F%d" % (amount, extrusion_speed), "G90"])
+#
+# def changeTool(self, tool):
+# try:
+# toolNum = int(tool[len("tool"):])
+# self.command("T%d" % toolNum)
+# except ValueError:
+# pass
+#
+# def setTemperature(self, type, value):
+# if type.startswith("tool"):
+# printer_profile = self._printerProfileManager.get_current_or_default()
+# extruder_count = printer_profile["extruder"]["count"]
+# if extruder_count > 1:
+# try:
+# toolNum = int(type[len("tool"):])
+# self.command("M104 T%d S%f" % (toolNum, value))
+# except ValueError:
+# pass
+# else:
+# self.command("M104 S%f" % value)
+# elif type == "bed":
+# self.command("M140 S%f" % value)
+#
+# def setTemperatureOffset(self, offsets={}):
+# if self._comm is None:
+# return
+#
+# tool, bed = self._comm.getOffsets()
+#
+# validatedOffsets = {}
+#
+# for key in offsets:
+# value = offsets[key]
+# if key == "bed":
+# bed = value
+# validatedOffsets[key] = value
+# elif key.startswith("tool"):
+# try:
+# toolNum = int(key[len("tool"):])
+# tool[toolNum] = value
+# validatedOffsets[key] = value
+# except ValueError:
+# pass
+#
+# self._comm.setTemperatureOffset(tool, bed)
+# self._stateMonitor.setTempOffsets(validatedOffsets)
+#
+# def selectFile(self, filename, sd, printAfterSelect=False):
+# if self._comm is None or (self._comm.isBusy() or self._comm.isStreaming()):
+# self._logger.info("Cannot load file: printer not connected or currently busy")
+# return
+#
+# self._printAfterSelect = printAfterSelect
+# self._comm.selectFile(filename, sd)
+# self._setProgressData(0, None, None, None)
+# self._setCurrentZ(None)
+#
+# def unselectFile(self):
+# if self._comm is not None and (self._comm.isBusy() or self._comm.isStreaming()):
+# return
+#
+# self._comm.unselectFile()
+# self._setProgressData(0, None, None, None)
+# self._setCurrentZ(None)
+#
+# def startPrint(self):
+# """
+# Starts the currently loaded print job.
+# Only starts if the printer is connected and operational, not currently printing and a printjob is loaded
+# """
+# if self._comm is None or not self._comm.isOperational() or self._comm.isPrinting():
+# return
+# if self._selectedFile is None:
+# return
+#
+# self._timeEstimationData = TimeEstimationHelper()
+# self._lastProgressReport = None
+# self._setCurrentZ(None)
+# self._comm.startPrint()
+# self._addPositionData(None, None)
+#
+
+#
+# def togglePausePrint(self):
+# """
+# Pause the current printjob.
+# """
+# if self._comm is None:
+# return
+#
+# self._comm.setPause(not self._comm.isPaused())
+#
+# def cancelPrint(self, disableMotorsAndHeater=True):
+# """
+# Cancel the current printjob.
+# """
+# if self._comm is None:
+# return
+#
+# self._comm.cancelPrint()
+#
+# if disableMotorsAndHeater:
+# printer_profile = self._printerProfileManager.get_current_or_default()
+# extruder_count = printer_profile["extruder"]["count"]
+#
+# # disable motors, switch off hotends, bed and fan
+# #commands = ["M84"]
+# #commands.extend(map(lambda x: "M104 T%d S0" % x, range(extruder_count)))
+# #commands.extend(["M140 S0", "M106 S0"])
+# commands = ["M05", "G0X0Y0", "M09"]
+# self.commands(commands)
+#
+# # reset progress, height, print time
+# self._setCurrentZ(None)
+# self._setProgressData(None, None, None, None)
+#
+# # mark print as failure
+# if self._selectedFile is not None:
+# self._fileManager.log_print(FileDestinations.SDCARD if self._selectedFile["sd"] else FileDestinations.LOCAL, self._selectedFile["filename"], time.time(), self._comm.getPrintTime(), False, self._printerProfileManager.get_current_or_default()["id"])
+# payload = {
+# "file": self._selectedFile["filename"],
+# "origin": FileDestinations.LOCAL
+# }
+# if self._selectedFile["sd"]:
+# payload["origin"] = FileDestinations.SDCARD
+# eventManager().fire(Events.PRINT_FAILED, payload)
+#
+# #~~ state monitoring
+#
+# def _setCurrentZ(self, currentZ):
+# self._currentZ = currentZ
+# self._stateMonitor.setCurrentZ(self._currentZ)
+#
+# def _setState(self, state):
+# self._state = state
+# self._stateMonitor.setState({"text": self.getStateString(), "flags": self._getStateFlags()})
+#
+# def _addLog(self, log):
+# self._log.append(log)
+# self._stateMonitor.addLog(log)
+#
+# def _addMessage(self, message):
+# self._messages.append(message)
+# self._stateMonitor.addMessage(message)
+#
+# def _estimateTotalPrintTime(self, progress, printTime):
+# if not progress or not printTime or not self._timeEstimationData:
+# #self._estimationLogger.info("{progress};{printTime};;;;".format(**locals()))
+# return None
+#
+# else:
+# newEstimate = printTime / progress
+# self._timeEstimationData.update(newEstimate)
+#
+# result = None
+# if self._timeEstimationData.is_stable():
+# result = self._timeEstimationData.average_total_rolling
+#
+# #averageTotal = self._timeEstimationData.average_total
+# #averageTotalRolling = self._timeEstimationData.average_total_rolling
+# #averageDistance = self._timeEstimationData.average_distance
+#
+# #self._estimationLogger.info("{progress};{printTime};{newEstimate};{averageTotal};{averageTotalRolling};{averageDistance}".format(**locals()))
+#
+# return result
+#
+# def _setProgressData(self, progress, filepos, printTime, cleanedPrintTime):
+# estimatedTotalPrintTime = self._estimateTotalPrintTime(progress, cleanedPrintTime)
+# statisticalTotalPrintTime = None
+# totalPrintTime = estimatedTotalPrintTime
+#
+# if self._selectedFile and "estimatedPrintTime" in self._selectedFile and self._selectedFile["estimatedPrintTime"]:
+# statisticalTotalPrintTime = self._selectedFile["estimatedPrintTime"]
+# if progress and cleanedPrintTime:
+# if estimatedTotalPrintTime is None:
+# totalPrintTime = statisticalTotalPrintTime
+# else:
+# if progress < 0.5:
+# sub_progress = progress * 2
+# else:
+# sub_progress = 1.0
+# totalPrintTime = (1 - sub_progress) * statisticalTotalPrintTime + sub_progress * estimatedTotalPrintTime
+#
+# #self._printTimeLogger.info("{progress};{cleanedPrintTime};{estimatedTotalPrintTime};{statisticalTotalPrintTime};{totalPrintTime}".format(**locals()))
+#
+# self._progress = progress
+# self._printTime = printTime
+# self._printTimeLeft = totalPrintTime - cleanedPrintTime if (totalPrintTime is not None and cleanedPrintTime is not None) else None
+#
+# self._stateMonitor.setProgress({
+# "completion": self._progress * 100 if self._progress is not None else None,
+# "filepos": filepos,
+# "printTime": int(self._printTime) if self._printTime is not None else None,
+# "printTimeLeft": int(self._printTimeLeft) if self._printTimeLeft is not None else None
+# })
+#
+# if progress:
+# progress_int = int(progress * 100)
+# if self._lastProgressReport != progress_int:
+# self._lastProgressReport = progress_int
+# self._reportPrintProgressToPlugins(progress_int)
+#
+#
+# def _addTemperatureData(self, temp, bedTemp):
+# currentTimeUtc = int(time.time())
+#
+# data = {
+# "time": currentTimeUtc
+# }
+# for tool in temp.keys():
+# data["tool%d" % tool] = {
+# "actual": temp[tool][0],
+# "target": temp[tool][1]
+# }
+# if bedTemp is not None and isinstance(bedTemp, tuple):
+# data["bed"] = {
+# "actual": bedTemp[0],
+# "target": bedTemp[1]
+# }
+#
+# self._temps.append(data)
+#
+# self._temp = temp
+# self._bedTemp = bedTemp
+#
+# self._stateMonitor.addTemperature(data)
+#
+# def _setJobData(self, filename, filesize, sd):
+# if filename is not None:
+# self._selectedFile = {
+# "filename": filename,
+# "filesize": filesize,
+# "sd": sd,
+# "estimatedPrintTime": None
+# }
+# else:
+# self._selectedFile = None
+# self._stateMonitor.setJobData({
+# "file": {
+# "name": None,
+# "origin": None,
+# "size": None,
+# "date": None
+# },
+# "estimatedPrintTime": None,
+# "averagePrintTime": None,
+# "lastPrintTime": None,
+# "filament": None,
+# })
+# return
+#
+# estimatedPrintTime = None
+# lastPrintTime = None
+# averagePrintTime = None
+# date = None
+# filament = None
+# if filename:
+# # Use a string for mtime because it could be float and the
+# # javascript needs to exact match
+# if not sd:
+# date = int(os.stat(filename).st_ctime)
+#
+# try:
+# fileData = self._fileManager.get_metadata(FileDestinations.SDCARD if sd else FileDestinations.LOCAL, filename)
+# except:
+# fileData = None
+# if fileData is not None:
+# if "analysis" in fileData:
+# if estimatedPrintTime is None and "estimatedPrintTime" in fileData["analysis"]:
+# estimatedPrintTime = fileData["analysis"]["estimatedPrintTime"]
+# if "filament" in fileData["analysis"].keys():
+# filament = fileData["analysis"]["filament"]
+# if "statistics" in fileData:
+# printer_profile = self._printerProfileManager.get_current_or_default()["id"]
+# if "averagePrintTime" in fileData["statistics"] and printer_profile in fileData["statistics"]["averagePrintTime"]:
+# averagePrintTime = fileData["statistics"]["averagePrintTime"][printer_profile]
+# if "lastPrintTime" in fileData["statistics"] and printer_profile in fileData["statistics"]["lastPrintTime"]:
+# lastPrintTime = fileData["statistics"]["lastPrintTime"][printer_profile]
+#
+# if averagePrintTime is not None:
+# self._selectedFile["estimatedPrintTime"] = averagePrintTime
+# elif estimatedPrintTime is not None:
+# # TODO apply factor which first needs to be tracked!
+# self._selectedFile["estimatedPrintTime"] = estimatedPrintTime
+#
+# self._stateMonitor.setJobData({
+# "file": {
+# "name": os.path.basename(filename) if filename is not None else None,
+# "origin": FileDestinations.SDCARD if sd else FileDestinations.LOCAL,
+# "size": filesize,
+# "date": date
+# },
+# "estimatedPrintTime": estimatedPrintTime,
+# "averagePrintTime": averagePrintTime,
+# "lastPrintTime": lastPrintTime,
+# "filament": filament,
+# })
+#
+# def _sendInitialStateUpdate(self, callback):
+# try:
+# data = self._stateMonitor.getCurrentData()
+# data.update({
+# "temps": list(self._temps),
+# "logs": list(self._log),
+# "messages": list(self._messages)
+# })
+# callback.sendHistoryData(data)
+# except Exception, err:
+# import sys
+# sys.stderr.write("ERROR: %s\n" % str(err))
+# pass
+#
+# def _getStateFlags(self):
+# return {
+# "operational": self.isOperational(),
+# "locked": self.isLocked(),
+# "printing": self.isPrinting(),
+# "closedOrError": self.isClosedOrError(),
+# "error": self.isError(),
+# "paused": self.isPaused(),
+# "ready": self.isReady(),
+# "sdReady": self.isSdReady()
+# }
+#
+# #~~ callbacks triggered from self._comm
+#
+# def mcLog(self, message):
+# """
+# Callback method for the comm object, called upon log output.
+# #"""
+# self._addLog(message)
+#
+# def mcTempUpdate(self, temp, bedTemp):
+# self._addTemperatureData(temp, bedTemp)
+#
+
+#
+# def mcStateChange(self, state):
+# """
+# Callback method for the comm object, called if the connection state changes.
+# #"""
+# oldState = self._state
+#
+# # forward relevant state changes to gcode manager
+# if self._comm is not None and oldState == self._comm.STATE_PRINTING:
+# if self._selectedFile is not None:
+# if state == self._comm.STATE_OPERATIONAL:
+# self._fileManager.log_print(FileDestinations.SDCARD if self._selectedFile["sd"] else FileDestinations.LOCAL, self._selectedFile["filename"], time.time(), self._comm.getPrintTime(), True, self._printerProfileManager.get_current_or_default()["id"])
+# elif state == self._comm.STATE_CLOSED or state == self._comm.STATE_ERROR or state == self._comm.STATE_CLOSED_WITH_ERROR:
+# self._fileManager.log_print(FileDestinations.SDCARD if self._selectedFile["sd"] else FileDestinations.LOCAL, self._selectedFile["filename"], time.time(), self._comm.getPrintTime(), False, self._printerProfileManager.get_current_or_default()["id"])
+# self._analysisQueue.resume() # printing done, put those cpu cycles to good use
+# elif self._comm is not None and state == self._comm.STATE_PRINTING:
+# self._analysisQueue.pause() # do not analyse files while printing
+#
+# self._setState(state)
+#
+# def mcMessage(self, message):
+# """
+# Callback method for the comm object, called upon message exchanges via serial.
+# Stores the message in the message buffer, truncates buffer to the last 300 lines.
+# #"""
+# self._addMessage(message)
+#
+# def mcProgress(self):
+# """
+# Callback method for the comm object, called upon any change in progress of the printjob.
+# Triggers storage of new values for printTime, printTimeLeft and the current progress.
+# #"""
+#
+# self._setProgressData(self._comm.getPrintProgress(), self._comm.getPrintFilepos(), self._comm.getPrintTime(), self._comm.getCleanedPrintTime())
+#=======
class StateMonitor(object):
def __init__(self, interval=0.5, on_update=None, on_add_temperature=None, on_add_log=None, on_add_message=None):
@@ -861,7 +1270,9 @@ class StateMonitor(object):
self._sd_upload_data = None
self._current_z = None
self._progress = None
-
+ self._machinePosition = None
+ self._workPosition = None
+
self._offsets = {}
self._change_event = threading.Event()
@@ -877,6 +1288,8 @@ class StateMonitor(object):
self.set_job_data(job_data)
self.set_progress(progress)
self.set_current_z(current_z)
+ self._machinePosition = None
+ self._workPosition = None
def add_temperature(self, temperature):
self._on_add_temperature(temperature)
@@ -935,6 +1348,14 @@ class StateMonitor(object):
"progress": self._progress,
"offsets": self._offsets
}
+
+ def setWorkPosition(self, workPosition):
+ self._workPosition = workPosition
+ self._change_event.set()
+
+ def setMachinePosition(self, machinePosition):
+ self._machinePosition = machinePosition
+ self._change_event.set()
class TemperatureHistory(InvariantContainer):
diff --git a/src/octoprint/server/util/flask.py b/src/octoprint/server/util/flask.py
index 8abba926..8f53006c 100644
--- a/src/octoprint/server/util/flask.py
+++ b/src/octoprint/server/util/flask.py
@@ -478,9 +478,6 @@ class PluginAssetResolver(flask.ext.assets.FlaskResolver):
try:
prefix, plugin, name = item.split("/", 2)
blueprint = prefix + "." + plugin
- print('####', blueprint, app.blueprints[blueprint])
- #for attr in dir(app.blueprints[blueprint]):
- # print "obj.%s = %s" % (attr, getattr(app.blueprints[blueprint], attr))
directory = flask.ext.assets.get_static_folder(app.blueprints[blueprint])
item = name
endpoint = blueprint + ".static"
diff --git a/src/octoprint/static/js/app/viewmodels/connection.js b/src/octoprint/static/js/app/viewmodels/connection.js
index d6408dbf..62ab6622 100644
--- a/src/octoprint/static/js/app/viewmodels/connection.js
+++ b/src/octoprint/static/js/app/viewmodels/connection.js
@@ -211,7 +211,7 @@ $(function() {
self.isReady(data.flags.ready);
self.isLoading(data.flags.loading);
- var connectionTab = $("#connection");
+ var connectionTab = $("#connection_wrapper");
if (self.previousIsOperational != self.isOperational()) {
if (self.isOperational() && connectionTab.hasClass("in")) {
// connection just got established, close connection tab for now
diff --git a/src/octoprint/static/js/app/viewmodels/control.js b/src/octoprint/static/js/app/viewmodels/control.js
index 962ee910..a9ea5249 100644
--- a/src/octoprint/static/js/app/viewmodels/control.js
+++ b/src/octoprint/static/js/app/viewmodels/control.js
@@ -2,9 +2,6 @@
//function ControlViewModel(loginStateViewModel, settingsViewModel, printerStateViewModel) {
// var self = this;
//
-// self.loginState = loginStateViewModel;
-// self.settings = settingsViewModel;
-// self.printerState = printerStateViewModel;
//
// self._createToolEntry = function() {
// return {
@@ -23,7 +20,6 @@
// self.isLoading = ko.observable(undefined);
//
// self.extrusionAmount = ko.observable(undefined);
-// self.jogDistanceInMM = ko.observable(undefined)
// self.controls = ko.observableArray([]);
//
// self.tools = ko.observableArray([]);
@@ -60,6 +56,7 @@ $(function() {
self.loginState = parameters[0];
self.settings = parameters[1];
+ self.printerState = parameters[2];
self._createToolEntry = function () {
return {
@@ -207,14 +204,7 @@ $(function() {
// return control;
// };
//
-// self.laserPos = ko.computed(function(){
-// var pos = self.printerState.currentPos();
-// if(!pos){
-// return "(?, ?)";
-// } else {
-// return "("+ pos.x + ", "+ pos.y + ")";
-// }
-// }, this);
+
//
// self.focus_on = function(){
//
@@ -399,9 +389,7 @@ $(function() {
// });
// };
//
-// self.setCoordinateOrigin = function(){
-// self.sendCustomCommand({type:'command', command: "G92 X0 Y0"});
-// };
+
//=======
self.sendJogCommand = function (axis, multiplier, distance) {
if (typeof distance === "undefined")
@@ -864,12 +852,26 @@ $(function() {
button.click();
}
};
+ self.laserPos = ko.computed(function () {
+ var pos = self.printerState.currentPos();
+ if (!pos) {
+ return "(?, ?)";
+ } else {
+ return "(" + pos.x + ", " + pos.y + ")";
+ }
+ }, this);
+
+ self.setCoordinateOrigin = function () {
+ self.sendCustomCommand({type: 'command', command: "G92 X0 Y0"});
+ };
+
+ self.jogDistanceInMM = ko.observable(undefined)
}
OCTOPRINT_VIEWMODELS.push([
ControlViewModel,
- ["loginStateViewModel", "settingsViewModel"],
+ ["loginStateViewModel", "settingsViewModel", 'printerStateViewModel'],
"#control"
]);
});
diff --git a/src/octoprint/static/js/app/viewmodels/files.js b/src/octoprint/static/js/app/viewmodels/files.js
index 6d096b80..65263475 100644
--- a/src/octoprint/static/js/app/viewmodels/files.js
+++ b/src/octoprint/static/js/app/viewmodels/files.js
@@ -347,10 +347,14 @@ $(function() {
return data["prints"]["last"]["success"] ? "text-success" : "text-error";
};
- self.templateFor = function(data) {
- return "files_template_" + data.type;
- };
-
+ self.templateFor = function(data) {
+ var extension = data.name.split('.').pop().toLowerCase();
+ if (extension === "svg") {
+ return "files_template_" + data.type + "_svg";
+ } else {
+ return "files_template_" + data.type;
+ }
+ };
self.getEntryId = function(data) {
return "gcode_file_" + md5(data["origin"] + ":" + data["name"]);
};
diff --git a/src/octoprint/static/js/app/viewmodels/printerstate.js b/src/octoprint/static/js/app/viewmodels/printerstate.js
index 19da04f1..fde3aa79 100644
--- a/src/octoprint/static/js/app/viewmodels/printerstate.js
+++ b/src/octoprint/static/js/app/viewmodels/printerstate.js
@@ -7,7 +7,6 @@
// self.stateString = ko.observable(undefined);
// self.isErrorOrClosed = ko.observable(undefined);
// self.isOperational = ko.observable(undefined);
-// self.isLocked = ko.observable(undefined);
// self.isConnecting = ko.observable(undefined);
// self.isPrinting = ko.observable(undefined);
// self.isPaused = ko.observable(undefined);
@@ -33,7 +32,6 @@
//
// self.currentHeight = ko.observable(undefined);
//
-// self.currentPos = ko.observable(undefined);
// self.conversion = vectorConversionViewModel;
//
//
@@ -70,6 +68,8 @@ $(function() {
self.isReady = ko.observable(undefined);
self.isLoading = ko.observable(undefined);
self.isSdReady = ko.observable(undefined);
+ self.isLocked = ko.observable(undefined);
+ self.isConnecting = ko.observable(undefined);
self.filename = ko.observable(undefined);
self.progress = ko.observable(undefined);
@@ -87,6 +87,7 @@ $(function() {
self.lastPrintTime = ko.observable(undefined);
self.currentHeight = ko.observable(undefined);
+ self.currentPos = ko.observable(undefined);
self.TITLE_PRINT_BUTTON_PAUSED = gettext("Restarts the print job from the beginning");
self.TITLE_PRINT_BUTTON_UNPAUSED = gettext("Starts the print job");
@@ -190,7 +191,6 @@ $(function() {
// self.stateString(gettext(data.text));
// self.isErrorOrClosed(data.flags.closedOrError);
// self.isOperational(data.flags.operational);
-// self.isLocked(data.flags.locked);
// self.isConnecting(data.text === "Connecting" || data.text === "Opening serial port");
// self.isPaused(data.flags.paused);
// self.isPrinting(data.flags.printing);
@@ -274,6 +274,8 @@ $(function() {
self.isError(data.flags.error);
self.isReady(data.flags.ready);
self.isSdReady(data.flags.sdReady);
+ self.isLocked(data.flags.locked);
+ self.isConnecting(data.text === "Connecting" || data.text === "Opening serial port");
if (self.isPaused() != prevPaused) {
if (self.isPaused()) {
diff --git a/src/octoprint/static/js/app/viewmodels/settings.js b/src/octoprint/static/js/app/viewmodels/settings.js
index 5eed7d6c..d204d794 100644
--- a/src/octoprint/static/js/app/viewmodels/settings.js
+++ b/src/octoprint/static/js/app/viewmodels/settings.js
@@ -119,15 +119,7 @@
// self.requestData();
// };
//
-// self.saveall = function(e, v){
-//// $("#settings_save_btn").css("visibility", "visible");
-//
-// $("#settingsTabs li.active").addClass('saveInProgress');
-// if(self.savetimer !== undefined){
-// clearTimeout(self.savetimer);
-// }
-// self.savetimer = setTimeout(self.instantSaveData, 2000);
-// };
+
//
// self.requestData = function(callback) {
// $.ajax({
@@ -202,68 +194,7 @@
// self.terminalFilters(response.terminalFilters);
// };
//
-// self.collectData = function (){
-// var data = ko.mapping.toJS(self.settings);
-// data = _.extend(data, {
-// "api" : {
-// "enabled": self.api_enabled(),
-// "key": self.api_key(),
-// "allowCrossOrigin": self.api_allowCrossOrigin()
-// },
-// "appearance" : {
-// "name": self.appearance_name(),
-// "color": self.appearance_color()
-// },
-// "printer": {
-// "defaultExtrusionLength": self.printer_defaultExtrusionLength()
-// },
-// "webcam": {
-// "streamUrl": self.webcam_streamUrl(),
-// "snapshotUrl": self.webcam_snapshotUrl(),
-// "ffmpegPath": self.webcam_ffmpegPath(),
-// "bitrate": self.webcam_bitrate(),
-// "watermark": self.webcam_watermark(),
-// "flipH": self.webcam_flipH(),
-// "flipV": self.webcam_flipV()
-// },
-// "feature": {
-// "gcodeViewer": self.feature_gcodeViewer(),
-// "temperatureGraph": self.feature_temperatureGraph(),
-// "waitForStart": self.feature_waitForStart(),
-// "alwaysSendChecksum": self.feature_alwaysSendChecksum(),
-// "sdSupport": self.feature_sdSupport(),
-// "sdAlwaysAvailable": self.feature_sdAlwaysAvailable(),
-// "swallowOkAfterResend": self.feature_swallowOkAfterResend(),
-// "repetierTargetTemp": self.feature_repetierTargetTemp(),
-// "keyboardControl": self.feature_keyboardControl()
-// },
-// "serial": {
-// "port": self.serial_port(),
-// "baudrate": self.serial_baudrate(),
-// "autoconnect": self.serial_autoconnect(),
-// "timeoutConnection": self.serial_timeoutConnection(),
-// "timeoutDetection": self.serial_timeoutDetection(),
-// "timeoutCommunication": self.serial_timeoutCommunication(),
-// "timeoutTemperature": self.serial_timeoutTemperature(),
-// "timeoutSdStatus": self.serial_timeoutSdStatus(),
-// "log": self.serial_log()
-// },
-// "folder": {
-// "uploads": self.folder_uploads(),
-// "timelapse": self.folder_timelapse(),
-// "timelapseTmp": self.folder_timelapseTmp(),
-// "logs": self.folder_logs(),
-// "watched": self.folder_watched()
-// },
-// "temperature": {
-// "profiles": self.temperature_profiles()
-// },
-// "system": {
-// "actions": self.system_actions()
-// }
-// });
-// return data;
-// };
+
//=======
$(function() {
function SettingsViewModel(parameters) {
@@ -591,8 +522,7 @@ $(function() {
self.languagePacksAvailable = ko.computed(function() {
return self.translations.allSize() > 0;
});
-
- };
+
//<<<<<<< HEAD
// self.saveData = function() {
@@ -615,23 +545,7 @@ $(function() {
// });
// };
//
-// self.instantSaveData = function() {
-//
-// var data = self.collectData();
-//
-// $.ajax({
-// url: API_BASEURL + "settings",
-// type: "POST",
-// dataType: "json",
-// contentType: "application/json; charset=UTF-8",
-// data: JSON.stringify(data),
-// success: function(response) {
-//// self.fromResponse(response);
-//// $("#settings_dialog").modal("hide");
-//// $("#settings_save_btn").attr("disabled", "disabled");
-//// $("#settings_save_btn").css("visibility", "hidden");
-// $("#settingsTabs li.active").removeClass('saveInProgress');
-// self.savetimer = undefined;
+
//=======
self.deleteLanguagePack = function(locale, pack) {
$.ajax({
@@ -821,7 +735,102 @@ $(function() {
}
});
};
-// }
+
+ self.saveall = function(e, v){
+ // $("#settings_save_btn").css("visibility", "visible");
+
+ $("#settingsTabs li.active").addClass('saveInProgress');
+ if(self.savetimer !== undefined){
+ clearTimeout(self.savetimer);
+ }
+ self.savetimer = setTimeout(self.instantSaveData, 2000);
+ };
+
+ self.instantSaveData = function() {
+
+ var data = self.collectData();
+
+ $.ajax({
+ url: API_BASEURL + "settings",
+ type: "POST",
+ dataType: "json",
+ contentType: "application/json; charset=UTF-8",
+ data: JSON.stringify(data),
+ success: function(response) {
+ // self.fromResponse(response);
+ // $("#settings_dialog").modal("hide");
+ // $("#settings_save_btn").attr("disabled", "disabled");
+ // $("#settings_save_btn").css("visibility", "hidden");
+ $("#settingsTabs li.active").removeClass('saveInProgress');
+ self.savetimer = undefined;
+ }
+ });
+ };
+
+
+ self.collectData = function (){
+ var data = ko.mapping.toJS(self.settings);
+ data = _.extend(data, {
+ "api" : {
+ "enabled": self.api_enabled(),
+ "key": self.api_key(),
+ "allowCrossOrigin": self.api_allowCrossOrigin()
+ },
+ "appearance" : {
+ "name": self.appearance_name(),
+ "color": self.appearance_color()
+ },
+ "printer": {
+ "defaultExtrusionLength": self.printer_defaultExtrusionLength()
+ },
+ "webcam": {
+ "streamUrl": self.webcam_streamUrl(),
+ "snapshotUrl": self.webcam_snapshotUrl(),
+ "ffmpegPath": self.webcam_ffmpegPath(),
+ "bitrate": self.webcam_bitrate(),
+ "watermark": self.webcam_watermark(),
+ "flipH": self.webcam_flipH(),
+ "flipV": self.webcam_flipV()
+ },
+ "feature": {
+ "gcodeViewer": self.feature_gcodeViewer(),
+ "temperatureGraph": self.feature_temperatureGraph(),
+ "waitForStart": self.feature_waitForStart(),
+ "alwaysSendChecksum": self.feature_alwaysSendChecksum(),
+ "sdSupport": self.feature_sdSupport(),
+ "sdAlwaysAvailable": self.feature_sdAlwaysAvailable(),
+ "swallowOkAfterResend": self.feature_swallowOkAfterResend(),
+ "repetierTargetTemp": self.feature_repetierTargetTemp(),
+ "keyboardControl": self.feature_keyboardControl()
+ },
+ "serial": {
+ "port": self.serial_port(),
+ "baudrate": self.serial_baudrate(),
+ "autoconnect": self.serial_autoconnect(),
+ "timeoutConnection": self.serial_timeoutConnection(),
+ "timeoutDetection": self.serial_timeoutDetection(),
+ "timeoutCommunication": self.serial_timeoutCommunication(),
+ "timeoutTemperature": self.serial_timeoutTemperature(),
+ "timeoutSdStatus": self.serial_timeoutSdStatus(),
+ "log": self.serial_log()
+ },
+ "folder": {
+ "uploads": self.folder_uploads(),
+ "timelapse": self.folder_timelapse(),
+ "timelapseTmp": self.folder_timelapseTmp(),
+ "logs": self.folder_logs(),
+ "watched": self.folder_watched()
+ },
+ "temperature": {
+ "profiles": self.temperature_profiles()
+ },
+ "system": {
+ "actions": self.system_actions()
+ }
+ });
+ return data;
+ };
+ };
OCTOPRINT_VIEWMODELS.push([
SettingsViewModel,
diff --git a/src/octoprint/static/js/app/viewmodels/terminal.js b/src/octoprint/static/js/app/viewmodels/terminal.js
index 6099cf1a..8e0766ed 100644
--- a/src/octoprint/static/js/app/viewmodels/terminal.js
+++ b/src/octoprint/static/js/app/viewmodels/terminal.js
@@ -11,7 +11,6 @@
//
// self.isErrorOrClosed = ko.observable(undefined);
// self.isOperational = ko.observable(undefined);
-// self.isLocked = ko.observable(undefined);
// self.isPrinting = ko.observable(undefined);
// self.isPaused = ko.observable(undefined);
// self.isError = ko.observable(undefined);
@@ -93,32 +92,7 @@
// }
// };
//
-// self.sendCommandWithSafetyPopup = function(){
-// var command = self.command().split(' ').join('');
-// if (!command) {
-// return;
-// }
-//
-// console.log(command);
-// var parts = command.match(/^(M3|M03)(S[0-9.]+)?/i);
-// if(parts !== null){
-//
-// $("#confirmation_dialog .confirmation_dialog_message").text(gettext("The laser will now be enabled. 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) {
-// e.preventDefault();
-// $("#confirmation_dialog").modal("hide");
-// self.sendCommand();
-// });
-// $("#confirmation_dialog").modal("show");
-//
-//
-//
-// } else {
-// self.sendCommand();
-// }
-// };
+
//
// self.sendCommand = function() {
// var command = self.command();
@@ -154,6 +128,7 @@ $(function() {
self.isError = ko.observable(undefined);
self.isReady = ko.observable(undefined);
self.isLoading = ko.observable(undefined);
+ self.isLocked = ko.observable(undefined);
self.autoscrollEnabled = ko.observable(true);
@@ -370,6 +345,33 @@ $(function() {
};
//>>>>>>> upstream/maintenance
+ self.sendCommandWithSafetyPopup = function () {
+ var command = self.command().split(' ').join('');
+ if (!command) {
+ return;
+ }
+
+ console.log(command);
+ var parts = command.match(/^(M3|M03)(S[0-9.]+)?/i);
+ if (parts !== null) {
+
+ $("#confirmation_dialog .confirmation_dialog_message").text(gettext("The laser will now be enabled. 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) {
+ e.preventDefault();
+ $("#confirmation_dialog").modal("hide");
+ self.sendCommand();
+ });
+ $("#confirmation_dialog").modal("show");
+
+
+
+ } else {
+ self.sendCommand();
+ }
+ };
+
}
OCTOPRINT_VIEWMODELS.push([
diff --git a/src/octoprint/templates/mrbeam_index.jinja2 b/src/octoprint/templates/mrbeam_index.jinja2
index e16a081f..65cd06ed 100644
--- a/src/octoprint/templates/mrbeam_index.jinja2
+++ b/src/octoprint/templates/mrbeam_index.jinja2
@@ -19,13 +19,15 @@
+