diff --git a/.versioneer-lookup b/.versioneer-lookup index 342b9dec1..9585f8ad8 100644 --- a/.versioneer-lookup +++ b/.versioneer-lookup @@ -16,11 +16,14 @@ prerelease HEAD \(detached.* -# maintenance is currently the branch for preparation of maintenance release 1.3.3 +# maintenance is currently the branch for preparation of maintenance release 1.3.4 # so are any fix/... and improve/... branches -maintenance 1.3.3 0a69dbeddb301d5a32827a3f0d561f875df24234 pep440-dev -fix/.* 1.3.3 0a69dbeddb301d5a32827a3f0d561f875df24234 pep440-dev -improve/.* 1.3.3 0a69dbeddb301d5a32827a3f0d561f875df24234 pep440-dev +maintenance 1.3.4 3fbd477d15b5776ca929ea578c5437720aaf7f31 pep440-dev +fix/.* 1.3.4 3fbd477d15b5776ca929ea578c5437720aaf7f31 pep440-dev +improve/.* 1.3.4 3fbd477d15b5776ca929ea578c5437720aaf7f31 pep440-dev + +# staging/maintenance is currently the branch for preparation of 1.3.3rc3 (if we'll need that) +staging/maintenance 1.3.3rc2 3fbd477d15b5776ca929ea578c5437720aaf7f31 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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f3fb34118..b8ba81c03 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -365,10 +365,16 @@ There are three main branches in OctoPrint: the `maintenance` branch and are now being pushed on the "Maintenance" pre release channel for further testing. Version number follows the scheme `..rc` (e.g. `1.2.9rc1`). + * `staging/maintenance`: Any preparation for potential follow-up RCs takes place here. + Version number follows the scheme `..rc.dev` (e.g. + `1.2.9rc1.dev3`) for a current Maintenance RC of `..rc`. * `rc/devel`: This branch is reserved for future releases that have graduated from the `devel` branch and are now being pushed on the "Devel" pre release channel for further testing. Version number follows the scheme `..0rc` (e.g. `1.3.0rc1`) for a current stable OctoPrint version of `..`. + * `staging/devel`: Any preparation for potential follow-up Devel RCs takes place + here. Version number follows the scheme `..0rc.dev` (e.g. + `1.3.0rc1.dev12`) for a current Devel RC of `..0rc`. Additionally, from time to time you might see other branches pop up in the repository. Those usually have one of the following prefixes: diff --git a/src/octoprint/plugins/announcements/static/js/announcements.js b/src/octoprint/plugins/announcements/static/js/announcements.js index 2fe4dbb7d..be569b5f6 100644 --- a/src/octoprint/plugins/announcements/static/js/announcements.js +++ b/src/octoprint/plugins/announcements/static/js/announcements.js @@ -258,22 +258,22 @@ $(function() { buttons: [{ text: gettext("Later"), click: function(notice) { - self.hiddenChannels.push(key); notice.remove(); + self.hiddenChannels.push(key); } }, { text: gettext("Mark read"), click: function(notice) { - self.markRead(key, value.last); notice.remove(); + self.markRead(key, value.last); } }, { text: gettext("Read..."), addClass: "btn-primary", click: function(notice) { + notice.remove(); self.showAnnouncementDialog(key); self.markRead(key, value.last); - notice.remove(); } }] }, diff --git a/src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js b/src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js index 0ee352e0e..6ea6e8972 100644 --- a/src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js +++ b/src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js @@ -685,17 +685,21 @@ $(function() { hide: false }; + var restartClicked = false; if (self.restartCommandSpec) { options.confirm = { confirm: true, buttons: [{ text: gettext("Restart now"), - click: function () { + click: function (notice) { + if (restartClicked) return; + restartClicked = true; showConfirmationDialog({ message: gettext("This will restart your OctoPrint server."), onproceed: function() { OctoPrint.system.executeCommand("core", "restart") .done(function() { + notice.remove(); new PNotify({ title: gettext("Restart in progress"), text: gettext("The server is now being restarted in the background") @@ -707,6 +711,9 @@ $(function() { text: gettext("Trying to restart the server produced an error, please check octoprint.log for details. You'll have to restart manually.") }) }); + }, + onclose: function() { + restartClicked = false; } }); } @@ -716,6 +723,7 @@ $(function() { notification = PNotify.singleButtonNotify(options); } else if (response.needs_refresh) { + var refreshClicked = false; notification = PNotify.singleButtonNotify({ title: titleSuccess, text: textReload, @@ -724,6 +732,8 @@ $(function() { buttons: [{ text: gettext("Reload now"), click: function () { + if (refreshClicked) return; + refreshClicked = true; location.reload(true); } }] diff --git a/src/octoprint/plugins/softwareupdate/__init__.py b/src/octoprint/plugins/softwareupdate/__init__.py index d29495b1e..4060daabc 100644 --- a/src/octoprint/plugins/softwareupdate/__init__.py +++ b/src/octoprint/plugins/softwareupdate/__init__.py @@ -870,7 +870,7 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, self._logger.info("Restarting...") try: - util.execute(restart_command) + util.execute(restart_command, evaluate_returncode=False, async=True) except exceptions.ScriptError as e: self._logger.exception("Error while restarting via command {}".format(restart_command)) self._logger.warn("Restart stdout:\n{}".format(e.stdout)) diff --git a/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js b/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js index cfc20cb5d..5431186db 100644 --- a/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js +++ b/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js @@ -123,8 +123,9 @@ $(function() { self.config_updateMethod = ko.observable(); self.config_releaseChannel = ko.observable(); - self.configurationDialog = $("#settings_plugin_softwareupdate_configurationdialog"); - self.confirmationDialog = $("#softwareupdate_confirmation_dialog"); + self.configurationDialog = undefined; + self.confirmationDialog = undefined; + self._updateClicked = false; self.config_availableCheckTypes = ko.observableArray([]); self.config_availableReleaseChannels = ko.observableArray([]); @@ -357,7 +358,11 @@ $(function() { }, { text: gettext("Update now"), addClass: "btn-primary", - click: self.update + click: function() { + if (self._updateClicked) return; + self._updateClicked = true; + self.update(); + } }] }; options["buttons"] = { @@ -501,8 +506,14 @@ $(function() { }; self.update = function(force) { - if (self.updateInProgress) return; - if (!self.loginState.isAdmin()) return; + if (self.updateInProgress) { + self._updateClicked = false; + return; + } + if (!self.loginState.isAdmin()) { + self._updateClicked = false; + return; + } if (self.printerState.isPrinting()) { self._showPopup({ @@ -510,6 +521,7 @@ $(function() { text: gettext("A print job is currently in progress. Updating will be prevented until it is done."), type: "error" }); + self._updateClicked = false; } else { self.forceUpdate = (force == true); self.confirmationDialog.modal("show"); @@ -518,9 +530,13 @@ $(function() { }; self.confirmUpdate = function() { - self.confirmationDialog.modal("hide"); self.performUpdate(self.forceUpdate, _.map(self.availableAndPossible(), function(info) { return info.key })); + self.confirmationDialog.modal("hide"); + }; + + self.confirmationHidden = function() { + self._updateClicked = false; }; self._showWorkingDialog = function(title) { @@ -578,6 +594,10 @@ $(function() { self.onStartup = function() { self.workingDialog = $("#settings_plugin_softwareupdate_workingdialog"); self.workingOutput = $("#settings_plugin_softwareupdate_workingdialog_output"); + self.configurationDialog = $("#settings_plugin_softwareupdate_configurationdialog"); + self.confirmationDialog = $("#softwareupdate_confirmation_dialog"); + + self.confirmationDialog.on("hidden", self.confirmationHidden); }; self.onServerDisconnect = function() { diff --git a/src/octoprint/plugins/softwareupdate/util.py b/src/octoprint/plugins/softwareupdate/util.py index 273351829..020fce3df 100644 --- a/src/octoprint/plugins/softwareupdate/util.py +++ b/src/octoprint/plugins/softwareupdate/util.py @@ -9,12 +9,12 @@ __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms from .exceptions import ScriptError -def execute(command, cwd=None, evaluate_returncode=True): +def execute(command, cwd=None, evaluate_returncode=True, async=False): import sarge p = None try: - p = sarge.run(command, cwd=cwd, stdout=sarge.Capture(), stderr=sarge.Capture()) + p = sarge.run(command, cwd=cwd, stdout=sarge.Capture(), stderr=sarge.Capture(), async=async) except: returncode = p.returncode if p is not None else None stdout = p.stdout.text if p is not None and p.stdout is not None else "" diff --git a/src/octoprint/printer/__init__.py b/src/octoprint/printer/__init__.py index e26a80e42..8e4b1e3c3 100644 --- a/src/octoprint/printer/__init__.py +++ b/src/octoprint/printer/__init__.py @@ -299,6 +299,7 @@ class PrinterInterface(object): after the file is selected. Raises: + InvalidFileType: if the file is not a machinecode file and hence cannot be printed InvalidFileLocation: if an absolute path was provided and not contained within local storage or doesn't exist """ @@ -593,3 +594,6 @@ class UnknownScript(Exception): class InvalidFileLocation(Exception): pass + +class InvalidFileType(Exception): + pass diff --git a/src/octoprint/printer/standard.py b/src/octoprint/printer/standard.py index a0c1b817c..45c309c7e 100644 --- a/src/octoprint/printer/standard.py +++ b/src/octoprint/printer/standard.py @@ -17,9 +17,9 @@ import time from octoprint import util as util from octoprint.events import eventManager, Events -from octoprint.filemanager import FileDestinations, NoSuchStorage +from octoprint.filemanager import FileDestinations, NoSuchStorage, valid_file_type from octoprint.plugin import plugin_manager, ProgressPlugin -from octoprint.printer import PrinterInterface, PrinterCallback, UnknownScript, InvalidFileLocation +from octoprint.printer import PrinterInterface, PrinterCallback, UnknownScript, InvalidFileLocation, InvalidFileType from octoprint.printer.estimation import TimeEstimationHelper from octoprint.settings import settings from octoprint.util import comm as comm @@ -846,6 +846,9 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback): self._stateMonitor.add_temperature(data) def _validateJob(self, filename, sd): + if not valid_file_type(filename, type="machinecode"): + raise InvalidFileType("{} is not a machinecode file, cannot print".format(filename)) + if sd: return diff --git a/src/octoprint/server/__init__.py b/src/octoprint/server/__init__.py index 3a4dd7f6a..8a59c693a 100644 --- a/src/octoprint/server/__init__.py +++ b/src/octoprint/server/__init__.py @@ -550,7 +550,7 @@ class Server(object): "on_shutdown", sorting_context="ShutdownPlugin.on_shutdown") - # wait for shutdown even to be processed, but maximally for 15s + # wait for shutdown event to be processed, but maximally for 15s event_timeout = 15.0 if eventManager.join(timeout=event_timeout): self._logger.warn("Event loop was still busy processing after {}s, shutting down anyhow".format(event_timeout)) @@ -565,13 +565,16 @@ class Server(object): def sigterm_handler(*args, **kwargs): # will stop tornado on SIGTERM, making the program exit cleanly def shutdown_tornado(): + self._logger.debug("Shutting down tornado's IOLoop...") ioloop.stop() + self._logger.debug("SIGTERM received...") ioloop.add_callback_from_signal(shutdown_tornado) signal.signal(signal.SIGTERM, sigterm_handler) try: # this is the main loop - as long as tornado is running, OctoPrint is running ioloop.start() + self._logger.debug("Tornado's IOLoop stopped") except (KeyboardInterrupt, SystemExit): pass except: diff --git a/src/octoprint/static/js/app/helpers.js b/src/octoprint/static/js/app/helpers.js index 98a24d5b7..744ce15b6 100644 --- a/src/octoprint/static/js/app/helpers.js +++ b/src/octoprint/static/js/app/helpers.js @@ -646,6 +646,7 @@ function showConfirmationDialog(msg, onacknowledge, options) { var proceed = options.proceed || gettext("Proceed"); var proceedClass = options.proceedClass || "danger"; var onproceed = options.onproceed || undefined; + var onclose = options.onclose || undefined; var dialogClass = options.dialogClass || ""; var modalHeader = $('

' + title + '

'); @@ -663,14 +664,19 @@ function showConfirmationDialog(msg, onacknowledge, options) { .append($('
').addClass('modal-header').append(modalHeader)) .append($('
').addClass('modal-body').append(modalBody)) .append($('
').addClass('modal-footer').append(cancelButton).append(proceedButton)); + modal.on('hidden', function(event) { + if (onclose && _.isFunction(onclose)) { + onclose(event); + } + }); modal.modal("show"); proceedButton.click(function(e) { e.preventDefault(); - modal.modal("hide"); if (onproceed && _.isFunction(onproceed)) { onproceed(e); } + modal.modal("hide"); }); return modal; diff --git a/src/octoprint/static/js/app/viewmodels/control.js b/src/octoprint/static/js/app/viewmodels/control.js index 544eeeede..ecf86eb7f 100644 --- a/src/octoprint/static/js/app/viewmodels/control.js +++ b/src/octoprint/static/js/app/viewmodels/control.js @@ -442,6 +442,7 @@ $(function() { self.additionalControls = additionalControls; self.rerenderControls(); } + self._enableWebcam(); }; self.onFocus = function (data, event) { diff --git a/src/octoprint/static/js/app/viewmodels/files.js b/src/octoprint/static/js/app/viewmodels/files.js index 5da2cd3a5..6b94f9978 100644 --- a/src/octoprint/static/js/app/viewmodels/files.js +++ b/src/octoprint/static/js/app/viewmodels/files.js @@ -841,13 +841,14 @@ $(function() { function evaluateDropzones() { var enableLocal = self.loginState.isUser(); - var enableSd = enableLocal && CONFIG_SD_SUPPORT && self.printerState.isSdReady(); + var enableSd = enableLocal && CONFIG_SD_SUPPORT && self.printerState.isSdReady() && !self.isPrinting(); self._setDropzone("local", enableLocal); self._setDropzone("sdcard", enableSd); } self.loginState.isUser.subscribe(evaluateDropzones); self.printerState.isSdReady.subscribe(evaluateDropzones); + self.isPrinting.subscribe(evaluateDropzones); evaluateDropzones(); self.requestData(); @@ -1106,7 +1107,7 @@ $(function() { if (foundLocal) { self.dropZoneLocalBackground.addClass("hover"); self.dropZoneSdBackground.removeClass("hover"); - } else if (foundSd && self.printerState.isSdReady()) { + } else if (foundSd && self.printerState.isSdReady() && !self.isPrinting()) { self.dropZoneSdBackground.addClass("hover"); self.dropZoneLocalBackground.removeClass("hover"); } else if (found) { diff --git a/src/octoprint/static/js/app/viewmodels/timelapse.js b/src/octoprint/static/js/app/viewmodels/timelapse.js index f6a96c682..ed26a414e 100644 --- a/src/octoprint/static/js/app/viewmodels/timelapse.js +++ b/src/octoprint/static/js/app/viewmodels/timelapse.js @@ -48,7 +48,7 @@ $(function() { return ("timed" == self.timelapseType()); }); self.saveButtonEnabled = ko.pureComputed(function() { - return self.isDirty() && self.isOperational() && !self.isPrinting() && self.loginState.isUser(); + return self.isDirty() && !self.isPrinting() && self.loginState.isUser(); }); self.isOperational.subscribe(function() { diff --git a/src/octoprint/templates/overlays/dragndrop.jinja2 b/src/octoprint/templates/overlays/dragndrop.jinja2 index 91a74a38d..bb67ae1ba 100644 --- a/src/octoprint/templates/overlays/dragndrop.jinja2 +++ b/src/octoprint/templates/overlays/dragndrop.jinja2 @@ -4,7 +4,7 @@ {% if enableSdSupport %}

{{ _('Upload locally') }}
-

{{ _('Upload to SD') }}
({{ _('SD not initialized') }})
+

{{ _('Upload to SD') }}
({{ _('Cannot upload to printer\'s SD while printing') }})({{ _('SD not initialized') }})
{% else %}

{{ _('Upload') }}
diff --git a/src/octoprint/templates/sidebar/files.jinja2 b/src/octoprint/templates/sidebar/files.jinja2 index 99b199df8..4a06d7d71 100644 --- a/src/octoprint/templates/sidebar/files.jinja2 +++ b/src/octoprint/templates/sidebar/files.jinja2 @@ -55,18 +55,18 @@
{% if enableSdSupport %} - + {{ _('Upload') }} - + {{ _('Upload to SD') }} - + {% else %} - + {{ _('Upload') }} diff --git a/src/octoprint/templates/tabs/timelapse.jinja2 b/src/octoprint/templates/tabs/timelapse.jinja2 index d749dcf71..0decec276 100644 --- a/src/octoprint/templates/tabs/timelapse.jinja2 +++ b/src/octoprint/templates/tabs/timelapse.jinja2 @@ -5,7 +5,7 @@

{{ _('Timelapse Configuration') }}

- @@ -16,25 +16,25 @@
- + {{ _('sec') }}
- + {{ _('fps') }}
- + {{ _('sec') }}
@@ -42,7 +42,7 @@
- + {{ _('mm') }}
{{ _('Enter the retraction z-hop used in the firmware or the gcode file to trigger snapshots for the timelapse only if a real layer change happens. For this to work properly your retraction z-hop has to be different from your layerheight!') }}