Merge branch 'maintenance' into devel

# Conflicts:
#	src/octoprint/static/js/app/main.js
This commit is contained in:
Gina Häußge committed 2017-12-01 16:10:12 +01:00
commit eb5a3d1d36
24 files changed
+3393 -1814

No files matched your search

+1 -1
View File
@@ -62,7 +62,7 @@ to also include a link to a file with which to reproduce the problem.]
[Try to reproduce your problem in safe mode. You can find information
on how to enable safe mode in the Contribution Guidelines.]
#### Branch & Commit or Version of OctoPrint
#### Version of OctoPrint
[Can be found in the lower left corner of the web interface. ALWAYS INCLUDE.]
+7 -7
View File
@@ -16,16 +16,16 @@ prerelease
HEAD
\(detached.*
# maintenance is currently the branch for preparation of maintenance release 1.3.6
# maintenance is currently the branch for preparation of maintenance release 1.3.7
# so are any fix/... and improve/... branches
maintenance 1.3.6 1a6dbb3f4a5bef857cdeb13c031b9deca2cf30a2 pep440-dev
fix/.* 1.3.6 1a6dbb3f4a5bef857cdeb13c031b9deca2cf30a2 pep440-dev
improve/.* 1.3.6 1a6dbb3f4a5bef857cdeb13c031b9deca2cf30a2 pep440-dev
maintenance 1.3.7 99e1c3ac007a0eee9d6f908e598c6b029f3ae40c pep440-dev
fix/.* 1.3.7 99e1c3ac007a0eee9d6f908e598c6b029f3ae40c pep440-dev
improve/.* 1.3.7 99e1c3ac007a0eee9d6f908e598c6b029f3ae40c 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.6rc2
# so is regressionfix/...
staging/maintenance 1.3.6rc1 77753ca02602d3a798d6b0a22535e6fd69ff448a pep440-dev
regressionfix/.* 1.3.6rc1 77753ca02602d3a798d6b0a22535e6fd69ff448a pep440-dev
staging/maintenance 1.3.6rc2 99e1c3ac007a0eee9d6f908e598c6b029f3ae40c pep440-dev
regressionfix/.* 1.3.6rc2 99e1c3ac007a0eee9d6f908e598c6b029f3ae40c 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
+109
View File
@@ -1,5 +1,114 @@
# OctoPrint Changelog
## 1.3.6rc1 (2017-12-01)
### Note for upgraders and plugin authors: Change in the bundling of JS assets can lead to issues in plugins
A change to solve issues with plugins bundling JS assets that cause interference with other plugins (e.g. through the declaration of `"use strict"`) and in general to add better isolation and error handling might cause errors for some plugins that go beyond your run-off-the-mill view model and also implicitly declare new globals.
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/).
### Improvements
* [#203](https://github.com/foosel/OctoPrint/issues/203) - Allow selecting the current tab via URL hashs. Also update URL hash when switching tabs, thus adding this to the browser history and allowing quicker back and forth navigation through the browser's back and forward buttons.
* [#1026](https://github.com/foosel/OctoPrint/issues/1026) - Automatically upper case parameters in GCODE commands sent from the Terminal tab. A black list is in place that prevent upper casing of parameters for GCODE commands where it doesn't make sense (default: `M117`). See also [#2177](https://github.com/foosel/OctoPrint/pull/2177).
* [#2050](https://github.com/foosel/OctoPrint/issues/2050) - New hook [`octoprint.comm.protocol.temperatures.received`](http://docs.octoprint.org/en/maintenance/plugins/hooks.html#octoprint-comm-protocol-temperatures-received) that allows plugins to further preprocess/sanitize temperature data received from the printer.
* [#2055](https://github.com/foosel/OctoPrint/issues/2055) - Increased the size of the API key field in the settings.
* [#2056](https://github.com/foosel/OctoPrint/issues/2056) - Added a Copy button to the API key field in the settings and user settings.
* [#2094](https://github.com/foosel/OctoPrint/issues/2094) - Allow UTF-8 display names for uploaded files. The files will still get an ASCII only name on disk, but the UTF-8 name used during upload will also be persisted and shown in the file list. This also allows using emojis in your file and folder names now.
* [#2104](https://github.com/foosel/OctoPrint/issues/2104) - Allow more URL schemes for installing plugins from. Supported schemes should now mirror what `pip` itself supports: `http`, `https`, `git`, `git+http`, `git+https`, `git+ssh`, `git+git`, `hg+http`, `hg+https`, `hg+static-http`, `hg+ssh`, `svn`, `svn+svn`, `svn+http`, `svn+https`, `svn+ssh`, `bzr+http`, `bzr+https`, `bzr+ssh`, `bzr+sftp`, `bzr+ftp`, `bzr+lp`.
* [#2109](https://github.com/foosel/OctoPrint/pull/2109) - New decorator `@firstrun_only_access` for API endpoints that should only be available before first setup has been completed.
* [#2111](https://github.com/foosel/OctoPrint/issues/2111) - Made the file list's scroll bar wider.
* [#2131](https://github.com/foosel/OctoPrint/issues/2131) - Added warning to restart, shutdown, reboot and update confirmations that that may disrupt ongoing prints, even those run from the printer's internal storage/SD. See also [#2146](https://github.com/foosel/OctoPrint/pull/2146) and [#2152](https://github.com/foosel/OctoPrint/pull/2152).
* [#2138](https://github.com/foosel/OctoPrint/issues/2138) - Slightly longer timeout when attempting to read from serial during auto detection via programming mode. Might help with detection of some slower printer controllers under certain circumstances.
* [#2200](https://github.com/foosel/OctoPrint/issues/2200) - Wrap all JS assets of plugins into one anonymous function per plugin. That way plugins using `"use strict";` won't cause hard to debug and weird issues with other plugins bundled after them. The down side is that plugins currently relying on implicit declaration of global helper functions or variables (`function convert(value) { ... }`) to be available outside of their own plugin's JS assets will now run into errors. To compensate for that while affected plugins are adjusted to declare globals explicitly (`window.convert = function(value) { ... }`), a temporary feature flag was added as "Settings > Features > Enable legacy plugin asset bundling" that switches back to the old form of bundling until plugins you rely on are updated. This flag will be removed again in a later version (currently planned for 1.3.8). See also the note above and [#2246](https://github.com/foosel/OctoPrint/issues/2246).
* [#2229](https://github.com/foosel/OctoPrint/issues/2229) - Added note to printer profile dialog that the nozzle offsets for multi extruder setups are only to be configured if they are not already set in the printer's firmware.
* [#2232](https://github.com/foosel/OctoPrint/issues/2232) - Disable movement distance buttons when not connected to the printer or when printing, since they don't have any use then.
* [#2239](https://github.com/foosel/OctoPrint/pull/2239) - Improved the check summing speed, thus improving the general achievable throughput on the comm layer.
* Allow cancelling of file transfers
* Made check of how old an unrendered timelapse is more lenient buy looking at both the creation and last modification date and using the younger one.
* Made notifications in general auto-close faster.
* Make the first profile saved for a slicer the default profile for that slicer.
* New command `server` for testing server connections on the [JS test API](http://docs.octoprint.org/en/maintenance/api/util.html#post--api-util-test).
* New hook [`octoprint.accesscontrol.keyvalidator`](http://docs.octoprint.org/en/maintenance/plugins/hooks.html#octoprint-accesscontrol-keyvalidator) that allows plugins to validate their own customized API keys to be used to access OctoPrint.
* Updated `cookiecutter`, `requests` and `psutil` dependencies.
* Added safety warning to first run wizard.
* More error resilience against broken view models.
* New sub command `octoprint safemode`. Will set the `server.startOnceInSafeMode` setting in the config so that the next (re)start of the server after issuing this command will happen in safe mode.
* New sub command `octoprint config effective`. Will report the effective config.
* New centralized plugin blacklist (opt-in). Allows to prevent plugins/certain versions of plugins known to cause crippling issues with the normal operation of OctoPrint to be disabled from loading, if the user has opted to do so in the settings/wizard.
* Log how to enable `serial.log` to `serial.log` if it's disabled. That will hopefully put at least a small dent in the amount of "It's empty!" responses in tickets ;)
* Force new Pypi index URL in `requirements.txt` as an additional work around against old tooling.
* Prefer plain `pip` over `git` for updating OctoPrint.
* Added environment detection and logging on startup. That should give us more information about the environment to produce a reported bug in.
* Added OctoPi support plugin that provides information about the detected OctoPi version. Will only load if OctoPi is detected.
* More dynamic plugin mixin detection. Now using a base class instead of having to list all types manually. Should greatly reduce overhead of adding new mixin types.
* Support leaf merging for file extension tree, allowing to add new file extensions to types registered by default.
* Allow non GCODE SD file transfers if registered as `machinecode` through e.g. a plugin's file extension hook. Caution: This doesn't make streaming arbitrary files to the printer via serial work magically. It merely allows that, it's up to the firmware to actually be able to handle that. Also, the regular GCODE streaming protocol is used, so if the streamed file contains control characters from that (e.g. `M29` to signal the end of the streaming process), stuff will break!
* Added a test button for the online connectivity check.
* Announcements plugin: Added UTM Tags.
* Cura plugin: Less `not configured yet` logging.
* GCODE viewer: Added advanced options that allow configuring display of bounding boxes, sorting by layers and hiding of empty layers.
* GCODE viewer: Persist all options to local storage so they will be automatically set again the next time the GCODE viewer is used in the same browser.
* Software update: Auto-hide "Everything is up-to-date" notification.
* Easier copying of terminal contents thanks to dedicated copy button.
* Timelapse: [#2067](https://github.com/foosel/OctoPrint/issues/2067) - Added rate limiting to z-based timelapse capturing to prevent issues when accidentally leaving this mode on with vase mode prints.
* Timelapse: Refactored configuration form & added reset button to switch back to currently active settings.
* Timelapse: Sort timelapses by modification instead of creation time (creation time can be newer if a backup restore was done).
* Virtual printer: Support configurable ambient temperature for testing.
* Virtual printer: Support configurable reset lines.
* Virtual printer: Added new debug trigger `trigger_missing_lineno`.
* Virtual printer: Allow empty/`None` prepared oks, allowing to simulate lost acknowledgements right on start.
* Docs: [#2142](https://github.com/foosel/OctoPrint/pull/2142) - Added documentation for the bundled virtual printer plugin.
* Docs: [#2234](https://github.com/foosel/OctoPrint/pull/2234) - Added info on how to install under Suse Linux.
* Docs: Added example PyCharm run configuration that includes automatic dependency updates on start.
* Docs: Added information on how to run the test suite.
* Various refactorings
* Various documentation updates
### Bug fixes
* [#2044](https://github.com/foosel/OctoPrint/pull/2044) - Fix various typos in strings and comments
* [#2048](https://github.com/foosel/OctoPrint/pull/2048) & [#2176](https://github.com/foosel/OctoPrint/pull/2176) - Fixed various warnings during documentation generation.
* [#2077](https://github.com/foosel/OctoPrint/issues/2077) - Fix an issue with shared nozzles and the temperature graph, causing temperature to not be reported properly when another tool but the first one is selected. See also [#2077](https://github.com/foosel/OctoPrint/pull/2123)
* [#2108](https://github.com/foosel/OctoPrint/issues/2108) - Added no-op default action to login form so that username + password aren't sent as GET parameters if for some reason the user tries to log in before the view models are properly bound and thus the AJAX POST submission method is attached.
* [#2111](https://github.com/foosel/OctoPrint/issues/2111) - Prevent file list's scroll bar from fading out.
* [#2146](https://github.com/foosel/OctoPrint/issues/2147) - Fix initialization of temperature graph if it's not on the first tab due to tab reordering.
* [#2166](https://github.com/foosel/OctoPrint/issues/2166) - Workaround for a Firefox bug that causes the Drag-n-Drop overlay to never go away if the file is dragged outside of the browser window.
* [#2167](https://github.com/foosel/OctoPrint/issues/2167) - Fixed grammar of print time estimation tooltip
* [#2175](https://github.com/foosel/OctoPrint/issues/2175) - Cancel printing when an external reset of the printer is detected on the serial connection.
* [#2181](https://github.com/foosel/OctoPrint/issues/2181) - More resilience against non-standard `M115` responses.
* [#2182](https://github.com/foosel/OctoPrint/pull/2182) - Don't start tracking non existing or nonfunctional tools if encountering a temperature command referencing said tool. See also [kantlivelong/OctoPrint-PSUControl#68](https://github.com/kantlivelong/OctoPrint-PSUControl/issues/68).
* [#2196](https://github.com/foosel/OctoPrint/issues/2196) - Marked API key fields as `readonly` instead of `disabled` to allow their contents to be copied in Firefox (which wasn't possible before).
* [#2203](https://github.com/foosel/OctoPrint/issues/2203) - Reset temperature offsets to 0 when disconnected from the printer.
* [#2206](https://github.com/foosel/OctoPrint/issues/2206) - Disable pre-configured timelapse if snapshot URL of ffmpeg path are unset.
* [#2214](https://github.com/foosel/OctoPrint/issues/2214) - Fixed temperature fields not selecting in MS Edge on focus.
* [#2217](https://github.com/foosel/OctoPrint/pull/2217) - Fix an issue in `octoprint.util` causing a crash when running under PyPy instead of CPython.
* [#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".
* 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.
* More resilience against corrupt `.metadata.yaml` files.
* More resilience against corrupt/invalid entries for system actions.
* More resilience against invalid JSON command requests.
* More resilience against broken packages in the python environment.
* Don't evaluate `onWebcamLoaded` more than once when switching to the webcam tab.
* Fixed `octoprint config` sub command.
* Fixed deactivated user accounts being able to login (albeit without a persistent session). Show fitting error instead.
* Fixed temperature auto report after an external reset.
* Don't log full request headers in Tornado on an error.
* Fix displayed notification message for synchronous system commands. Was accidentally swapped with the one for asynchronous system commands.
* GCODE viewer: Fix error on empty layers.
* Virtual printer: Fix resend simuation.
* Docs: Fixed CSS of line numbered listings.
* Docs: Updated mermaid to fix a deprecation warning.
([Commits](https://github.com/foosel/OctoPrint/compare/1.3.5...1.3.6rc1))
## 1.3.5 (2017-10-16)
### Improvements
+1 -1
View File
@@ -160,7 +160,7 @@ only provided here as some additional information for you), **even if only addin
[Try to reproduce your problem in safe mode. You can find information
on how to enable safe mode in the Contribution Guidelines.]
#### Branch & Commit or Version of OctoPrint
#### Version of OctoPrint
[Can be found in the lower left corner of the web interface. ALWAYS INCLUDE.]
+1 -4
View File
@@ -21,16 +21,13 @@ thanks to everyone who contributed!
* DeltaMaker 3D Printers
* E3D BigBox
* Ernesto Martinez
* Exovite
* F. Kunsmann
* Farren Young II
* Frank Sander
* Gary Deen
* Gary N McKinney
* George Robles
* günter weber
* James Seigel
* Jamie R McGuigan
* Jason Lawrence
* Jeff Moe
* Josh Daniels
@@ -64,4 +61,4 @@ thanks to everyone who contributed!
* Timeshell.ca
* Trent Shumay
and 1133 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)!
and 1151 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)!
+3
View File
@@ -4,6 +4,9 @@
Job operations
**************
Use these operations to query the currently selected file and start/cancel/restart/pause the
actual print job.
.. contents::
.. _sec-api-jobs-command:
+11
View File
@@ -990,6 +990,17 @@ Use the following settings to configure the server:
# DNS port against which to check (default: 53 - the default DNS port)
port: 53
# Configuration of the plugin blacklist
pluginBlacklist:
# whether use of the blacklist is enabled, defaults to false
enabled: false
# the URL from which to fetch the blacklist
url: http://plugins.octoprint.org/blacklist.json
# time to live of the cached blacklist, in seconds (default: 15 minutes)
ttl: 15 * 60
# Settings of when to display what disk space warning
diskspace:
+69
View File
@@ -174,6 +174,75 @@ As you can see, the ``disable_hotends`` and ``disable_bed`` snippets utilize the
extruders and set their temperature to 0, and to also set the bed temperature
to 0 if a heated bed is configured.
.. _sec-features-gcode_scripts-examples:
Examples
--------
.. _sec-features-gcode_scripts-examples-more_nifty_pause_and_resume:
More nifty pause and resume
...........................
If you do not have a multi-extruder setup, aren't printing from SD and have "Log position on pause" enabled under
Settings > Serial > Advanced options, the following ``afterPrintPaused`` and
``beforePrintResumed`` scripts might be interesting for you. With something like them in place, OctoPrint will move your print head
out of the way to a safe rest position (here ``G1 X0 Y0``, you might want to adjust that) on pause and move it back
to the persisted pause position on resume, making sure to also reset the extruder and feedrate.
.. code-block:: jinja
:caption: ``afterPrintPaused`` script
{% if pause_position.x is not none %}
; relative XYZE
G91
M83
; retract filament, move Z slightly upwards
G1 Z+5 E-5 F4500
; absolute XYZE
M82
G90
; move to a safe rest position, adjust as necessary
G1 X0 Y0
{% endif %}
.. code-block:: jinja
:caption: ``beforePrintResumed`` script
{% if pause_position.x is not none %}
; relative extruder
M83
; prime nozzle
G1 E-5 F4500
G1 E5 F4500
G1 E5 F4500
; absolute E
M82
; absolute XYZ
G90
; reset E
G92 E{{ pause_position.e }}
; move back to pause position XYZ
G1 X{{ pause_position.x }} Y{{ pause_position.y }} Z{{ pause_position.z }} F4500
; reset to feed rate before pause if available
{% if pause_position.f is not none %}G1 F{{ pause_position.f }}{% endif %}
{% endif %}
.. warning::
As mentioned in the warning above and the description of the example itself, this will *only* work if you are
not printing from SD and not using multiple extruders since OctoPrint will only then be able to track the
necessary position data and print parameters due to firmware limitations.
.. seealso::
`Jinja Template Designer Documentation <http://jinja.octoprint.org/templates.html>`_
+31 -31
View File
@@ -12,7 +12,7 @@ versions = get_versions()
__version__ = versions['version']
__branch__ = versions.get('branch', None)
__display_version__ = "{} ({} branch)".format(__version__, __branch__) if __branch__ else __version__
__display_version__ = __version__
__revision__ = versions.get('full-revisionid', versions.get('full', None))
del versions
@@ -96,17 +96,17 @@ def init_platform(basedir, configfile, use_logging_file=True, logging_file=None,
after_safe_mode(**kwargs)
event_manager = init_event_manager(settings)
kwargs["event_manager"] = event_manager
if callable(after_event_manager):
after_event_manager(**kwargs)
connectivity_checker = init_connectivity_checker(settings, event_manager)
kwargs["connectivity_checker"] = connectivity_checker
if callable(after_connectivity_checker):
after_connectivity_checker(**kwargs)
plugin_manager = init_pluginsystem(settings,
safe_mode=safe_mode,
ignore_blacklist=ignore_blacklist,
@@ -115,10 +115,10 @@ def init_platform(basedir, configfile, use_logging_file=True, logging_file=None,
if callable(after_plugin_manager):
after_plugin_manager(**kwargs)
environment_detector = init_environment_detector(plugin_manager)
kwargs["environment_detector"] = environment_detector
if callable(after_environment_detector):
after_environment_detector(**kwargs)
@@ -314,7 +314,7 @@ def init_pluginsystem(settings, safe_mode=False, ignore_blacklist=True, connecti
settings.getBaseFolder("plugins")]
plugin_entry_points = ["octoprint.plugin"]
plugin_disabled_list = settings.get(["plugins", "_disabled"])
plugin_blacklist = []
if not ignore_blacklist and settings.getBoolean(["server", "pluginBlacklist", "enabled"]):
plugin_blacklist = get_plugin_blacklist(settings, connectivity_checker=connectivity_checker)
@@ -403,34 +403,34 @@ def get_plugin_blacklist(settings, connectivity_checker=None):
import os
import time
import yaml
from octoprint.util import bom_aware_open
from octoprint.util.version import is_octoprint_compatible
logger = log.getLogger(__name__ + ".startup")
if connectivity_checker is not None and not connectivity_checker.online:
logger.info("We don't appear to be online, not fetching plugin blacklist")
return []
def format_blacklist(entries):
format_entry = lambda x: "{} ({})".format(x[0], x[1]) if isinstance(x, (list, tuple)) and len(x) == 2 \
else "{} (any)".format(x)
return ", ".join(map(format_entry, entries))
def process_blacklist(entries):
result = []
if not isinstance(entries, list):
return result
for entry in entries:
if not "plugin" in entry:
continue
if "octoversions" in entry and not is_octoprint_compatible(*entry["octoversions"]):
continue
if "version" in entry:
logger.debug("Blacklisted plugin: {}, version: {}".format(entry["plugin"], entry["version"]))
result.append((entry["plugin"], entry["version"]))
@@ -441,28 +441,28 @@ def get_plugin_blacklist(settings, connectivity_checker=None):
else:
logger.debug("Blacklisted plugin: {}".format(entry["plugin"]))
result.append(entry["key"])
return result
def fetch_blacklist_from_cache(path, ttl):
if not os.path.isfile(path):
return None
if os.stat(path).st_mtime + ttl < time.time():
return None
with bom_aware_open(path, encoding="utf-8", mode="r") as f:
result = yaml.safe_load(f)
if isinstance(result, list):
return result
def fetch_blacklist_from_url(url, timeout=3, cache=None):
result = []
try:
r = requests.get(url, timeout=timeout)
result = process_blacklist(r.json())
if cache is not None:
try:
with bom_aware_open(cache, encoding="utf-8", mode="w") as f:
@@ -472,23 +472,23 @@ def get_plugin_blacklist(settings, connectivity_checker=None):
except:
logger.info("Unable to fetch plugin blacklist from {}, proceeding without it.".format(url))
return result
try:
# first attempt to fetch from cache
cache_path = os.path.join(settings.getBaseFolder("data"), "plugin_blacklist.yaml")
ttl = settings.getInt(["server", "pluginBlacklist", "ttl"])
blacklist = fetch_blacklist_from_cache(cache_path, ttl)
if blacklist is None:
# no result from the cache, let's fetch it fresh
url = settings.get(["server", "pluginBlacklist", "url"])
timeout = settings.getFloat(["server", "pluginBlacklist", "timeout"])
blacklist = fetch_blacklist_from_url(url, timeout=timeout, cache=cache_path)
if blacklist is None:
# still now result, so no blacklist
blacklist = []
if blacklist:
logger.info("Blacklist processing done, "
"adding {} blacklisted plugin versions: {}".format(len(blacklist),
@@ -509,16 +509,16 @@ def init_event_manager(settings):
def init_connectivity_checker(settings, event_manager):
from octoprint.events import Events
from octoprint.util import ConnectivityChecker
# start regular check if we are connected to the internet
connectivityEnabled = settings.getBoolean(["server", "onlineCheck", "enabled"])
connectivityInterval = settings.getInt(["server", "onlineCheck", "interval"])
connectivityHost = settings.get(["server", "onlineCheck", "host"])
connectivityPort = settings.getInt(["server", "onlineCheck", "port"])
def on_connectivity_change(old_value, new_value):
event_manager.fire(Events.CONNECTIVITY_CHANGED, payload=dict(old=old_value, new=new_value))
connectivityChecker = ConnectivityChecker(connectivityInterval,
connectivityHost,
port=connectivityPort,
+3 -3
View File
@@ -81,8 +81,8 @@ def run_server(basedir, configfile, host, port, debug, allow_root, logging_confi
safe_mode=safe_mode,
ignore_blacklist=ignore_blacklist,
after_safe_mode=log_startup,
after_plugin_manager=log_register_rollover)
after_environment_detector=log_register_rollover)
settings, _, safe_mode, event_manager, connectivity_checker, plugin_manager, environment_detector = components
except FatalStartupError as e:
@@ -152,7 +152,7 @@ def enable_safemode(ctx, **kwargs):
settings.setBoolean(["server", "startOnceInSafeMode"], True)
settings.save()
click.echo("Safe mode flag set, OctoPrint will start in safe mode on next restart.")
+54 -29
View File
@@ -1,5 +1,9 @@
# coding=utf-8
from __future__ import absolute_import
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
__copyright__ = "Copyright (C) 2017 The OctoPrint Project - Released under terms of the AGPLv3 License"
import copy
import logging
import os
@@ -11,7 +15,6 @@ import yaml
import psutil
from octoprint.plugin import EnvironmentDetectionPlugin
from octoprint.util import get_formatted_size
from octoprint.util.platform import get_os
class EnvironmentDetector(object):
@@ -34,58 +37,77 @@ class EnvironmentDetector(object):
return copy.deepcopy(self._cache)
def run_detection(self, notify_plugins=True):
environment = dict()
environment["os"] = self._detect_os()
environment["python"] = self._detect_python()
environment["hardware"] = self._detect_hardware()
try:
environment = dict()
environment["os"] = self._detect_os()
environment["python"] = self._detect_python()
environment["hardware"] = self._detect_hardware()
plugin_result = self._detect_from_plugins()
if plugin_result:
environment["plugins"] = plugin_result
plugin_result = self._detect_from_plugins()
if plugin_result:
environment["plugins"] = plugin_result
with self._cache_lock:
self._cache = environment
with self._cache_lock:
self._cache = environment
if notify_plugins:
self.notify_plugins()
if notify_plugins:
self.notify_plugins()
return environment
return environment
except:
self._logger.exception("Unexpected error while detecting environment")
with self._cache_lock:
self._cache = dict()
return self._cache
def _detect_os(self):
return dict(id=get_os(),
platform=sys.platform)
def _detect_python(self):
result = dict()
result = dict(version="unknown",
pip="unknown")
# determine python version
result["version"] = platform.python_version()
try:
result["version"] = platform.python_version()
except:
self._logger.exception("Error detecting python version")
# determine if we are running from a virtual environment
if hasattr(sys, "real_prefix") or (hasattr(sys, "base_prefix") and os.path.realpath(sys.prefix) != os.path.realpath(sys.base_prefix)):
result["virtualenv"] = sys.prefix
try:
if hasattr(sys, "real_prefix") or (hasattr(sys, "base_prefix") and os.path.realpath(sys.prefix) != os.path.realpath(sys.base_prefix)):
result["virtualenv"] = sys.prefix
except:
self._logger.exception("Error detecting whether we are running in a virtual environment")
# try to find pip version
try:
import pip
result["pip"] = pip.__version__
except:
result["pip"] = "unknown"
self._logger.exception("Error detecting pip version")
return result
def _detect_hardware(self):
cores = psutil.cpu_count()
cpu_freq = psutil.cpu_freq()
ram = psutil.virtual_memory()
result = dict(cores="unknown",
freq="unknown",
ram="unknown")
try:
cores = psutil.cpu_count()
cpu_freq = psutil.cpu_freq()
ram = psutil.virtual_memory()
if cores:
result["cores"] = cores
if cpu_freq and hasattr(cpu_freq, "max"):
result["freq"] = cpu_freq.max
if ram and hasattr(ram, "total"):
result["ram"] = ram.total
except:
self._logger.exception("Error while detecting hardware environment")
result = dict()
if cores:
result["cores"] = cores
if cpu_freq and hasattr(cpu_freq, "max"):
result["freq"] = cpu_freq.max
if ram and hasattr(ram, "total"):
result["ram"] = ram.total
return result
def _detect_from_plugins(self):
@@ -110,7 +132,10 @@ class EnvironmentDetector(object):
else:
self._logger.log(level, message)
_log(self._format())
try:
_log(self._format())
except:
self._logger.exception("Error logging detected environment")
def _format(self):
with self._cache_lock:
+1 -1
View File
@@ -27,7 +27,7 @@ class OctoPrintLogHandler(CleaningTimedRotatingFileHandler):
def doRollover(self):
CleaningTimedRotatingFileHandler.doRollover(self)
for rcb in self.__class__.rollover_callbacks:
for rcb in self.rollover_callbacks:
callback, args, kwargs = rcb
callback(*args, **kwargs)
@@ -125,14 +125,7 @@ class OctoPiSupportPlugin(octoprint.plugin.EnvironmentDetectionPlugin,
]
def get_template_vars(self):
version = self._get_version()
cpuinfo = self._get_cpuinfo()
model = self._get_model()
return dict(version=version,
rpi_revision=cpuinfo.get("revision", "unknown"),
rpi_serial=cpuinfo.get("serial", "unknown"),
rpi_model=model)
return dict(version=self._get_version())
#~~ Helpers
@@ -1,6 +1,6 @@
<h3>{{ _('About OctoPi') }}</h3>
<h4>{{ _('The ready-to-go Raspberry Pi image with OctoPrint') }}</h4>
<h4>The ready-to-go Raspberry Pi image with OctoPrint</h4>
<p>Version <span class="plugin_octopi_support_version">{{ plugin_octopi_support_version }}</span></p>
@@ -30,13 +30,3 @@
<a href="https://www.gnu.org/licenses/gpl-3.0.en.html" target="_blank" rel="noreferrer noopener">www.gnu.org/licenses/gpl-3.0.en.html</a>.
</p>
{% if plugin_octopi_support_rpi_model != "unknown" %}
<h3>{{ _('About this Raspberry Pi') }}</h3>
<ul>
<li>Model: {{ plugin_octopi_support_rpi_model }}</li>
<li>Revision: {{ plugin_octopi_support_rpi_revision }}</li>
<li>Serial: {{ plugin_octopi_support_rpi_serial }}</li>
</ul>
{% endif %}
+26 -7
View File
@@ -13,7 +13,7 @@ except:
import urlparse
from webassets.bundle import Bundle
from webassets.merge import MemoryHunk
from webassets.merge import MemoryHunk, BaseHunk
from webassets.filter import Filter
from webassets.filter.cssrewrite.base import PatternRewriter
import webassets.filter.cssrewrite.urlpath as urlpath
@@ -105,17 +105,36 @@ class JsDelimiterBundler(Filter):
out.write("\n;\n")
_PLUGIN_BUNDLE_WRAPPER = \
class ChainedHunk(BaseHunk):
def __init__(self, *hunks):
self._hunks = hunks
def mtime(self):
pass
def data(self):
result = u""
for hunk in self._hunks:
if isinstance(hunk, tuple) and len(hunk) == 2:
hunk, f = hunk
else:
f = lambda x: x
result += f(hunk.data())
return result
_PLUGIN_BUNDLE_WRAPPER_PREFIX = \
u"""// JS assets for plugin {plugin}
(function () {{
try {{
{contents}
"""
_PLUGIN_BUNDLE_WRAPPER_SUFFIX = \
u"""
}} catch (error) {{
log.error("Error in JS assets for plugin {plugin}:", (error.stack || error));
}}
}})();
"""
class JsPluginBundle(Bundle):
def __init__(self, plugin, *args, **kwargs):
Bundle.__init__(self, *args, **kwargs)
@@ -128,6 +147,6 @@ class JsPluginBundle(Bundle):
parent_filters=parent_filters, extra_filters=extra_filters,
disable_cache=disable_cache)
# TODO find a solution that eats less memory - maybe a ChainedMemoryHunk instead?
return MemoryHunk(_PLUGIN_BUNDLE_WRAPPER.format(contents=hunk.data().replace("\n", "\n "),
plugin=self.plugin))
return ChainedHunk(MemoryHunk(_PLUGIN_BUNDLE_WRAPPER_PREFIX.format(plugin=self.plugin)),
(hunk, lambda x: x.replace("\n", "\n ")),
MemoryHunk(_PLUGIN_BUNDLE_WRAPPER_SUFFIX.format(plugin=self.plugin)))
+27 -25
View File
@@ -105,12 +105,12 @@ $(function() {
var userAgent = (navigator && navigator.userAgent || "").toLowerCase();
var vendor = (navigator && navigator.vendor || "").toLowerCase();
exports.browser.opera = userAgent.match(/opera|opr/) != null;
exports.browser.chrome = !exports.browser.opera && /google inc/.test(vendor) && userAgent.match(/chrome|crios/) != null;
exports.browser.firefox = userAgent.match(/firefox|fxios/) != null;
exports.browser.ie = userAgent.match(/msie|trident/) != null;
exports.browser.edge = userAgent.match(/edge/) != null;
exports.browser.safari = !exports.browser.chrome && !exports.browser.edge && !exports.browser.opera && userAgent.match(/safari/) != null;
exports.browser.opera = userAgent.match(/opera|opr/) !== null;
exports.browser.chrome = !exports.browser.opera && /google inc/.test(vendor) && userAgent.match(/chrome|crios/) !== null;
exports.browser.firefox = userAgent.match(/firefox|fxios/) !== null;
exports.browser.ie = userAgent.match(/msie|trident/) !== null;
exports.browser.edge = userAgent.match(/edge/) !== null;
exports.browser.safari = !exports.browser.chrome && !exports.browser.edge && !exports.browser.opera && userAgent.match(/safari/) !== null;
exports.browser.mobile = $.browser.mobile;
exports.browser.desktop = !exports.browser.mobile;
@@ -132,8 +132,7 @@ $(function() {
// work around a stupid iOS6 bug where ajax requests get cached and only work once, as described at
// http://stackoverflow.com/questions/12506897/is-safari-on-ios-6-caching-ajax-results
$.ajaxPrefilter(function(options, originalOptions, jqXHR) {
if (options.type != "GET") {
var headers;
if (options.type !== "GET") {
if (options.hasOwnProperty("headers")) {
options.headers["Cache-Control"] = "no-cache";
} else {
@@ -199,7 +198,7 @@ $(function() {
return new PNotify(options);
}
var autoDisplay = options.auto_display != false;
var autoDisplay = options.auto_display !== false;
var params = $.extend(true, {}, options);
params.auto_display = false;
@@ -453,7 +452,7 @@ $(function() {
"z-index": 9999
}).off('click')
.on('click', function (e) {
if (e.target.tagName.toLowerCase() == "input")
if (e.target.tagName.toLowerCase() === "input")
return;
$(this).hide();
@@ -486,7 +485,7 @@ $(function() {
$.fn.lazyload = function() {
return this.each(function() {
if (this.tagName.toLowerCase() != "img") return;
if (this.tagName.toLowerCase() !== "img") return;
var src = this.getAttribute("data-src");
if (src) {
@@ -510,7 +509,7 @@ $(function() {
callViewModels(allViewModels, "onAfterTabChange", [current, previous]);
};
var tabs = $('#tabs a[data-toggle="tab"]');
var tabs = $('#tabs').find('a[data-toggle="tab"]');
tabs.on('show', function (e) {
var current = e.target.hash;
var previous = e.relatedTarget.hash;
@@ -521,11 +520,26 @@ $(function() {
var current = e.target.hash;
var previous = e.relatedTarget.hash;
onAfterTabChange(current, previous);
// make sure we also update the hash but stick to the current scroll position
var scrollmem = $('body').scrollTop() || $('html').scrollTop();
window.location.hash = current;
$('html,body').scrollTop(scrollmem);
});
onTabChange(OCTOPRINT_INITIAL_TAB);
onAfterTabChange(OCTOPRINT_INITIAL_TAB, undefined);
var changeTab = function() {
var hashtag = window.location.hash;
if (!hashtag) return;
var tab = $('#tabs').find('a[href="' + hashtag + '"]');
if (tab) {
tab.tab("show");
}
};
// Fix input element click problems on dropdowns
$(".dropdown input, .dropdown label").click(function(e) {
e.stopPropagation();
@@ -539,17 +553,6 @@ $(function() {
// reload overlay
$("#reloadui_overlay_reload").click(function() { location.reload(); });
var changeTab = function()
{
var hashtag = window.location.hash;
var tab = $('#tabs a[href="' + hashtag + '"]');
if (tab.length)
{
tab.tab("show");
onTabChange(hashtag);
}
}
//~~ final initialization - passive login, settings fetch, view model binding
if (!_.has(viewModelMap, "settingsViewModel")) {
@@ -669,8 +672,7 @@ $(function() {
changeTab();
});
if (window.location.hash != "")
{
if (window.location.hash !== "") {
changeTab();
}
@@ -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="https://github.com/foosel/OctoPrint/releases/tag/1.3.6" %}
<span class="help-block">{% trans url="http://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
@@ -27,7 +27,7 @@
<div data-bind="visible: !sharedNozzle()" style="display: none">
<div class="control-group">
<div class="controls">
{{ _('Please specify the nozzle offsets of the extruders relative to the first nozzle T0.') }}
{{ _('Please specify the nozzle offsets of the extruders relative to the first nozzle T0 <strong>if you haven\'t already done so in your firmware</strong>. Otherwise leave them at (0,0).') }}
</div>
</div>
+1 -1
View File
@@ -73,7 +73,7 @@
<div class="distance">
<div class="btn-group" data-toggle="buttons-radio" id="jog_distance">
<!-- ko foreach: distances -->
<button type="button" class="btn distance" data-bind="enable: $root.loginState.isUser(), text: $data, click: function() { $root.distance($data) }, css: { active: $root.distance() === $data }, attr: { id: 'control-distance' + $root.stripDistanceDecimal($data) }"></button>
<button type="button" class="btn distance" data-bind="enable: $root.isOperational() && !$root.isPrinting() && $root.loginState.isUser(), text: $data, click: function() { $root.distance($data) }, css: { active: $root.distance() === $data }, attr: { id: 'control-distance' + $root.stripDistanceDecimal($data) }"></button>
<!-- /ko -->
</div>
</div>
File diff suppressed because it is too large. Load diff
Binary file not shown.
File diff suppressed because it is too large. Load diff
+882 -539
View File
File diff suppressed because it is too large. Load diff