Merge branch 'staging/maintenance' into maintenance
This commit is contained in:
commit
50bb0bcfd4
8 files changed
+83
-39
No files matched your search
@@ -681,7 +681,9 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
|
||||
self._console_logger.debug(u"{prefix} {line}".format(**locals()))
|
||||
|
||||
def _mark_plugin_enabled(self, plugin, needs_restart=False):
|
||||
disabled_list = list(self._settings.global_get(["plugins", "_disabled"]))
|
||||
disabled_list = list(self._settings.global_get(["plugins", "_disabled"],
|
||||
validator=lambda x: isinstance(x, list),
|
||||
fallback=[]))
|
||||
if plugin.key in disabled_list:
|
||||
disabled_list.remove(plugin.key)
|
||||
self._settings.global_set(["plugins", "_disabled"], disabled_list)
|
||||
@@ -699,7 +701,9 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
|
||||
version=plugin.version))
|
||||
|
||||
def _mark_plugin_disabled(self, plugin, needs_restart=False):
|
||||
disabled_list = list(self._settings.global_get(["plugins", "_disabled"]))
|
||||
disabled_list = list(self._settings.global_get(["plugins", "_disabled"],
|
||||
validator=lambda x: isinstance(x, list),
|
||||
fallback=[]))
|
||||
if not plugin.key in disabled_list:
|
||||
disabled_list.append(plugin.key)
|
||||
self._settings.global_set(["plugins", "_disabled"], disabled_list)
|
||||
|
||||
@@ -80,7 +80,7 @@ def perform_update(target, check, target_version, log_cb=None, online=True, forc
|
||||
install_arg = check["pip"].format(target_version=target_version, target=target_version)
|
||||
|
||||
logger.debug(u"Target: %s, executing pip install %s" % (target, install_arg))
|
||||
pip_args = ["install", install_arg]
|
||||
pip_args = ["install", install_arg, "--no-cache-dir"]
|
||||
pip_kwargs = dict()
|
||||
if pip_working_directory is not None:
|
||||
pip_kwargs.update(cwd=pip_working_directory)
|
||||
|
||||
@@ -82,6 +82,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
self._selectedFile = None
|
||||
|
||||
self._estimator_factory = PrintTimeEstimator
|
||||
self._estimator = None
|
||||
analysis_queue_hooks = plugin_manager().get_hooks("octoprint.printer.estimation.factory")
|
||||
for name, hook in analysis_queue_hooks.items():
|
||||
try:
|
||||
@@ -500,6 +501,10 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
if self._comm is None or not self._comm.isOperational() or self._comm.isPrinting():
|
||||
return
|
||||
|
||||
with self._selectedFileMutex:
|
||||
if self._selectedFile is None:
|
||||
return
|
||||
|
||||
self._fileManager.delete_recovery_data()
|
||||
|
||||
self._lastProgressReport = None
|
||||
@@ -749,7 +754,8 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
cleanedPrintTime = self._comm.getCleanedPrintTime()
|
||||
|
||||
printTimeLeft = printTimeLeftOrigin = None
|
||||
if progress is not None and self._estimator is not None:
|
||||
estimator = self._estimator
|
||||
if progress is not None:
|
||||
progress_int = int(progress * 100)
|
||||
if self._lastProgressReport != progress_int:
|
||||
self._lastProgressReport = progress_int
|
||||
@@ -761,7 +767,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
elif progress == 1.0:
|
||||
printTimeLeft = 0
|
||||
printTimeLeftOrigin = None
|
||||
else:
|
||||
elif estimator is not None:
|
||||
statisticalTotalPrintTime = None
|
||||
statisticalTotalPrintTimeType = None
|
||||
with self._selectedFileMutex:
|
||||
@@ -770,11 +776,11 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
statisticalTotalPrintTime = self._selectedFile["estimatedPrintTime"]
|
||||
statisticalTotalPrintTimeType = self._selectedFile.get("estimatedPrintTimeType", None)
|
||||
|
||||
printTimeLeft, printTimeLeftOrigin = self._estimator.estimate(progress,
|
||||
printTime,
|
||||
cleanedPrintTime,
|
||||
statisticalTotalPrintTime,
|
||||
statisticalTotalPrintTimeType)
|
||||
printTimeLeft, printTimeLeftOrigin = estimator.estimate(progress,
|
||||
printTime,
|
||||
cleanedPrintTime,
|
||||
statisticalTotalPrintTime,
|
||||
statisticalTotalPrintTimeType)
|
||||
|
||||
return self._dict(completion=progress * 100 if progress is not None else None,
|
||||
filepos=filepos,
|
||||
@@ -1031,6 +1037,8 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
else:
|
||||
eventManager().fire(Events.FILE_DESELECTED)
|
||||
|
||||
self._create_estimator()
|
||||
|
||||
self._setJobData(full_path, size, sd, user=user)
|
||||
self._stateMonitor.set_state(self._dict(text=self.get_state_string(), flags=self._getStateFlags()))
|
||||
|
||||
@@ -1308,20 +1316,23 @@ class StateMonitor(object):
|
||||
self._change_event.set()
|
||||
|
||||
def _work(self):
|
||||
while True:
|
||||
self._change_event.wait()
|
||||
try:
|
||||
while True:
|
||||
self._change_event.wait()
|
||||
|
||||
now = time.time()
|
||||
delta = now - self._last_update
|
||||
additional_wait_time = self._interval - delta
|
||||
if additional_wait_time > 0:
|
||||
time.sleep(additional_wait_time)
|
||||
now = time.time()
|
||||
delta = now - self._last_update
|
||||
additional_wait_time = self._interval - delta
|
||||
if additional_wait_time > 0:
|
||||
time.sleep(additional_wait_time)
|
||||
|
||||
with self._state_lock:
|
||||
data = self.get_current_data()
|
||||
self._update_callback(data)
|
||||
self._last_update = time.time()
|
||||
self._change_event.clear()
|
||||
with self._state_lock:
|
||||
data = self.get_current_data()
|
||||
self._update_callback(data)
|
||||
self._last_update = time.time()
|
||||
self._change_event.clear()
|
||||
except:
|
||||
logging.getLogger(__name__).exception("Looks like something crashed inside the state update worker. Please report this on the OctoPrint issue tracker (make sure to include logs!)")
|
||||
|
||||
def get_current_data(self):
|
||||
with self._progress_lock:
|
||||
|
||||
+15
-10
@@ -1425,17 +1425,22 @@ class Settings(object):
|
||||
#~~ getter
|
||||
|
||||
def get(self, path, **kwargs):
|
||||
error_on_path = kwargs.get("error_on_path", False)
|
||||
new_kwargs = dict(kwargs)
|
||||
if "error_on_path" in new_kwargs:
|
||||
del new_kwargs["error_on_path"]
|
||||
error_on_path = kwargs.pop("error_on_path", False)
|
||||
validator = kwargs.pop("validator", None)
|
||||
fallback = kwargs.pop("fallback", None)
|
||||
|
||||
try:
|
||||
return self._get_value(path, **new_kwargs)
|
||||
except NoSuchSettingsPath:
|
||||
if error_on_path:
|
||||
raise
|
||||
return None
|
||||
def process():
|
||||
try:
|
||||
return self._get_value(path, **kwargs)
|
||||
except NoSuchSettingsPath:
|
||||
if error_on_path:
|
||||
raise
|
||||
return None
|
||||
|
||||
result = process()
|
||||
if callable(validator) and not validator(result):
|
||||
result = fallback
|
||||
return result
|
||||
|
||||
def getInt(self, path, **kwargs):
|
||||
minimum = kwargs.pop("min", None)
|
||||
|
||||
Reference in new issue
Block a user