Merge branch 'maintenance' into devel

This commit is contained in:
Gina Häußge committed 2021-08-04 15:55:54 +02:00
commit 4156ccc08f
27 files changed
+9077 -7143

No files matched your search

+1
View File
@@ -1,5 +1,6 @@
approve_label: "approved"
problem_label: "needs some work"
ignore_label: "skip validation"
allowed_targets: ["maintenance", "devel", "staging/maintenance", "staging/devel"]
forbidden_sources:
+2 -1
View File
@@ -1,7 +1,8 @@
name: "Pull Request Automation"
on:
pull_request_target:
types: ["opened", "synchronize", "reopened", "edited", "labeled", "unlabeled"]
#types: ["opened", "synchronize", "reopened", "edited", "labeled", "unlabeled"]
types: ["opened"]
jobs:
pr-automation:
+7 -7
View File
@@ -18,21 +18,21 @@ prerelease
HEAD
\(detached.*
# maintenance is currently the branch for preparation of maintenance release 1.7.0
# maintenance is currently the branch for preparation of maintenance release 1.8.0
# so are any fix/... and improve/... branches
maintenance 1.7.0 07c4630d126617c2ae98a9c23ad49facf7bf0bbd pep440-dev
fix/.* 1.7.0 07c4630d126617c2ae98a9c23ad49facf7bf0bbd pep440-dev
improve/.* 1.7.0 07c4630d126617c2ae98a9c23ad49facf7bf0bbd pep440-dev
maintenance 1.8.0 3fe45661cd79c5137d9d4f5f4adb4d9519bc2084 pep440-dev
fix/.* 1.8.0 3fe45661cd79c5137d9d4f5f4adb4d9519bc2084 pep440-dev
improve/.* 1.8.0 3fe45661cd79c5137d9d4f5f4adb4d9519bc2084 pep440-dev
# staging/bugfix is the branch for preparation of the 1.6.1 bugfix release
# so are any bug/... branches
staging/bugfix 1.6.1 29484fb2926960279e62881d6ee073c374a2a5fe pep440-dev
bug/.* 1.6.1 29484fb2926960279e62881d6ee073c374a2a5fe pep440-dev
# staging/maintenance is currently the branch for preparation of 1.6.0rc4
# staging/maintenance is currently the branch for preparation of 1.7.0rc2
# so is regressionfix/...
staging/maintenance 1.6.0rc4 7054a726bb3dc363a98ec6944b24e07879bb389b pep440-dev
regressionfix/.* 1.6.0rc4 7054a726bb3dc363a98ec6944b24e07879bb389b pep440-dev
staging/maintenance 1.7.0rc2 3fe45661cd79c5137d9d4f5f4adb4d9519bc2084 pep440-dev
regressionfix/.* 1.7.0rc2 3fe45661cd79c5137d9d4f5f4adb4d9519bc2084 pep440-dev
# staging/devel is currently inactive (but has the 1.4.1rc4 namespace)
staging/devel 1.4.1rc4 650d54d1885409fa1d411eb54b9e8c7ff428910f pep440-dev
+2
View File
@@ -146,6 +146,8 @@ date of first contribution):
* ["sparxooo"](https://github.com/sparxooo)
* ["Stevil Knevil"](https://github.com/StevilKnevil)
* [ldursw](https://github.com/ldursw)
* [Ian Wilt](https://github.com/ianwiltdotcom)
* [Ben Sycha](https://github.com/Sycha)
OctoPrint started off as a fork of [Cura](https://github.com/daid/Cura) by
[Daid Braam](https://github.com/daid). Parts of its communication layer and
+10 -9
View File
@@ -9,6 +9,7 @@ thanks to everyone who contributed!
* 3D-TECH
* 3DPrinterOS
* Arnljot Arntsen
* Artillery 3D
* Ash King
* BigTreeTech
* Boris Hussein
@@ -18,56 +19,56 @@ thanks to everyone who contributed!
* Chris Lynch
* Christian Petropolis
* Christian Wolf
* Christian Würthner
* Christoph Sigrist
* Creality3D
* D Brian Kimmel
* Dana Voigt
* David Bounds
* DeltaMaker 3D Printers
* Dennis Breining
* Dennis Christilaw
* Douglas Floyd
* Dr. Frank Wester
* Eric Betts
* Ernesto Martinez
* Franziska Kunsmann
* George Robles
* Greg Holloway
* Hog Duske
* Hopewell Medical Acupuncture Center
* Itay Shem-tov
* Jeremy Cole
* Joshua Wills
* Julian Melo
* Justin Kaufman
* Kaile Riser
* Kale Stedman
* Kazuhiro Ogura
* Kelly C McNiece
* Kenneth Jiang
* Kurt Wubbels
* Kyle Menigoz
* LA 3D Printer Repair
* Lachlan Bell
* Lee Dohm
* LulzBot
* Makespace Madrid
* Mark Walker
* Michael Aumock
* Mike Kershaw
* Miles Flavel
* Mosaic Manufacturing
* Nat Friedman
* Neil R. Goldberg
* Norman Jaffe
* Ory Weaver
* Patrick Glyré
* Peopoly
* Pete Barnwell
* Prof Yuh Wen Chen
* Raise3D
* Randy C. Will
* Ranjib Dey
* Richard McGuire
* Richard Michaud
* Richard Stocks
* Rigid3D
* Robert Gusek
* Ronald Griehsler
* Sacha Telgenhof
* Sebastien Andrivet
* Stefan Krister
* Steve Thompson
@@ -77,4 +78,4 @@ thanks to everyone who contributed!
* Ulderico Cirello
* Ulrich Kempken
and 2350 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel) or via [GitHub Sponsors](https://github.com/users/foosel/sponsorship)!
and 2334 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel) or via [GitHub Sponsors](https://github.com/users/foosel/sponsorship)!
+64
View File
@@ -365,6 +365,14 @@ Files
- 0..1
- :ref:`GCODE analysis information <sec-api-datamodel-files-gcodeanalysis>`
- Information from the analysis of the GCODE file, if available. Left out in abridged version.
* - ``prints``
- 0..1
- :ref:`Print history information <sec-api-datamodel-files-prints>`
- Information about previous prints of the file. Left out if the file has never been printed.
* - ``statistics``
- 0..1
- :ref:`Print statistics information <sec-api-datamodel-files-stats>`
- Statistics about the file, based on the previous print times. Left out if the file has never been printed.
.. _sec-api-datamodel-files-fileabridged:
@@ -506,6 +514,62 @@ References
- The model from which this file was generated (e.g. an STL, currently not used). Never present for
folders.
.. _sec-api-datamodel-files-prints:
Print History
-------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``success``
- 1
- Number
- Number of successful prints
* - ``failure``
- 1
- Number
- Number of failed prints
* - ``last.date``
- 1
- Unix Timestamp
- Last date this file was printed
* - ``last.printTime``
- 1
- Float
- Last print time in seconds
* - ``last.success``
- 1
- Boolean
- Whether the last print was a success or not
.. _sec-api-datamodel-files-stats:
Print Statistics
----------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``averagePrintTime``
- 1
- Object
- Object that maps printer profile names to the last print time of the file, in seconds
* - ``lastPrintTime``
- 1
- Object
- Object that maps printer profile names to the average print time of the file, in seconds
.. _sec-api-datamodel-access:
Access control
+99
View File
@@ -315,3 +315,102 @@ Otherwise go through Settings.
Make sure you are running a PyCharm version of 2016.1 or later, or manually fix
`a debugger bug contained in earlier versions <https://youtrack.jetbrains.com/issue/PY-18365>`_ or plugin management
will not work in your developer install when running OctoPrint from PyCharm in debug mode.
Visual Studio Code (vscode)
---------------------------
- Install Visual Studio Code from `code.visualstudio.com <https://code.visualstudio.com/Download>`_
- Open folder select OctoPrint checkout folder (e.g. ``~/devel/OctoPrint`` or ``C:\Devel\OctoPrint``)
- Create a directory ``.vscode`` if not already present in the root of the project
- Create the following files inside the ``.vscode`` directory
settings.json
.. code-block:: json
{
"python.defaultInterpreterPath": "venv3/bin/python",
"python.formatting.provider": "black",
"python.formatting.blackArgs": [
"--config",
"black.toml"
],
"editor.formatOnSave": true,
"python.sortImports.args": [
"--profile=black",
],
"[python]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
},
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
"python.linting.enabled": true
}
tasks.json
.. code-block:: json
{
"version": "2.0.0",
"tasks": [
{
"label": "clean build artifacts",
"type": "shell",
"command": "python ./setup.py clean"
},
{
"label": "build docs",
"type": "shell",
"command": "sphinx-build -b html ./docs ./docs/_build"
}
]
}
launch.json
.. code-block:: json
{
"version": "0.2.0",
"configurations": [
{
"name": "OctoPrint",
"type": "python",
"request": "launch",
"module": "octoprint",
"args": [
"serve",
"--debug"
],
"cwd": "${workspaceFolder}/src",
"preLaunchTask": "clean build artifacts"
}
]
}
In the terminal install the python extension by running this command:
.. code-block:: bash
code --install-extension ms-python.python
In vscode terminal, or with venv active install code formatter black and linter flake8 by running:
.. code-block:: bash
python -m pip install -U black flake8 flake8-bugbear
Summary of vscode config:
* Pressing ``F5`` will now start OctoPrint in debug mode
* Your terminal inside vscode uses the virtual python environment
* Saving a file will run an auto formatter and import sort
* ``Ctrl+Shift+B`` can be used to run the ``build docs`` task to rebuild the documentation
+5
View File
@@ -607,6 +607,11 @@ Eject
EStop
An ``M112`` was sent to the printer through OctoPrint (not triggered when printing from SD!)
FilamentChange
An ``M600``, ``M701`` or ``M702`` was sent to the printer through OctoPrint (not triggered when printing from SD!)
.. versionadded:: 1.7.0
PositionUpdate
The response to an ``M114`` was received by OctoPrint. The payload contains the current position information
parsed from the response and (in the case of the selected tool ``t`` and the current feedrate ``f``) tracked
+2 -1
View File
@@ -70,7 +70,8 @@ Context
All GCODE scripts have access to the following template variables through the template context:
* ``printer_profile``: The currently selected :ref:`Printer Profile <sec-modules-printer-profile>`, including
information such as the extruder count, the build volume size, the filament diameter etc.
information such as the extruder count, the build volume size, the filament diameter etc. The individual properties
follow the common data model for :ref:`printer profiles <sec-api-printerprofiles-datamodel-profile>`.
* ``last_position``: Last position reported by the printer via `M114` (might be unset if no `M114` was sent so far!).
Consists of ``x``, ``y``, ``z`` and ``e`` coordinates as received by the printer and tracked values for ``f`` and
current tool ``t`` taken from commands sent through OctoPrint. All of these coordinates might be ``None`` if no
+11 -11
View File
@@ -24,7 +24,7 @@ INSTALL_REQUIRES = [
# additional OctoPrint plugins that are maintained on a different release cycle
"OctoPrint-FileCheck>=2021.2.23",
"OctoPrint-FirmwareCheck>=2021.2.4",
"OctoPrint-PiSupport>=2021.3.26",
"OctoPrint-PiSupport>=2021.8.2",
# the following dependencies are non trivial to update since later versions
# introduce backwards incompatible changes that might affect plugins, or due to
# other observed problems
@@ -35,12 +35,12 @@ INSTALL_REQUIRES = [
"flask>=1.1.2,<2",
"Jinja2>=2.11.2,<3",
"Flask-Login>=0.5,<0.6", # flask-login doesn't use semver & breaks stuff on minor version increases
"Flask-Babel>=1.0,<2",
"Flask-Babel>=1.0,<2", # newer versions require Python 3
"Flask-Assets>=2.0,<3",
"werkzeug>=1.0.1,<2",
"itsdangerous>=1.1.0,<2",
"cachelib>=0.1,<1",
"PyYAML>=5.3.1,<6",
"werkzeug>=1.0.1,<2", # newer versions require Python 3
"itsdangerous>=1.1.0,<2", # newer versions require Python 3
"cachelib>=0.1,<0.2", # newer versions require Python 3
"PyYAML>=5.4.1,<6",
"pyserial>=3.4,<4",
"netaddr>=0.7.19,<1",
"watchdog==1.0.0",
@@ -53,26 +53,26 @@ INSTALL_REQUIRES = [
"semantic_version>=2.8.5,<3",
"psutil>=5.7,<6",
"Click>=7.1.2,<8",
"feedparser>=6.0.2,<7",
"feedparser>=6.0.8,<7",
"future>=0.18.2,<1", # not really needed anymore, but leaving in for py2/3 compat plugins
"websocket-client>=0.57,<1",
"wrapt>=1.12.1,<2",
"emoji>=0.5.4,<1",
"immutabledict>=1.2.0,<2",
"immutabledict>=2.1,<3",
"sentry-sdk>=0.15.1,<1",
"filetype>=1.0.7,<2",
"zeroconf>=0.24,<0.25",
"zeroconf>=0.33,<0.34",
"zipstream-new>=1.1.8,<1.2",
"pathvalidate>=2.4.1,<3",
"colorlog>=5.0.1,<6",
# vendor bundled dependencies
"unidecode>=0.04.14,<0.05", # dependency of awesome-slugify
"unidecode", # dependency of awesome-slugify, leave w/o range to not cause dependency hell w/ Octolapse deps
"blinker>=1.4,<2", # dependency of flask_principal
]
# OSX specific requirements
INSTALL_REQUIRES_OSX = [
"appdirs>=1.4.4",
"appdirs>=1.4.4,<2",
]
# Additional requirements for optional install options
+4 -4
View File
@@ -266,16 +266,16 @@ def init_logging(
"formatters": {
"simple": {"format": simple_format},
"colored": {
"class": "colorlog.ColoredFormatter",
"format": "%(log_color)s" + simple_format,
"()": "colorlog.ColoredFormatter",
"format": "%(log_color)s" + simple_format + "%(reset)s",
"reset": True,
"log_colors": {
"DEBUG": "light_white",
"DEBUG": "cyan",
"INFO": "white",
"WARNING": "yellow",
"ERROR": "red",
"CRITICAL": "bold_red",
},
"reset": True,
},
"serial": {"format": "%(asctime)s - %(message)s"},
"timings": {"format": "%(asctime)s - %(message)s"},
+1
View File
@@ -98,6 +98,7 @@ class Events:
REGISTERED_MESSAGE_RECEIVED = "RegisteredMessageReceived"
COMMAND_SUPPRESSED = "CommandSuppressed"
INVALID_TOOL_REPORTED = "InvalidToolReported"
FILAMENT_CHANGE = "FilamentChange"
# Timelapse
CAPTURE_START = "CaptureStart"
@@ -18,10 +18,10 @@ from octoprint.util.version import (
)
SENTRY_URL_SERVER = (
"https://6a544965fe6c4c6eb96f7e39352b2924@o118517.ingest.sentry.io/1373987"
"https://72786e02c7bf4e8487cc987b24f855fd@o118517.ingest.sentry.io/1373987"
)
SENTRY_URL_COREUI = (
"https://840570e9555741bcb82bd56a084fb46e@o118517.ingest.sentry.io/1374096"
"https://94a57f3316ec4d2a80d454695fcb72dd@o118517.ingest.sentry.io/1374096"
)
SETTINGS_DEFAULTS = {
@@ -0,0 +1,64 @@
# -*- coding: utf-8 -*-
from flask_babel import gettext
import octoprint.events
import octoprint.plugin
from octoprint.access import ADMIN_GROUP
class EventManagerPlugin(
octoprint.plugin.SettingsPlugin,
octoprint.plugin.AssetPlugin,
octoprint.plugin.TemplatePlugin,
):
def on_settings_load(self):
my_settings = {
"availableEvents": octoprint.events.all_events(),
"subscriptions": [],
}
events = self._settings.global_get(["events"])
if events:
my_settings["subscriptions"] = events.get("subscriptions", [])
return my_settings
def on_settings_save(self, data):
if type(data.get("subscriptions")) == list:
self._settings.global_set(
["events", "subscriptions"], data.get("subscriptions", [])
)
def get_assets(self):
return {"js": ["js/events.js"]}
def get_template_configs(self):
return [
{
"type": "settings",
"custom_bindings": True,
"name": gettext("Event Manager"),
}
]
def get_additional_permissions(self):
return [
{
"key": "MANAGE",
"name": "Event management",
"description": gettext(
"Allows for the management of event subscriptions."
),
"default_groups": [ADMIN_GROUP],
"roles": ["manage"],
}
]
__plugin_name__ = gettext("Event Manager")
__plugin_pythoncompat__ = ">=2.7,<4"
__plugin_author__ = "jneilliii"
__plugin_license__ = "AGPLv3"
__plugin_description__ = gettext(
"Plugin to configure event subscriptions available in config.yaml."
)
__plugin_implementation__ = EventManagerPlugin()
@@ -0,0 +1,59 @@
/*
* View model for OctoPrint-EventCoordinator
*
* Author: jneilliii
* License: AGPLv3
*/
$(function () {
function eventManagerViewModel(parameters) {
var self = this;
self.settingsViewModel = parameters[0];
self.selectedCommand = ko.observable();
self.eventDetails = function (data) {
if (data === false) {
return {
event: ko.observable(""),
command: ko.observable(""),
type: ko.observable(""),
enabled: ko.observable(true),
debug: ko.observable(false)
};
} else {
if (!data.hasOwnProperty("enabled")) {
data["enabled"] = ko.observable(true);
}
if (!data.hasOwnProperty("debug")) {
data["debug"] = ko.observable(false);
}
return data;
}
};
self.addEvent = function () {
self.selectedCommand(self.eventDetails(false));
self.settingsViewModel.settings.plugins.eventmanager.subscriptions.push(
self.selectedCommand()
);
$("#EventManagerEditor").modal("show");
};
self.editEvent = function (data) {
self.selectedCommand(self.eventDetails(data));
$("#EventManagerEditor").modal("show");
};
self.removeEvent = function (data) {
self.settingsViewModel.settings.plugins.eventmanager.subscriptions.remove(
data
);
};
}
OCTOPRINT_VIEWMODELS.push({
construct: eventManagerViewModel,
dependencies: ["settingsViewModel"],
elements: ["#settings_plugin_eventmanager"]
});
});
@@ -0,0 +1,65 @@
<div class="alert alert-block">
<p>{{ _('For additional information on OctoPrint events please see <a href="%(url)s" target="_blank" rel="noopener noreferer">the official documentation</a>.', url='https://docs.octoprint.org/en/master/events/index.html') }}</p>
<p><strong>{{ _('Warning:') }}</strong> {{ _('For changes to take effect you must restart OctoPrint after saving.') }}</p>
</div>
<div class="row-fluid">
<div class="span4">{{ _('Event') }}</div>
<div class="span6">{{ _('Command') }}</div>
<div class="span2 btn-group">
<button class="btn btn-mini" data-bind="click: addEvent"><i class="fa fa-plus"></i> {{ _('Add') }}</button>
</div>
</div>
<div data-bind="foreach: settingsViewModel.settings.plugins.eventmanager.subscriptions" class="row-fluid">
<div class="row-fluid">
<div class="span4" data-bind="text: event"></div>
<div class="span6" data-bind="text: command"></div>
<div class="span2 btn-group">
<button class="btn btn-mini" data-bind="click: $root.editEvent"><i class="fa fa-pencil"></i></button>
<button class="btn btn-mini btn-danger" data-bind="click: $root.removeEvent"><i class="fa fa-trash-alt"></i></button>
</div>
</div>
</div>
<div id="EventManagerEditor" data-bind="with: selectedCommand" class="modal hide fade">
<div class="modal-header">
<a href="#" class="close" data-dismiss="modal" aria-hidden="true">&times;</a>
<h3>{{ _('Command Editor') }}</h3>
</div>
<div class="modal-body">
<div class="control-group">
<label class="control-label">{{ _('Event') }}</label>
<div class="controls">
<select class="input-block-level" data-bind="value: event, options: $root.settingsViewModel.settings.plugins.eventmanager.availableEvents().sort(), optionsCaption: 'Select Event', valueAllowUnset: true"></select>
</div>
</div>
<div class="control-group">
<label class="control-label">{{ _('Command') }}</label>
<div class="controls">
<input type="text" class="input-block-level" data-bind="value: command" />
</div>
</div>
<div class="control-group">
<label class="control-label">{{ _('Type') }}</label>
<div class="controls">
<select data-bind="value: type, options: ['gcode', 'system'], optionsCaption: 'Select Event Type', valueAllowUnset: true"></select>
</div>
</div>
<div class="control-group">
<label class="control-label">{{ _('Enabled') }}</label>
<div class="controls">
<input type="checkbox" data-bind="checked: enabled" />
</div>
</div>
<div class="control-group">
<label class="control-label">{{ _('Debug') }}</label>
<div class="controls">
<input type="checkbox" data-bind="checked: debug" />
</div>
</div>
</div>
<div class="modal-footer">
<div class="row-fluid">
{{ _('Do not forget to save in main settings.') }} <button type="button" class="btn" data-dismiss="modal">{{ _('Close') }}</button>
</div>
</div>
</div>
@@ -63,6 +63,8 @@ class SoftwareUpdatePlugin(
OCTOPRINT_RESTART_TYPES = ("pip", "single_file_plugin")
VALID_RESTART_TYPES = ("octoprint", "environment")
DATA_FORMAT_VERSION = "v4"
CHECK_OVERLAY_KEY = "softwareupdate_check_overlay"
@@ -625,15 +627,45 @@ class SoftwareUpdatePlugin(
self._save_update_log()
def _is_octoprint_outdated_and_can_update(self):
information, update_available, update_possible = self.get_current_versions()
if not update_available or not update_possible or "octoprint" not in information:
checks = self._get_configured_checks()
check = checks.get("octoprint", None)
if not check:
return False
octoprint_information = information["octoprint"]
return (
octoprint_information["updateAvailable"]
and octoprint_information["updatePossible"]
check = self._populated_check("octoprint", check)
credentials = self._settings.get(["credentials"], merged=True)
_, update_available, update_possible, _, _ = self._get_current_version(
"octoprint", check, credentials=credentials
)
if not update_available or not update_possible:
return False
restart_type = self._get_restart_type(check)
restart_command = self._get_restart_command(restart_type)
return restart_command is not None
def _get_restart_type(self, check):
if check.get("restart") in self.VALID_RESTART_TYPES:
return check["restart"]
elif "pip" in check or check.get("method") in self.OCTOPRINT_RESTART_TYPES:
return "octoprint"
else:
target_restart_type = None
return target_restart_type
def _get_restart_command(self, restart_type):
if restart_type == "octoprint":
return self._settings.global_get(
["server", "commands", "serverRestartCommand"]
)
elif restart_type == "environment":
return self._settings.global_get(
["server", "commands", "systemRestartCommand"]
)
else:
return None
# ~~ SettingsPlugin API
@@ -1087,6 +1119,8 @@ class SoftwareUpdatePlugin(
)(view)()
@octoprint.plugin.BlueprintPlugin.route("/check", methods=["GET"])
@no_firstrun_access
@Permissions.PLUGIN_SOFTWAREUPDATE_CHECK.require(403)
def check_for_update(self):
if (
not Permissions.PLUGIN_SOFTWAREUPDATE_CHECK.can()
@@ -1428,7 +1462,11 @@ class SoftwareUpdatePlugin(
def _is_wizard_update_required(self):
firstrun = self._settings.global_get(["server", "firstRun"])
return firstrun and self._is_octoprint_outdated_and_can_update()
return (
firstrun
and self._is_octoprint_outdated_and_can_update()
and not self._is_settings_wizard_required()
)
def _is_settings_wizard_required(self):
checks = self._get_configured_checks()
@@ -1442,6 +1480,14 @@ class SoftwareUpdatePlugin(
def get_wizard_version(self):
return 1
def get_wizard_details(self):
result = {}
if self._is_wizard_update_required():
information, _, _ = self.get_current_versions()
data = information.get("octoprint", {})
result["update"] = data
return result
##~~ EventHandlerPlugin API
def on_event(self, event, payload):
@@ -1881,15 +1927,7 @@ class SoftwareUpdatePlugin(
if target_result is not None:
target_results[target] = target_result
if "restart" in check:
target_restart_type = check["restart"]
elif (
"pip" in check
or check.get("method") in self.OCTOPRINT_RESTART_TYPES
):
target_restart_type = "octoprint"
else:
target_restart_type = None
target_restart_type = self._get_restart_type(check)
# if our update requires a restart we have to determine which type
if restart_type is None or (
@@ -1920,16 +1958,7 @@ class SoftwareUpdatePlugin(
# one of our updates requires a restart of either type "octoprint" or "environment". Let's see if
# we can actually perform that
restart_command = None
if restart_type == "octoprint":
restart_command = self._settings.global_get(
["server", "commands", "serverRestartCommand"]
)
elif restart_type == "environment":
restart_command = self._settings.global_get(
["server", "commands", "systemRestartCommand"]
)
restart_command = self._get_restart_command(restart_type)
if restart_command:
self._send_client_message(
"restarting",
@@ -306,74 +306,79 @@ $(function () {
);
};
self._enrichInformation = function (key, information) {
information["key"] = key;
if (
!information.hasOwnProperty("displayName") ||
information.displayName === ""
) {
information.displayName = information.key;
}
if (
!information.hasOwnProperty("displayVersion") ||
information.displayVersion === ""
) {
information.displayVersion = information.information.local.name;
}
if (
!information.hasOwnProperty("releaseNotes") ||
information.releaseNotes === ""
) {
information.releaseNotes = undefined;
}
var fullNameTemplate = gettext("%(name)s: %(version)s");
information.fullNameLocal = _.sprintf(fullNameTemplate, {
name: _.escape(information.displayName),
version: _.escape(information.displayVersion)
});
var fullNameRemoteVars = {
name: _.escape(information.displayName),
version: gettext("unknown")
};
if (
information.hasOwnProperty("information") &&
information.information.hasOwnProperty("remote") &&
information.information.remote.hasOwnProperty("name")
) {
fullNameRemoteVars.version = _.escape(
information.information.remote.name
);
}
information.fullNameRemote = _.sprintf(fullNameTemplate, fullNameRemoteVars);
if (information.releaseChannels && information.releaseChannels.current) {
information.releaseChannels.current = ko.observable(
information.releaseChannels.current
);
information.releaseChannels.current.subscribe(function (selected) {
var patch = {};
patch[key] = {channel: selected};
OctoPrint.plugins.softwareupdate.configure(patch).done(function () {
self.performCheck(false, false, false, [key]);
});
});
}
information.toggleDisabled = function () {
var patch = {};
patch[key] = {disabled: !information.disabled};
OctoPrint.plugins.softwareupdate.configure(patch).done(function () {
self.performCheck(false, false, false, [key]);
});
};
return information;
};
self.fromCheckResponse = function (data, ignoreSeen, showIfNothingNew) {
self.cacheTimestamp(data.timestamp);
var versions = [];
_.each(data.information, function (value, key) {
value["key"] = key;
if (!value.hasOwnProperty("displayName") || value.displayName === "") {
value.displayName = value.key;
}
if (
!value.hasOwnProperty("displayVersion") ||
value.displayVersion === ""
) {
value.displayVersion = value.information.local.name;
}
if (!value.hasOwnProperty("releaseNotes") || value.releaseNotes === "") {
value.releaseNotes = undefined;
}
var fullNameTemplate = gettext("%(name)s: %(version)s");
value.fullNameLocal = _.sprintf(fullNameTemplate, {
name: _.escape(value.displayName),
version: _.escape(value.displayVersion)
});
var fullNameRemoteVars = {
name: _.escape(value.displayName),
version: gettext("unknown")
};
if (
value.hasOwnProperty("information") &&
value.information.hasOwnProperty("remote") &&
value.information.remote.hasOwnProperty("name")
) {
fullNameRemoteVars.version = _.escape(value.information.remote.name);
}
value.fullNameRemote = _.sprintf(fullNameTemplate, fullNameRemoteVars);
if (value.releaseChannels && value.releaseChannels.current) {
value.releaseChannels.current = ko.observable(
value.releaseChannels.current
);
value.releaseChannels.current.subscribe(function (selected) {
var patch = {};
patch[key] = {channel: selected};
OctoPrint.plugins.softwareupdate
.configure(patch)
.done(function () {
self.performCheck(false, false, false, [key]);
});
});
}
value.toggleDisabled = function () {
var patch = {};
patch[key] = {disabled: !value.disabled};
OctoPrint.plugins.softwareupdate.configure(patch).done(function () {
self.performCheck(false, false, false, [key]);
});
};
if (key === "octoprint") {
self.octoprintData.item = value;
self.octoprintData.current(value.information.local.name);
self.octoprintData.available(value.information.remote.name);
}
self._enrichInformation(key, value);
versions.push(value);
});
self.versions.updateItems(versions);
@@ -683,14 +688,7 @@ $(function () {
};
self.performUpdate = function (force, items) {
if (
!(
self.loginState.hasPermission(
self.access.permissions.PLUGIN_SOFTWAREUPDATE_UPDATE
) || CONFIG_FIRST_RUN
)
)
return;
if (!self.updateAccess()) return;
if (self.printerState.isPrinting()) return;
self.updateInProgress = true;
@@ -747,15 +745,16 @@ $(function () {
return self.update(force, self.availableAndPossibleAndEnabled());
};
self.updateAccess = function () {
return (
self.loginState.hasPermission(
self.access.permissions.PLUGIN_SOFTWAREUPDATE_UPDATE
) || CONFIG_FIRST_RUN
);
};
self.update = function (force, items) {
if (
self.updateInProgress ||
!(
self.loginState.hasPermission(
self.access.permissions.PLUGIN_SOFTWAREUPDATE_UPDATE
) || CONFIG_FIRST_RUN
)
) {
if (self.updateInProgress || !self.updateAccess()) {
self._updateClicked = false;
return;
}
@@ -851,8 +850,10 @@ $(function () {
self._showWorkingDialog = function (title) {
if (
!self.loginState.hasPermission(
self.access.permissions.PLUGIN_SOFTWAREUPDATE_CHECK
!(
self.loginState.hasPermission(
self.access.permissions.PLUGIN_SOFTWAREUPDATE_CHECK
) || CONFIG_FIRST_RUN
)
) {
return;
@@ -929,6 +930,21 @@ $(function () {
self.performCheck();
};
self.onWizardDetails = function (data) {
if (
data.softwareupdate &&
data.softwareupdate.details &&
data.softwareupdate.details.update
) {
var value = data.softwareupdate.details.update;
self._enrichInformation("octoprint", value);
self.octoprintData.item = value;
self.octoprintData.current(value.information.local.name);
self.octoprintData.available(value.information.remote.name);
}
};
self.onDataUpdaterReconnect = function () {
if (self.waitingForRestart) {
self.waitingForRestart = false;
@@ -203,9 +203,9 @@
<h3 data-bind="text: workingTitle"></h3>
</div>
<div class="modal-body">
<pre id="settings_plugin_softwareupdate_workingdialog_output" class="pre-scrollable pre-output" style="height: 170px; display: none" data-bind="visible: loginState.isAdmin, foreach: loglines"><span data-bind="text: line, css: {stdout: stream == 'stdout', stderr: stream == 'stderr', call: stream == 'call', message: stream == 'message'}"></span></pre>
<p style="display: none" data-bind="visible: !loginState.isAdmin() && $root.working()"><i class="fas fa-spinner fa-spin"></i> {{ _('Update in progress, please wait.') }}</p>
<p style="display: none" data-bind="visible: !loginState.isAdmin() && !$root.working()">{{ _('Update done, please close this window.') }}</p>
<pre id="settings_plugin_softwareupdate_workingdialog_output" class="pre-scrollable pre-output" style="height: 170px; display: none" data-bind="visible: $root.updateAccess(), foreach: loglines"><span data-bind="text: line, css: {stdout: stream == 'stdout', stderr: stream == 'stderr', call: stream == 'call', message: stream == 'message'}"></span></pre>
<p style="display: none" data-bind="visible: !$root.updateAccess() && $root.working()"><i class="fas fa-spinner fa-spin"></i> {{ _('Update in progress, please wait.') }}</p>
<p style="display: none" data-bind="visible: !$root.updateAccess() && !$root.working()">{{ _('Update done, please close this window.') }}</p>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" data-bind="enable: !$root.working()" aria-hidden="true">{{ _('Close') }}</button>
+2 -1
View File
@@ -96,11 +96,12 @@ class PrinterStateConnection(
"*": [],
}
# TODO: Permissions should be overridable from plugins, this special case stuff here is a hack
_emit_permissions = {
"connected": [],
"reauthRequired": [],
"plugin": lambda payload: []
if payload.get("plugin") == "backup"
if payload.get("plugin") in ("backup", "softwareupdate")
and settings().getBoolean(["server", "firstRun"])
else [Permissions.STATUS],
"*": [Permissions.STATUS],
+1
View File
@@ -350,6 +350,7 @@ default_settings = {
"plugin_pluginmanager",
"plugin_softwareupdate",
"plugin_announcements",
"plugin_eventmanager",
"plugin_backup",
"plugin_tracking",
"plugin_errortracking",
File diff suppressed because it is too large. Load diff
+38 -22
View File
@@ -286,6 +286,10 @@ gcodeToEvent = {
# motors on/off
"M80": Events.POWER_ON,
"M81": Events.POWER_OFF,
# filament change
"M600": Events.FILAMENT_CHANGE,
"M701": Events.FILAMENT_CHANGE,
"M702": Events.FILAMENT_CHANGE,
}
@@ -4127,27 +4131,7 @@ class MachineCom:
self._lastResendNumber = lineToResend
self._currentResendCount = 0
if (
self._resendDelta > len(self._lastLines)
or len(self._lastLines) == 0
or self._resendDelta < 0
):
error_text = "Printer requested line {} but no sufficient history is available, can't resend".format(
lineToResend
)
self._log(error_text)
self._logger.warning(
error_text
+ ". Printer requested line {}, current line is {}, line history has {} entries.".format(
lineToResend, self._current_line, len(self._lastLines)
)
)
if self.isPrinting():
# abort the print & disconnect, there's nothing we can do to rescue it
self._trigger_error(error_text, "resend")
else:
# reset resend delta, we can't do anything about it
self._resendDelta = None
self._resendCheckPossibility(lineToResend)
# if we log resends, make sure we don't log more resends than the set rate within a window
#
@@ -4215,9 +4199,14 @@ class MachineCom:
# resend_ok_timer, so make sure that resendDelta is actually still set (see #2632)
return False
cmd = self._lastLines[-self._resendDelta].decode("ascii")
lineNumber = self._current_line - self._resendDelta
if not self._resendCheckPossibility(lineNumber):
# Something has gone wrong if we get here, but we already logged and
# handled it.
return False
cmd = self._lastLines[-self._resendDelta].decode("ascii")
result = self._enqueue_for_sending(cmd, linenumber=lineNumber, resend=True)
self._resendDelta -= 1
@@ -4232,6 +4221,33 @@ class MachineCom:
return result
def _resendCheckPossibility(self, lineno):
if (
self._resendDelta > len(self._lastLines)
or len(self._lastLines) == 0
or self._resendDelta < 0
):
error_text = "Should resend line {} but no sufficient history is available, can't resend".format(
lineno
)
self._log(error_text)
self._logger.warning(
error_text
+ ". Line to resend is {}, current line is {}, line history has {} entries.".format(
lineno, self._current_line, len(self._lastLines)
)
)
if self.isPrinting():
# abort the print & disconnect, there's nothing we can do to rescue it
self._trigger_error(error_text, "resend")
else:
# reset resend delta, we can't do anything about it
self._resendDelta = None
return False
else:
return True
def _sendCommand(self, cmd, cmd_type=None, on_sent=None, tags=None):
# Make sure we are only handling one sending job at a time
with self._sendingLock:
Binary file not shown.
File diff suppressed because it is too large. Load diff
+1003 -771
View File
File diff suppressed because it is too large. Load diff