1 parent
6a069de240
commit
a9b395dac8
13 files changed
+136
-105
No files matched your search
@@ -98,6 +98,8 @@ def getSettings():
|
||||
"defaultExtrusionLength": s.getInt(["printerParameters", "defaultExtrusionLength"])
|
||||
},
|
||||
"webcam": {
|
||||
"webcamEnabled": s.getBoolean(["webcam", "webcamEnabled"]),
|
||||
"timelapseEnabled": s.getBoolean(["webcam", "timelapseEnabled"]),
|
||||
"streamUrl": s.get(["webcam", "stream"]),
|
||||
"streamRatio": s.get(["webcam", "streamRatio"]),
|
||||
"streamTimeout": s.getInt(["webcam", "streamTimeout"]),
|
||||
@@ -382,6 +384,8 @@ def _saveSettings(data):
|
||||
if "defaultExtrusionLength" in data["printer"]: s.setInt(["printerParameters", "defaultExtrusionLength"], data["printer"]["defaultExtrusionLength"])
|
||||
|
||||
if "webcam" in data.keys():
|
||||
if "webcamEnabled" in data["webcam"]: s.setBoolean(["webcam", "webcamEnabled"], data["webcam"]["webcamEnabled"])
|
||||
if "timelapseEnabled" in data["webcam"]: s.setBoolean(["webcam", "timelapseEnabled"], data["webcam"]["timelapseEnabled"])
|
||||
if "streamUrl" in data["webcam"]: s.set(["webcam", "stream"], data["webcam"]["streamUrl"])
|
||||
if "streamRatio" in data["webcam"] and data["webcam"]["streamRatio"] in ("16:9", "4:3"): s.set(["webcam", "streamRatio"], data["webcam"]["streamRatio"])
|
||||
if "streamTimeout" in data["webcam"]: s.setInt(["webcam", "streamTimeout"], data["webcam"]["streamTimeout"])
|
||||
|
||||
@@ -111,6 +111,7 @@ def getTimelapseData():
|
||||
finished_list.append(output)
|
||||
|
||||
result = dict(config=config,
|
||||
enabled=settings().getBoolean(["webcam", "timelapseEnabled"]),
|
||||
files=finished_list)
|
||||
|
||||
if unrendered:
|
||||
|
||||
@@ -179,7 +179,7 @@ def index():
|
||||
|
||||
enable_accesscontrol = userManager.enabled
|
||||
enable_gcodeviewer = settings().getBoolean(["gcodeViewer", "enabled"])
|
||||
enable_timelapse = bool(settings().get(["webcam", "snapshot"]) and settings().get(["webcam", "ffmpeg"]))
|
||||
enable_timelapse = settings().getBoolean(["webcam", "timelapseEnabled"])
|
||||
|
||||
def default_template_filter(template_type, template_key):
|
||||
if template_type == "navbar":
|
||||
@@ -355,7 +355,7 @@ def index():
|
||||
now)
|
||||
|
||||
render_kwargs.update(dict(
|
||||
webcamStream=settings().get(["webcam", "stream"]),
|
||||
enableWebcam=settings().getBoolean(["webcam", "enableWebcam"]) and bool(settings().get(["webcam", "stream"])),
|
||||
enableTemperatureGraph=settings().get(["feature", "temperatureGraph"]),
|
||||
enableAccessControl=enable_accesscontrol,
|
||||
accessControlActive=accesscontrol_active,
|
||||
|
||||
@@ -209,6 +209,8 @@ default_settings = {
|
||||
}
|
||||
},
|
||||
"webcam": {
|
||||
"webcamEnabled": True,
|
||||
"timelapseEnabled": True,
|
||||
"stream": None,
|
||||
"streamRatio": "16:9",
|
||||
"streamTimeout": 5,
|
||||
|
||||
@@ -117,6 +117,8 @@ $(function() {
|
||||
|
||||
self.printer_defaultExtrusionLength = ko.observable(undefined);
|
||||
|
||||
self.webcam_webcamEnabled = ko.observable(undefined);
|
||||
self.webcam_timelapseEnabled = ko.observable(undefined);
|
||||
self.webcam_streamUrl = ko.observable(undefined);
|
||||
self.webcam_streamRatio = ko.observable(undefined);
|
||||
self.webcam_streamTimeout = ko.observable(undefined);
|
||||
|
||||
@@ -3,6 +3,7 @@ $(function() {
|
||||
var self = this;
|
||||
|
||||
self.loginState = parameters[0];
|
||||
self.settings = parameters[1];
|
||||
|
||||
self.timelapsePopup = undefined;
|
||||
|
||||
@@ -523,7 +524,7 @@ $(function() {
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: TimelapseViewModel,
|
||||
dependencies: ["loginStateViewModel"],
|
||||
dependencies: ["loginStateViewModel", "settingsViewModel"],
|
||||
elements: ["#timelapse"]
|
||||
});
|
||||
});
|
||||
@@ -1,6 +1,7 @@
|
||||
<h3>{{ _('Webcam') }}</h3>
|
||||
|
||||
<form class="form-horizontal">
|
||||
{% include "snippets/settings/webcam/webcamEnabled.jinja2" %}
|
||||
{% include "snippets/settings/webcam/webcamStreamUrl.jinja2" %}
|
||||
{% include "snippets/settings/webcam/webcamStreamRatio.jinja2" %}
|
||||
{% include "snippets/settings/webcam/webcamOrientation.jinja2" %}
|
||||
@@ -16,6 +17,7 @@
|
||||
<h3>{{ _('Timelapse Recordings') }}</h3>
|
||||
|
||||
<form class="form-horizontal">
|
||||
{% include "snippets/settings/webcam/timelapseEnabled.jinja2" %}
|
||||
{% include "snippets/settings/webcam/webcamSnapshotUrl.jinja2" %}
|
||||
{% include "snippets/settings/webcam/ffmpegPath.jinja2" %}
|
||||
{% include "snippets/settings/webcam/watermark.jinja2" %}
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
<!-- ko if: userString -->
|
||||
<span title="{{ _('User who selected this file for printing') }}">{{ _('User') }}</span>: <strong data-bind="text: userString"></strong><br>
|
||||
<!-- /ko -->
|
||||
<!-- ko if: settings.webcam_timelapseEnabled -->
|
||||
<span title="{{ _('Current timelapse configuration') }}">{{ _('Timelapse') }}</span>: <strong data-bind="text: timelapseString"></strong><br>
|
||||
<!-- /ko -->
|
||||
<!-- ko foreach: filament -->
|
||||
<span data-bind="text: 'Filament (' + name() + '): ', title: 'Filament usage for ' + name()"></span><strong data-bind="text: formatFilament(data())"></strong><br>
|
||||
<!-- /ko -->
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: webcam_timelapseEnabled" id="settings-webcamTimelapseEnabled"> {{ _('Enable timelapse support') }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,7 @@
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: webcam_webcamEnabled" id="settings-webcamWebcamEnabled"> {{ _('Enable webcam support') }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,4 +1,4 @@
|
||||
{% if webcamStream %}
|
||||
{% if enableWebcam %}
|
||||
<div id="webcam_container" tabindex="0" data-bind="event: { keydown: onKeyDown, mouseover: onMouseOver, mouseout: onMouseOut, focus: onFocus }">
|
||||
<div class="nowebcam" data-bind="visible: !webcamLoaded()">
|
||||
<div class="text webcam_loading" data-bind="visible: !webcamLoaded() && !webcamError()">
|
||||
@@ -7,7 +7,7 @@
|
||||
<div class="text webcam_error" data-bind="visible: !webcamLoaded() && webcamError()">
|
||||
<p><strong>{{ _('Webcam stream not loaded') }}</strong></p>
|
||||
<p data-bind="visible: !loginState.isAdmin()"><small>{{ _('It might not be configured correctly or require authentication. To have this fixed, get in touch with an administrator of this OctoPrint instance.') }}</small></p>
|
||||
<p data-bind="visible: loginState.isAdmin"><small>{{ _('It might not be configured correctly or require authentication. You can change the URL of the stream under "Settings" > "Webcam & Timelapse" > "Stream URL". If you don\'t have a webcam just set the URL to an empty value.') }}</small></p>
|
||||
<p data-bind="visible: loginState.isAdmin"><small>{{ _('It might not be configured correctly or require authentication. You can change the URL of the stream under "Settings" > "Webcam & Timelapse" > "Webcam" > "Stream URL". If you don\'t have a webcam you can also just disable webcam support there.') }}</small></p>
|
||||
<p data-bind="visible: loginState.isUser"><small>{{ _('Currently configured stream URL') }}: <a target="_blank" rel="noreferrer" data-bind="attr: {href: settings.webcam_streamUrl}, text: settings.webcam_streamUrl"></a></small></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,93 +1,104 @@
|
||||
<div style="display: none;" data-bind="visible: loginState.isUser">
|
||||
<div class="alert" data-bind="visible: isPrinting()">
|
||||
{{ _('Take note that timelapse configuration is disabled while your printer is printing.') }}
|
||||
<div style="display: none;" data-bind="visible: settings.webcam_snapshotUrl() && settings.webcam_ffmpegPath()">
|
||||
<div class="alert" data-bind="visible: isPrinting()">
|
||||
{{ _('Take note that timelapse configuration is disabled while your printer is printing.') }}
|
||||
</div>
|
||||
|
||||
<h1>{{ _('Timelapse Configuration') }}</h1>
|
||||
|
||||
<form class="form-horizontal">
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="webcam_timelapse_mode">{{ _('Timelapse Mode') }}</label>
|
||||
<div class="controls">
|
||||
<select id="webcam_timelapse_mode" data-bind="value: timelapseType, enable: !isPrinting() && loginState.isUser()">
|
||||
<option value="off">{{ _('Off') }}</option>
|
||||
<option value="timed">{{ _('Timed') }}</option>
|
||||
<option value="zchange">{{ _('On Z Change') }}</option>
|
||||
</select>
|
||||
<span class="help-block" data-bind="visible: timelapseType() == 'zchange'"><span class="label label-info">{{ _('Note') }}</span> {% trans %}Does not work when printing from the printer's SD Card (no way to detect the change in Z reliably). Use "Timed" mode for those prints instead.{% endtrans %}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="webcam_timelapse_mindelay" class="control-group" data-bind="visible: timelapseType() == 'zchange'">
|
||||
<label class="control-label" for="webcam_timelapse_minDelay">{{ _('Minimum interval') }}</label>
|
||||
<div class="controls">
|
||||
<div class="input-append">
|
||||
<input type="number" min="1" class="input-mini" id="webcam_timelapse_minDelay" data-bind="value: timelapseMinDelay, valueUpdate: 'afterkeydown', enable: !isPrinting() && loginState.isUser()">
|
||||
<span class="add-on">{{ _('sec') }}</span>
|
||||
</div>
|
||||
<span class="help-block">{{ _('OctoPrint will rate limit snapshots to this minimum interval. This it to prevent against performance issues with vase mode/continous z prints.') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="webcam_timelapse_timedsettings" class="control-group" data-bind="visible: intervalInputEnabled">
|
||||
<label class="control-label" for="webcam_timelapse_interval">{{ _('Snapshot interval') }}</label>
|
||||
<div class="controls">
|
||||
<div class="input-append">
|
||||
<input type="number" min="1" class="input-mini" id="webcam_timelapse_interval" data-bind="value: timelapseTimedInterval, valueUpdate: 'afterkeydown', enable: !isPrinting() && loginState.isUser()">
|
||||
<span class="add-on">{{ _('sec') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="webcam_timelapse_fps">{{ _('Timelapse frame rate') }}</label>
|
||||
<div class="controls">
|
||||
<div class="input-append">
|
||||
<input type="number" min="1" class="input-mini" id="webcam_timelapse_fps" data-bind="value: timelapseFps, valueUpdate: 'afterkeydown', enable: !isPrinting() && loginState.isUser() && timelapseTypeSelected()">
|
||||
<span class="add-on">{{ _('fps') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="webcam_timelapse_postRoll">{{ _('Timelapse post roll') }}</label>
|
||||
<div class="controls">
|
||||
<div class="input-append">
|
||||
<input type="number" min="0" class="input-mini" id="webcam_timelapse_postRoll" data-bind="value: timelapsePostRoll, valueUpdate: 'afterkeydown', enable: !isPrinting() && loginState.isUser() && timelapseTypeSelected()">
|
||||
<span class="add-on">{{ _('sec') }}</span>
|
||||
</div>
|
||||
<span class="help-block">{{ _('OctoPrint will use the final picture to add this many seconds to the end of your rendered timelapse.') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="webcam_timelapse_retractionsettings" class="control-group" data-bind="visible: timelapseType() == 'zchange'">
|
||||
<label class="control-label" for="webcam_timelapse_retractionZHop">{{ _('Retraction Z-Hop') }}</label>
|
||||
<div class="controls">
|
||||
<div class="input-append">
|
||||
<input type="number" min="0.0" class="input-mini" id="webcam_timelapse_retractionZHop" data-bind="value: timelapseRetractionZHop, valueUpdate: 'afterkeydown', enable: !isPrinting() && loginState.isUser()">
|
||||
<span class="add-on">{{ _('mm') }}</span>
|
||||
</div>
|
||||
<span class="help-block">{{ _('Enter the retraction z-hop used in the firmware or the gcode file to trigger snapshots for the timelapse only if a real layer change happens. For this to work properly your retraction z-hop has to be different from your layerheight!') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group" data-bind="visible: loginState.isAdmin">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: persist, enable: isOperational() && !isPrinting() && loginState.isUser()"> {{ _('Save as default') }}
|
||||
<span class="help-block">{{ _('Check this to make your selected timelapse mode and options persist across restarts.') }}</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<strong class="text-center text-block" data-bind="visible: saveButtonEnabled">{{ _('You have unsaved changes. Don\'t forget to save them.') }}</strong>
|
||||
<button class="btn btn-primary btn-block" data-bind="click: save, enable: saveButtonEnabled">{{ _('Save changes') }}</button>
|
||||
<button class="btn btn-block" data-bind="click: reset, enable: resetButtonEnabled">{{ _('Reset to active configuration') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="alert" style="display: none" data-bind="visible: !settings.webcam_snapshotUrl() || !settings.webcam_ffmpegPath()">
|
||||
<p><strong>{{ _('Timelapse not fully configured') }}</strong></p>
|
||||
<p data-bind="visible: !loginState.isAdmin()">{{ _('The snapshot URL and/or the path to FFMPEG are missing. To have this fixed, get in touch with an administrator of this OctoPrint instance.') }}</p>
|
||||
<p data-bind="visible: loginState.isAdmin">{{ _('The snapshot URL and/or the path to FFMPEG are missing. You can change both under "Settings" > "Webcam & Timelapse" > "Timelapse". If you don\'t have a webcam or don\'t want to enable timelapse support you can also just disable it there.') }}</p>
|
||||
<p data-bind="visible: loginState.isUser"><small>
|
||||
{{ _('Currently configured snapshot URL') }}: <span data-bind="text: settings.webcam_snapshotUrl"></span><br/>
|
||||
{{ _('Currently configured path to FFMPEG') }}: <span data-bind="text: settings.webcam_ffmpegPath"></span>
|
||||
</small></p>
|
||||
</div>
|
||||
|
||||
<h1>{{ _('Timelapse Configuration') }}</h1>
|
||||
|
||||
<form class="form-horizontal">
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="webcam_timelapse_mode">{{ _('Timelapse Mode') }}</label>
|
||||
<div class="controls">
|
||||
<select id="webcam_timelapse_mode" data-bind="value: timelapseType, enable: !isPrinting() && loginState.isUser()">
|
||||
<option value="off">{{ _('Off') }}</option>
|
||||
<option value="timed">{{ _('Timed') }}</option>
|
||||
<option value="zchange">{{ _('On Z Change') }}</option>
|
||||
</select>
|
||||
<span class="help-block" data-bind="visible: timelapseType() == 'zchange'"><span class="label label-info">{{ _('Note') }}</span> {% trans %}Does not work when printing from the printer's SD Card (no way to detect the change in Z reliably). Use "Timed" mode for those prints instead.{% endtrans %}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="webcam_timelapse_mindelay" class="control-group" data-bind="visible: timelapseType() == 'zchange'">
|
||||
<label class="control-label" for="webcam_timelapse_minDelay">{{ _('Minimum interval') }}</label>
|
||||
<div class="controls">
|
||||
<div class="input-append">
|
||||
<input type="number" min="1" class="input-mini" id="webcam_timelapse_minDelay" data-bind="value: timelapseMinDelay, valueUpdate: 'afterkeydown', enable: !isPrinting() && loginState.isUser()">
|
||||
<span class="add-on">{{ _('sec') }}</span>
|
||||
</div>
|
||||
<span class="help-block">{{ _('OctoPrint will rate limit snapshots to this minimum interval. This it to prevent against performance issues with vase mode/continous z prints.') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="webcam_timelapse_timedsettings" class="control-group" data-bind="visible: intervalInputEnabled">
|
||||
<label class="control-label" for="webcam_timelapse_interval">{{ _('Snapshot interval') }}</label>
|
||||
<div class="controls">
|
||||
<div class="input-append">
|
||||
<input type="number" min="1" class="input-mini" id="webcam_timelapse_interval" data-bind="value: timelapseTimedInterval, valueUpdate: 'afterkeydown', enable: !isPrinting() && loginState.isUser()">
|
||||
<span class="add-on">{{ _('sec') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="webcam_timelapse_fps">{{ _('Timelapse frame rate') }}</label>
|
||||
<div class="controls">
|
||||
<div class="input-append">
|
||||
<input type="number" min="1" class="input-mini" id="webcam_timelapse_fps" data-bind="value: timelapseFps, valueUpdate: 'afterkeydown', enable: !isPrinting() && loginState.isUser() && timelapseTypeSelected()">
|
||||
<span class="add-on">{{ _('fps') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="webcam_timelapse_postRoll">{{ _('Timelapse post roll') }}</label>
|
||||
<div class="controls">
|
||||
<div class="input-append">
|
||||
<input type="number" min="0" class="input-mini" id="webcam_timelapse_postRoll" data-bind="value: timelapsePostRoll, valueUpdate: 'afterkeydown', enable: !isPrinting() && loginState.isUser() && timelapseTypeSelected()">
|
||||
<span class="add-on">{{ _('sec') }}</span>
|
||||
</div>
|
||||
<span class="help-block">{{ _('OctoPrint will use the final picture to add this many seconds to the end of your rendered timelapse.') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="webcam_timelapse_retractionsettings" class="control-group" data-bind="visible: timelapseType() == 'zchange'">
|
||||
<label class="control-label" for="webcam_timelapse_retractionZHop">{{ _('Retraction Z-Hop') }}</label>
|
||||
<div class="controls">
|
||||
<div class="input-append">
|
||||
<input type="number" min="0.0" class="input-mini" id="webcam_timelapse_retractionZHop" data-bind="value: timelapseRetractionZHop, valueUpdate: 'afterkeydown', enable: !isPrinting() && loginState.isUser()">
|
||||
<span class="add-on">{{ _('mm') }}</span>
|
||||
</div>
|
||||
<span class="help-block">{{ _('Enter the retraction z-hop used in the firmware or the gcode file to trigger snapshots for the timelapse only if a real layer change happens. For this to work properly your retraction z-hop has to be different from your layerheight!') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group" data-bind="visible: loginState.isAdmin">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: persist, enable: isOperational() && !isPrinting() && loginState.isUser()"> {{ _('Save as default') }}
|
||||
<span class="help-block">{{ _('Check this to make your selected timelapse mode and options persist across restarts.') }}</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<strong class="text-center text-block" data-bind="visible: saveButtonEnabled">{{ _('You have unsaved changes. Don\'t forget to save them.') }}</strong>
|
||||
<button class="btn btn-primary btn-block" data-bind="click: save, enable: saveButtonEnabled">{{ _('Save changes') }}</button>
|
||||
<button class="btn btn-block" data-bind="click: reset, enable: resetButtonEnabled">{{ _('Reset to active configuration') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<h1>{{ _('Finished Timelapses') }}</h1>
|
||||
|
||||
@@ -316,24 +316,16 @@ def configure_timelapse(config=None, persist=False):
|
||||
|
||||
snapshot_url = settings().get(["webcam", "snapshot"])
|
||||
ffmpeg_path = settings().get(["webcam", "ffmpeg"])
|
||||
timelapse_enabled = settings().getBoolean(["webcam", "timelapseEnabled"])
|
||||
timelapse_precondition = snapshot_url is not None and snapshot_url.strip() != "" \
|
||||
and ffmpeg_path is not None and ffmpeg_path.strip() != ""
|
||||
|
||||
type = config["type"]
|
||||
if not timelapse_precondition and type is not None and type != "off":
|
||||
if not timelapse_precondition and timelapse_precondition:
|
||||
logging.getLogger(__name__).warn("Essential timelapse settings unconfigured (snapshot URL or FFMPEG path) "
|
||||
"but timelapse enabled, forcing disabled timelapse and disabling it "
|
||||
"in the config as well.")
|
||||
type = "off"
|
||||
config["type"] = "off"
|
||||
"but timelapse enabled.")
|
||||
|
||||
if not persist:
|
||||
# make sure we persist at least that timelapse is now disabled by default - we don't want the above
|
||||
# warning to log
|
||||
settings().set(["webcam", "timelapse", "type"], "off")
|
||||
settings().save()
|
||||
|
||||
if type is None or "off" == type:
|
||||
if not timelapse_enabled or not timelapse_precondition or type is None or "off" == type:
|
||||
current = None
|
||||
|
||||
else:
|
||||
|
||||
Reference in new issue
Block a user