Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e88e6ba292 | ||
|
|
25c56a5402 | ||
|
|
7fc0f48659 | ||
|
|
dfe345007e | ||
|
|
4fe6e0545a | ||
|
|
c84e199e87 | ||
|
|
79f7a5a1e7 | ||
|
|
679674df22 | ||
|
|
5989d243d3 | ||
|
|
97cb0088f6 | ||
|
|
2ed36ed383 | ||
|
|
12b8a54081 | ||
|
|
a35e145649 | ||
|
|
f77be701a2 | ||
|
|
c33e9e4c85 | ||
|
|
1f9fe8c868 | ||
|
|
8f2e4ad978 | ||
|
|
b82d955ec7 | ||
|
|
832d2f4155 | ||
|
|
c336452f6c | ||
|
|
a9b6edde2b | ||
|
|
d59ef5c711 | ||
|
|
375480c707 | ||
|
|
60cacb9447 | ||
|
|
c159ab7fe2 | ||
|
|
e949e0198f |
No files matched your search
+7
-5
@@ -18,12 +18,14 @@ HEAD
|
||||
|
||||
# maintenance is currently the branch for preparation of maintenance release 1.3.5
|
||||
# so are any fix/... and improve/... branches
|
||||
maintenance 1.3.5 fe481e12b3c50a2def3b41515200e13a8c6a5c72 pep440-dev
|
||||
fix/.* 1.3.5 fe481e12b3c50a2def3b41515200e13a8c6a5c72 pep440-dev
|
||||
improve/.* 1.3.5 fe481e12b3c50a2def3b41515200e13a8c6a5c72 pep440-dev
|
||||
maintenance 1.3.6 1a6dbb3f4a5bef857cdeb13c031b9deca2cf30a2 pep440-dev
|
||||
fix/.* 1.3.6 1a6dbb3f4a5bef857cdeb13c031b9deca2cf30a2 pep440-dev
|
||||
improve/.* 1.3.6 1a6dbb3f4a5bef857cdeb13c031b9deca2cf30a2 pep440-dev
|
||||
|
||||
# staging/maintenance is currently the branch for preparation of 1.3.5rc1
|
||||
staging/maintenance 1.3.5rc1 fe481e12b3c50a2def3b41515200e13a8c6a5c72 pep440-dev
|
||||
# staging/maintenance is currently the branch for preparation of 1.3.5rc4
|
||||
# so is regressionfix/...
|
||||
staging/maintenance 1.3.5rc4 679674df2282af0c4500367fa93864c6defa3802 pep440-dev
|
||||
regressionfix/.* 1.3.5rc4 679674df2282af0c4500367fa93864c6defa3802 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
|
||||
@@ -1,5 +1,40 @@
|
||||
# OctoPrint Changelog
|
||||
|
||||
## 1.3.5rc4 (2017-10-04)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
* [#2135](https://github.com/foosel/OctoPrint/issues/2135) - Fix an issue causing import errors inside the GCODE analysis tool in certain environments due to `sys.path` entries causing relative imports.
|
||||
* [#2136](https://github.com/foosel/OctoPrint/issues/2136) - Fix wrong minimum version for `sockjs-tornado` dependency.
|
||||
* [#2137](https://github.com/foosel/OctoPrint/issues/2137) - Fix issue with session cookies getting lost when running an OctoPrint instance on a subpath of another (e.g. `octopi.local/` and `octopi.local/octoprint2`).
|
||||
* [#2140](https://github.com/foosel/OctoPrint/issues/2140) - Fix issue with locale dependent sorting of sub wizards during first time setup causing issues leading to the wizard not being able to complete.
|
||||
|
||||
([Commits](https://github.com/foosel/OctoPrint/compare/1.3.5rc3...1.3.5rc4))
|
||||
|
||||
## 1.3.5rc3 (2017-08-25)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
* [#2059](https://github.com/foosel/OctoPrint/issues/2059) - Fix an issue causing the new temperature controls to wrap on touch enabled devices when the temperature dropdown is opened.
|
||||
* [#2090](https://github.com/foosel/OctoPrint/issues/2090) - Fix an issue causing an aborted server startup under Windows if the timing is just right.
|
||||
* Fix an issue causing rollover of `serial.log` to fail under Windows.
|
||||
|
||||
([Commits](https://github.com/foosel/OctoPrint/compare/1.3.5rc2...1.3.5rc3))
|
||||
|
||||
## 1.3.5rc2 (2017-07-27)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
* [#2033](https://github.com/foosel/OctoPrint/issues/2033) - Temperature tab: Fix for legend in graph not updating with current values on mouse over.
|
||||
* [#2033](https://github.com/foosel/OctoPrint/issues/2033) - Temperature tab: Fix for new temperature inputs not fitting on one line in Firefox.
|
||||
* [#2033](https://github.com/foosel/OctoPrint/issues/2033) - Temperature tab & GCODE viewer: Fix for available tools (and offsets) not properly updating on change of printer profile.
|
||||
* [#2033](https://github.com/foosel/OctoPrint/issues/2033) - Wizard: Fix sorting of required wizards not properly handling non-ASCII unicode.
|
||||
* [#2035](https://github.com/foosel/OctoPrint/issues/2035) - Fix an issue of the server not starting up if there's a file in the analysis backlog. The reason for this is that spawning a new process while the intermediary server is active causes the server port to be blocked (this is due to how subprocessing works by default), in turn leading to an error on startup since the port cannot be bound by the actual server. Since the GCODE analysis takes now place in its own subprocess and hence triggers this problem, it had to be moved until after the actual server has already started up to avoid this problem.
|
||||
* Wizard: Fix `onWizardPreventSettingsRefreshDialog` callback invocation.
|
||||
* Corewizard plugin: Fix `firstrunonly` wizards (e.g. for printer profile configuration) being displayed again if _any_ of the sub wizards (e.g. for the online check opt-in and configuration) is active.
|
||||
|
||||
([Commits](https://github.com/foosel/OctoPrint/compare/1.3.5rc1...1.3.5rc2))
|
||||
|
||||
## 1.3.5rc1 (2017-07-26)
|
||||
|
||||
### Improvements
|
||||
|
||||
+2
-4
@@ -7,7 +7,6 @@ thanks to everyone who contributed!
|
||||
## Patreon Patrons
|
||||
|
||||
* 3D Moniak
|
||||
* Aaron Lieberman
|
||||
* Aleph Objects, Inc.
|
||||
* Andrew Moorby
|
||||
* Arnljot Arntsen
|
||||
@@ -38,7 +37,6 @@ thanks to everyone who contributed!
|
||||
* Kaile Riser
|
||||
* Kale Stedman
|
||||
* Kazuhiro Ogura
|
||||
* Lamin Kivelä
|
||||
* Makespace Madrid
|
||||
* Marcus Ackermann
|
||||
* Mark Qvist
|
||||
@@ -46,6 +44,7 @@ thanks to everyone who contributed!
|
||||
* Masayoshi Mitsui
|
||||
* Michael Aumock
|
||||
* Miles Flavel
|
||||
* mitchell hirsch
|
||||
* Mohammed khorakiwala
|
||||
* Noe Ruiz
|
||||
* Patrick McGinnis
|
||||
@@ -56,7 +55,6 @@ thanks to everyone who contributed!
|
||||
* Roger Strolz
|
||||
* Roy Cortes
|
||||
* Samer Najia
|
||||
* SeeMeCNC
|
||||
* Simon Hallam
|
||||
* Stefan Krister
|
||||
* Stephane Schittly
|
||||
@@ -66,4 +64,4 @@ thanks to everyone who contributed!
|
||||
* Timeshell.ca
|
||||
* Trent Shumay
|
||||
|
||||
and 1117 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)!
|
||||
and 1121 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)!
|
||||
@@ -23,7 +23,7 @@ INSTALL_REQUIRES = [
|
||||
# to some voodoo needed to get large streamed uploads and downloads
|
||||
# to work that is probably not completely straightforward and therefore
|
||||
# something for post-1.3.0-stable release
|
||||
"sockjs-tornado>=1.0.2,<1.1",
|
||||
"sockjs-tornado>=1.0.3,<1.1",
|
||||
"PyYAML>=3.10,<3.11",
|
||||
"Flask-Login>=0.2.2,<0.3",
|
||||
"Flask-Principal>=0.3.5,<0.4",
|
||||
|
||||
@@ -194,7 +194,8 @@ def init_logging(settings, use_logging_file=True, logging_file=None, default_con
|
||||
"level": "DEBUG",
|
||||
"formatter": "serial",
|
||||
"backupCount": 3,
|
||||
"filename": os.path.join(settings.getBaseFolder("logs"), "serial.log")
|
||||
"filename": os.path.join(settings.getBaseFolder("logs"), "serial.log"),
|
||||
"delay": True
|
||||
}
|
||||
},
|
||||
"loggers": {
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env python2
|
||||
# coding=utf-8
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
if __name__ == "__main__":
|
||||
import octoprint
|
||||
octoprint.main()
|
||||
@@ -135,9 +135,10 @@ from .plugins import plugin_commands
|
||||
from .dev import dev_commands
|
||||
from .client import client_commands
|
||||
from .config import config_commands
|
||||
from .analysis import analysis_commands
|
||||
|
||||
@click.group(name="octoprint", invoke_without_command=True, cls=click.CommandCollection,
|
||||
sources=[server_commands, plugin_commands, dev_commands, client_commands, config_commands])
|
||||
sources=[server_commands, plugin_commands, dev_commands, client_commands, config_commands, analysis_commands])
|
||||
@standard_options()
|
||||
@legacy_options
|
||||
@click.version_option(version=octoprint.__version__, allow_from_autoenv=False)
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
# coding=utf-8
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
__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 click
|
||||
|
||||
#~~ "octoprint util" commands
|
||||
|
||||
@click.group()
|
||||
def analysis_commands():
|
||||
pass
|
||||
|
||||
@analysis_commands.group(name="analysis")
|
||||
def util():
|
||||
"""Analysis tools."""
|
||||
pass
|
||||
|
||||
|
||||
@util.command(name="gcode")
|
||||
@click.option("--throttle", "throttle", type=float, default=None)
|
||||
@click.option("--throttle-lines", "throttle_lines", type=int, default=None)
|
||||
@click.option("--speed-x", "speedx", type=float, default=6000)
|
||||
@click.option("--speed-y", "speedy", type=float, default=6000)
|
||||
@click.option("--speed-z", "speedz", type=float, default=300)
|
||||
@click.option("--offset", "offset", type=(float, float), multiple=True)
|
||||
@click.option("--max-t", "maxt", type=int, default=10)
|
||||
@click.option("--g90-extruder", "g90_extruder", is_flag=True)
|
||||
@click.option("--progress", "progress", is_flag=True)
|
||||
@click.argument("path", type=click.Path())
|
||||
def gcode_command(path, speedx, speedy, speedz, offset, maxt, throttle, throttle_lines, g90_extruder, progress):
|
||||
"""Runs a GCODE file analysis."""
|
||||
|
||||
import time
|
||||
import yaml
|
||||
from octoprint.util.gcodeInterpreter import gcode
|
||||
|
||||
throttle_callback = None
|
||||
if throttle:
|
||||
def throttle_callback(filePos, readBytes):
|
||||
if filePos % throttle_lines == 0:
|
||||
# only apply throttle every $throttle_lines lines
|
||||
time.sleep(throttle)
|
||||
|
||||
offsets = offset
|
||||
if offsets is None:
|
||||
offsets = []
|
||||
elif isinstance(offset, tuple):
|
||||
offsets = list(offsets)
|
||||
offsets = [(0, 0)] + offsets
|
||||
if len(offsets) < maxt:
|
||||
offsets += [(0, 0)] * (maxt - len(offsets))
|
||||
|
||||
start_time = time.time()
|
||||
|
||||
progress_callback = None
|
||||
if progress:
|
||||
def progress_callback(percentage):
|
||||
click.echo("PROGRESS:{}".format(percentage))
|
||||
interpreter = gcode(progress_callback=progress_callback)
|
||||
|
||||
interpreter.load(path,
|
||||
speedx=speedx,
|
||||
speedy=speedy,
|
||||
offsets=offsets,
|
||||
throttle=throttle_callback,
|
||||
max_extruders=maxt,
|
||||
g90_extruder=g90_extruder)
|
||||
|
||||
click.echo("DONE:{}s".format(time.time() - start_time))
|
||||
click.echo("RESULTS:")
|
||||
click.echo(yaml.safe_dump(interpreter.get_result(), default_flow_style=False, indent=" ", allow_unicode=True))
|
||||
+29
-3
@@ -132,9 +132,11 @@ class EventManager(object):
|
||||
self._registeredListeners = collections.defaultdict(list)
|
||||
self._logger = logging.getLogger(__name__)
|
||||
|
||||
self._startup_signaled = False
|
||||
self._shutdown_signaled = False
|
||||
|
||||
self._queue = queue.Queue()
|
||||
self._held_back = queue.Queue()
|
||||
|
||||
self._worker = threading.Thread(target=self._work)
|
||||
self._worker.daemon = True
|
||||
@@ -161,7 +163,8 @@ class EventManager(object):
|
||||
|
||||
octoprint.plugin.call_plugin(octoprint.plugin.types.EventHandlerPlugin,
|
||||
"on_event",
|
||||
args=(event, payload))
|
||||
args=(event, payload),
|
||||
initialized=True)
|
||||
self._logger.info("Event loop shut down")
|
||||
except:
|
||||
self._logger.exception("Ooops, the event bus worker loop crashed")
|
||||
@@ -177,7 +180,30 @@ class EventManager(object):
|
||||
payload being a payload object specific to the event.
|
||||
"""
|
||||
|
||||
self._queue.put((event, payload))
|
||||
send_held_back = False
|
||||
if event == Events.STARTUP:
|
||||
self._logger.info("Processing startup event, this is our first event")
|
||||
self._startup_signaled = True
|
||||
send_held_back = True
|
||||
|
||||
self._enqueue(event, payload)
|
||||
|
||||
if send_held_back:
|
||||
self._logger.info("Adding {} events to queue that "
|
||||
"were held back before startup event".format(self._held_back.qsize()))
|
||||
while True:
|
||||
try:
|
||||
self._queue.put(self._held_back.get(block=False))
|
||||
except queue.Empty:
|
||||
break
|
||||
|
||||
def _enqueue(self, event, payload):
|
||||
if self._startup_signaled:
|
||||
q = self._queue
|
||||
else:
|
||||
q = self._held_back
|
||||
|
||||
q.put((event, payload))
|
||||
|
||||
if event == Events.UPDATED_FILES and "type" in payload and payload["type"] == "printables":
|
||||
# when sending UpdatedFiles with type "printables", also send another event with deprecated type "gcode"
|
||||
@@ -185,7 +211,7 @@ class EventManager(object):
|
||||
import copy
|
||||
legacy_payload = copy.deepcopy(payload)
|
||||
legacy_payload["type"] = "gcode"
|
||||
self._queue.put((event, legacy_payload))
|
||||
q.put((event, legacy_payload))
|
||||
|
||||
def subscribe(self, event, callback):
|
||||
"""
|
||||
|
||||
@@ -180,9 +180,12 @@ class FileManager(object):
|
||||
import octoprint.settings
|
||||
self._recovery_file = os.path.join(octoprint.settings.settings().getBaseFolder("data"), "print_recovery_data.yaml")
|
||||
|
||||
def initialize(self):
|
||||
def initialize(self, process_backlog=False):
|
||||
self.reload_plugins()
|
||||
if process_backlog:
|
||||
self.process_backlog()
|
||||
|
||||
def process_backlog(self):
|
||||
def worker():
|
||||
self._logger.info("Adding backlog items from all storage types to analysis queue...".format(**locals()))
|
||||
for storage_type, storage_manager in self._storage_managers.items():
|
||||
|
||||
@@ -324,8 +324,8 @@ class GcodeAnalysisQueue(AbstractAnalysisQueue):
|
||||
speedy = self._current.printer_profile["axes"]["y"]["speed"]
|
||||
offsets = self._current.printer_profile["extruder"]["offsets"]
|
||||
|
||||
interpreter = os.path.realpath(os.path.join(os.path.dirname(__file__), "..", "util", "gcodeInterpreter.py"))
|
||||
command = [sys.executable, interpreter, "--speed-x={}".format(speedx), "--speed-y={}".format(speedy),
|
||||
command = [sys.executable, "-m", "octoprint", "analysis", "gcode",
|
||||
"--speed-x={}".format(speedx), "--speed-y={}".format(speedy),
|
||||
"--max-t={}".format(max_extruders), "--throttle={}".format(throttle),
|
||||
"--throttle-lines={}".format(throttle_lines)]
|
||||
for offset in offsets[1:]:
|
||||
|
||||
@@ -25,6 +25,13 @@ class CoreWizardPlugin(octoprint.plugin.AssetPlugin,
|
||||
names = self._get_subwizard_attrs("_get_", "_wizard_name")
|
||||
additional = self._get_subwizard_attrs("_get_", "_additional_wizard_template_data")
|
||||
|
||||
firstrunonly = self._get_subwizard_attrs("_is_", "_wizard_firstrunonly")
|
||||
firstrun = self._settings.global_get(["server", "firstRun"])
|
||||
|
||||
if not firstrun:
|
||||
required = dict((key, value) for key, value in required.items()
|
||||
if not firstrunonly.get(key, lambda: False)())
|
||||
|
||||
result = list()
|
||||
for key, method in required.items():
|
||||
if not method():
|
||||
@@ -37,7 +44,11 @@ class CoreWizardPlugin(octoprint.plugin.AssetPlugin,
|
||||
if not name:
|
||||
continue
|
||||
|
||||
config = dict(type="wizard", name=name, template="corewizard_{}_wizard.jinja2".format(key), div="wizard_plugin_corewizard_{}".format(key))
|
||||
config = dict(type="wizard",
|
||||
name=name,
|
||||
template="corewizard_{}_wizard.jinja2".format(key),
|
||||
div="wizard_plugin_corewizard_{}".format(key),
|
||||
suffix="_{}".format(key))
|
||||
if key in additional:
|
||||
additional_result = additional[key]()
|
||||
if additional_result:
|
||||
@@ -63,10 +74,12 @@ class CoreWizardPlugin(octoprint.plugin.AssetPlugin,
|
||||
firstrunonly = self._get_subwizard_attrs("_is_", "_wizard_firstrunonly")
|
||||
firstrun = self._settings.global_get(["server", "firstRun"])
|
||||
|
||||
any_not_firstrunonly = any(map(lambda m: not m(), firstrunonly.values()))
|
||||
if not firstrun:
|
||||
required = dict((key, value) for key, value in required.items()
|
||||
if not firstrunonly.get(key, lambda: False)())
|
||||
any_required = any(map(lambda m: m(), required.values()))
|
||||
|
||||
return (firstrun or any_not_firstrunonly) and any_required
|
||||
return any_required
|
||||
|
||||
def get_wizard_details(self):
|
||||
result = dict()
|
||||
|
||||
@@ -27,6 +27,11 @@ import atexit
|
||||
import signal
|
||||
import base64
|
||||
|
||||
try:
|
||||
import fcntl
|
||||
except ImportError:
|
||||
fcntl = None
|
||||
|
||||
SUCCESS = {}
|
||||
NO_CONTENT = ("", 204)
|
||||
NOT_MODIFIED = ("Not Modified", 304)
|
||||
@@ -214,6 +219,16 @@ class Server(object):
|
||||
# start the intermediary server
|
||||
self._start_intermediary_server()
|
||||
|
||||
### IMPORTANT!
|
||||
###
|
||||
### Best do not start any subprocesses until the intermediary server shuts down again or they MIGHT inherit the
|
||||
### open port and prevent us from firing up Tornado later.
|
||||
###
|
||||
### The intermediary server's socket should have the CLOSE_EXEC flag (or its equivalent) set where possible, but
|
||||
### we can only do that if fcntl is availabel or we are on Windows, so better safe than sorry.
|
||||
###
|
||||
### See also issues #2035 and #2090
|
||||
|
||||
# then initialize the plugin manager
|
||||
pluginManager.reload_plugins(startup=True, initialize_implementations=False)
|
||||
|
||||
@@ -569,8 +584,13 @@ class Server(object):
|
||||
self._server = util.tornado.CustomHTTPServer(self._tornado_app, max_body_sizes=max_body_sizes, default_max_body_size=self._settings.getInt(["server", "maxSize"]))
|
||||
self._server.listen(self._port, address=self._host)
|
||||
|
||||
### From now on it's ok to launch subprocesses again
|
||||
|
||||
eventManager.fire(events.Events.STARTUP)
|
||||
|
||||
# analysis backlog
|
||||
fileManager.process_backlog()
|
||||
|
||||
# auto connect
|
||||
if self._settings.getBoolean(["serial", "autoconnect"]):
|
||||
try:
|
||||
@@ -1356,21 +1376,44 @@ class Server(object):
|
||||
|
||||
rules = map(process, filter(lambda rule: len(rule) == 2 or len(rule) == 3, rules))
|
||||
|
||||
self._intermediary_server = BaseHTTPServer.HTTPServer((host, port), lambda *args, **kwargs: IntermediaryServerHandler(rules, *args, **kwargs))
|
||||
self._intermediary_server = BaseHTTPServer.HTTPServer((host, port),
|
||||
lambda *args, **kwargs: IntermediaryServerHandler(rules, *args, **kwargs),
|
||||
bind_and_activate=False)
|
||||
|
||||
thread = threading.Thread(target=self._intermediary_server.serve_forever)
|
||||
# if possible, make sure our socket's port descriptor isn't handed over to subprocesses
|
||||
from octoprint.util.platform import set_close_exec
|
||||
try:
|
||||
set_close_exec(self._intermediary_server.fileno())
|
||||
except:
|
||||
self._logger.exception("Error while attempting to set_close_exec on intermediary server socket")
|
||||
|
||||
# then bind the server and have it serve our handler until stopped
|
||||
try:
|
||||
self._intermediary_server.server_bind()
|
||||
self._intermediary_server.server_activate()
|
||||
except:
|
||||
self._intermediary_server.server_close()
|
||||
raise
|
||||
|
||||
def serve():
|
||||
try:
|
||||
self._intermediary_server.serve_forever()
|
||||
except:
|
||||
self._logger.exception("Error in intermediary server")
|
||||
|
||||
thread = threading.Thread(target=serve)
|
||||
thread.daemon = True
|
||||
thread.start()
|
||||
|
||||
self._logger.debug("Intermediary server started")
|
||||
self._logger.info("Intermediary server started")
|
||||
|
||||
def _stop_intermediary_server(self):
|
||||
if self._intermediary_server is None:
|
||||
return
|
||||
self._logger.debug("Shutting down intermediary server...")
|
||||
self._logger.info("Shutting down intermediary server...")
|
||||
self._intermediary_server.shutdown()
|
||||
self._intermediary_server.server_close()
|
||||
self._logger.debug("Intermediary server shut down")
|
||||
self._logger.info("Intermediary server shut down")
|
||||
|
||||
class LifecycleManager(object):
|
||||
def __init__(self, plugin_manager):
|
||||
|
||||
@@ -455,9 +455,12 @@ class OctoPrintFlaskRequest(flask.Request):
|
||||
|
||||
We need this because cookies are not port-specific and we don't want to overwrite our
|
||||
session and other cookies from one OctoPrint instance on our machine with those of another
|
||||
one who happens to listen on the same address albeit a different port.
|
||||
one who happens to listen on the same address albeit a different port or script root.
|
||||
"""
|
||||
return "_P" + self.server_port
|
||||
result = "_P" + self.server_port
|
||||
if self.script_root:
|
||||
return result + "_R" + self.script_root.replace("/", "|")
|
||||
return result
|
||||
|
||||
|
||||
class OctoPrintFlaskResponse(flask.Response):
|
||||
|
||||
@@ -21,6 +21,7 @@ from octoprint.server import app, userManager, pluginManager, gettext, \
|
||||
NOT_MODIFIED
|
||||
from octoprint.settings import settings
|
||||
from octoprint.filemanager import get_all_extensions
|
||||
from octoprint.util import to_unicode
|
||||
|
||||
import re
|
||||
import base64
|
||||
@@ -460,13 +461,26 @@ def _process_templates():
|
||||
)
|
||||
|
||||
# sorting orders
|
||||
def wizard_key_extractor(d, k):
|
||||
if d[1].get("_key", None) == "plugin_corewizard_acl":
|
||||
# Ultra special case - we MUST always have the ACL wizard first since otherwise any steps that follow and
|
||||
# that require to access APIs to function will run into errors since those APIs won't work before ACL
|
||||
# has been configured. See also #2140
|
||||
return u"0:{}".format(to_unicode(d[0]))
|
||||
elif d[1].get("mandatory", False):
|
||||
# Other mandatory steps come before the optional ones
|
||||
return u"1:{}".format(to_unicode(d[0]))
|
||||
else:
|
||||
# Finally everything else
|
||||
return u"2:{}".format(to_unicode(d[0]))
|
||||
|
||||
template_sorting = dict(
|
||||
navbar=dict(add="prepend", key=None),
|
||||
sidebar=dict(add="append", key="name"),
|
||||
tab=dict(add="append", key="name"),
|
||||
settings=dict(add="custom_append", key="name", custom_add_entries=lambda missing: dict(section_plugins=(gettext("Plugins"), None)), custom_add_order=lambda missing: ["section_plugins"] + missing),
|
||||
usersettings=dict(add="append", key="name"),
|
||||
wizard=dict(add="append", key="name", key_extractor=lambda d, k: "0:{}".format(d[0]) if "mandatory" in d[1] and d[1]["mandatory"] else "1:{}".format(d[0])),
|
||||
wizard=dict(add="append", key="name", key_extractor=wizard_key_extractor),
|
||||
about=dict(add="append", key="name"),
|
||||
generic=dict(add="append", key=None)
|
||||
)
|
||||
|
||||
@@ -1 +1 @@
|
||||
.btn{display:inline-block;*display:inline;*zoom:1;padding:4px 12px;margin-bottom:0;font-size:14px;line-height:20px;text-align:center;vertical-align:middle;cursor:pointer;color:#333;text-shadow:0 1px 1px rgba(255,255,255,.75);background-color:#f5f5f5;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-repeat:repeat-x;*background-color:#e6e6e6;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);border:1px solid #ccc;*border:0;border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;*margin-left:.3em;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05)}.btn.active,.btn.disabled,.btn:active,.btn:focus,.btn:hover,.btn[disabled]{color:#333;background-color:#e6e6e6;*background-color:#d9d9d9}.btn.active,.btn:active{background-color:#ccc \9}.btn:first-child{*margin-left:0}.btn:focus,.btn:hover{color:#333;text-decoration:none;background-position:0 -15px;-webkit-transition:background-position .1s linear;-moz-transition:background-position .1s linear;-o-transition:background-position .1s linear;transition:background-position .1s linear}.btn:focus{outline:#333 dotted thin;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.btn.disabled,.btn[disabled]{cursor:default;background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-large{padding:11px 19px;font-size:17.5px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.btn-large [class*=" icon-"],.btn-large [class^=icon-]{margin-top:4px}.btn-small{padding:2px 10px;font-size:11.9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-small [class*=" icon-"],.btn-small [class^=icon-]{margin-top:0}.btn-mini [class*=" icon-"],.btn-mini [class^=icon-]{margin-top:-1px}.btn-mini{padding:0 6px;font-size:10.5px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-block{display:block;width:100%;padding-left:0;padding-right:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.btn-block+.btn-block{margin-top:5px}input[type=submit].btn-block,input[type=reset].btn-block,input[type=button].btn-block{width:100%}.btn-primary{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#006dcc;background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;border-color:#04c #04c #002a80;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#04c;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-primary.active,.btn-primary.disabled,.btn-primary:active,.btn-primary:focus,.btn-primary:hover,.btn-primary[disabled]{color:#fff;background-color:#04c;*background-color:#003bb3}.btn-primary.active,.btn-primary:active{background-color:#039 \9}.btn-warning{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#faa732;background-image:-moz-linear-gradient(top,#fbb450,#f89406);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fbb450),to(#f89406));background-image:-webkit-linear-gradient(top,#fbb450,#f89406);background-image:-o-linear-gradient(top,#fbb450,#f89406);background-image:linear-gradient(to bottom,#fbb450,#f89406);background-repeat:repeat-x;border-color:#f89406 #f89406 #ad6704;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#f89406;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-warning.active,.btn-warning.disabled,.btn-warning:active,.btn-warning:focus,.btn-warning:hover,.btn-warning[disabled]{color:#fff;background-color:#f89406;*background-color:#df8505}.btn-warning.active,.btn-warning:active{background-color:#c67605 \9}.btn-danger{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#da4f49;background-image:-moz-linear-gradient(top,#ee5f5b,#bd362f);background-image:-webkit-gradient(linear,0 0,0 100%,from(#ee5f5b),to(#bd362f));background-image:-webkit-linear-gradient(top,#ee5f5b,#bd362f);background-image:-o-linear-gradient(top,#ee5f5b,#bd362f);background-image:linear-gradient(to bottom,#ee5f5b,#bd362f);background-repeaLine truncated
|
||||
.btn{display:inline-block;*display:inline;*zoom:1;padding:4px 12px;margin-bottom:0;font-size:14px;line-height:20px;text-align:center;vertical-align:middle;cursor:pointer;color:#333;text-shadow:0 1px 1px rgba(255,255,255,.75);background-color:#f5f5f5;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-repeat:repeat-x;*background-color:#e6e6e6;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);border:1px solid #ccc;*border:0;border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;*margin-left:.3em;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05)}.btn.active,.btn.disabled,.btn:active,.btn:focus,.btn:hover,.btn[disabled]{color:#333;background-color:#e6e6e6;*background-color:#d9d9d9}.btn.active,.btn:active{background-color:#ccc \9}.btn:first-child{*margin-left:0}.btn:focus,.btn:hover{color:#333;text-decoration:none;background-position:0 -15px;-webkit-transition:background-position .1s linear;-moz-transition:background-position .1s linear;-o-transition:background-position .1s linear;transition:background-position .1s linear}.btn:focus{outline:#333 dotted thin;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.btn.disabled,.btn[disabled]{cursor:default;background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-large{padding:11px 19px;font-size:17.5px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.btn-large [class*=" icon-"],.btn-large [class^=icon-]{margin-top:4px}.btn-small{padding:2px 10px;font-size:11.9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-small [class*=" icon-"],.btn-small [class^=icon-]{margin-top:0}.btn-mini [class*=" icon-"],.btn-mini [class^=icon-]{margin-top:-1px}.btn-mini{padding:0 6px;font-size:10.5px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-block{display:block;width:100%;padding-left:0;padding-right:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.btn-block+.btn-block{margin-top:5px}input[type=submit].btn-block,input[type=reset].btn-block,input[type=button].btn-block{width:100%}.btn-primary{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#006dcc;background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;border-color:#04c #04c #002a80;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#04c;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-primary.active,.btn-primary.disabled,.btn-primary:active,.btn-primary:focus,.btn-primary:hover,.btn-primary[disabled]{color:#fff;background-color:#04c;*background-color:#003bb3}.btn-primary.active,.btn-primary:active{background-color:#039 \9}.btn-warning{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#faa732;background-image:-moz-linear-gradient(top,#fbb450,#f89406);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fbb450),to(#f89406));background-image:-webkit-linear-gradient(top,#fbb450,#f89406);background-image:-o-linear-gradient(top,#fbb450,#f89406);background-image:linear-gradient(to bottom,#fbb450,#f89406);background-repeat:repeat-x;border-color:#f89406 #f89406 #ad6704;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#f89406;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-warning.active,.btn-warning.disabled,.btn-warning:active,.btn-warning:focus,.btn-warning:hover,.btn-warning[disabled]{color:#fff;background-color:#f89406;*background-color:#df8505}.btn-warning.active,.btn-warning:active{background-color:#c67605 \9}.btn-danger{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#da4f49;background-image:-moz-linear-gradient(top,#ee5f5b,#bd362f);background-image:-webkit-gradient(linear,0 0,0 100%,from(#ee5f5b),to(#bd362f));background-image:-webkit-linear-gradient(top,#ee5f5b,#bd362f);background-image:-o-linear-gradient(top,#ee5f5b,#bd362f);background-image:linear-gradient(to bottom,#ee5f5b,#bd362f);background-repeaLine truncated
|
||||
@@ -1000,10 +1000,13 @@ function setOnViewModelsIf(allViewModels, key, value, condition) {
|
||||
}
|
||||
|
||||
function callViewModels(allViewModels, method, callback) {
|
||||
if (!allViewModels) return;
|
||||
callViewModelsIf(allViewModels, method, undefined, callback);
|
||||
}
|
||||
|
||||
function callViewModelsIf(allViewModels, method, condition, callback) {
|
||||
if (!allViewModels) return;
|
||||
|
||||
if (condition == undefined || !_.isFunction(condition)) {
|
||||
condition = function() { return true; };
|
||||
}
|
||||
|
||||
@@ -109,8 +109,7 @@ $(function() {
|
||||
self.reader_sortLayers.subscribe(self.synchronizeOptions);
|
||||
self.reader_hideEmptyLayers.subscribe(self.synchronizeOptions);
|
||||
|
||||
// subscribe to relevant printer settings...
|
||||
self.settings.printerProfiles.currentProfileData.subscribe(function() {
|
||||
self._printerProfileUpdated = function() {
|
||||
if (!self.enabled) return;
|
||||
|
||||
var currentProfileData = self.settings.printerProfiles.currentProfileData();
|
||||
@@ -146,6 +145,27 @@ $(function() {
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// subscribe to relevant printer settings...
|
||||
self.settings.printerProfiles.currentProfileData.subscribe(function() {
|
||||
self._printerProfileUpdated();
|
||||
if (self.settings.printerProfiles.currentProfileData()) {
|
||||
if (self.settings.printerProfiles.currentProfileData().extruder) {
|
||||
self.settings.printerProfiles.currentProfileData().extruder.count.subscribe(self._printerProfileUpdated);
|
||||
self.settings.printerProfiles.currentProfileData().extruder.sharedNozzle.subscribe(self._printerProfileUpdated);
|
||||
self.settings.printerProfiles.currentProfileData().extruder.offsets.subscribe(self._printerProfileUpdated);
|
||||
}
|
||||
if (self.settings.printerProfiles.currentProfileData().volume) {
|
||||
self.settings.printerProfiles.currentProfileData().volume.width.subscribe(self._printerProfileUpdated);
|
||||
self.settings.printerProfiles.currentProfileData().volume.depth.subscribe(self._printerProfileUpdated);
|
||||
self.settings.printerProfiles.currentProfileData().volume.formFactor.subscribe(self._printerProfileUpdated);
|
||||
}
|
||||
if (self.settings.printerProfiles.currentProfileData().axes) {
|
||||
self.settings.printerProfiles.currentProfileData().axes.x.inverted.subscribe(self._printerProfileUpdated);
|
||||
self.settings.printerProfiles.currentProfileData().axes.y.inverted.subscribe(self._printerProfileUpdated);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
self.settings.feature_g90InfluencesExtruder.subscribe(function() {
|
||||
@@ -194,11 +214,13 @@ $(function() {
|
||||
currentProfileData = self.settings.printerProfiles.currentProfileData();
|
||||
}
|
||||
|
||||
if (currentProfileData && currentProfileData.extruder && currentProfileData.extruder.offsets() && !currentProfileData.extruder.sharedNozzle()) {
|
||||
if (currentProfileData && currentProfileData.extruder) {
|
||||
var offsets = [];
|
||||
_.each(currentProfileData.extruder.offsets(), function(offset) {
|
||||
offsets.push({x: offset[0], y: offset[1]})
|
||||
});
|
||||
if (currentProfileData.extruder.offsets() && !currentProfileData.extruder.sharedNozzle()) {
|
||||
_.each(currentProfileData.extruder.offsets(), function(offset) {
|
||||
offsets.push({x: offset[0], y: offset[1]})
|
||||
});
|
||||
}
|
||||
return offsets;
|
||||
} else {
|
||||
return undefined;
|
||||
|
||||
@@ -95,7 +95,7 @@ $(function() {
|
||||
self._printerProfileUpdated = function() {
|
||||
var graphColors = ["red", "orange", "green", "brown", "purple"];
|
||||
var heaterOptions = {};
|
||||
var tools = self.tools();
|
||||
var tools = [];
|
||||
var color;
|
||||
|
||||
// tools
|
||||
@@ -123,7 +123,7 @@ $(function() {
|
||||
if (tools.length < 1 || !tools[0]) {
|
||||
tools[0] = self._createToolEntry();
|
||||
}
|
||||
tools[0]["name"](gettext("Hotend"));
|
||||
tools[0]["name"](gettext("Tool"));
|
||||
tools[0]["key"]("tool0");
|
||||
}
|
||||
|
||||
@@ -147,6 +147,7 @@ $(function() {
|
||||
self.settingsViewModel.printerProfiles.currentProfileData.subscribe(function() {
|
||||
self._printerProfileUpdated();
|
||||
self.settingsViewModel.printerProfiles.currentProfileData().extruder.count.subscribe(self._printerProfileUpdated);
|
||||
self.settingsViewModel.printerProfiles.currentProfileData().extruder.sharedNozzle.subscribe(self._printerProfileUpdated);
|
||||
self.settingsViewModel.printerProfiles.currentProfileData().heatedBed.subscribe(self._printerProfileUpdated);
|
||||
});
|
||||
|
||||
@@ -721,9 +722,7 @@ $(function() {
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
self.onStartup = function() {
|
||||
self.changeOffsetDialog = $("#change_offset_dialog");
|
||||
};
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ $(function() {
|
||||
if (!self.finishing && self.isDialogActive()
|
||||
&& hasDataChanged(self.settingsViewModel.getLocalData(), self.settingsViewModel.lastReceivedSettings)) {
|
||||
var preventSettingsRefreshDialog = false;
|
||||
callViewModels(allViewModels, "onWizardPreventSettingsRefreshDialog", function(method) {
|
||||
callViewModels(self.allViewModels, "onWizardPreventSettingsRefreshDialog", function(method) {
|
||||
// if any of our methods returns that it wants to prevent the dialog
|
||||
// we'll need to set preventSettingsRefreshDialog to true
|
||||
//
|
||||
|
||||
+5
-1
@@ -687,7 +687,11 @@
|
||||
if (!isActive) {
|
||||
if ('ontouchstart' in document.documentElement) {
|
||||
// if mobile we we use a backdrop because click events don't delegate
|
||||
$('<div class="dropdown-backdrop"/>').insertBefore($(this)).on('click', clearMenus)
|
||||
|
||||
// PATCH by foosel based on CapnBry's suggestion - see foosel/OctoPrint#2059 for details
|
||||
//$('<div class="dropdown-backdrop"/>').insertBefore($(this)).on('click', clearMenus)
|
||||
$('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
|
||||
// /PATCH
|
||||
}
|
||||
$parent.toggleClass('open')
|
||||
}
|
||||
|
||||
@@ -435,8 +435,11 @@ table {
|
||||
}
|
||||
|
||||
&.temperature_tool {
|
||||
width: 18%;
|
||||
width: 16%;
|
||||
text-align: left;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
&.temperature_actual {
|
||||
@@ -444,7 +447,7 @@ table {
|
||||
}
|
||||
|
||||
&.temperature_target {
|
||||
width: 40%;
|
||||
width: 42%;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
</table>
|
||||
|
||||
<script type="text/html" id="temprow-template">
|
||||
<th class="temperature_tool" data-bind="text: name"></th>
|
||||
<td class="temperature_actual" data-bind="html: formatTemperature(actual())"></td>
|
||||
<th class="temperature_tool" data-bind="text: name, attr: {title: name}"></th>
|
||||
<td class="temperature_actual" data-bind="html: formatTemperature(actual()), attr: {title: formatTemperature(actual())}"></td>
|
||||
<td class="temperature_target">
|
||||
<form class="form-inline" style="margin:0" data-bind="submit: function(element) { $root.setTarget($data, element) }">
|
||||
<div class="input-prepend input-append">
|
||||
|
||||
Binary file not shown.
File diff suppressed because it is too large.
Load diff
@@ -512,85 +512,3 @@ def getCodeFloat(line, code):
|
||||
except:
|
||||
return None
|
||||
|
||||
if __name__ == "__main__":
|
||||
import click
|
||||
import time
|
||||
import yaml
|
||||
import sys
|
||||
|
||||
@click.command()
|
||||
@click.option("--throttle", "throttle", type=float, default=None)
|
||||
@click.option("--throttle-lines", "throttle_lines", type=int, default=None)
|
||||
@click.option("--speed-x", "speedx", type=float, default=6000)
|
||||
@click.option("--speed-y", "speedy", type=float, default=6000)
|
||||
@click.option("--speed-z", "speedz", type=float, default=300)
|
||||
@click.option("--offset", "offset", type=(float, float), multiple=True)
|
||||
@click.option("--max-t", "maxt", type=int, default=10)
|
||||
@click.option("--g90-extruder", "g90_extruder", is_flag=True)
|
||||
@click.option("--progress", "progress", is_flag=True)
|
||||
@click.argument("path", type=click.Path())
|
||||
def main(path, speedx, speedy, speedz, offset, maxt, throttle, throttle_lines, g90_extruder, progress):
|
||||
throttle_callback = None
|
||||
if throttle:
|
||||
def throttle_callback(filePos, readBytes):
|
||||
if filePos % throttle_lines == 0:
|
||||
# only apply throttle every $throttle_lines lines
|
||||
time.sleep(throttle)
|
||||
|
||||
offsets = offset
|
||||
if offsets is None:
|
||||
offsets = []
|
||||
elif isinstance(offset, tuple):
|
||||
offsets = list(offsets)
|
||||
offsets = [(0, 0)] + offsets
|
||||
if len(offsets) < maxt:
|
||||
offsets += [(0, 0)] * (maxt - len(offsets))
|
||||
|
||||
start_time = time.time()
|
||||
|
||||
progress_callback = None
|
||||
if progress:
|
||||
def progress_callback(percentage):
|
||||
print("PROGRESS:{}".format(percentage))
|
||||
interpreter = gcode(progress_callback=progress_callback)
|
||||
|
||||
interpreter.load(path,
|
||||
speedx=speedx,
|
||||
speedy=speedy,
|
||||
offsets=offsets,
|
||||
throttle=throttle_callback,
|
||||
max_extruders=maxt,
|
||||
g90_extruder=g90_extruder)
|
||||
|
||||
print("DONE:{}s".format(time.time() - start_time))
|
||||
print("RESULTS:")
|
||||
print(yaml.safe_dump(interpreter.get_result(), default_flow_style=False, indent=" ", allow_unicode=True))
|
||||
|
||||
# os args are gained differently on win32
|
||||
try:
|
||||
from click.utils import get_os_args
|
||||
args = get_os_args()
|
||||
except ImportError:
|
||||
# for whatever reason we are running an older Click version?
|
||||
args = sys.argv[1:]
|
||||
|
||||
if len(args) >= len(sys.argv):
|
||||
# Now some ugly preprocessing of our arguments starts. We have a somewhat difficult situation on our hands
|
||||
# here if we are running under Windows and want to be able to handle utf-8 command line parameters (think
|
||||
# plugin parameters such as names or something, e.g. for the "dev plugin:new" command) while at the same
|
||||
# time also supporting sys.argv rewriting for debuggers etc (e.g. PyCharm).
|
||||
#
|
||||
# So what we try to do here is solve this... Generally speaking, sys.argv and whatever Windows returns
|
||||
# for its CommandLineToArgvW win32 function should have the same length. If it doesn't however and
|
||||
# sys.argv is shorter than the win32 specific command line arguments, obviously stuff was cut off from
|
||||
# sys.argv which also needs to be cut off of the win32 command line arguments.
|
||||
#
|
||||
# So this is what we do here.
|
||||
|
||||
# -1 because first entry is the script that was called
|
||||
sys_args_length = len(sys.argv) - 1
|
||||
|
||||
# cut off stuff from the beginning
|
||||
args = args[-1 * sys_args_length:] if sys_args_length else []
|
||||
|
||||
main(args=args, prog_name="octoprint-gcode-analysis")
|
||||
@@ -0,0 +1,41 @@
|
||||
# coding=utf-8
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
__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 sys
|
||||
|
||||
try:
|
||||
import fcntl
|
||||
except ImportError:
|
||||
fcntl = None
|
||||
|
||||
# set_close_exec
|
||||
|
||||
if fcntl is not None and hasattr(fcntl, "FD_CLOEXEC"):
|
||||
def set_close_exec(handle):
|
||||
flags = fcntl.fcntl(handle, fcntl.F_GETFD)
|
||||
flags |= fcntl.FD_CLOEXEC
|
||||
fcntl.fcntl(handle, fcntl.F_SETFD, flags)
|
||||
|
||||
elif sys.platform == "win32":
|
||||
def set_close_exec(handle):
|
||||
import ctypes
|
||||
import ctypes.wintypes
|
||||
|
||||
# see https://msdn.microsoft.com/en-us/library/ms724935(v=vs.85).aspx
|
||||
SetHandleInformation = ctypes.windll.kernel32.SetHandleInformation
|
||||
SetHandleInformation.argtypes = (ctypes.wintypes.HANDLE, ctypes.wintypes.DWORD, ctypes.wintypes.DWORD)
|
||||
SetHandleInformation.restype = ctypes.c_bool
|
||||
|
||||
HANDLE_FLAG_INHERIT = 0x00000001
|
||||
|
||||
result = SetHandleInformation(handle, HANDLE_FLAG_INHERIT, 0)
|
||||
if not result:
|
||||
raise ctypes.GetLastError()
|
||||
|
||||
else:
|
||||
def set_close_exec(handle):
|
||||
# no-op
|
||||
pass
|
||||
@@ -530,6 +530,13 @@ class OctoPrintFlaskRequestTest(unittest.TestCase):
|
||||
def test_cookie_suffix(self):
|
||||
request = OctoPrintFlaskRequest(standard_environ)
|
||||
self.assertEquals("_P5000", request.cookie_suffix)
|
||||
|
||||
def test_cookie_suffix_with_root(self):
|
||||
script_root_environ = dict(standard_environ)
|
||||
script_root_environ["SCRIPT_NAME"] = "/path/to/octoprint"
|
||||
|
||||
request = OctoPrintFlaskRequest(script_root_environ)
|
||||
self.assertEquals("_P5000_R|path|to|octoprint", request.cookie_suffix)
|
||||
|
||||
def test_cookies(self):
|
||||
environ = dict(standard_environ)
|
||||
@@ -561,8 +568,10 @@ class OctoPrintFlaskResponseTest(unittest.TestCase):
|
||||
def test_cookie_set_and_delete(self, path, scriptroot):
|
||||
environ = dict(standard_environ)
|
||||
|
||||
expected_suffix = "_P5000"
|
||||
if scriptroot is not None:
|
||||
environ.update(dict(SCRIPT_NAME=scriptroot))
|
||||
expected_suffix += "_R" + scriptroot.replace("/", "|")
|
||||
|
||||
request = OctoPrintFlaskRequest(environ)
|
||||
|
||||
@@ -586,7 +595,7 @@ class OctoPrintFlaskResponseTest(unittest.TestCase):
|
||||
response.set_cookie("some_key", "some_value", **kwargs)
|
||||
|
||||
# set_cookie should have key and path values adjusted
|
||||
set_cookie_mock.assert_called_once_with(response, "some_key_P5000", "some_value", path=expected_path_set)
|
||||
set_cookie_mock.assert_called_once_with(response, "some_key" + expected_suffix, "some_value", path=expected_path_set)
|
||||
|
||||
# test delete_cookie
|
||||
with mock.patch("flask.Response.set_cookie") as set_cookie_mock:
|
||||
|
||||
Binary file not shown.
+1475
-509
File diff suppressed because it is too large.
Load diff
+57
-57
@@ -6,16 +6,16 @@
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OctoPrint 1.3.5.dev136+g10e834f.dirty\n"
|
||||
"Project-Id-Version: OctoPrint 1.3.5rc4.dev6+g25c56a54\n"
|
||||
"Report-Msgid-Bugs-To: i18n@octoprint.org\n"
|
||||
"POT-Creation-Date: 2017-07-26 12:30+0200\n"
|
||||
"POT-Creation-Date: 2017-10-04 13:18+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Generated-By: Babel 2.3.4\n"
|
||||
"Generated-By: Babel 2.5.1\n"
|
||||
|
||||
#: src/octoprint/plugins/announcements/__init__.py:126
|
||||
#: src/octoprint/plugins/announcements/templates/announcements.jinja2:4
|
||||
@@ -105,31 +105,31 @@ msgstr ""
|
||||
msgid "Refresh Announcements"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/plugins/corewizard/__init__.py:95
|
||||
#: src/octoprint/plugins/corewizard/__init__.py:108
|
||||
#: src/octoprint/plugins/corewizard/templates/corewizard_acl_wizard.jinja2:1
|
||||
#: src/octoprint/server/views.py:559
|
||||
#: src/octoprint/server/views.py:573
|
||||
msgid "Access Control"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/plugins/corewizard/__init__.py:143
|
||||
#: src/octoprint/server/views.py:553
|
||||
#: src/octoprint/plugins/corewizard/__init__.py:156
|
||||
#: src/octoprint/server/views.py:567
|
||||
msgid "Webcam & Timelapse"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/plugins/corewizard/__init__.py:161
|
||||
#: src/octoprint/plugins/corewizard/__init__.py:174
|
||||
#: src/octoprint/plugins/corewizard/templates/corewizard_servercommands_wizard.jinja2:1
|
||||
msgid "Server Commands"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/plugins/corewizard/__init__.py:175
|
||||
#: src/octoprint/plugins/corewizard/__init__.py:188
|
||||
msgid "Online connectivity check"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/plugins/corewizard/__init__.py:192
|
||||
#: src/octoprint/plugins/corewizard/__init__.py:205
|
||||
msgid "Default Printer Profile"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/plugins/corewizard/__init__.py:218
|
||||
#: src/octoprint/plugins/corewizard/__init__.py:231
|
||||
msgid ""
|
||||
"Without this plugin OctoPrint will no longer be able to perform setup "
|
||||
"steps that might be required after an update."
|
||||
@@ -1325,7 +1325,7 @@ msgid "Software Update"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/plugins/softwareupdate/__init__.py:964
|
||||
#: src/octoprint/server/views.py:557
|
||||
#: src/octoprint/server/views.py:571
|
||||
#: src/octoprint/static/js/app/viewmodels/appearance.js:13
|
||||
#: src/octoprint/static/js/app/viewmodels/appearance.js:18
|
||||
#: src/octoprint/static/js/app/viewmodels/appearance.js:20
|
||||
@@ -1674,113 +1674,113 @@ msgstr ""
|
||||
msgid "OctoPrint version tracking"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/server/views.py:467
|
||||
#: src/octoprint/server/views.py:481
|
||||
msgid "Plugins"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/server/views.py:524
|
||||
#: src/octoprint/server/views.py:538
|
||||
msgid "Connection"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/server/views.py:525
|
||||
#: src/octoprint/server/views.py:539
|
||||
#: src/octoprint/templates/sidebar/state.jinja2:1
|
||||
msgid "State"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/server/views.py:526
|
||||
#: src/octoprint/server/views.py:540
|
||||
msgid "Files"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/server/views.py:532
|
||||
#: src/octoprint/server/views.py:546
|
||||
msgid "Temperature"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/server/views.py:533
|
||||
#: src/octoprint/server/views.py:547
|
||||
msgid "Control"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/server/views.py:534
|
||||
#: src/octoprint/server/views.py:548
|
||||
msgid "GCode Viewer"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/server/views.py:535
|
||||
#: src/octoprint/server/views.py:549
|
||||
msgid "Terminal"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/server/views.py:536
|
||||
#: src/octoprint/server/views.py:550
|
||||
#: src/octoprint/templates/sidebar/state.jinja2:4
|
||||
msgid "Timelapse"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/server/views.py:542
|
||||
#: src/octoprint/server/views.py:556
|
||||
msgid "Printer"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/server/views.py:544
|
||||
#: src/octoprint/server/views.py:558
|
||||
msgid "Serial Connection"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/server/views.py:545
|
||||
#: src/octoprint/server/views.py:559
|
||||
#: src/octoprint/templates/dialogs/settings/printerprofiles.jinja2:1
|
||||
msgid "Printer Profiles"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/server/views.py:546
|
||||
#: src/octoprint/server/views.py:560
|
||||
msgid "Temperatures"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/server/views.py:547
|
||||
#: src/octoprint/server/views.py:561
|
||||
msgid "Terminal Filters"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/server/views.py:548
|
||||
#: src/octoprint/server/views.py:562
|
||||
msgid "GCODE Scripts"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/server/views.py:550 src/octoprint/server/views.py:552
|
||||
#: src/octoprint/server/views.py:564 src/octoprint/server/views.py:566
|
||||
msgid "Features"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/server/views.py:554
|
||||
#: src/octoprint/server/views.py:568
|
||||
msgid "GCODE Visualizer"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/server/views.py:555
|
||||
#: src/octoprint/server/views.py:569
|
||||
msgid "API"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/server/views.py:560
|
||||
#: src/octoprint/server/views.py:574
|
||||
#: src/octoprint/templates/dialogs/settings/folders.jinja2:2
|
||||
#: src/octoprint/templates/sidebar/files_header.jinja2:10
|
||||
msgid "Folders"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/server/views.py:561
|
||||
#: src/octoprint/server/views.py:575
|
||||
msgid "Appearance"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/server/views.py:562
|
||||
#: src/octoprint/server/views.py:576
|
||||
#: src/octoprint/templates/dialogs/settings/logs.jinja2:2
|
||||
msgid "Logs"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/server/views.py:563
|
||||
#: src/octoprint/server/views.py:577
|
||||
msgid "Server"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/server/views.py:569
|
||||
#: src/octoprint/server/views.py:583
|
||||
msgid "Access"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/server/views.py:570
|
||||
#: src/octoprint/server/views.py:584
|
||||
msgid "Interface"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/server/views.py:586
|
||||
#: src/octoprint/server/views.py:600
|
||||
msgid "Start"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/server/views.py:587
|
||||
#: src/octoprint/server/views.py:601
|
||||
#: src/octoprint/templates/dialogs/wizard.jinja2:57
|
||||
msgid "Finish"
|
||||
msgstr ""
|
||||
@@ -2028,14 +2028,14 @@ msgstr ""
|
||||
|
||||
#: src/octoprint/static/js/app/viewmodels/control.js:72
|
||||
#: src/octoprint/static/js/app/viewmodels/files.js:604
|
||||
#: src/octoprint/static/js/app/viewmodels/gcode.js:508
|
||||
#: src/octoprint/static/js/app/viewmodels/gcode.js:530
|
||||
#: src/octoprint/static/js/app/viewmodels/printerstate.js:234
|
||||
#: src/octoprint/static/js/app/viewmodels/temperature.js:115
|
||||
#: src/octoprint/static/js/app/viewmodels/temperature.js:126
|
||||
msgid "Tool"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/static/js/app/viewmodels/control.js:78
|
||||
#: src/octoprint/static/js/app/viewmodels/temperature.js:126
|
||||
msgid "Hotend"
|
||||
msgstr ""
|
||||
|
||||
@@ -2059,19 +2059,19 @@ msgid ""
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/static/js/app/viewmodels/files.js:593
|
||||
#: src/octoprint/static/js/app/viewmodels/gcode.js:467
|
||||
#: src/octoprint/static/js/app/viewmodels/gcode.js:489
|
||||
msgid "Model size"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/static/js/app/viewmodels/files.js:599
|
||||
#: src/octoprint/static/js/app/viewmodels/files.js:604
|
||||
#: src/octoprint/static/js/app/viewmodels/gcode.js:505
|
||||
#: src/octoprint/static/js/app/viewmodels/gcode.js:508
|
||||
#: src/octoprint/static/js/app/viewmodels/gcode.js:527
|
||||
#: src/octoprint/static/js/app/viewmodels/gcode.js:530
|
||||
msgid "Filament"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/static/js/app/viewmodels/files.js:608
|
||||
#: src/octoprint/static/js/app/viewmodels/gcode.js:512
|
||||
#: src/octoprint/static/js/app/viewmodels/gcode.js:534
|
||||
msgid "Estimated print time"
|
||||
msgstr ""
|
||||
|
||||
@@ -2182,40 +2182,40 @@ msgstr ""
|
||||
msgid "Analyzed"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/static/js/app/viewmodels/gcode.js:468
|
||||
#: src/octoprint/static/js/app/viewmodels/gcode.js:490
|
||||
msgid "Estimated total print time"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/static/js/app/viewmodels/gcode.js:469
|
||||
#: src/octoprint/static/js/app/viewmodels/gcode.js:491
|
||||
msgid "Estimated layer height"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/static/js/app/viewmodels/gcode.js:469
|
||||
#: src/octoprint/static/js/app/viewmodels/gcode.js:491
|
||||
#: src/octoprint/templates/tabs/timelapse.jinja2:46
|
||||
msgid "mm"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/static/js/app/viewmodels/gcode.js:470
|
||||
#: src/octoprint/static/js/app/viewmodels/gcode.js:492
|
||||
msgid "Layer count"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/static/js/app/viewmodels/gcode.js:470
|
||||
#: src/octoprint/static/js/app/viewmodels/gcode.js:492
|
||||
msgid "printed"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/static/js/app/viewmodels/gcode.js:470
|
||||
#: src/octoprint/static/js/app/viewmodels/gcode.js:492
|
||||
msgid "visited"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/static/js/app/viewmodels/gcode.js:500
|
||||
#: src/octoprint/static/js/app/viewmodels/gcode.js:522
|
||||
msgid "Layer number"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/static/js/app/viewmodels/gcode.js:501
|
||||
#: src/octoprint/static/js/app/viewmodels/gcode.js:523
|
||||
msgid "Layer height"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/static/js/app/viewmodels/gcode.js:502
|
||||
#: src/octoprint/static/js/app/viewmodels/gcode.js:524
|
||||
msgid "GCODE commands"
|
||||
msgstr ""
|
||||
|
||||
@@ -2570,21 +2570,21 @@ msgstr ""
|
||||
msgid "Bed"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/static/js/app/viewmodels/temperature.js:317
|
||||
#: src/octoprint/static/js/app/viewmodels/temperature.js:318
|
||||
#: src/octoprint/templates/tabs/temperature.jinja2:11
|
||||
msgid "Actual"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/static/js/app/viewmodels/temperature.js:322
|
||||
#: src/octoprint/static/js/app/viewmodels/temperature.js:323
|
||||
#: src/octoprint/templates/tabs/temperature.jinja2:12
|
||||
msgid "Target"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/static/js/app/viewmodels/temperature.js:354
|
||||
#: src/octoprint/static/js/app/viewmodels/temperature.js:355
|
||||
msgid "just now"
|
||||
msgstr ""
|
||||
|
||||
#: src/octoprint/static/js/app/viewmodels/temperature.js:356
|
||||
#: src/octoprint/static/js/app/viewmodels/temperature.js:357
|
||||
msgid "min"
|
||||
msgstr ""
|
||||
|
||||
|
||||
Reference in new issue
Block a user