Merge branch 'maintenance' into devel

# Conflicts:
#	src/octoprint/plugins/pluginmanager/static/css/pluginmanager.css
#	src/octoprint/plugins/virtual_printer/virtual.py
This commit is contained in:
Gina Häußge committed 2019-10-30 15:59:30 +01:00
commit 30a4b9e9ab
21 files changed
+872 -743

No files matched your search

+24 -14
View File
@@ -19,14 +19,23 @@ _PROC_DT_MODEL_PATH = "/proc/device-tree/model"
_OCTOPI_VERSION_PATH = "/etc/octopi_version"
_VCGENCMD_THROTTLE = "/usr/bin/vcgencmd get_throttled"
### uncomment for local debugging
#import sys
#base = os.path.realpath(os.path.join(os.path.dirname(__file__), "..", "..", "..", "..", "tests", "plugins", "pi_support", "fakes"))
#_PROC_DT_MODEL_PATH = os.path.join(base, "fake_model.txt")
#_OCTOPI_VERSION_PATH = os.path.join(base, "fake_octopi.txt")
#_VCGENCMD_THROTTLE = "{} {}".format(sys.executable, os.path.join(base, "fake_vcgencmd.py"))
#import itertools
#_VCGENCMD_OUTPUT = itertools.chain(iter(("0x0", "0x0", "0x50005", "0x50000", "0x70007")), itertools.repeat("0x70000"))
_CHECK_INTERVAL_OK = 300
_CHECK_INTERVAL_THROTTLED = 30
__LOCAL_DEBUG = False
if __LOCAL_DEBUG:
### mocks & settings for local debugging
import sys
base = os.path.realpath(os.path.join(os.path.dirname(__file__), "..", "..", "..", "..", "tests", "plugins", "pi_support", "fakes"))
_PROC_DT_MODEL_PATH = os.path.join(base, "fake_model.txt")
_OCTOPI_VERSION_PATH = os.path.join(base, "fake_octopi.txt")
_VCGENCMD_THROTTLE = "{} {}".format(sys.executable, os.path.join(base, "fake_vcgencmd.py"))
import itertools
_VCGENCMD_OUTPUT = itertools.chain(iter(("0x0", "0x0", "0x50005", "0x50000", "0x70007")), itertools.repeat("0x70005"))
_CHECK_INTERVAL_OK = 10
_CHECK_INTERVAL_THROTTLED = 5
# see https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=147781&start=50#p972790
@@ -135,8 +144,11 @@ def get_proc_dt_model():
def get_vcgencmd_throttled_state(command):
output = sarge.get_stdout(command)
#output = "throttled={}".format(next(_VCGENCMD_OUTPUT)) # for local debugging
if __LOCAL_DEBUG:
output = "throttled={}".format(next(_VCGENCMD_OUTPUT)) # mock for local debugging
else:
output = sarge.get_stdout(command)
if not "throttled=0x" in output:
raise ValueError("cannot parse \"{}\" output: {}".format(command, output))
@@ -237,11 +249,9 @@ class PiSupportPlugin(octoprint.plugin.EnvironmentDetectionPlugin,
def _check_throttled_state_interval(self):
if self._throttle_state.current_issue:
# check state every 30s if something's currently amiss
return 30
return _CHECK_INTERVAL_THROTTLED
else:
# check state every 5min if nothing's currently amiss
return 300
return _CHECK_INTERVAL_OK
def _check_throttled_state_condition(self):
return self._throttle_functional
@@ -181,6 +181,8 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
helpers = self._plugin_manager.get_helpers("pi_support", "get_throttled")
if helpers and "get_throttled" in helpers:
self._get_throttled = helpers["get_throttled"]
if self._settings.get_boolean(["ignore_throttled"]):
self._logger.warn("!!! THROTTLE STATE IGNORED !!! You have configured the Plugin Manager plugin to ignore an active throttle state of the underlying system. You might run into stability issues or outright corrupt your install. Consider fixing the throttling issue instead of suppressing it.")
# decouple repository fetching from server startup
self._fetch_all_data(do_async=True)
@@ -198,7 +200,8 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
confirm_uninstall=True,
confirm_disable=False,
dependency_links=False,
hidden=[]
hidden=[],
ignore_throttled=False
)
def on_settings_save(self, data):
@@ -393,7 +396,7 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
def command_install(self, url=None, path=None, force=False, reinstall=None, dependency_links=False):
throttled = self._get_throttled()
if throttled and isinstance(throttled, dict) and throttled.get("current_issue", False):
if throttled and isinstance(throttled, dict) and throttled.get("current_issue", False) and not self._settings.get_boolean(["ignore_throttled"]):
# currently throttled, we refuse to run
return make_response("System is currently throttled, refusing to install "
"anything due to possible stability issues", 409)
@@ -33,27 +33,25 @@ $(function() {
}
},
{
"all": function(item) {
return true;
},
"bundled": function(item) {
return item.bundled;
},
"3rdparty": function(item) {
return !item.bundled;
},
"enabled": function(item) {
return item.enabled;
},
"disabled": function(item) {
return !item.enabled;
}
},
"name",
["all"],
[["all", "bundled", "3rdparty"]],
[],
[["bundled", "3rdparty"], ["enabled", "disabled"]],
0
);
if (self.plugins.currentFilters().length === 0) {
// old versions didn't have filters, we might still have that stuck in the local storage
self.plugins.addFilter("all");
}
self.repositoryplugins = new ItemListHelper(
"plugin.pluginmanager.repositoryplugins",
{
@@ -193,7 +191,7 @@ $(function() {
};
self.throttled = ko.pureComputed(function() {
return self.piSupport && self.piSupport.currentIssue();
return self.piSupport && self.piSupport.currentIssue() && !self.settingsViewModel.settings.plugins.pluginmanager.ignore_throttled();
});
self.invalidUrl = ko.pureComputed(function() {
@@ -307,7 +305,7 @@ $(function() {
} else {
self.plugins.resetSearch();
}
}
};
self.performRepositorySearch = function() {
var query = self.repositorySearchQuery();
@@ -8,7 +8,7 @@
#settings_plugin_pluginmanager_pluginlist {
display: block;
width: auto;
height: 400px;
max-height: 400px;
overflow-x: hidden;
overflow-y: scroll;
padding-right: 2px;
@@ -41,9 +41,14 @@
<div class="pull-right">
<div class="btn-group">
<button class="btn btn-small" data-bind="click: function() { plugins.addFilter('all') }, css: {active: _.contains(plugins.currentFilters(), 'all')}" title="{{ _('Show all plugins')|edq }}">All</button>
<button class="btn btn-small" data-bind="click: function() { plugins.addFilter('bundled') }, css: {active: _.contains(plugins.currentFilters(), 'bundled')}" title="{{ _('Show only bundled plugins')|edq }}">Bundled</button>
<button class="btn btn-small" data-bind="click: function() { plugins.addFilter('3rdparty') }, css: {active: _.contains(plugins.currentFilters(), '3rdparty')}" title="{{ _('Show only third-party plugins')|edq }}">3rd Party</button>
<button class="btn btn-small" data-bind="click: function() { plugins.removeFilter('bundled'); plugins.removeFilter('3rdparty'); }, css: {active: !_.contains(plugins.currentFilters(), 'bundled') && !_.contains(plugins.currentFilters(), '3rdparty')}" title="{{ _('Show both bundled and third-party plugins')|edq }}">All</button>
<button class="btn btn-small" data-bind="click: function() { plugins.addFilter('bundled') }, css: {active: _.contains(plugins.currentFilters(), 'bundled')}" title="{{ _('Show only bundled plugins')|edq }}">{{ _('Bundled') }}</button>
<button class="btn btn-small" data-bind="click: function() { plugins.addFilter('3rdparty') }, css: {active: _.contains(plugins.currentFilters(), '3rdparty')}" title="{{ _('Show only third-party plugins')|edq }}">{{ _('3rd party') }}</button>
</div>
<div class="btn-group">
<button class="btn btn-small" data-bind="click: function() { plugins.removeFilter('enabled'); plugins.removeFilter('disabled'); }, css: {active: !_.contains(plugins.currentFilters(), 'enabled') && !_.contains(plugins.currentFilters(), 'disabled')}" title="{{ _('Show both enabled and disabled plugins')|edq }}">All</button>
<button class="btn btn-small" data-bind="click: function() { plugins.addFilter('enabled') }, css: {active: _.contains(plugins.currentFilters(), 'enabled')}" title="{{ _('Show only enabled plugins')|edq }}">{{ _('Enabled') }}</button>
<button class="btn btn-small" data-bind="click: function() { plugins.addFilter('disabled') }, css: {active: _.contains(plugins.currentFilters(), 'disabled')}" title="{{ _('Show only disabled plugins')|edq }}">{{ _('Disabled') }}</button>
</div>
<button class="btn btn-small" data-bind="click: function() { $root.showPluginSettings(); }" title="{{ _('Plugin Configuration')|edq }}"><i class="fa fa-wrench"></i></button>
</div>
@@ -125,6 +125,8 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
helpers = self._plugin_manager.get_helpers("pi_support", "get_throttled")
if helpers and "get_throttled" in helpers:
self._get_throttled = helpers["get_throttled"]
if self._settings.get_boolean(["ignore_throttled"]):
self._logger.warn("!!! THROTTLE STATE IGNORED !!! You have configured the Software Update plugin to ignore an active throttle state of the underlying system. You might run into stability issues or outright corrupt your install. Consider fixing the throttling issue instead of suppressing it.")
def on_after_startup(self):
self._check_environment()
@@ -302,7 +304,9 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
"cache_ttl": 24 * 60,
"notify_users": True
"notify_users": True,
"ignore_throttled": False
}
def on_settings_load(self):
@@ -614,7 +618,7 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
@Permissions.PLUGIN_SOFTWAREUPDATE_UPDATE.require(403)
def perform_update(self):
throttled = self._get_throttled()
if throttled and isinstance(throttled, dict) and throttled.get("current_issue", False):
if throttled and isinstance(throttled, dict) and throttled.get("current_issue", False) and not self._settings.get_boolean(["ignore_throttled"]):
# currently throttled, we refuse to run
return flask.make_response("System is currently throttled, refusing to update "
"anything due to possible stability issues", 409)
@@ -1 +1 @@
#settings_plugin_softwareupdate_updatelist{display:block;width:auto;height:500px;overflow-x:hidden;overflow-y:scroll;padding-right:2px;margin-bottom:1em}td.settings_plugin_softwareupdate_column_update{width:16px}td.settings_plugin_softwareupdate_column_information .line{display:block}#settings_plugin_softwareupdate_workingdialog_output{font-size:.8em}#settings_plugin_softwareupdate_workingdialog_output .message{font-weight:700}#settings_plugin_softwareupdate_workingdialog_output .separator{font-weight:700;color:#666}#settings_plugin_softwareupdate_workingdialog_output .stdout{color:#333}#settings_plugin_softwareupdate_workingdialog_output .stderr{color:#900}#settings_plugin_softwareupdate_workingdialog_output .call{color:#009}#settings_plugin_softwareupdate_workingdialog_output .message_error{font-weight:700;color:#900}.softwareupdate_notification ul{margin:10px 0 10px 25px}.softwareupdate_notification ul .name{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block}
#settings_plugin_softwareupdate_updatelist{display:block;width:auto;max-height:500px;overflow-x:hidden;overflow-y:scroll;padding-right:2px;margin-bottom:1em}td.settings_plugin_softwareupdate_column_update{width:16px}td.settings_plugin_softwareupdate_column_information .line{display:block}#settings_plugin_softwareupdate_workingdialog_output{font-size:.8em}#settings_plugin_softwareupdate_workingdialog_output .message{font-weight:700}#settings_plugin_softwareupdate_workingdialog_output .separator{font-weight:700;color:#666}#settings_plugin_softwareupdate_workingdialog_output .stdout{color:#333}#settings_plugin_softwareupdate_workingdialog_output .stderr{color:#900}#settings_plugin_softwareupdate_workingdialog_output .call{color:#009}#settings_plugin_softwareupdate_workingdialog_output .message_error{font-weight:700;color:#900}.softwareupdate_notification ul{margin:10px 0 10px 25px}.softwareupdate_notification ul .name{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block}
@@ -102,7 +102,7 @@ $(function() {
});
self.throttled = ko.pureComputed(function() {
return self.piSupport && self.piSupport.currentIssue();
return self.piSupport && self.piSupport.currentIssue() && !self.settings.settings.plugins.pluginmanager.ignore_throttled();
});
self.onUserPermissionsChanged = self.onUserLoggedIn = self.onUserLoggedOut = function() {
@@ -497,7 +497,7 @@ $(function() {
return;
}
if (self.piSupport && self.piSupport.currentIssue()) {
if (self.throttled()) {
self._showPopup({
title: gettext("Can't update while throttled"),
text: gettext("Your system is currently throttled. OctoPrint refuses to run updates while in this state due to possible stability issues."),
@@ -1,7 +1,7 @@
#settings_plugin_softwareupdate_updatelist {
display: block;
width: auto;
height: 500px;
max-height: 500px;
overflow-x: hidden;
overflow-y: scroll;
padding-right: 2px;
@@ -550,9 +550,9 @@ class VirtualPrinter(object):
if self._sdCardReady:
self._reportSdStatus()
match = re.search(r"S([0-9]+)", data)
if match:
interval = int(match.group(1))
matchS = re.search(r"S([0-9]+)", data)
if matchS:
interval = int(matchS.group(1))
if self._sdstatus_reporter is not None:
self._sdstatus_reporter.cancel()
@@ -584,9 +584,11 @@ class VirtualPrinter(object):
def _gcode_M113(self, data):
# type: (str) -> None
interval = int(re.search(r"S([0-9]+)", data).group(1))
if 0 <= interval <= 60:
self._busyInterval = interval
matchS = re.search(r"S([0-9]+)", data)
if matchS is not None:
interval = int(matchS.group(1))
if 0 <= interval <= 60:
self._busyInterval = interval
# noinspection PyUnusedLocal
def _gcode_M114(self, data):
@@ -629,23 +631,29 @@ class VirtualPrinter(object):
def _gcode_M155(self, data):
# type: (str) -> None
interval = int(re.search(r"S([0-9]+)", data).group(1))
if self._temperature_reporter is not None:
self._temperature_reporter.cancel()
matchS = re.search(r"S([0-9]+)", data)
if matchS is not None:
interval = int(matchS.group(1))
if self._temperature_reporter is not None:
self._temperature_reporter.cancel()
if interval > 0:
self._temperature_reporter = RepeatedTimer(interval, lambda: self._send(self._generateTemperatureOutput()))
self._temperature_reporter.start()
else:
self._temperature_reporter = None
if interval > 0:
self._temperature_reporter = RepeatedTimer(interval, lambda: self._send(self._generateTemperatureOutput()))
self._temperature_reporter.start()
else:
self._temperature_reporter = None
def _gcode_M220(self, data):
# type: (str) -> None
self._feedrate_multiplier = float(re.search(r'S([0-9]+)', data).group(1))
matchS = re.search(r"S([0-9]+)", data)
if matchS is not None:
self._feedrate_multiplier = float(matchS.group(1))
def _gcode_M221(self, data):
# type: (str) -> None
self._flowrate_multiplier = float(re.search(r'S([0-9]+)', data).group(1))
matchS = re.search(r"S([0-9]+)", data)
if matchS is not None:
self._flowrate_multiplier = float(matchS.group(1))
# noinspection PyUnusedLocal
def _gcode_M400(self, data):
+3 -4
View File
@@ -839,13 +839,12 @@ function showSelectionDialog(options) {
selectionBody.append(container);
additionalClass = "span6"
} else {
container = $("<div class='row-fluid'></div>");
selectionBody.append(container);
additionalClass = "span6 offset3";
container = selectionBody;
additionalClass = "btn-block";
}
_.each(selections, function(s, i) {
var button = $('<button class="btn" data-index="' + i + '">' + selections[i] + '</button>');
var button = $('<button class="btn" style="white-space: normal; word-wrap: break-word" data-index="' + i + '">' + selections[i] + '</button>');
if (additionalClass) {
button.addClass(additionalClass);
}
@@ -372,7 +372,7 @@
<label class="control-label" for="settings-serialEmergencyCommands">{{ _('Emergency commands') }}</label>
<div class="controls">
<input type="text" class="input-block-level" id="settings-serialEmergencyCommands" data-bind="value: serial_emergencyCommands">
<span class="help-inline">{{ _('Use this to specify emergency commands which should jump any queues and - if supported by the firmware - be force sent. Just the G or M code, comma separated. Defaults to <code>M112</code>, <code>M118</code> and <code>M410</code>.') }}</span> </div>
<span class="help-inline">{{ _('Use this to specify emergency commands which should jump any queues and - if supported by the firmware - be force sent. Just the G or M code, comma separated. Defaults to <code>M112</code>, <code>M108</code> and <code>M410</code>.') }}</span> </div>
</div>
<div>
<div><small><a href="#" class="muted" data-bind="toggleContent: { class: 'fa-caret-right fa-caret-down', container: '#settings_serial_protocol_finetuning .hide' }"><i class="fa fa-caret-right"></i> {{ _('Advanced options') }}</a></small></div>
@@ -51,6 +51,6 @@
</div>
<p>
<small>{{ _('This information is used for manual control via the "Control" tab. It does NOT influence already sliced files that you upload to OctoPrint!') }}</small>
<small>{{ _('This information is used for manual control via the "Control" tab.') }}</small>
</p>
</form>
@@ -133,6 +133,6 @@
</div>
<p>
<small>{{ _('This information is used for the temperature tab, the bounding box check, the GCODE Viewer and/or when slicing from OctoPrint. It does NOT influence already sliced files that you upload to OctoPrint!') }}</small>
<small>{{ _('This information is used for the temperature tab, the bounding box check, the GCODE Viewer and/or when slicing from OctoPrint.') }}</small>
</p>
</form>
@@ -13,6 +13,7 @@
<label class="control-label">{{ _('Number of Extruders') }}</label>
<div class="controls">
<input type="number" class="input-mini text-right" min="1" max="10" data-bind="value: extruders">
<span class="help-block">{{ _('Make sure to specify number of extruders available on your printer or you might run into issues') }}</span>
</div>
</div>
<div data-bind="visible: extruders() > 1" style="display: none">
@@ -52,6 +53,6 @@
</div>
<p>
<small>{{ _('This information is used for the graph and controls available in the "Temperature" tab, the GCODE viewer and when slicing from within OctoPrint. It does NOT influence already sliced files that you upload to OctoPrint!') }}</small>
<small>{{ _('This information is used for the graph and controls available in the "Temperature" tab, the GCODE viewer, when slicing from within OctoPrint and for deciding which toolchange commands are safe to send to the printer.') }}</small>
</p>
</form>
File diff suppressed because it is too large. Load diff
+8 -1
View File
@@ -2058,7 +2058,12 @@ class MachineCom(object):
else:
self._consecutive_not_sd_printing = 0
if self.isSdFileSelected():
if not self.isSdPrinting() and current != total and current > 0:
# If we are not yet sd printing, the current does not equal the total, is larger
# than zero and has increased since the last time we saw a position report, then
# yes, this looks like we just started printing due to an external trigger.
if not self.isSdPrinting() and current != total and current > 0 \
and self._currentFile and current > self._currentFile.pos:
self.startPrint(external_sd=True)
self._currentFile.pos = current
@@ -2515,6 +2520,8 @@ class MachineCom(object):
if self._busy_protocol_support:
self._set_busy_protocol_interval()
self._consecutive_not_sd_printing = 0
def _get_temperature_timer_interval(self):
busy_default = 4.0
target_default = 2.0
Binary file not shown.
File diff suppressed because it is too large. Load diff
+282 -262
View File
File diff suppressed because it is too large. Load diff