Merge branch 'improve/intermediaryUrlsAndTimeouts' into devel

Conflicts:
	AUTHORS.md
	src/octoprint/plugins/virtual_printer/virtual.py
This commit is contained in:
Gina Häußge 2016-07-06 13:32:03 +02:00
commit a2cd46899c
10 changed files with 53 additions and 8 deletions

View file

@ -69,6 +69,7 @@ date of first contribution):
* [Kyle Evans](https://github.com/kevans91)
* [Javier Martínez Arrieta](https://github.com/Javierma)
* ["MirceaDan"](https://github.com/ByReaL)
* [Ovidiu Hossu](https://github.com/MoonshineSG)
OctoPrint started off as a fork of [Cura](https://github.com/daid/Cura) by
[Daid Braam](https://github.com/daid). Parts of its communication layer and

View file

@ -290,6 +290,14 @@ The following settings are only relevant to you if you want to do OctoPrint deve
# < ok T0:34.3/0.0 T1:23.5/0.0 B:43.2/0.0
includeCurrentToolInTemps: true
# Whether to include the selected filename in the M23 File opened response.
#
# True: > M23 filename.gcode
# < File opened: filename.gcode Size: 27
# False: > M23 filename.gcode
# > File opened
includeFilenameInOpened: true
# The maximum movement speeds of the simulated printer's axes, in mm/s
movementSpeed:
x: 6000
@ -426,6 +434,9 @@ Use the following settings to enable or disable OctoPrint features:
# Specifies whether support for SD printing and file management should be enabled
sdSupport: true
# Specifies whether firmware expects relative paths for selecting SD files
sdRelativePath: false
# Whether to always assume that an SD card is present in the printer.
# Needed by some firmwares which don't report the SD card status properly.
sdAlwaysAvailable: false

View file

@ -539,7 +539,10 @@ class VirtualPrinter(object):
else:
self._selectedSdFile = file
self._selectedSdFileSize = os.stat(file).st_size
self._send("File opened: %s Size: %d" % (filename, self._selectedSdFileSize))
if settings().getBoolean(["devel", "virtualPrinter", "includeFilenameInOpened"]):
self._send("File opened: %s Size: %d" % (filename, self._selectedSdFileSize))
else:
self._send("File opened")
self._send("File selected")
def _startSdPrint(self):

View file

@ -385,7 +385,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
self._printAfterSelect = printAfterSelect
self._posAfterSelect = pos
self._comm.selectFile("/" + path if sd else path, sd)
self._comm.selectFile("/" + path if sd and not settings().getBoolean(["feature", "sdRelativePath"]) else path, sd)
self._setProgressData(completion=0)
self._setCurrentZ(None)

View file

@ -67,6 +67,7 @@ def getSettings():
"alwaysSendChecksum": s.getBoolean(["feature", "alwaysSendChecksum"]),
"neverSendChecksum": s.getBoolean(["feature", "neverSendChecksum"]),
"sdSupport": s.getBoolean(["feature", "sdSupport"]),
"sdRelativePath": s.getBoolean(["feature", "sdRelativePath"]),
"sdAlwaysAvailable": s.getBoolean(["feature", "sdAlwaysAvailable"]),
"swallowOkAfterResend": s.getBoolean(["feature", "swallowOkAfterResend"]),
"repetierTargetTemp": s.getBoolean(["feature", "repetierTargetTemp"]),
@ -229,6 +230,7 @@ def _saveSettings(data):
if "alwaysSendChecksum" in data["feature"].keys(): s.setBoolean(["feature", "alwaysSendChecksum"], data["feature"]["alwaysSendChecksum"])
if "neverSendChecksum" in data["feature"].keys(): s.setBoolean(["feature", "neverSendChecksum"], data["feature"]["neverSendChecksum"])
if "sdSupport" in data["feature"].keys(): s.setBoolean(["feature", "sdSupport"], data["feature"]["sdSupport"])
if "sdRelativePath" in data["feature"].keys(): s.setBoolean(["feature", "sdRelativePath"], data["feature"]["sdRelativePath"])
if "sdAlwaysAvailable" in data["feature"].keys(): s.setBoolean(["feature", "sdAlwaysAvailable"], data["feature"]["sdAlwaysAvailable"])
if "swallowOkAfterResend" in data["feature"].keys(): s.setBoolean(["feature", "swallowOkAfterResend"], data["feature"]["swallowOkAfterResend"])
if "repetierTargetTemp" in data["feature"].keys(): s.setBoolean(["feature", "repetierTargetTemp"], data["feature"]["repetierTargetTemp"])

View file

@ -172,6 +172,7 @@ default_settings = {
"sendChecksumWithUnknownCommands": False,
"unknownCommandsNeedAck": False,
"sdSupport": True,
"sdRelativePath": False,
"sdAlwaysAvailable": False,
"swallowOkAfterResend": True,
"repetierTargetTemp": False,
@ -307,6 +308,7 @@ default_settings = {
"okWithLinenumber": False,
"numExtruders": 1,
"includeCurrentToolInTemps": True,
"includeFilenameInOpened": True,
"movementSpeed": {
"x": 6000,
"y": 6000,

View file

@ -141,9 +141,17 @@
var timeout = 1500;
var baseUrl = window.location.href;
var currentQuery = "";
var currentFragment = "";
if (baseUrl.indexOf("#") > -1) {
currentFragment = baseUrl.substring(baseUrl.indexOf("#"));
baseUrl = baseUrl.substring(0, baseUrl.indexOf("#"));
}
if (baseUrl.indexOf("?") > -1) {
currentQuery = baseUrl.substring(baseUrl.indexOf("?"));
baseUrl = baseUrl.substring(0, baseUrl.indexOf("?"));
}
if (baseUrl.indexOf("/static") > -1) {
baseUrl = baseUrl.substring(0, baseUrl.indexOf("/static"));
}
@ -164,10 +172,16 @@
serverIsOnline = true;
message.className = "pulsate1 green";
message.innerText = "OctoPrint server online, reloading page...";
window.location = baseUrl;
var reloadUrl = baseUrl + currentQuery + currentFragment;
if (reloadUrl == window.location.href) {
window.location.reload(false);
} else {
window.location.href = reloadUrl;
}
} else {
// online.gif still not available, let's look at
var interval = 15;
var interval = 10;
if (intervals.length) {
interval = intervals.shift();
}
@ -191,7 +205,7 @@
}
backendOfflineCounter++;
if (backendOfflineCounter > 10) {
if (backendOfflineCounter > 15) {
if (serverTimeout) {
window.clearTimeout(serverTimeout);
}

View file

@ -124,6 +124,7 @@ $(function() {
self.feature_waitForStart = ko.observable(undefined);
self.feature_sendChecksum = ko.observable("print");
self.feature_sdSupport = ko.observable(undefined);
self.feature_sdRelativePath = ko.observable(undefined);
self.feature_sdAlwaysAvailable = ko.observable(undefined);
self.feature_swallowOkAfterResend = ko.observable(undefined);
self.feature_repetierTargetTemp = ko.observable(undefined);

View file

@ -34,6 +34,13 @@
</label>
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox">
<input type="checkbox" data-bind="checked: feature_sdRelativePath" id="settings-sdRelativePath"> {{ _('Select SD files by relative path') }} <span class="label">{{ _('RepRap Firmware') }}</span>
</label>
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox">

View file

@ -1149,12 +1149,16 @@ class MachineCom(object):
elif 'File opened' in line and not self._ignore_select:
# answer to M23, at least on Marlin, Repetier and Sprinter: "File opened:%s Size:%d"
match = regex_sdFileOpened.search(line)
if match:
name = match.group("name")
size = int(match.group("size"))
else:
name = "Unknown"
size = 0
if self._sdFileToSelect:
name = self._sdFileToSelect
self._sdFileToSelect = None
else:
name = match.group("name")
self._currentFile = PrintingSdFileInformation(name, int(match.group("size")))
self._currentFile = PrintingSdFileInformation(name, size)
elif 'File selected' in line:
if self._ignore_select:
self._ignore_select = False