Compare commits

...
20 Commits
Author SHA1 Message Date
Gina Häußge 777c02135e Fixed a copy paste error in the changelog 2017-12-12 12:42:40 +01:00
Gina Häußge 793bb714eb Preparing release of 1.3.6 2017-12-12 10:36:33 +01:00
Gina Häußge 8229842334 Revert "Some long overdue == vs === view model cleanup"
This reverts commit 8a977e8777.

Was causing at least one regression, to be redone for 1.3.7
2017-12-12 10:09:27 +01:00
Gina Häußge 38a711ac56 staging is now 1.3.6rc4 2017-12-08 16:21:05 +01:00
Gina Häußge a8747f7e36 Fix a bug with release vs dev version detection 2017-12-08 15:09:58 +01:00
Gina Häußge 17e6f5d508 Preparing release of 1.3.6rc3 2017-12-07 17:40:04 +01:00
Gina Häußge 133a4658ee Switch to https for (plugins.)octoprint.org
Also add utm tags to the two support-octoprint links so we have a chance
to see if anyone ever actually clicks on those.
2017-12-07 16:35:01 +01:00
Gina Häußge 0a2e2ed297 Don't write default update type & method to config
If we set method to pip in 1.3.6 and then roll back to 1.3.5 we will
need to a manual config.yaml update otherwise or we will no longer be
able to update.

Be removing the force parameter and using the actual default settings
instead of current ones, we don't do that anymore.
2017-12-07 11:15:43 +01:00
Gina Häußge 6b41dbc12b staging is 1.3.6rc3.dev 2017-12-05 16:00:58 +01:00
Gina Häußge 3f4a70cf92 Prepare release of 1.3.6rc2 2017-12-05 12:34:55 +01:00
Gina Häußge 41eb9481b3 Fix offset values on API after setting one offset
Make sure to set the actual effective offsets as provided by the comm
layer (which merges incoming single offset adjustments) instead of only
setting the input, effectively nuking return of offsets set prior.

Closes #2268
2017-12-05 12:17:48 +01:00
Gina Häußge 743d590d52 model might not be set yet
So don't try to read its length right away.

Closes #2267
2017-12-05 10:54:33 +01:00
Gina Häußge 900e8a2aaf Docs: Fixed a typo 2017-12-05 10:40:20 +01:00
Gina Häußge 06816fb8dc Test: checksum missing => missing checksum 2017-12-04 16:04:38 +01:00
Gina Häußge cc0a17f2ac Unit tests for MachineCom._handle_errors
With various Marlin and Repetier error variants.
2017-12-04 15:56:31 +01:00
Gina Häußge 9b1b4420a3 Make error messages in virtual printer configurable
We want to be able to test various firmware variants for stuff like
checksum and line number mismatches...

See also #2262
2017-12-04 11:47:29 +01:00
Gina Häußge 263925625b resend_request_communication_errors was too narrow
Didn't match Marlin's "checksum mismatch", only Repetier's "checksum
error". Since the error handler checks against
recoverable_communication_errors before
resend_request_communication_errors, we can just switch back to the more
broader check against "checksum" for the latter.

We could also have added an explicit check for "checksum mismatch"
instead but since we used to check for "checksum" and we don't know what
other varieties for this specific error might be out there in the
thousands of firmware variants (who needs consistency when they can
have a free for all?), we'll err on the side of caution instead.

Fixes #2262
2017-12-04 11:10:06 +01:00
Gina Häußge f72dfb48e1 Fix ordering of plugin assets
Should be alphabetical per their identifier. As noticed by @BillyBlaze
2017-12-01 18:16:44 +01:00
Gina Häußge e064400900 Link to blacklist in wizard & settings
As suggested by @Kunsi in #2256
2017-12-01 17:47:16 +01:00
Gina Häußge 107954021b staging is 1.3.6rc2.dev 2017-12-01 16:05:06 +01:00
45 changed files with 1769 additions and 3709 deletions

No files matched your search

+3 -3
View File
@@ -22,10 +22,10 @@ maintenance 1.3.6 1a6dbb3f4a5bef857cdeb13c031b9deca2cf30a2 pep440-dev
fix/.* 1.3.6 1a6dbb3f4a5bef857cdeb13c031b9deca2cf30a2 pep440-dev
improve/.* 1.3.6 1a6dbb3f4a5bef857cdeb13c031b9deca2cf30a2 pep440-dev
# staging/maintenance is currently the branch for preparation of 1.3.6rc1
# staging/maintenance is currently the branch for preparation of 1.3.6rc4
# so is regressionfix/...
staging/maintenance 1.3.6rc1 77753ca02602d3a798d6b0a22535e6fd69ff448a pep440-dev
regressionfix/.* 1.3.6rc1 77753ca02602d3a798d6b0a22535e6fd69ff448a pep440-dev
staging/maintenance 1.3.6rc4 a8747f7e36a03ff2449b62cdf68b8a26a6fa61b3 pep440-dev
regressionfix/.* 1.3.6rc4 a8747f7e36a03ff2449b62cdf68b8a26a6fa61b3 pep440-dev
# every other branch is a development branch and thus gets resolved to 1.4.0-dev for now
.* 1.4.0 7f5d03d0549bcbd26f40e7e4a3297ea5204fb1cc pep440-dev
+17 -3
View File
@@ -1,6 +1,6 @@
# OctoPrint Changelog
## 1.3.6rc1 (2017-12-01)
## 1.3.6 (2017-12-12)
### Note for upgraders and plugin authors: Change in the bundling of JS assets can lead to issues in plugins
@@ -8,7 +8,7 @@ A change to solve issues with plugins bundling JS assets that cause interference
If you happen to run into any such issues, you can switch back to the old way of bundling JS assets via the newly introduced "Settings > Feature > Enable legacy plugin asset bundling" toggle (check it, save the settings, restart the server). This is provided to allow for a minimally invasive adjustment period until affected plugins have been updated.
You can find out more about the change, how to know if a plugin is even affected and what do about it [on the OctoBlog](http://octoprint.org/blog/2017/12/01/heads-up-plugin-authors/).
You can find out more about the change, how to know if a plugin is even affected and what do about it [on the OctoBlog](https://octoprint.org/blog/2017/12/01/heads-up-plugin-authors/).
### Improvements
@@ -67,6 +67,7 @@ You can find out more about the change, how to know if a plugin is even affected
* Docs: Added information on how to run the test suite.
* Various refactorings
* Various documentation updates
* Fetch plugin blacklist (and also announcements, plugin notices and plugin repository) via https instead of http.
### Bug fixes
@@ -89,6 +90,9 @@ You can find out more about the change, how to know if a plugin is even affected
* [#2226](https://github.com/foosel/OctoPrint/issues/2226) - Handle `No Line Number with checksum, Last Line: ...` errors from the firmware.
* [#2233](https://github.com/foosel/OctoPrint/pull/2233) - Respond with `411 Length Required` when content length is missing on file uploads.
* [#2242](https://github.com/foosel/OctoPrint/issues/2242) - Fixed an issue where print time left could show "1 days" instead of "1 day".
* [#2262](https://github.com/foosel/OctoPrint/issues/2262) (regression) - Fixed a bug causing `Error:checksum mismatch, Last Line: ...` errors from the firmware to be handled incorrectly.
* [#2267](https://github.com/foosel/OctoPrint/issues/2267) (regression) - Fixed a bug causing the GCODE viewer to not get properly initialized due to a JS error on load if "Also show next layer" was selected.
* [#2268](https://github.com/foosel/OctoPrint/issues/2268) (regression) - Fixed a bug causing a display error with the temperature offsets. If one offset was changed, all others seemed to revert back to 0.
* Fixed cleanup of unrendered timelapses with certain names.
* Fixed a caching issue with the file list API and the slicing API.
* Fixed initial sizing of the temperature graph.
@@ -106,8 +110,18 @@ You can find out more about the change, how to know if a plugin is even affected
* Virtual printer: Fix resend simuation.
* Docs: Fixed CSS of line numbered listings.
* Docs: Updated mermaid to fix a deprecation warning.
* Fixed ordering of plugin assets, should be alphabetical based on the plugin identifier. (regression)
* Fixed an issue causing redundant software update configuration settings to be written to `config.yaml`, in turn causing issues when downgrading to <1.3.5. (regression)
* Fixed an issue detecting whether the installed version is a release version or a development version. (regression)
([Commits](https://github.com/foosel/OctoPrint/compare/1.3.5...1.3.6rc1))
### More Information
* [Commits](https://github.com/foosel/OctoPrint/compare/1.3.5...1.3.6)
* Release Candidates:
* [1.3.6rc1](https://github.com/foosel/OctoPrint/releases/tag/1.3.6rc1)
* [1.3.6rc2](https://github.com/foosel/OctoPrint/releases/tag/1.3.6rc2)
* [1.3.6rc3](https://github.com/foosel/OctoPrint/releases/tag/1.3.6rc3)
* A special **Thank you!** to everyone who reported back on these release candidates this time: [andrivet](https://github.com/andrivet), [b-morgan](https://github.com/b-morgan), [bjarchi](https://github.com/bjarchi), [chippypilot](https://github.com/chippypilot), [ChrisHeerschap](https://github.com/ChrisHeerschap), [cosmith71](https://github.com/cosmith71), [Crowlord](https://github.com/Crowlord), [ctgreybeard](https://github.com/ctgreybeard), [fiveangle](https://github.com/fiveangle), [goeland86](https://github.com/goeland86), [jbjones27](https://github.com/jbjones27), [jneilliii](https://github.com/jneilliii), [JohnOCFII](https://github.com/JohnOCFII), [Kunsi](https://github.com/Kunsi), [Lordxv](https://github.com/Lordxv), [malnvenshorn](https://github.com/malnvenshorn), [mcp5500](https://github.com/mcp5500), [ntoff](https://github.com/ntoff), [ripp2003](https://github.com/ripp2003) and [schorsch3000](https://github.com/schorsch3000)
## 1.3.5 (2017-10-16)
+5 -5
View File
@@ -5,14 +5,14 @@
OctoPrint provides a snappy web interface for controlling consumer 3D printers. It is Free Software
and released under the [GNU Affero General Public License V3](http://www.gnu.org/licenses/agpl.html).
Its website can be found at [octoprint.org](http://octoprint.org).
Its website can be found at [octoprint.org](https://octoprint.org/?utm_source=github&utm_medium=readme).
The documentation is located at [docs.octoprint.org](http://docs.octoprint.org).
The official plugin repository can be reached at [plugins.octoprint.org](http://plugins.octoprint.org).
The official plugin repository can be reached at [plugins.octoprint.org](https://plugins.octoprint.org/?utm_source=github&utm_medium=readme).
OctoPrint's development wouldn't be possible without the [financial support by its community](http://octoprint.org/support-octoprint/).
If you enjoy OctoPrint, please consider becoming a regular supporter!
**OctoPrint's development wouldn't be possible without the [financial support by its community](https://octoprint.org/support-octoprint/?utm_source=github&utm_medium=readme).
If you enjoy OctoPrint, please consider becoming a regular supporter!**
![Screenshot](http://i.imgur.com/dF3noFp.png)
@@ -29,7 +29,7 @@ Contributions of all kinds are welcome, not only in the form of code but also wi
[official documentation](http://docs.octoprint.org/) or [the public wiki](https://github.com/foosel/OctoPrint/wiki), support
of other users in the [bug tracker](https://github.com/foosel/OctoPrint/issues),
[the Mailinglist](https://groups.google.com/group/octoprint) or
[the G+ Community](https://plus.google.com/communities/102771308349328485741) and also [financially](http://octoprint.org/support-octoprint/).
[the G+ Community](https://plus.google.com/communities/102771308349328485741) and also [financially](https://octoprint.org/support-octoprint/?utm_source=github&utm_medium=readme).
If you think something is bad about OctoPrint or its documentation the way it is, please help
in any way to make it better instead of just complaining about it -- this is an Open Source Project
+2 -5
View File
@@ -36,19 +36,16 @@ thanks to everyone who contributed!
* Kazuhiro Ogura
* Makespace Madrid
* Marcus Ackermann
* Mark Qvist
* Mark Walker
* Masayoshi Mitsui
* Michael Aumock
* Miles Flavel
* mitchell hirsch
* Mohammed khorakiwala
* Noe Ruiz
* Patrick McGinnis
* Peter Grace
* Peter Schmehl
* PRINT3Dforum.com
* Robert Gusek
* Randy C. Will
* Roger Strolz
* Roy Cortes
* Samer Najia
@@ -61,4 +58,4 @@ thanks to everyone who contributed!
* Timeshell.ca
* Trent Shumay
and 1151 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)!
and 1062 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)!
+1 -1
View File
@@ -146,7 +146,7 @@ Out of the box, OctoPrint defaults to the following script setup for ``afterPrin
;disable all heaters
{% snippet 'disable_hotends' %}
[% snippet 'disable_bed' %}
{% snippet 'disable_bed' %}
;disable fan
M106 S0
+1 -1
View File
@@ -63,7 +63,7 @@ EXTRA_REQUIRES = dict(
# Dependencies for developing OctoPrint
develop=[
# Testing dependencies
"mock>=1.0.1,<1.1",
"mock>=2.0.0,<3",
"nose>=1.3.0,<1.4",
"ddt",
@@ -60,27 +60,27 @@ class AnnouncementPlugin(octoprint.plugin.AssetPlugin,
description="Important announcements about OctoPrint.",
priority=1,
type="rss",
url="http://octoprint.org/feeds/important.xml"),
url="https://octoprint.org/feeds/important.xml"),
_releases=dict(name="Release Announcements",
description="Announcements of new releases and release candidates of OctoPrint.",
priority=2,
type="rss",
url="http://octoprint.org/feeds/releases.xml"),
url="https://octoprint.org/feeds/releases.xml"),
_blog=dict(name="On the OctoBlog",
description="Development news, community spotlights, OctoPrint On Air episodes and more from the official OctoBlog.",
priority=2,
type="rss",
url="http://octoprint.org/feeds/octoblog.xml"),
url="https://octoprint.org/feeds/octoblog.xml"),
_plugins=dict(name="New Plugins in the Repository",
description="Announcements of new plugins released on the official Plugin Repository.",
priority=2,
type="rss",
url="http://plugins.octoprint.org/feed.xml"),
url="https://plugins.octoprint.org/feed.xml"),
_octopi=dict(name="OctoPi News",
description="News around OctoPi, the Raspberry Pi image including OctoPrint.",
priority=2,
type="rss",
url="http://octoprint.org/feeds/octopi.xml")),
url="https://octoprint.org/feeds/octopi.xml")),
enabled_channels=[],
forced_channels=["_important"],
channel_order=["_important", "_releases", "_blog", "_plugins", "_octopi"],
@@ -6,6 +6,11 @@
normal operation, allowing you to uninstall or update them to a newer version.
{% endtrans %}</p>
<p>{% trans url="https://plugins.octoprint.org/blacklist/" %}
By default, OctoPrint will use the blacklist hosted at <code>plugins.octoprint.org/blacklist.json</code> which you
can also take a look at in a more human readable format <a href="{{ url }}" target="_blank">here</a>.
{% endtrans %}</p>
<p>{% trans %}
Please decide whether to allow fetch and use of this centralized blacklist starting with the next server start.
You may also change your decision at any time through Settings > Server right from within OctoPrint.
@@ -5,7 +5,7 @@
<p>Version <span class="plugin_octopi_support_version">{{ plugin_octopi_support_version }}</span></p>
<ul>
<li>Website: <a href="http://octoprint.org/download/" target="_blank" rel="noreferrer noopener">octoprint.org/download</a> &amp; <a href="https://octopi.octoprint.org" target="_blank" rel="noreferrer noopener">octopi.octoprint.org</a></li>
<li>Website: <a href="https://octoprint.org/download/" target="_blank" rel="noreferrer noopener">octoprint.org/download</a> &amp; <a href="https://octopi.octoprint.org" target="_blank" rel="noreferrer noopener">octopi.octoprint.org</a></li>
<li>Source Code: <a href="https://github.com/guysoft/OctoPi" target="_blank" rel="noreferrer noopener">github.com/guysoft/OctoPi</a></li>
</ul>
@@ -117,9 +117,9 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
def get_settings_defaults(self):
return dict(
repository="http://plugins.octoprint.org/plugins.json",
repository="https://plugins.octoprint.org/plugins.json",
repository_ttl=24*60,
notices="http://plugins.octoprint.org/notices.json",
notices="https://plugins.octoprint.org/notices.json",
notices_ttl=6*60,
pip_args=None,
pip_force_user=False,
@@ -196,8 +196,8 @@ $(function() {
return;
}
var restartSpec = _.filter(lastResponse.core, function(spec) { return spec.action === "restart" });
self.restartCommandSpec = restartSpec !== undefined && restartSpec.length > 0 ? restartSpec[0] : undefined;
var restartSpec = _.filter(lastResponse.core, function(spec) { return spec.action == "restart" });
self.restartCommandSpec = restartSpec != undefined && restartSpec.length > 0 ? restartSpec[0] : undefined;
});
self.notifications = [];
@@ -207,9 +207,9 @@ $(function() {
self.noticeCountText = ko.pureComputed(function() {
var count = self.noticeCount();
if (count === 0) {
if (count == 0) {
return gettext("There are no plugin notices. Great!");
} else if (count === 1) {
} else if (count == 1) {
return gettext("There is a plugin notice for one of your installed plugins.");
} else {
return _.sprintf(gettext("There are %(count)d plugin notices for one or more of your installed plugins."), {count: count});
@@ -224,15 +224,15 @@ $(function() {
var command = self._getToggleCommand(data);
var not_safemode_victim = !data.safe_mode_victim || data.safe_mode_enabled;
var not_blacklisted = !data.blacklisted;
return self.enableManagement() && (command === "disable" || (not_safemode_victim && not_blacklisted)) && data.key !== 'pluginmanager';
return self.enableManagement() && (command == "disable" || (not_safemode_victim && not_blacklisted)) && data.key != 'pluginmanager';
};
self.enableUninstall = function(data) {
return self.enableManagement()
&& (data.origin !== "entry_point" || self.pipAvailable())
&& (data.origin != "entry_point" || self.pipAvailable())
&& data.managable
&& !data.bundled
&& data.key !== 'pluginmanager'
&& data.key != 'pluginmanager'
&& !data.pending_uninstall;
};
@@ -299,7 +299,7 @@ $(function() {
maxNumberOfFiles: 1,
autoUpload: false,
add: function(e, data) {
if (data.files.length === 0) {
if (data.files.length == 0) {
return false;
}
@@ -341,7 +341,7 @@ $(function() {
self.performRepositorySearch = function() {
var query = self.repositorySearchQuery();
if (query !== undefined && query.trim() !== "") {
if (query !== undefined && query.trim() != "") {
query = query.toLocaleLowerCase();
self.repositoryplugins.changeSearchFunction(function(entry) {
return entry && (entry["title"].toLocaleLowerCase().indexOf(query) > -1 || entry["description"].toLocaleLowerCase().indexOf(query) > -1);
@@ -447,7 +447,7 @@ $(function() {
return;
}
if (data.key === "pluginmanager") return;
if (data.key == "pluginmanager") return;
var onSuccess = function() {
self.requestData();
@@ -461,7 +461,7 @@ $(function() {
})
};
if (self._getToggleCommand(data) === "enable") {
if (self._getToggleCommand(data) == "enable") {
if (data.safe_mode_victim && !data.safe_mode_enabled) return;
OctoPrint.plugins.pluginmanager.enable(data.key)
.done(onSuccess)
@@ -582,7 +582,7 @@ $(function() {
}
if (data.bundled) return;
if (data.key === "pluginmanager") return;
if (data.key == "pluginmanager") return;
self._markWorking(gettext("Uninstalling plugin..."), _.sprintf(gettext("Uninstalling plugin \"%(name)s\""), {name: data.name}));
@@ -633,7 +633,7 @@ $(function() {
self.savePluginSettings = function() {
var repository = self.config_repositoryUrl();
if (repository !== undefined && repository.trim() === "") {
if (repository != undefined && repository.trim() == "") {
repository = null;
}
@@ -645,7 +645,7 @@ $(function() {
}
var notices = self.config_noticesUrl();
if (notices !== undefined && notices.trim() === "") {
if (notices != undefined && notices.trim() == "") {
notices = null;
}
@@ -657,7 +657,7 @@ $(function() {
}
var pipArgs = self.config_pipAdditionalArgs();
if (pipArgs !== undefined && pipArgs.trim() === "") {
if (pipArgs != undefined && pipArgs.trim() == "") {
pipArgs = null;
}
@@ -709,7 +709,7 @@ $(function() {
};
if (response.result) {
if (action === "install" && response.plugin && response.plugin.blacklisted) {
if (action == "install" && response.plugin && response.plugin.blacklisted) {
notification = new PNotify({
title: titleSuccess,
text: textSuccess,
@@ -862,7 +862,7 @@ $(function() {
};
self.toggleButtonCss = function(data) {
var icon = self._getToggleCommand(data) === "enable" ? "fa fa-toggle-off" : "fa fa-toggle-on";
var icon = self._getToggleCommand(data) == "enable" ? "fa fa-toggle-off" : "fa fa-toggle-on";
var disabled = (self.enableToggle(data)) ? "" : " disabled";
return icon + disabled;
@@ -870,7 +870,7 @@ $(function() {
self.toggleButtonTitle = function(data) {
var command = self._getToggleCommand(data);
if (command === "enable") {
if (command == "enable") {
if (data.blacklisted) {
return gettext("Blacklisted");
} else if (data.safe_mode_victim && !data.safe_mode_enabled) {
@@ -884,7 +884,7 @@ $(function() {
};
self.showPluginNotifications = function(plugin) {
if (!plugin.notifications || plugin.notifications.length === 0) return;
if (!plugin.notifications || plugin.notifications.length == 0) return;
self._removeAllNoticeNotificationsForPlugin(plugin.key);
_.each(plugin.notifications, function(notification) {
@@ -893,7 +893,7 @@ $(function() {
};
self.showPluginNotificationsLinkText = function(plugins) {
if (!plugins.notifications || plugins.notifications.length === 0) return;
if (!plugins.notifications || plugins.notifications.length == 0) return;
var count = plugins.notifications.length;
var importantCount = _.filter(plugins.notifications, function(notification) { return notification.important }).length;
@@ -929,7 +929,7 @@ $(function() {
var text = "";
if (notification.versions && notification.versions.length > 0) {
var versions = _.map(notification.versions, function(v) { return (v === version) ? "<strong>" + v + "</strong>" : v; }).join(", ");
var versions = _.map(notification.versions, function(v) { return (v == version) ? "<strong>" + v + "</strong>" : v; }).join(", ");
text += "<small>" + _.sprintf(gettext("Affected versions: %(versions)s"), {versions: versions}) + "</small>";
} else {
text += "<small>" + gettext("Affected versions: all") + "</small>";
@@ -1005,7 +1005,7 @@ $(function() {
self._isNoticeNotificationHidden = function(key, date) {
if (!self.hiddenNoticeNotifications[key]) return false;
return _.any(_.map(self.hiddenNoticeNotifications[key], function(d) { return date === d; }));
return _.any(_.map(self.hiddenNoticeNotifications[key], function(d) { return date == d; }));
};
var noticeLocalStorageKey = "plugin.pluginmanager.seen_notices";
@@ -1039,7 +1039,7 @@ $(function() {
if (!Modernizr.localstorage)
return false;
if (localStorage[noticeLocalStorageKey] === undefined)
if (localStorage[noticeLocalStorageKey] == undefined)
return false;
var knownData = JSON.parse(localStorage[noticeLocalStorageKey]);
@@ -1094,7 +1094,7 @@ $(function() {
};
self.onDataUpdaterPluginMessage = function(plugin, data) {
if (plugin !== "pluginmanager") {
if (plugin != "pluginmanager") {
return;
}
@@ -1108,21 +1108,21 @@ $(function() {
var messageType = data.type;
if (messageType === "loglines" && self.working()) {
if (messageType == "loglines" && self.working()) {
_.each(data.loglines, function(line) {
self.loglines.push(self._preprocessLine(line));
});
self._scrollWorkingOutputToEnd();
} else if (messageType === "result") {
} else if (messageType == "result") {
var titleSuccess, textSuccess, textRestart, textReload, textReconnect, titleError, textError;
var action = data.action;
var name = "Unknown";
if (action === "install") {
if (action == "install") {
var unknown = false;
if (data.hasOwnProperty("plugin")) {
if (data.plugin === "unknown") {
if (data.plugin == "unknown") {
unknown = true;
} else {
name = data.plugin.name;
@@ -1172,13 +1172,13 @@ $(function() {
if (data.hasOwnProperty("reason")) {
if (data.was_reinstalled) {
if (sourceType === "path") {
if (sourceType == "path") {
textError = _.sprintf(gettext("Reinstalling the plugin from file failed: %(reason)s"), {reason: data.reason});
} else {
textError = _.sprintf(gettext("Reinstalling the plugin from \"%(source)s\" failed: %(reason)s"), {reason: data.reason, source: source});
}
} else {
if (sourceType === "path") {
if (sourceType == "path") {
textError = _.sprintf(gettext("Installing the plugin from file failed: %(reason)s"), {reason: data.reason});
} else {
textError = _.sprintf(gettext("Installing the plugin from \"%(source)s\" failed: %(reason)s"), {reason: data.reason, source: source});
@@ -1186,13 +1186,13 @@ $(function() {
}
} else {
if (data.was_reinstalled) {
if (sourceType === "path") {
if (sourceType == "path") {
textError = gettext("Reinstalling the plugin from file failed, please see the log for details.");
} else {
textError = _.sprintf(gettext("Reinstalling the plugin from \"%(source)s\" failed, please see the log for details."), {source: source});
}
} else {
if (sourceType === "path") {
if (sourceType == "path") {
textError = gettext("Installing the plugin from file failed, please see the log for details.");
} else {
textError = _.sprintf(gettext("Installing the plugin from \"%(source)s\" failed, please see the log for details."), {source: source});
@@ -1200,7 +1200,7 @@ $(function() {
}
}
} else if (action === "uninstall") {
} else if (action == "uninstall") {
if (data.hasOwnProperty("plugin")) {
name = data.plugin.name;
}
@@ -1218,7 +1218,7 @@ $(function() {
textError = gettext("Uninstalling the plugin failed, please see the log for details.");
}
} else if (action === "enable") {
} else if (action == "enable") {
if (data.hasOwnProperty("plugin")) {
name = data.plugin.name;
}
@@ -1236,7 +1236,7 @@ $(function() {
textError = gettext("Toggling the plugin failed, please see the log for details.");
}
} else if (action === "disable") {
} else if (action == "disable") {
if (data.hasOwnProperty("plugin")) {
name = data.plugin.name;
}
@@ -133,7 +133,7 @@
{{ pluginmanager_safemode() }}
{{ pluginmanager_offline() }}
<h4 style="position: relative">
{{ _('... from the <a href="%(url)s" target="_blank">Plugin Repository</a>', url='http://plugins.octoprint.org') }}
{{ _('... from the <a href="%(url)s" target="_blank">Plugin Repository</a>', url='https://plugins.octoprint.org') }}
<div class="dropdown pull-right">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<span class="fa fa-wrench"></span>
@@ -306,30 +306,10 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
if "notify_users" in data:
self._settings.set_boolean(["notify_users"], data["notify_users"])
checks = self._get_configured_checks()
if "octoprint" in checks:
check = checks["octoprint"]
update_type = check.get("type", None)
update_method = self._get_update_method("octoprint", check)
checkout_folder = check.get("checkout_folder", None)
update_folder = check.get("update_folder", None)
prerelease = check.get("prerelease", False)
prerelease_channel = check.get("prerelease_channel", None)
else:
update_type = update_method = checkout_folder = update_folder = prerelease_channel = None
prerelease = False
defaults = dict(
plugins=dict(softwareupdate=dict(
checks=dict(
octoprint=dict(
type=update_type,
method=update_method,
checkout_folder=checkout_folder,
update_folder=update_folder,
prerelease=prerelease,
prerelease_channel=prerelease_channel
)
octoprint=self.get_settings_defaults()["checks"]["octoprint"]
)
))
)
@@ -338,7 +318,7 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
if "octoprint_checkout_folder" in data:
self._settings.set(["checks", "octoprint", "checkout_folder"], data["octoprint_checkout_folder"], defaults=defaults, force=True)
if update_folder and data["octoprint_checkout_folder"]:
if self._settings.get(["checks", "octoprint", "update_folder"]) and data["octoprint_checkout_folder"]:
self._settings.set(["checks", "octoprint", "update_folder"], None, defaults=defaults, force=True)
updated_octoprint_check_config = True
@@ -346,13 +326,13 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
octoprint_type = data["octoprint_type"]
if octoprint_type == "github_release":
self._settings.set(["checks", "octoprint", "type"], octoprint_type, defaults=defaults, force=True)
self._settings.set(["checks", "octoprint", "method"], "pip", defaults=defaults, force=True)
self._settings.set(["checks", "octoprint", "type"], octoprint_type, defaults=defaults)
self._settings.set(["checks", "octoprint", "method"], "pip", defaults=defaults)
updated_octoprint_check_config = True
elif octoprint_type == "git_commit":
self._settings.set(["checks", "octoprint", "type"], octoprint_type, defaults=defaults, force=True)
self._settings.set(["checks", "octoprint", "method"], "update_script", defaults=defaults, force=True)
self._settings.set(["checks", "octoprint", "type"], octoprint_type, defaults=defaults)
self._settings.set(["checks", "octoprint", "method"], "update_script", defaults=defaults)
updated_octoprint_check_config = True
if "octoprint_release_channel" in data:
@@ -993,6 +973,8 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
if target == "octoprint":
from flask.ext.babel import gettext
from octoprint.util.version import is_released_octoprint_version, is_stable_octoprint_version
result["displayName"] = to_unicode(check.get("displayName"), errors="replace")
if result["displayName"] is None:
# displayName missing or set to None
@@ -1010,16 +992,16 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
stable_branch = check["stable_branch"]["branch"]
if "prerelease_branches" in check:
release_branches += [x["branch"] for x in check["prerelease_branches"]]
result["released_version"] = not release_branches or BRANCH in release_branches
result["released_version"] = is_released_octoprint_version()
if check["type"] in self.COMMIT_TRACKING_TYPES:
result["current"] = REVISION if REVISION else "unknown"
else:
result["current"] = VERSION
if check["type"] == "github_release" and (check.get("prerelease", None) or BRANCH != stable_branch):
# we are tracking github releases and are either also tracking prerelease OR are currently installed
# from something that is not the stable (master) branch => we need to change some parameters
if check["type"] == "github_release" and (check.get("prerelease", None) or not is_stable_octoprint_version()):
# we are tracking github releases and are either also tracking prerelease OR are currently running
# a non stable version => we need to change some parameters
# we compare versions fully, not just the base so that we see a difference
# between RCs + stable for the same version release
@@ -1039,17 +1021,9 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
result["update_branch"] = check.get("update_branch", stable_branch)
if check.get("update_script", None):
# we force an exact version
# we force an exact version & python unequality check, to be able to downgrade
result["force_exact_version"] = True
if BRANCH != result.get("prerelease_channel"):
# we force python unequality check here because that will also allow us to
# downgrade on a prerelease channel change (rc/devel => rc/maintenance)
#
# we detect channel changes by comparing the current branch with the target
# branch of the release channel - unequality means we might have to handle
# a downgrade
result["release_compare"] = "python_unequal"
result["release_compare"] = "python_unequal"
elif check.get("pip", None):
# we force python unequality check for pip installs, to be able to downgrade
@@ -14,7 +14,7 @@
};
OctoPrintSoftwareUpdateClient.prototype.checkEntries = function(entries, force, opts) {
if (arguments.length === 1 && _.isObject(arguments[0])) {
if (arguments.length == 1 && _.isObject(arguments[0])) {
var params = arguments[0];
entries = params.entries;
force = params.force;
@@ -22,7 +22,7 @@
}
entries = entries || [];
if (typeof entries === "string") {
if (typeof entries == "string") {
entries = [entries];
}
@@ -37,7 +37,7 @@
};
OctoPrintSoftwareUpdateClient.prototype.check = function(force, opts) {
if (arguments.length === 1 && _.isObject(arguments[0])) {
if (arguments.length == 1 && _.isObject(arguments[0])) {
var params = arguments[0];
force = params.force;
opts = params.opts;
@@ -47,7 +47,7 @@
};
OctoPrintSoftwareUpdateClient.prototype.update = function(entries, force, opts) {
if (arguments.length === 1 && _.isObject(arguments[0])) {
if (arguments.length == 1 && _.isObject(arguments[0])) {
var params = arguments[0];
entries = params.entries;
force = params.force;
@@ -55,7 +55,7 @@
}
entries = entries || [];
if (typeof entries === "string") {
if (typeof entries == "string") {
entries = [entries];
}
@@ -67,7 +67,7 @@
};
OctoPrintSoftwareUpdateClient.prototype.updateAll = function(force, opts) {
if (arguments.length === 1 && _.isObject(arguments[0])) {
if (arguments.length == 1 && _.isObject(arguments[0])) {
var params = arguments[0];
force = params.force;
opts = params.opts;
@@ -551,7 +551,7 @@ $(function() {
});
self._updateClicked = false;
} else {
self.forceUpdate = (force === true);
self.forceUpdate = (force == true);
self.confirmationDialog.modal("show");
}
@@ -66,6 +66,8 @@ class VirtualPrinter(object):
self._prepared_errors = []
self._errors = settings().get(["devel", "virtualPrinter", "errors"], merged=True)
self.currentExtruder = 0
self.extruderCount = settings().getInt(["devel", "virtualPrinter", "numExtruders"])
self.pinnedExtruders = settings().get(["devel", "virtualPrinter", "pinnedExtruders"])
@@ -146,8 +148,8 @@ class VirtualPrinter(object):
self._triggerResendAt100 = True
self._triggerResendWithTimeoutAt105 = True
self._triggeredResendWithTimeoutAt105 = False
self._triggerResendWithMissingLinenoAt110 = True
self._triggerResendWithChecksumMismatchAt115 = True
readThread = threading.Thread(target=self._processIncoming, name="octoprint.plugins.virtual_printer.wait_thread")
readThread.start()
@@ -227,7 +229,7 @@ class VirtualPrinter(object):
self.currentLine += 1
elif settings().getBoolean(["devel", "virtualPrinter", "forceChecksum"]):
self._send("Error: Missing checksum")
self._send(self._error("checksum_missing"))
continue
# track N = N + 1
@@ -261,7 +263,11 @@ class VirtualPrinter(object):
continue
elif linenumber == 110 and self._triggerResendWithMissingLinenoAt110 and not self._writingToSd:
self._triggerResendWithMissingLinenoAt110 = False
self._send("Error: No Line Number with checksum, Last Line: {}".format(self.lastN))
self._send(self._error("lineno_missing", self.lastN))
continue
elif linenumber == 115 and self._triggerResendWithChecksumMismatchAt115 and not self._writingToSd:
self._triggerResendWithChecksumMismatchAt115 = False
self._triggerResend(checksum=True)
continue
elif len(self._prepared_errors):
prepared = self._prepared_errors.pop(0)
@@ -355,7 +361,7 @@ class VirtualPrinter(object):
self._send("echo:changed F value")
return False
else:
self._send("Error: Unknown command F")
self._send(self._error("command_unknown", "F"))
return True
def _gcode_M104(self, data):
@@ -549,11 +555,11 @@ class VirtualPrinter(object):
if actual is None:
if checksum:
self._send("Error: Wrong checksum")
self._send(self._error("checksum_mismatch"))
else:
self._send("Error: Missing checksum")
self._send(self._error("checksum_missing"))
else:
self._send("Error: expected line %d got %d" % (expected, actual))
self._send(self._error("lineno_mismatch", expected, actual))
def request_resend():
self._send("Resend:%d" % expected)
@@ -636,11 +642,13 @@ class VirtualPrinter(object):
elif data == "trigger_missing_checksum":
self._prepared_errors.append(lambda cur, last, line: self._triggerResend(expected=last, checksum=False))
elif data == "trigger_missing_lineno":
self._prepared_errors.append(lambda cur, last, line: self._send("Error: No Line Number with checksum, Last Line: {}".format(last)))
self._prepared_errors.append(lambda cur, last, line: self._send(self._error("lineno_missing", last)))
elif data == "drop_connection":
self._debug_drop_connection = True
elif data == "mintemp_error":
self._send(self._error("mintemp"))
elif data == "maxtemp_error":
self._send("Error: MAXTEMP triggered!")
self._send(self._error("maxtemp"))
elif data == "go_awol":
self._send("// Going AWOL")
self._debug_awol = True
@@ -1182,6 +1190,9 @@ class VirtualPrinter(object):
return ok.format(ok, lastN=self.lastN, buffer=self.buffered.maxsize - self.buffered.qsize())
def _error(self, error, *args, **kwargs):
return "Error: {}".format(self._errors.get(error).format(*args, **kwargs))
class CharCountingQueue(queue.Queue):
def __init__(self, maxsize, name=None):
+1 -1
View File
@@ -367,7 +367,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
return
self._comm.setTemperatureOffset(offsets)
self._setOffsets(offsets)
self._setOffsets(self._comm.getOffsets())
def _convert_rate_value(self, factor, min=0, max=200):
if not isinstance(factor, (int, float, long)):
+3 -3
View File
@@ -15,7 +15,7 @@ from flask.ext.assets import Environment, Bundle
from babel import Locale
from watchdog.observers import Observer
from watchdog.observers.polling import PollingObserver
from collections import defaultdict
from collections import defaultdict, OrderedDict
from builtins import bytes, range
from past.builtins import basestring
@@ -1268,7 +1268,7 @@ class Server(object):
# TODO remove again in 1.3.8
def js_bundles_for_plugins(collection, filters=None):
"""Produces Bundle instances"""
result = dict()
result = OrderedDict()
for plugin, assets in collection.items():
if len(assets):
result[plugin] = Bundle(*assets, filters=filters)
@@ -1277,7 +1277,7 @@ class Server(object):
else:
def js_bundles_for_plugins(collection, filters=None):
"""Produces JsPluginBundle instances that output IIFE wrapped assets"""
result = dict()
result = OrderedDict()
for plugin, assets in collection.items():
if len(assets):
result[plugin] = JsPluginBundle(plugin, *assets, filters=filters)
+8 -6
View File
@@ -28,6 +28,8 @@ import octoprint.server
import octoprint.users
import octoprint.plugin
from octoprint.util import DefaultOrderedDict
from werkzeug.contrib.cache import BaseCache
from past.builtins import basestring
@@ -1348,12 +1350,12 @@ def collect_plugin_assets(enable_gcodeviewer=True, preferred_stylesheet="css"):
logger = logging.getLogger(__name__ + ".collect_plugin_assets")
supported_stylesheets = ("css", "less")
assets = dict(bundled=dict(js=collections.defaultdict(list),
css=collections.defaultdict(list),
less=collections.defaultdict(list)),
external=dict(js=collections.defaultdict(list),
css=collections.defaultdict(list),
less=collections.defaultdict(list)))
assets = dict(bundled=dict(js=DefaultOrderedDict(list),
css=DefaultOrderedDict(list),
less=DefaultOrderedDict(list)),
external=dict(js=DefaultOrderedDict(list),
css=DefaultOrderedDict(list),
less=DefaultOrderedDict(list)))
asset_plugins = octoprint.plugin.plugin_manager().get_implementations(octoprint.plugin.AssetPlugin)
for implementation in asset_plugins:
+11 -2
View File
@@ -159,7 +159,7 @@ default_settings = {
},
"pluginBlacklist": {
"enabled": None,
"url": "http://plugins.octoprint.org/blacklist.json",
"url": "https://plugins.octoprint.org/blacklist.json",
"ttl": 15 * 60 # 15 min
},
"diskspace": {
@@ -389,7 +389,16 @@ default_settings = {
"capabilities": {
"AUTOREPORT_TEMP": True
},
"ambientTemperature": 21.3
"ambientTemperature": 21.3,
"errors": {
"checksum_mismatch": "Checksum mismatch",
"checksum_missing": "Missing checksum",
"lineno_mismatch": "expected line {} got {}",
"lineno_missing": "No Line Number with checksum, Last Line: {}",
"maxtemp": "MAXTEMP triggered!",
"mintemp": "MINTEMP triggered!",
"command_unknown": "Unknown command {}"
}
}
}
}
@@ -69,7 +69,7 @@ GCODE.renderer = (function(){
ctx.clearRect(p1.x,p1.y,p2.x-p1.x,p2.y-p1.y);
drawGrid();
drawBoundingBox();
if(renderOptions['showNextLayer'] && layerNumStore < model.length - 1) {
if (renderOptions['showNextLayer'] && model && model.length && layerNumStore < model.length - 1) {
drawLayer(layerNumStore + 1, 0, GCODE.renderer.getLayerNumSegments(layerNumStore + 1), true);
}
if (renderOptions['showPreviousLayer'] && layerNumStore > 0) {
@@ -50,7 +50,7 @@ $(function() {
});
self.webcamRatioClass = ko.pureComputed(function() {
if (self.settings.webcam_streamRatio() === "4:3") {
if (self.settings.webcam_streamRatio() == "4:3") {
return "ratio43";
} else {
return "ratio169";
@@ -156,7 +156,7 @@ $(function() {
if (control.hasOwnProperty("children")) {
control.children = ko.observableArray(self._processControls(control.children));
if (!control.hasOwnProperty("layout") || !(control.layout === "vertical" || control.layout === "horizontal" || control.layout === "horizontal_grid")) {
if (!control.hasOwnProperty("layout") || !(control.layout == "vertical" || control.layout == "horizontal" || control.layout == "horizontal_grid")) {
control.layout = "vertical";
}
@@ -371,23 +371,23 @@ $(function() {
};
self._enableWebcam = function() {
if (OctoPrint.coreui.selectedTab !== "#control" || !OctoPrint.coreui.browserTabVisible) {
if (OctoPrint.coreui.selectedTab != "#control" || !OctoPrint.coreui.browserTabVisible) {
return;
}
if (self.webcamDisableTimeout !== undefined) {
if (self.webcamDisableTimeout != undefined) {
clearTimeout(self.webcamDisableTimeout);
}
var webcamImage = $("#webcam_image");
var currentSrc = webcamImage.attr("src");
// safari bug doesn't release the mjpeg stream, so we just set it up the once
if (OctoPrint.coreui.browser.safari && currentSrc !== undefined) {
if (OctoPrint.coreui.browser.safari && currentSrc != undefined) {
return;
}
var newSrc = self.settings.webcam_streamUrl();
if (currentSrc !== newSrc) {
if (currentSrc != newSrc) {
if (newSrc.lastIndexOf("?") > -1) {
newSrc += "&";
} else {
@@ -416,9 +416,9 @@ $(function() {
};
self.onTabChange = function (current, previous) {
if (current === "#control") {
if (current == "#control") {
self._enableWebcam();
} else if (previous === "#control") {
} else if (previous == "#control") {
self._disableWebcam();
}
};
+28 -28
View File
@@ -194,7 +194,7 @@ $(function() {
});
self._retrieveBedDimensions = function(currentProfileData) {
if (currentProfileData === undefined) {
if (currentProfileData == undefined) {
currentProfileData = self.settings.printerProfiles.currentProfileData();
}
@@ -202,7 +202,7 @@ $(function() {
var x = undefined, y = undefined, r = undefined, circular = false, centeredOrigin = false;
var formFactor = currentProfileData.volume.formFactor();
if (formFactor === "circular") {
if (formFactor == "circular") {
r = currentProfileData.volume.width() / 2;
circular = true;
centeredOrigin = true;
@@ -210,7 +210,7 @@ $(function() {
x = currentProfileData.volume.width();
y = currentProfileData.volume.depth();
if (currentProfileData.volume.origin) {
centeredOrigin = currentProfileData.volume.origin() === "center";
centeredOrigin = currentProfileData.volume.origin() == "center";
}
}
@@ -227,7 +227,7 @@ $(function() {
};
self._retrieveToolOffsets = function(currentProfileData) {
if (currentProfileData === undefined) {
if (currentProfileData == undefined) {
currentProfileData = self.settings.printerProfiles.currentProfileData();
}
@@ -246,7 +246,7 @@ $(function() {
};
self._retrieveAxesConfiguration = function(currentProfileData) {
if (currentProfileData === undefined) {
if (currentProfileData == undefined) {
currentProfileData = self.settings.printerProfiles.currentProfileData();
}
@@ -380,7 +380,7 @@ $(function() {
self.loadFile = function(path, date){
self.enableReload(false);
self.needsLoad = false;
if (self.status === "idle" && self.errorCount < 3) {
if (self.status == "idle" && self.errorCount < 3) {
self.status = "request";
OctoPrint.files.download("local", path)
.done(function(response, rstatus) {
@@ -408,10 +408,10 @@ $(function() {
GCODE.renderer.clear();
GCODE.gCodeReader.loadFile(par);
if (self.layerSlider !== undefined) {
if (self.layerSlider != undefined) {
self.layerSlider.slider("disable");
}
if (self.layerCommandSlider !== undefined) {
if (self.layerCommandSlider != undefined) {
self.layerCommandSlider.slider("disable");
}
};
@@ -436,10 +436,10 @@ $(function() {
GCODE.renderer.render(cmdIndex.layer, 0, cmdIndex.cmd);
GCODE.ui.updateLayerInfo(cmdIndex.layer);
if (self.layerSlider !== undefined) {
if (self.layerSlider != undefined) {
self.layerSlider.slider("setValue", cmdIndex.layer);
}
if (self.layerCommandSlider !== undefined) {
if (self.layerCommandSlider != undefined) {
self.layerCommandSlider.slider("setValue", [0, cmdIndex.cmd]);
}
};
@@ -461,17 +461,17 @@ $(function() {
self.currentlyPrinting = data.state.flags && (data.state.flags.printing || data.state.flags.paused);
if(self.loadedFilepath
&& self.loadedFilepath === data.job.file.path
&& self.loadedFileDate === data.job.file.date) {
&& self.loadedFilepath == data.job.file.path
&& self.loadedFileDate == data.job.file.date) {
if (OctoPrint.coreui.browserTabVisible && self.tabActive && self.currentlyPrinting && self.renderer_syncProgress() && !self.waitForApproval()) {
self._renderPercentage(data.progress.completion);
}
self.errorCount = 0
} else {
self.clear();
if (data.job.file.path && data.job.file.origin !== "sdcard"
&& self.status !== "request"
&& (!self.waitForApproval() || self.selectedFile.path() !== data.job.file.path || self.selectedFile.date() !== data.job.file.date)) {
if (data.job.file.path && data.job.file.origin != "sdcard"
&& self.status != "request"
&& (!self.waitForApproval() || self.selectedFile.path() != data.job.file.path || self.selectedFile.date() != data.job.file.date)) {
self.selectedFile.path(data.job.file.path);
self.selectedFile.date(data.job.file.date);
self.selectedFile.size(data.job.file.size);
@@ -511,7 +511,7 @@ $(function() {
self._onModelLoaded = function(model) {
if (!model) {
self.ui_modelInfo("");
if (self.layerSlider !== undefined) {
if (self.layerSlider != undefined) {
self.layerSlider.slider("disable");
self.layerSlider.slider("setMax", 1);
self.layerSlider.slider("setValue", 0);
@@ -531,7 +531,7 @@ $(function() {
self.ui_modelInfo(output.join("<br>"));
self.maxLayer = model.layersPrinted - 1;
if (self.layerSlider !== undefined) {
if (self.layerSlider != undefined) {
self.layerSlider.slider("enable");
self.layerSlider.slider("setMax", self.maxLayer);
self.layerSlider.slider("setValue", 0);
@@ -545,7 +545,7 @@ $(function() {
self._onLayerSelected = function(layer) {
if (!layer) {
self.ui_layerInfo("");
if (self.layerCommandSlider !== undefined) {
if (self.layerCommandSlider != undefined) {
self.layerCommandSlider.slider("disable");
self.layerCommandSlider.slider("setMax", 1);
self.layerCommandSlider.slider("setValue", [0, 1]);
@@ -559,8 +559,8 @@ $(function() {
output.push(gettext("Layer number") + ": " + (layer.number + 1));
output.push(gettext("Layer height") + " (mm): " + layer.height);
output.push(gettext("GCODE commands") + ": " + layer.commands);
if (layer.filament !== undefined) {
if (layer.filament.length === 1) {
if (layer.filament != undefined) {
if (layer.filament.length == 1) {
output.push(gettext("Filament") + ": " + layer.filament[0].toFixed(2) + "mm");
} else {
for (var i = 0; i < layer.filament.length; i++) {
@@ -572,7 +572,7 @@ $(function() {
self.ui_layerInfo(output.join("<br>"));
if (self.layerCommandSlider !== undefined) {
if (self.layerCommandSlider != undefined) {
self.layerCommandSlider.slider("enable");
self.layerCommandSlider.slider("setMax", layer.commands - 1);
self.layerCommandSlider.slider("setValue", [0, layer.commands - 1]);
@@ -587,11 +587,11 @@ $(function() {
if (!options) return;
for (var opt in options) {
if (opt === "zoomInOnModel" && options[opt] !== self.renderer_zoomOnModel()) {
if (opt == "zoomInOnModel" && options[opt] != self.renderer_zoomOnModel()) {
self.renderer_zoomOnModel(false);
} else if (opt === "centerViewport" && options[opt] !== self.renderer_centerViewport()) {
} else if (opt == "centerViewport" && options[opt] != self.renderer_centerViewport()) {
self.renderer_centerViewport(false);
} else if (opt === "moveModel" && options[opt] !== self.renderer_centerModel()) {
} else if (opt == "moveModel" && options[opt] != self.renderer_centerModel()) {
self.renderer_centerModel(false);
}
}
@@ -601,7 +601,7 @@ $(function() {
if (self.currentlyPrinting && self.renderer_syncProgress()) self.renderer_syncProgress(false);
var value = event.value;
if (self.currentLayer !== undefined && self.currentLayer === value) return;
if (self.currentLayer !== undefined && self.currentLayer == value) return;
self.currentLayer = value;
GCODE.ui.changeSelectedLayer(value);
@@ -641,7 +641,7 @@ $(function() {
if (self.currentlyPrinting && self.renderer_syncProgress()) self.renderer_syncProgress(false);
var tuple = event.value;
if (self.currentCommand !== undefined && self.currentCommand[0] === tuple[0] && self.currentCommand[1] === tuple[1]) return;
if (self.currentCommand !== undefined && self.currentCommand[0] == tuple[0] && self.currentCommand[1] == tuple[1]) return;
self.currentCommand = tuple;
GCODE.ui.changeSelectedCommands(self.layerSlider.slider("getValue"), tuple[0], tuple[1]);
@@ -656,14 +656,14 @@ $(function() {
};
self.onTabChange = function(current, previous) {
self.tabActive = current === "#gcode";
self.tabActive = current == "#gcode";
if (self.tabActive && self.needsLoad) {
self.loadFile(self.selectedFile.path(), self.selectedFile.date());
}
};
self.shiftLayer = function(value){
if (value !== self.currentLayer) {
if (value != self.currentLayer) {
self.layerSlider.slider('setValue', value);
value = self.layerSlider.slider('getValue');
//This sets the scroll bar to the appropriate position.
@@ -98,7 +98,7 @@ $(function() {
self.login = function(u, p, r) {
var username = u || self.loginUser();
var password = p || self.loginPass();
var remember = (r !== undefined ? r : self.loginRemember());
var remember = (r != undefined ? r : self.loginRemember());
return OctoPrint.browser.login(username, password, remember)
.done(function(response) {
@@ -51,7 +51,7 @@ $(function() {
self.volumeOrigin = ko.observable();
self.volumeFormFactor.subscribe(function(value) {
if (value === "circular") {
if (value == "circular") {
self.volumeOrigin("center");
}
});
@@ -123,10 +123,10 @@ $(function() {
data = placeholder;
}
var validCharacters = (data && (data === self._sanitize(data)));
var validCharacters = (data && (data == self._sanitize(data)));
var existingProfile = self.profiles.getItem(function(item) {return item.id === data});
return !data || !validCharacters || (self.isNew() && existingProfile !== undefined);
var existingProfile = self.profiles.getItem(function(item) {return item.id == data});
return !data || !validCharacters || (self.isNew() && existingProfile != undefined);
});
self.identifierInvalidText = ko.pureComputed(function() {
@@ -136,7 +136,7 @@ $(function() {
if (!self.identifier() && !self.identifierPlaceholder()) {
return gettext("Identifier must be set");
} else if (self.identifier() !== self._sanitize(self.identifier())) {
} else if (self.identifier() != self._sanitize(self.identifier())) {
return gettext("Invalid characters, only a-z, A-Z, 0-9, -, ., _, ( and ) are allowed")
} else {
return gettext("A profile with such an identifier already exists");
@@ -170,9 +170,9 @@ $(function() {
};
var keys = [];
if (formFactor === "rectangular") {
if (formFactor == "rectangular") {
keys = ["lowerleft", "center"];
} else if (formFactor === "circular") {
} else if (formFactor == "circular") {
keys = ["center"];
}
@@ -312,7 +312,7 @@ $(function() {
}
}
if (profile.volume.formFactor === "circular") {
if (profile.volume.formFactor == "circular") {
profile.volume.depth = profile.volume.width;
}
@@ -320,7 +320,7 @@ $(function() {
};
self.defaultBoundingBox = function(width, depth, height, origin) {
if (origin === "center") {
if (origin == "center") {
var halfWidth = width / 2.0;
var halfDepth = depth / 2.0;
@@ -519,7 +519,7 @@ $(function() {
})
.fail(function(xhr) {
var text;
if (xhr.status === 409) {
if (xhr.status == 409) {
text = gettext("Cannot delete the default profile or the currently active profile.");
} else {
text = gettext("There was unexpected error while removing the printer profile, please consult the logs.");
@@ -534,7 +534,7 @@ $(function() {
};
self.updateProfile = function(profile, callback) {
if (profile === undefined) {
if (profile == undefined) {
profile = self.editor.toProfileData();
}
@@ -16,7 +16,7 @@ $(function() {
self.isSdReady = ko.observable(undefined);
self.enablePrint = ko.pureComputed(function() {
return self.isOperational() && self.isReady() && !self.isPrinting() && self.loginState.isUser() && self.filename() !== undefined;
return self.isOperational() && self.isReady() && !self.isPrinting() && self.loginState.isUser() && self.filename() != undefined;
});
self.enablePause = ko.pureComputed(function() {
return self.isOperational() && (self.isPrinting() || self.isPaused()) && self.loginState.isUser();
@@ -77,7 +77,7 @@ $(function() {
return formatDuration(self.printTime());
});
self.printTimeLeftString = ko.pureComputed(function() {
if (self.printTimeLeft() === undefined) {
if (self.printTimeLeft() == undefined) {
if (!self.printTime() || !(self.isPrinting() || self.isPaused())) {
return "-";
} else {
@@ -156,9 +156,9 @@ $(function() {
return "-";
var type = timelapse["type"];
if (type === "zchange") {
if (type == "zchange") {
return gettext("On Z Change");
} else if (type === "timed") {
} else if (type == "timed") {
return gettext("Timed") + " (" + timelapse["options"]["interval"] + " " + gettext("sec") + ")";
} else {
return "-";
@@ -197,7 +197,7 @@ $(function() {
self.isReady(data.flags.ready);
self.isSdReady(data.flags.sdReady);
if (self.isPaused() !== prevPaused) {
if (self.isPaused() != prevPaused) {
if (self.isPaused()) {
self.titlePrintButton(self.TITLE_PRINT_BUTTON_PAUSED);
self.titlePauseButton(self.TITLE_PAUSE_BUTTON_PAUSED);
@@ -214,7 +214,7 @@ $(function() {
self.filepath(data.file.path);
self.filesize(data.file.size);
self.filedisplay(data.file.display);
self.sd(data.file.origin === "sdcard");
self.sd(data.file.origin == "sdcard");
} else {
self.filename(undefined);
self.filepath(undefined);
@@ -227,7 +227,7 @@ $(function() {
self.lastPrintTime(data.lastPrintTime);
var result = [];
if (data.filament && typeof(data.filament) === "object" && _.keys(data.filament).length > 0) {
if (data.filament && typeof(data.filament) == "object" && _.keys(data.filament).length > 0) {
var keys = _.keys(data.filament);
keys.sort();
_.each(keys, function(key) {
@@ -38,7 +38,7 @@ $(function() {
});
self.enableTranslationUpload = ko.pureComputed(function() {
var name = self.translationUploadFilename();
return name !== undefined && name.trim() !== "" && !self.invalidTranslationArchive();
return name !== undefined && name.trim() != "" && !self.invalidTranslationArchive();
});
self.translations = new ItemListHelper(
@@ -415,7 +415,7 @@ $(function() {
autoUpload: false,
headers: OctoPrint.getRequestHeaders(),
add: function(e, data) {
if (data.files.length === 0) {
if (data.files.length == 0) {
return false;
}
@@ -444,14 +444,14 @@ $(function() {
self.settingsDialog.on('show', function(event) {
OctoPrint.coreui.settingsOpen = true;
if (event.target.id === "settings_dialog") {
if (event.target.id == "settings_dialog") {
self.requestTranslationData();
callViewModels(allViewModels, "onSettingsShown");
}
});
self.settingsDialog.on('hidden', function(event) {
OctoPrint.coreui.settingsOpen = false;
if (event.target.id === "settings_dialog") {
if (event.target.id == "settings_dialog") {
callViewModels(allViewModels, "onSettingsHidden");
}
});
@@ -525,11 +525,11 @@ $(function() {
self.requestData = function(local) {
// handle old parameter format
var callback = undefined;
if (arguments.length === 2 || _.isFunction(local)) {
if (arguments.length == 2 || _.isFunction(local)) {
var exc = new Error();
log.warn("The callback parameter of SettingsViewModel.requestData is deprecated, the method now returns a promise, please use that instead. Stacktrace:", (exc.stack || exc.stacktrace || "<n/a>"));
if (arguments.length === 2) {
if (arguments.length == 2) {
callback = arguments[0];
local = arguments[1];
} else {
@@ -626,8 +626,8 @@ $(function() {
var translations = [];
_.each(translationsByLocale, function(item) {
item["packs"].sort(function(a, b) {
if (a.identifier === "_core") return -1;
if (b.identifier === "_core") return 1;
if (a.identifier == "_core") return -1;
if (b.identifier == "_core") return 1;
if (a.display < b.display) return -1;
if (a.display > b.display) return 1;
@@ -640,7 +640,7 @@ $(function() {
};
self.languagePackDisplay = function(item) {
return item.display + ((item.english !== undefined) ? ' (' + item.english + ')' : '');
return item.display + ((item.english != undefined) ? ' (' + item.english + ')' : '');
};
self.languagePacksAvailable = ko.pureComputed(function() {
@@ -657,7 +657,7 @@ $(function() {
*/
self.getLocalData = function() {
var data = {};
if (self.settings !== undefined) {
if (self.settings != undefined) {
data = ko.mapping.toJS(self.settings);
}
@@ -665,8 +665,8 @@ $(function() {
var specialMappings = {
feature: {
externalHeatupDetection: function() { return !self.feature_disableExternalHeatupDetection()},
alwaysSendChecksum: function() { return self.feature_sendChecksum() === "always"},
neverSendChecksum: function() { return self.feature_sendChecksum() === "never"}
alwaysSendChecksum: function() { return self.feature_sendChecksum() == "always"},
neverSendChecksum: function() { return self.feature_sendChecksum() == "never"}
},
serial: {
additionalPorts : function() { return commentableLinesToArray(self.serial_additionalPorts()) },
@@ -707,7 +707,7 @@ $(function() {
// process all key-value-pairs here
_.forOwn(data, function(value, key) {
var observable = key;
if (keyPrefix !== undefined) {
if (keyPrefix != undefined) {
observable = keyPrefix + "_" + observable;
}
@@ -717,7 +717,7 @@ $(function() {
} else if (_.isPlainObject(value)) {
// value is another object, we'll dive deeper
var subresult = mapFromObservables(value, (mapping && mapping[key]) ? mapping[key] : undefined, observable);
if (subresult !== undefined) {
if (subresult != undefined) {
// we only set something on our result if we got something back
result[key] = subresult;
flag = true;
@@ -801,7 +801,7 @@ $(function() {
// process all key-value-pairs here
_.forOwn(data, function(value, key) {
var observable = key;
if (keyPrefix !== undefined) {
if (keyPrefix != undefined) {
observable = keyPrefix + "_" + observable;
}
@@ -832,16 +832,16 @@ $(function() {
} else {
options = {
success: successCallback,
sending: (setAsSending === true)
sending: (setAsSending == true)
}
}
self.settingsDialog.trigger("beforeSave");
self.sawUpdateEventWhileSending = false;
self.sending(data === undefined || options.sending || false);
self.sending(data == undefined || options.sending || false);
if (data === undefined) {
if (data == undefined) {
// we also only send data that actually changed when no data is specified
data = getOnlyChangedData(self.getLocalData(), self.lastReceivedSettings);
}
@@ -920,7 +920,7 @@ $(function() {
};
self.selectTab = function(tab) {
if (tab !== undefined) {
if (tab != undefined) {
if (!_.startsWith(tab, "#")) {
tab = "#" + tab;
}
@@ -41,10 +41,10 @@ $(function() {
};
self.profilesForSlicer = function(key) {
if (key === undefined) {
if (key == undefined) {
key = self.slicer();
}
if (key === undefined || !self.data.hasOwnProperty(key)) {
if (key == undefined || !self.data.hasOwnProperty(key)) {
return;
}
var slicer = self.data[key];
@@ -53,7 +53,7 @@ $(function() {
self.profiles.removeAll();
_.each(_.values(slicer.profiles), function(profile) {
var name = profile.displayName;
if (name === undefined) {
if (name == undefined) {
name = profile.key;
}
@@ -77,7 +77,7 @@ $(function() {
};
self.metadataForSlicer = function(key) {
if (key === undefined || !self.data.hasOwnProperty(key)) {
if (key == undefined || !self.data.hasOwnProperty(key)) {
return;
}
@@ -100,7 +100,7 @@ $(function() {
var containsSlicer = function(key) {
return _.any(slicers, function(slicer) {
return slicer.key === key;
return slicer.key == key;
});
};
@@ -134,7 +134,7 @@ $(function() {
}
var filename = file;
if (filename.lastIndexOf("/") !== 0) {
if (filename.lastIndexOf("/") != 0) {
path = path || filename.substr(0, filename.lastIndexOf("/"));
filename = filename.substr(filename.lastIndexOf("/") + 1);
}
@@ -173,10 +173,10 @@ $(function() {
};
self.enableSliceButton = ko.pureComputed(function() {
return self.destinationFilename() !== undefined
&& self.destinationFilename().trim() !== ""
&& self.slicer() !== undefined
&& self.profile() !== undefined
return self.destinationFilename() != undefined
&& self.destinationFilename().trim() != ""
&& self.slicer() != undefined
&& self.profile() != undefined
&& (!(self.printerState.isPrinting() || self.printerState.isPaused()) || !self.slicerSameDevice());
});
@@ -227,7 +227,7 @@ $(function() {
self.slicers.removeAll();
_.each(_.values(data), function(slicer) {
var name = slicer.displayName;
if (name === undefined) {
if (name == undefined) {
name = slicer.key;
}
@@ -276,13 +276,13 @@ $(function() {
destination: destinationFilename
};
if (self.path !== undefined) {
if (self.path != undefined) {
data["path"] = self.path;
}
if (self.afterSlicing() === "print") {
if (self.afterSlicing() == "print") {
data["print"] = true;
} else if (self.afterSlicing() === "select") {
} else if (self.afterSlicing() == "select") {
data["select"] = true;
}
@@ -57,7 +57,7 @@ $(function() {
var regex = self.filterRegex();
var lineVisible = function(entry) {
return regex === undefined || !entry.line.match(regex);
return regex == undefined || !entry.line.match(regex);
};
var filtered = false;
@@ -90,7 +90,7 @@ $(function() {
var regex = self.filterRegex();
var lineVisible = function(entry) {
return regex === undefined || !entry.line.match(regex);
return regex == undefined || !entry.line.match(regex);
};
var lines = self.log();
@@ -204,7 +204,7 @@ $(function() {
if (!self.terminalLogDuringPrinting() && self.isPrinting()) {
var last = self.plainLogLines()[self.plainLogLines().length - 1];
var disabled = "--- client too slow, log output disabled while printing ---";
if (last !== disabled) {
if (last != disabled) {
self.plainLogLines.push(disabled);
}
return;
@@ -225,7 +225,7 @@ $(function() {
}
var newLog = self.log().concat(_.map(newData, function(line) { return self._toInternalFormat(line) }));
if (newData.length !== data.length) {
if (newData.length != data.length) {
var cutoff = "--- too many lines to buffer, cut off ---";
newLog.push(self._toInternalFormat(cutoff, "cut"));
}
@@ -245,7 +245,7 @@ $(function() {
};
self._toInternalFormat = function(line, type) {
if (type === undefined) {
if (type == undefined) {
type = "line";
}
return {line: escapeUnprintableCharacters(line), type: type}
@@ -263,7 +263,7 @@ $(function() {
self.updateFilterRegex = function() {
var filterRegexStr = self.activeFilters().join("|").trim();
if (filterRegexStr === "") {
if (filterRegexStr == "") {
self.filterRegex(undefined);
} else {
self.filterRegex(new RegExp(filterRegexStr));
@@ -356,10 +356,10 @@ $(function() {
self.handleKeyDown = function(event) {
var keyCode = event.keyCode;
if (keyCode === 38 || keyCode === 40) {
if (keyCode === 38 && self.cmdHistory.length > 0 && self.cmdHistoryIdx > 0) {
if (keyCode == 38 || keyCode == 40) {
if (keyCode == 38 && self.cmdHistory.length > 0 && self.cmdHistoryIdx > 0) {
self.cmdHistoryIdx--;
} else if (keyCode === 40 && self.cmdHistoryIdx < self.cmdHistory.length - 1) {
} else if (keyCode == 40 && self.cmdHistoryIdx < self.cmdHistory.length - 1) {
self.cmdHistoryIdx++;
}
@@ -378,7 +378,7 @@ $(function() {
};
self.handleKeyUp = function(event) {
if (event.keyCode === 13) {
if (event.keyCode == 13) {
self.sendCommand();
}
@@ -387,7 +387,7 @@ $(function() {
};
self.onAfterTabChange = function(current, previous) {
self.tabActive = current === "#term";
self.tabActive = current == "#term";
self.updateOutput();
};
@@ -54,7 +54,7 @@ $(function() {
});
self.editorPasswordMismatch = ko.pureComputed(function() {
return self.editorPassword() !== self.editorRepeatedPassword();
return self.editorPassword() != self.editorRepeatedPassword();
});
self.requestData = function() {
@@ -185,7 +185,7 @@ $(function() {
throw OctoPrint.InvalidArgumentError("user must be set");
}
if (user.name === self.loginState.username()) {
if (user.name == self.loginState.username()) {
// we do not allow to delete ourselves
new PNotify({
title: gettext("Not possible"),
@@ -25,7 +25,7 @@ $(function() {
self.access_apikey(undefined);
self.interface_language("_default");
if (newUser !== undefined) {
if (newUser != undefined) {
self.access_apikey(newUser.apikey);
if (newUser.settings.hasOwnProperty("interface") && newUser.settings.interface.hasOwnProperty("language")) {
self.interface_language(newUser.settings.interface.language);
@@ -34,13 +34,13 @@ $(function() {
});
self.passwordMismatch = ko.pureComputed(function() {
return self.access_password() !== self.access_repeatedPassword();
return self.access_password() != self.access_repeatedPassword();
});
self.show = function(user) {
if (!CONFIG_ACCESS_CONTROL) return;
if (user === undefined) {
if (user == undefined) {
user = self.loginState.currentUser();
}
@@ -72,13 +72,13 @@ $(function() {
return false;
},
onTabShow: function(tab, navigation, index) {
if (index < 0 || tab.length === 0) {
if (index < 0 || tab.length == 0) {
return true;
}
var total = self.wizardDialog.bootstrapWizard("navigationLength");
if (index === total) {
if (index == total) {
self.wizardDialog.find(".button-next").hide();
self.wizardDialog.find(".button-finish").show().removeClass("disabled");
} else {
@@ -87,17 +87,17 @@ $(function() {
}
var active = tab[0].id;
if (active !== undefined) {
if (active != undefined) {
callViewModels(allViewModels, "onAfterWizardTabChange", [active]);
}
},
onTabChange: function(tab, navigation, index, nextTabIndex, nextTab) {
var current, next;
if (index === undefined || index < 0 ||
nextTabIndex === undefined || nextTabIndex < 0 ||
index === nextTabIndex ||
tab.length === 0 || nextTab.length === 0) {
if (index == undefined || index < 0 ||
nextTabIndex == undefined || nextTabIndex < 0 ||
index == nextTabIndex ||
tab.length == 0 || nextTab.length == 0) {
// let's ignore that nonsense
return;
}
@@ -105,7 +105,7 @@ $(function() {
current = tab[0].id;
next = nextTab[0].id;
if (current !== undefined && next !== undefined) {
if (current != undefined && next != undefined) {
var result = true;
callViewModels(allViewModels, "onBeforeWizardTabChange", function(method) {
// we want to continue evaluating even if result becomes false
@@ -145,7 +145,7 @@ $(function() {
// first, or it won't happen after the reload flag has been
// set once due to the || making further evaluation unnecessary
// then
reload = (method() === "reload") || reload;
reload = (method() == "reload") || reload;
});
self.finishWizard()
.done(function() {
@@ -5,14 +5,14 @@
<p>Version <span class="version">{{ display_version }}</span></p>
<ul>
<li>Website: <a href="http://octoprint.org" target="_blank" rel="noreferrer noopener">octoprint.org</a></li>
<li>Website: <a href="https://octoprint.org" target="_blank" rel="noreferrer noopener">octoprint.org</a></li>
<li>Source Code: <a href="https://github.com/foosel/OctoPrint" target="_blank" rel="noreferrer noopener">github.com/foosel/OctoPrint</a></li>
<li>Documentation: <a href="http://docs.octoprint.org" target="_blank" rel="noreferrer noopener">docs.octoprint.org</a></li>
</ul>
<p>
<strong>Development of OctoPrint wouldn't be possible without <a href="javascript:void(0)" data-bind="click: function() { showTab('{{ templates.about.entries.supporters[1]._div }}'); }">its supporters</a>.</strong><br>
If you enjoy OctoPrint, please consider <a href="http://octoprint.org/support-octoprint/" target="_blank" rel="noreferrer noopener">supporting its ongoing development</a>.
If you enjoy OctoPrint, please consider <a href="https://octoprint.org/support-octoprint/?utm_source=octoprint&utm_medium=about_dialog" target="_blank" rel="noreferrer noopener">supporting its ongoing development</a>.
</p>
<p>
@@ -3,7 +3,7 @@
<div class="controls">
<label class="checkbox">
<input type="checkbox" data-bind="checked: feature_legacyPluginAssets" id="settings-legacyPluginAssets"> {{ _('Enable legacy plugin asset bundling') }} <span class="label label-info">Compatibility</span>
<span class="help-block">{% trans url="http://octoprint.org/blog/2017/12/01/heads-up-plugin-authors/" %}
<span class="help-block">{% trans url="https://octoprint.org/blog/2017/12/01/heads-up-plugin-authors/" %}
Enable this, save and restart your server if you are running into issues with plugins with OctoPrint
1.3.6 or later that used to work with OctoPrint up to version 1.3.5. See <a href="{{ url }}">here</a>
for details on why this is happening. Note that this legacy flag will be removed in a future
@@ -17,7 +17,7 @@
<h4>{{ _('If you enjoy OctoPrint...') }}</h4>
<span style="display: inline-block; float: left; font-size: 4em; margin-right: .3em"><img src="{{ url_for('static', filename='img/tentacle-56x56.png') }}"></span>
<p>{% trans url='http://octoprint.org/support-octoprint/' %}
<p>{% trans url='https://octoprint.org/support-octoprint/?utm_source=octoprint&utm_medium=first_run_wizard' %}
Please consider to <strong><a href="{{ url }}" target="_blank">support OctoPrint's ongoing development</a></strong>,
which can only continue with funding by users like you! You can also find this link in the "About" dialog.<br>
<strong>Thank you!</strong>
+1 -1
View File
@@ -114,7 +114,7 @@
<li><small>{{ _('OctoPrint') }} <span class="version">{{ display_version|e }}</span></small></li>
</ul>
<ul id="footer_links" class="pull-right">
<li><a href="http://octoprint.org" target="_blank" rel="noreferrer noopener"><i class="fa fa-home"></i> {{ _('Homepage') }}</a></li>
<li><a href="https://octoprint.org" target="_blank" rel="noreferrer noopener"><i class="fa fa-home"></i> {{ _('Homepage') }}</a></li>
<li><a href="https://github.com/foosel/OctoPrint/" target="_blank" rel="noreferrer noopener"><i class="fa fa-github"></i> {{ _('Source') }}</a></li>
<li><a href="http://docs.octoprint.org" target="_blank" rel="noreferrer noopener"><i class="fa fa-book"></i> {{ _('Docs') }}</a></li>
<li><a href="https://github.com/foosel/OctoPrint/issues" target="_blank" rel="noreferrer noopener"><i class="fa fa-flag"></i> {{ _('Issues') }}</a></li>
@@ -3,3 +3,8 @@
the use of a centralized plugin version blacklist to automatically disable such plugins before they can interfere
with normal operation.
{% endtrans %}</p>
<p>{% trans url="https://plugins.octoprint.org/blacklist/" %}
By default, OctoPrint will use the blacklist hosted at <code>plugins.octoprint.org/blacklist.json</code> which you
can also take a look at in a more human readable format <a href="{{ url }}" target="_blank">here</a>.
{% endtrans %}</p>
File diff suppressed because it is too large. Load diff
+46
View File
@@ -20,6 +20,7 @@ import threading
from functools import wraps
import warnings
import contextlib
import collections
try:
import queue
@@ -737,6 +738,51 @@ def dict_filter(dictionary, filter_function):
return dict((k, v) for k, v in dictionary.items() if filter_function(k, v))
# Source: http://stackoverflow.com/a/6190500/562769
class DefaultOrderedDict(collections.OrderedDict):
def __init__(self, default_factory=None, *a, **kw):
if default_factory is not None and not callable(default_factory):
raise TypeError('first argument must be callable')
collections.OrderedDict.__init__(self, *a, **kw)
self.default_factory = default_factory
def __getitem__(self, key):
try:
return collections.OrderedDict.__getitem__(self, key)
except KeyError:
return self.__missing__(key)
def __missing__(self, key):
if self.default_factory is None:
raise KeyError(key)
self[key] = value = self.default_factory()
return value
def __reduce__(self):
if self.default_factory is None:
args = tuple()
else:
args = self.default_factory,
return type(self), args, None, None, self.items()
def copy(self):
return self.__copy__()
def __copy__(self):
return type(self)(self.default_factory, self)
def __deepcopy__(self, memo):
import copy
return type(self)(self.default_factory,
copy.deepcopy(self.items()))
# noinspection PyMethodOverriding
def __repr__(self):
return 'OrderedDefaultDict(%s, %s)' % (self.default_factory,
collections.OrderedDict.__repr__(self))
class Object(object):
pass
+14 -12
View File
@@ -1953,18 +1953,20 @@ class MachineCom(object):
return False
_resend_request_communication_errors = ("line number",
"wrong checksum",
"missing checksum",
"format error",
"expected line")
_recoverable_communication_errors = ("no line number with checksum",)
_sd_card_errors = ("volume.init",
"openroot",
"workdir",
"error writing to file",
"cannot open",
"cannot enter")
_recoverable_communication_errors = ("no line number with checksum",)
_resend_request_communication_errors = ("line number", # since this error class get's checked after recoverable
# communication errors, we can use this broad term here
"checksum", # since this error class get's checked after recoverable
# communication errors, we can use this broad term here
"format error",
"expected line")
_sd_card_errors = ("volume.init",
"openroot",
"workdir",
"error writing to file",
"cannot open",
"open failed",
"cannot enter")
def _handle_errors(self, line):
if line is None:
return
+57
View File
@@ -46,6 +46,63 @@ def get_octoprint_version(base=False):
return octoprint_version
def is_released_octoprint_version(version=None):
"""
>>> import pkg_resources
>>> is_released_octoprint_version(version=pkg_resources.parse_version("1.3.6rc3"))
True
>>> is_released_octoprint_version(version=pkg_resources.parse_version("1.3.6rc3.dev2+g1234"))
False
>>> is_released_octoprint_version(version=pkg_resources.parse_version("1.3.6"))
True
>>> is_released_octoprint_version(version=pkg_resources.parse_version("1.3.6.post1+g1234"))
True
>>> is_released_octoprint_version(version=pkg_resources.parse_version("1.3.6.post1.dev0+g1234"))
False
>>> is_released_octoprint_version(version=pkg_resources.parse_version("1.3.7.dev123+g23545"))
False
"""
if version is None:
version = get_octoprint_version()
if isinstance(version, tuple):
# old setuptools
return "*@" not in version
else:
# new setuptools
return "dev" not in version.public
def is_stable_octoprint_version(version=None):
"""
>>> import pkg_resources
>>> is_stable_octoprint_version(version=pkg_resources.parse_version("1.3.6rc3"))
False
>>> is_stable_octoprint_version(version=pkg_resources.parse_version("1.3.6rc3.dev2+g1234"))
False
>>> is_stable_octoprint_version(version=pkg_resources.parse_version("1.3.6"))
True
>>> is_stable_octoprint_version(version=pkg_resources.parse_version("1.3.6.post1+g1234"))
True
>>> is_stable_octoprint_version(version=pkg_resources.parse_version("1.3.6.post1.dev0+g1234"))
False
>>> is_stable_octoprint_version(version=pkg_resources.parse_version("1.3.7.dev123+g23545"))
False
"""
if version is None:
version = get_octoprint_version()
if not is_released_octoprint_version(version=version):
return False
if isinstance(version, tuple):
return "*a" not in version and "*b" not in version and "*c" not in version
else:
return not version.is_prerelease
def is_octoprint_compatible(*compatibility_entries, **kwargs):
"""
Tests if the current ``octoprint_version`` is compatible to any of the provided ``compatibility_entries``.
+237
View File
@@ -0,0 +1,237 @@
import unittest
import mock
import ddt
import octoprint.util.comm
@ddt.ddt
class TestCommErrorHandling(unittest.TestCase):
def setUp(self):
self._comm = mock.create_autospec(octoprint.util.comm.MachineCom)
# mocks
self._comm._handle_errors = lambda *args, **kwargs: octoprint.util.comm.MachineCom._handle_errors(self._comm, *args, **kwargs)
self._comm._recoverable_communication_errors = octoprint.util.comm.MachineCom._recoverable_communication_errors
self._comm._resend_request_communication_errors = octoprint.util.comm.MachineCom._resend_request_communication_errors
self._comm._sd_card_errors = octoprint.util.comm.MachineCom._sd_card_errors
self._comm._lastCommError = None
self._comm._errorValue = None
self._comm._clear_to_send = mock.Mock()
# settings
self._comm._ignore_errors = False
self._comm._disconnect_on_errors = True
self._comm.isPrinting.return_value = True
self._comm.isError.return_value = False
@ddt.data(
# Marlin
"Error: Line Number is not Last Line Number+1, Last Line: 1",
# Repetier
"Error: Expected Line 1 got 2",
# !! error type for good measure
"!! expected line 1 got 2"
)
def test_lineno_mismatch(self, line):
result = self._comm._handle_errors(line)
self.assertEqual(line, result)
self.assert_resend()
@ddt.data(
# Marlin
"Error: No Line Number with checksum, Last Line: 1",
)
def test_lineno_missing(self, line):
"""Should simulate OK to force resend request"""
result = self._comm._handle_errors(line)
self.assertEqual(line, result)
self.assert_recoverable()
@ddt.data(
# Marlin
"Error: checksum mismatch",
# Repetier
"Error: Wrong checksum",
)
def test_checksum_mismatch(self, line):
"""Should prepare receiving resend request"""
result = self._comm._handle_errors(line)
self.assertEqual(line, result)
self.assert_resend()
@ddt.data(
# Marlin
"Error: No Checksum with line number, Last Line: 1",
# Repetier
"Error: Missing checksum",
)
def test_checksum_missing(self, line):
"""Should prepare receiving resend request"""
result = self._comm._handle_errors(line)
self.assertEqual(line, result)
self.assert_resend()
@ddt.data(
# Marlin
"Error: volume.init failed",
"Error: openRoot failed",
"Error: workDir open failed",
"Error: Cannot enter subdir: folder",
# Repetier
"Error: file.open failed",
# Marlin & Repetier (halleluja!)
"Error: error writing to file",
"Error: open failed, File: foo.gco",
# Legacy?
"Error: Cannot open foo.gco",
)
def test_sd_error(self, line):
"""Should pass"""
result = self._comm._handle_errors(line)
self.assertEqual(line, result)
self.assert_nop()
@ddt.data(
# Marlin
"Error: Unknown command: \"ABC\"",
# Repetier
"Error: Unknown command:ABC",
)
def test_unknown_command(self, line):
"""Should pass"""
result = self._comm._handle_errors(line)
self.assertEqual(line, result)
self.assert_nop()
@ddt.data("Error: Printer on fire")
def test_other_error_disconnect(self, line):
"""Should trigger escalation"""
result = self._comm._handle_errors(line)
self.assertEqual(line, result)
# what should have happened
self.assert_disconnected()
# what should not have happened
self.assert_not_handle_ok()
self.assert_not_last_comm_error()
self.assert_not_print_cancelled()
self.assert_not_cleared_to_send()
@ddt.data("Error: Printer on fire")
def test_other_error_cancel(self, line):
"""Should trigger print cancel"""
self._comm._disconnect_on_errors = False
result = self._comm._handle_errors(line)
self.assertEqual(line, result)
# what should have happened
self.assert_print_cancelled()
self.assert_cleared_to_send()
# what should not have happened
self.assert_not_handle_ok()
self.assert_not_last_comm_error()
self.assert_not_disconnected()
@ddt.data("Error: Printer on fire")
def test_other_error_ignored(self, line):
"""Should only log"""
self._comm._ignore_errors = True
result = self._comm._handle_errors(line)
self.assertEqual(line, result)
# what should have happened
self.assert_cleared_to_send()
# what should not have happened
self.assert_not_handle_ok()
self.assert_not_last_comm_error()
self.assert_not_print_cancelled()
def test_not_an_error(self):
"""Should pass"""
result = self._comm._handle_errors("Not an error")
self.assertEqual("Not an error", result)
self.assert_nop()
def test_already_error(self):
"""Should pass"""
self._comm.isError.return_value = True
result = self._comm._handle_errors("Error: Printer on fire")
self.assertEqual("Error: Printer on fire", result)
self.assert_nop()
def test_line_none(self):
"""Should pass"""
self.assertIsNone(self._comm._handle_errors(None))
##~~ assertion helpers
def assert_handle_ok(self):
self._comm._handle_ok.assert_called_once()
def assert_not_handle_ok(self):
self._comm._handle_ok.assert_not_called()
def assert_last_comm_error(self):
self.assertIsNotNone(self._comm._lastCommError)
def assert_not_last_comm_error(self):
self.assertIsNone(self._comm._lastCommError)
def assert_disconnected(self):
self.assertIsNotNone(self._comm._errorValue)
self._comm._changeState.assert_called_once()
def assert_not_disconnected(self):
self.assertIsNone(self._comm._errorValue)
self._comm._changeState.assert_not_called()
def assert_print_cancelled(self):
self._comm.cancelPrint.assert_called_once()
def assert_not_print_cancelled(self):
self._comm.cancelPrint.assert_not_called()
def assert_cleared_to_send(self):
self._comm._clear_to_send.set.assert_called_once()
def assert_not_cleared_to_send(self):
self._comm._clear_to_send.set.assert_not_called()
def assert_nop(self):
self.assert_not_handle_ok()
self.assert_not_last_comm_error()
self.assert_not_disconnected()
self.assert_not_print_cancelled()
self.assert_not_cleared_to_send()
def assert_recoverable(self):
self.assert_handle_ok()
self.assert_not_last_comm_error()
self.assert_not_disconnected()
self.assert_not_print_cancelled()
self.assert_not_cleared_to_send()
def assert_resend(self):
self.assert_last_comm_error()
self.assert_not_handle_ok()
self.assert_not_disconnected()
self.assert_not_print_cancelled()
self.assert_not_cleared_to_send()
Binary file not shown.
File diff suppressed because it is too large. Load diff
+17 -6
View File
@@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: OctoPrint 1.3.6.dev192+ge9d17f0f.dirty\n"
"Project-Id-Version: OctoPrint 1.3.6rc2.dev10+g41eb9481\n"
"Report-Msgid-Bugs-To: i18n@octoprint.org\n"
"POT-Creation-Date: 2017-11-30 18:14+0100\n"
"POT-Creation-Date: 2017-12-05 12:29+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -349,6 +349,17 @@ msgid ""
msgstr ""
#: src/octoprint/plugins/corewizard/templates/corewizard_pluginblacklist_wizard.jinja2:9
#: src/octoprint/templates/snippets/settings/server/serverPluginBlacklistDescription.jinja2:7
#, python-format
msgid ""
"\n"
" By default, OctoPrint will use the blacklist hosted at "
"<code>plugins.octoprint.org/blacklist.json</code> which you\n"
" can also take a look at in a more human readable format <a "
"href=\"%(url)s\" target=\"_blank\">here</a>.\n"
msgstr ""
#: src/octoprint/plugins/corewizard/templates/corewizard_pluginblacklist_wizard.jinja2:14
msgid ""
"\n"
" Please decide whether to allow fetch and use of this centralized "
@@ -357,15 +368,15 @@ msgid ""
"Server right from within OctoPrint.\n"
msgstr ""
#: src/octoprint/plugins/corewizard/templates/corewizard_pluginblacklist_wizard.jinja2:15
#: src/octoprint/plugins/corewizard/templates/corewizard_pluginblacklist_wizard.jinja2:20
msgid "Disable Plugin Blacklist Processing"
msgstr ""
#: src/octoprint/plugins/corewizard/templates/corewizard_pluginblacklist_wizard.jinja2:16
#: src/octoprint/plugins/corewizard/templates/corewizard_pluginblacklist_wizard.jinja2:21
msgid "Enable Plugin Blacklist Processing"
msgstr ""
#: src/octoprint/plugins/corewizard/templates/corewizard_pluginblacklist_wizard.jinja2:20
#: src/octoprint/plugins/corewizard/templates/corewizard_pluginblacklist_wizard.jinja2:25
msgid ""
"\n"
" Plugin blacklist processing is <strong class=\"text-"
@@ -373,7 +384,7 @@ msgid ""
" "
msgstr ""
#: src/octoprint/plugins/corewizard/templates/corewizard_pluginblacklist_wizard.jinja2:23
#: src/octoprint/plugins/corewizard/templates/corewizard_pluginblacklist_wizard.jinja2:28
msgid ""
"\n"
" Plugin blacklist processing is <strong class=\"text-"