Merge branch 'devel' into commRefactoring
This commit is contained in:
commit
b7b2e99ab1
6 files changed
+36
-13
No files matched your search
@@ -20,7 +20,7 @@ Get connection settings
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
GET /api/control/connection HTTP/1.1
|
||||
GET /api/connection HTTP/1.1
|
||||
Host: example.com
|
||||
Content-Type: application/json
|
||||
X-Api-Key: abcdef...
|
||||
@@ -77,7 +77,7 @@ Issue a connection command
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
POST /api/control/connection HTTP/1.1
|
||||
POST /api/connection HTTP/1.1
|
||||
Host: example.com
|
||||
Content-Type: application/json
|
||||
X-Api-Key: abcdef...
|
||||
@@ -94,7 +94,7 @@ Issue a connection command
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
POST /api/control/connection HTTP/1.1
|
||||
POST /api/connection HTTP/1.1
|
||||
Host: example.com
|
||||
Content-Type: application/json
|
||||
X-Api-Key: abcdef...
|
||||
@@ -114,6 +114,6 @@ Issue a connection command
|
||||
Defaults to ``false`` if not set.
|
||||
:json boolean autoconnect: ``connect`` command: Whether to attempt to automatically connect to the printer on server
|
||||
startup. If not set no changes will be made to the current setting.
|
||||
:statuscode 200: No error
|
||||
:statuscode 204: No error
|
||||
:statuscode 400: If the selected `port` or `baudrate` for a ``connect`` command are not part of the available
|
||||
options.
|
||||
@@ -560,8 +560,6 @@ class MetadataAnalyzer:
|
||||
def _work(self):
|
||||
aborted = None
|
||||
while True:
|
||||
self._active.wait()
|
||||
|
||||
if aborted is not None:
|
||||
filename = aborted
|
||||
aborted = None
|
||||
@@ -570,6 +568,8 @@ class MetadataAnalyzer:
|
||||
(priority, filename) = self._queue.get()
|
||||
self._logger.debug("Processing file %s from queue (priority %d)" % (filename, priority))
|
||||
|
||||
self._active.wait()
|
||||
|
||||
try:
|
||||
self._analyzeGcode(filename)
|
||||
self._queue.task_done()
|
||||
|
||||
@@ -190,6 +190,8 @@ class Server():
|
||||
printer.connect(port, baudrate)
|
||||
try:
|
||||
IOLoop.instance().start()
|
||||
except KeyboardInterrupt:
|
||||
logger.info("Goodbye!")
|
||||
except:
|
||||
logger.fatal("Now that is embarrassing... Something really really went wrong here. Please report this including the stacktrace below in OctoPrint's bugtracker. Thanks!")
|
||||
logger.exception("Stacktrace follows:")
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
$(function() {
|
||||
|
||||
//~~ Initialize view models
|
||||
var loginStateViewModel = new LoginStateViewModel();
|
||||
var usersViewModel = new UsersViewModel(loginStateViewModel);
|
||||
|
||||
@@ -191,6 +191,24 @@ def silentRemove(file):
|
||||
pass
|
||||
|
||||
|
||||
def sanitizeAscii(line):
|
||||
return unicode(line, 'ascii', 'replace').encode('ascii', 'replace').rstrip()
|
||||
|
||||
|
||||
def filterNonAscii(line):
|
||||
"""
|
||||
Returns True if the line contains non-ascii characters, false otherwise
|
||||
|
||||
@param line the line to test
|
||||
"""
|
||||
|
||||
try:
|
||||
unicode(line, 'ascii').encode('ascii')
|
||||
return False
|
||||
except ValueError:
|
||||
return True
|
||||
|
||||
|
||||
def getJsonCommandFromRequest(request, valid_commands):
|
||||
if not "application/json" in request.headers["Content-Type"]:
|
||||
return None, None, make_response("Expected content-type JSON", 400)
|
||||
|
||||
@@ -23,7 +23,7 @@ from octoprint.settings import settings
|
||||
from octoprint.events import eventManager, Events
|
||||
from octoprint.filemanager.destinations import FileDestinations
|
||||
from octoprint.gcodefiles import isGcodeFileName
|
||||
from octoprint.util import getExceptionString, getNewTimeout
|
||||
from octoprint.util import getExceptionString, getNewTimeout, sanitizeAscii, filterNonAscii
|
||||
from octoprint.util.virtual import VirtualPrinter
|
||||
|
||||
try:
|
||||
@@ -605,7 +605,11 @@ class MachineCom(object):
|
||||
##~~ SD file list
|
||||
# if we are currently receiving an sd file list, each line is just a filename, so just read it and abort processing
|
||||
if self._sdFileList and isGcodeFileName(line.strip().lower()) and not 'End file list' in line:
|
||||
self._sdFiles.append(line.strip().lower())
|
||||
filename = line.strip().lower()
|
||||
if filterNonAscii(filename):
|
||||
self._logger.warn("Got a file from printer's SD that has a non-ascii filename (%s), that shouldn't happen according to the protocol" % filename)
|
||||
else:
|
||||
self._sdFiles.append(filename)
|
||||
continue
|
||||
|
||||
##~~ Temperature processing
|
||||
@@ -672,7 +676,7 @@ class MachineCom(object):
|
||||
"file": self._currentFile.getFilename(),
|
||||
"filename": os.path.basename(self._currentFile.getFilename()),
|
||||
"origin": self._currentFile.getFileLocation(),
|
||||
"time": time.time() - self._currentFile.getStartTime()
|
||||
"time": self.getPrintTime()
|
||||
})
|
||||
elif 'Done saving file' in line:
|
||||
self.refreshSdFiles()
|
||||
@@ -920,7 +924,7 @@ class MachineCom(object):
|
||||
if ret == '':
|
||||
#self._log("Recv: TIMEOUT")
|
||||
return ''
|
||||
self._log("Recv: %s" % (unicode(ret, 'ascii', 'replace').encode('ascii', 'replace').rstrip()))
|
||||
self._log("Recv: %s" % sanitizeAscii(ret))
|
||||
return ret
|
||||
|
||||
def _sendNext(self):
|
||||
@@ -934,7 +938,7 @@ class MachineCom(object):
|
||||
payload = {
|
||||
"local": self._currentFile.getLocalFilename(),
|
||||
"remote": self._currentFile.getRemoteFilename(),
|
||||
"time": time.time() - self._currentFile.getStartTime()
|
||||
"time": self.getPrintTime()
|
||||
}
|
||||
|
||||
self._currentFile = None
|
||||
@@ -947,7 +951,7 @@ class MachineCom(object):
|
||||
"file": self._currentFile.getFilename(),
|
||||
"filename": os.path.basename(self._currentFile.getFilename()),
|
||||
"origin": self._currentFile.getFileLocation(),
|
||||
"time": time.time() - self._currentFile.getStartTime()
|
||||
"time": self.getPrintTime()
|
||||
}
|
||||
self._callback.mcPrintjobDone()
|
||||
self._changeState(self.STATE_OPERATIONAL)
|
||||
|
||||
Reference in new issue
Block a user