Merge branch 'maintenance' into devel
No files matched your search
@@ -2,6 +2,7 @@
|
||||
|
||||
# pre-commit version updates
|
||||
b4f265d9f67508677e1697e74e248b895da7f43c
|
||||
2231e81efd32d649798f7a58cdb1755e34902d8a
|
||||
|
||||
# Switch to black formatting
|
||||
1f93b2355a2816918e11a55e61b42010d15a6720
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
exclude: ^(src/octoprint/vendor/|src/octoprint/static/js/lib|src/octoprint/static/vendor|tests/static/js/lib|tests/util/_files|scripts/|translations/|versioneer.py|.*\.css|.*\.svg)
|
||||
default_language_version:
|
||||
python: python3.10
|
||||
exclude: ^(src/octoprint/vendor/|src/octoprint/static/js/lib|src/octoprint/static/vendor|tests/static/js/lib|tests/util/_files|scripts/|translations/|.*\.css|.*\.svg)
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.1.0
|
||||
rev: v4.4.0
|
||||
hooks:
|
||||
- id: end-of-file-fixer
|
||||
- id: trailing-whitespace
|
||||
@@ -14,7 +16,7 @@ repos:
|
||||
args: ["--remove"]
|
||||
exclude: "setup.py|versioneer.py|src/octoprint_setuptools/__init__.py"
|
||||
- repo: https://github.com/asottile/pyupgrade
|
||||
rev: v2.31.0
|
||||
rev: v3.3.1
|
||||
hooks:
|
||||
- id: pyupgrade
|
||||
args: ["--py37-plus"]
|
||||
@@ -43,26 +45,23 @@ repos:
|
||||
hooks:
|
||||
- id: isort
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 22.3.0
|
||||
rev: 23.1.0
|
||||
hooks:
|
||||
- id: black
|
||||
additional_dependencies:
|
||||
- click==8.0.4
|
||||
- repo: https://github.com/pycqa/flake8
|
||||
rev: 3.9.2
|
||||
rev: 6.0.0
|
||||
hooks:
|
||||
- id: flake8
|
||||
args: [--config=setup.cfg]
|
||||
additional_dependencies:
|
||||
- flake8-bugbear==22.3.20
|
||||
- importlib-metadata<5.0
|
||||
- flake8-bugbear==23.2.13
|
||||
exclude: ^(docs/)
|
||||
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||
rev: v2.5.1
|
||||
rev: v2.7.1
|
||||
hooks:
|
||||
- id: prettier
|
||||
- repo: https://github.com/pre-commit/mirrors-eslint
|
||||
rev: v8.8.0
|
||||
rev: v8.34.0
|
||||
hooks:
|
||||
- id: eslint
|
||||
additional_dependencies:
|
||||
@@ -70,7 +69,7 @@ repos:
|
||||
files: \.js$
|
||||
exclude: ^(src/octoprint/vendor/|tests/static/js/lib|tests/util/_files|docs/|scripts/|translations/)
|
||||
- repo: https://github.com/codespell-project/codespell
|
||||
rev: v2.1.0
|
||||
rev: v2.2.2
|
||||
hooks:
|
||||
- id: codespell
|
||||
exclude: ^(src/octoprint/vendor/|tests/static/js/lib|tests/util/_files|tests/playwright|scripts/)
|
||||
@@ -10,7 +10,26 @@ The OctoPrint Plugin Manager comes bundled with OctoPrint.
|
||||
It allows management of installed plugins (listing, enabling, disabling
|
||||
and uninstalling) and installing new plugins from the official
|
||||
`OctoPrint Plugin Repository <http://plugins.octoprint.org>`_, web addresses
|
||||
or uploaded file archives.
|
||||
or uploaded files.
|
||||
|
||||
Installing from URL or file uploads currently supports the following file
|
||||
formats:
|
||||
|
||||
* ``.zip``, ``.tar.gz``, ``.tgz``, ``.tar``, ``.gz``, ``.whl``: Will be considered to be
|
||||
plugin archive and installed via ``pip``.
|
||||
* ``.py``: Will be considered to be a single file plugin and installed by copying it
|
||||
into ``~/.octoprint/plugins``.
|
||||
* ``.json``: Will be considered to be either a plugin manager export file (created by the Export button) or a manually created
|
||||
list of URLs to install from, e.g.
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
[
|
||||
"https://github.com/jneilliii/OctoPrint-BedLevelVisualizer/archive/master.zip",
|
||||
"https://github.com/eyal0/OctoPrint-PrintTimeGenius/archive/master.zip"
|
||||
]
|
||||
|
||||
The plugin manager will feed all contained URLs to the same logic as above.
|
||||
|
||||
.. _fig-bundledplugins-pluginmanager-mainscreen:
|
||||
.. figure:: ../images/bundledplugins-pluginmanager-mainscreen.png
|
||||
|
||||
@@ -610,9 +610,13 @@ ChartMarked
|
||||
|
||||
Payload:
|
||||
|
||||
* ``type``: the marking's ID. Built-in types are ``print``, ``done``, ``cancel``, ``pause``, and ``resume``. Plugins may set arbitrary types
|
||||
* ``label``: the human-readable short label of the marking
|
||||
* ``time``: the epoch time of marking
|
||||
* ``type``: The marking's ID. Built-in types are ``print``, ``done``, ``cancel``, ``pause``, and ``resume``.
|
||||
Plugins may set arbitrary types, which should be prefixed, e.g. ``pluginname_eventtype``. In the UI, the type
|
||||
ID is used to stylize the marking label.
|
||||
* ``label``: The human-readable short label of the marking, ideally one short word. Optional but recommended; if
|
||||
not specified, the UI will display the ``type``. The label may be localized in the UI.
|
||||
* ``time``: The epoch time of marking. Defaults to the event fire time if not specified. Plugins may set a time
|
||||
in the past if it makes sense for the event.
|
||||
|
||||
.. versionadded:: 1.9.0
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 57 KiB |
|
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 406 KiB |
|
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 71 KiB |
@@ -60,7 +60,7 @@
|
||||
:param string message: The type of message for which to register
|
||||
:param function handler: The handler function
|
||||
|
||||
.. js:function:: OctoPrintClient.socker.removeMessage(message, handler)
|
||||
.. js:function:: OctoPrintClient.socket.removeMessage(message, handler)
|
||||
|
||||
Removes the ``handler`` for messages of type ``message``.
|
||||
|
||||
|
||||
@@ -7,12 +7,13 @@ Internal Modules
|
||||
.. toctree::
|
||||
:maxdepth: 3
|
||||
|
||||
access.rst
|
||||
cli.rst
|
||||
filemanager.rst
|
||||
plugin.rst
|
||||
printer.rst
|
||||
schema.rst
|
||||
server.rst
|
||||
settings.rst
|
||||
slicing.rst
|
||||
users.rst
|
||||
util.rst
|
||||
@@ -0,0 +1,111 @@
|
||||
.. _sec-modules-schema:
|
||||
|
||||
octoprint.schema
|
||||
----------------
|
||||
|
||||
.. automodule:: octoprint.schema
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. _sec-modules-schema-config:
|
||||
|
||||
octoprint.schema.config
|
||||
-----------------------
|
||||
|
||||
.. automodule:: octoprint.schema.config
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. automodule:: octoprint.schema.config.access_control
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. automodule:: octoprint.schema.config.api
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. automodule:: octoprint.schema.config.appearance
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. automodule:: octoprint.schema.config.controls
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. automodule:: octoprint.schema.config.devel
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. automodule:: octoprint.schema.config.estimation
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. automodule:: octoprint.schema.config.events
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. automodule:: octoprint.schema.config.feature
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. automodule:: octoprint.schema.config.folder
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. automodule:: octoprint.schema.config.gcode_analysis
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. automodule:: octoprint.schema.config.plugins
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. automodule:: octoprint.schema.config.printer_parameters
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. automodule:: octoprint.schema.config.printer_profiles
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. automodule:: octoprint.schema.config.scripts
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. automodule:: octoprint.schema.config.serial
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. automodule:: octoprint.schema.config.server
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. automodule:: octoprint.schema.config.slicing
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. automodule:: octoprint.schema.config.system
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. automodule:: octoprint.schema.config.temperature
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. automodule:: octoprint.schema.config.terminalfilters
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. automodule:: octoprint.schema.config.webcam
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
|
||||
.. _sec-modules-schema-webcam:
|
||||
|
||||
octoprint.schema.webcam
|
||||
-----------------------
|
||||
|
||||
.. automodule:: octoprint.schema.webcam
|
||||
:members:
|
||||
:undoc-members:
|
||||
@@ -1177,6 +1177,42 @@ octoprint.plugin.backup.additional_excludes
|
||||
|
||||
See :ref:`here <sec-bundledplugins-backup-hooks-excludes>`.
|
||||
|
||||
.. _sec-plugins-hook-plugin-backup-before-backup:
|
||||
|
||||
octoprint.plugin.backup.before_backup
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. versionadded:: 1.9.0
|
||||
|
||||
See :ref:`here <sec-bundledplugins-backup-hooks-before-backup>`.
|
||||
|
||||
.. _sec-plugins-hook-plugin-backup-after-backup:
|
||||
|
||||
octoprint.plugin.backup.after_backup
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. versionadded:: 1.9.0
|
||||
|
||||
See :ref:`here <sec-bundledplugins-backup-hooks-after-backup>`.
|
||||
|
||||
.. _sec-plugins-hook-plugin-backup-before-restore:
|
||||
|
||||
octoprint.plugin.backup.before_restore
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. versionadded:: 1.9.0
|
||||
|
||||
See :ref:`here <sec-bundledplugins-backup-hooks-before-restore>`.
|
||||
|
||||
.. _sec-plugins-hook-plugin-backup-after-restore:
|
||||
|
||||
octoprint.plugin.backup.after_restore
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. versionadded:: 1.9.0
|
||||
|
||||
See :ref:`here <sec-bundledplugins-backup-hooks-after-restore>`.
|
||||
|
||||
.. _sec-plugins-hook-plugin-pluginmanager-reconnect:
|
||||
|
||||
octoprint.plugin.pluginmanager.reconnect_hooks
|
||||
@@ -1360,7 +1396,7 @@ octoprint.printer.sdcardupload
|
||||
to be created on the ``sdcard`` storage. ``elapsed`` is the elapsed time in seconds.
|
||||
|
||||
If the hook is going to handle the upload, it must return the (future) remote filename of the file on the ``sdcard``
|
||||
storage. If it returns ``None`` (or an otherwise falsy value), OctoPrint will interpret this as the hook not going to
|
||||
storage. If it returns ``None`` (or an otherwise false-y value), OctoPrint will interpret this as the hook not going to
|
||||
handle the file upload, in which case the next hook or - if no other hook is registered - the default implementation
|
||||
will be called.
|
||||
|
||||
|
||||
@@ -198,33 +198,6 @@ The following plugin mixins are currently available:
|
||||
Please note that all plugin mixins inherit from :class:`~octoprint.plugin.core.Plugin` and
|
||||
:class:`~octoprint.plugin.types.OctoPrintPlugin`, which also provide attributes of interest to plugin developers.
|
||||
|
||||
.. _sec-plugins-mixins-startupplugin:
|
||||
|
||||
StartupPlugin
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
.. autoclass:: octoprint.plugin.StartupPlugin
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
.. _sec-plugins-mixins-shutdownplugin:
|
||||
|
||||
ShutdownPlugin
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
.. autoclass:: octoprint.plugin.ShutdownPlugin
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
.. _sec-plugins-mixins-settingsplugin:
|
||||
|
||||
SettingsPlugin
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
.. autoclass:: octoprint.plugin.SettingsPlugin
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
.. _sec-plugins-mixins-assetplugin:
|
||||
|
||||
AssetPlugin
|
||||
@@ -234,42 +207,6 @@ AssetPlugin
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
.. _sec-plugins-mixins-templateplugin:
|
||||
|
||||
TemplatePlugin
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
.. autoclass:: octoprint.plugin.TemplatePlugin
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
.. _sec-plugins-mixins-wizardplugin:
|
||||
|
||||
WizardPlugin
|
||||
~~~~~~~~~~~~
|
||||
|
||||
.. autoclass:: octoprint.plugin.WizardPlugin
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
.. _sec-plugins-mixins-uiplugin:
|
||||
|
||||
UiPlugin
|
||||
~~~~~~~~
|
||||
|
||||
.. autoclass:: octoprint.plugin.UiPlugin
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
.. _sec-plugins-mixins-simpleapiplugin:
|
||||
|
||||
SimpleApiPlugin
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
.. autoclass:: octoprint.plugin.SimpleApiPlugin
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
.. _sec-plugins-mixins-blueprintplugin:
|
||||
|
||||
BlueprintPlugin
|
||||
@@ -297,12 +234,12 @@ ProgressPlugin
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
.. _sec-plugins-mixins-slicerplugin:
|
||||
.. _sec-plugins-mixins-reloadneeding:
|
||||
|
||||
SlicerPlugin
|
||||
~~~~~~~~~~~~
|
||||
ReloadNeedingPlugin
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. autoclass:: octoprint.plugin.SlicerPlugin
|
||||
.. autoclass:: octoprint.plugin.ReloadNeedingPlugin
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
@@ -315,11 +252,83 @@ RestartNeedingPlugin
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
.. _sec-plugins-mixins-reloadneeding:
|
||||
.. _sec-plugins-mixins-settingsplugin:
|
||||
|
||||
ReloadNeedingPlugin
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
SettingsPlugin
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
.. autoclass:: octoprint.plugin.ReloadNeedingPlugin
|
||||
.. autoclass:: octoprint.plugin.SettingsPlugin
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
.. _sec-plugins-mixins-shutdownplugin:
|
||||
|
||||
ShutdownPlugin
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
.. autoclass:: octoprint.plugin.ShutdownPlugin
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
.. _sec-plugins-mixins-simpleapiplugin:
|
||||
|
||||
SimpleApiPlugin
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
.. autoclass:: octoprint.plugin.SimpleApiPlugin
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
.. _sec-plugins-mixins-slicerplugin:
|
||||
|
||||
SlicerPlugin
|
||||
~~~~~~~~~~~~
|
||||
|
||||
.. autoclass:: octoprint.plugin.SlicerPlugin
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
.. _sec-plugins-mixins-startupplugin:
|
||||
|
||||
StartupPlugin
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
.. autoclass:: octoprint.plugin.StartupPlugin
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
.. _sec-plugins-mixins-templateplugin:
|
||||
|
||||
TemplatePlugin
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
.. autoclass:: octoprint.plugin.TemplatePlugin
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
.. _sec-plugins-mixins-uiplugin:
|
||||
|
||||
UiPlugin
|
||||
~~~~~~~~
|
||||
|
||||
.. autoclass:: octoprint.plugin.UiPlugin
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
.. _sec-plugins-mixins-webcamproviderplugin:
|
||||
|
||||
WebcamProviderPlugin
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. autoclass:: octoprint.plugin.WebcamProviderPlugin
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
.. _sec-plugins-mixins-wizardplugin:
|
||||
|
||||
WizardPlugin
|
||||
~~~~~~~~~~~~
|
||||
|
||||
.. autoclass:: octoprint.plugin.WizardPlugin
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -26,7 +26,6 @@ cache = {}
|
||||
|
||||
class OnlineIncludeReader(LiteralIncludeReader):
|
||||
def read_file(self, filename: str, location: Any = None) -> list[str]:
|
||||
|
||||
global cache
|
||||
try:
|
||||
if filename in cache:
|
||||
|
||||
@@ -15,7 +15,7 @@ lookupfile = .versioneer-lookup
|
||||
|
||||
[flake8]
|
||||
max-line-length = 90
|
||||
extend-ignore = E203, E231, E265, E266, E402, E501, E731
|
||||
extend-ignore = E203, E231, E265, E266, E402, E501, E731, B023, B903, B904, B907, B950, W503
|
||||
select = B,C,E,F,W,T4,B9
|
||||
exclude =
|
||||
src/octoprint/vendor
|
||||
|
||||
@@ -268,7 +268,6 @@ class PermissionsMetaClass(type):
|
||||
|
||||
|
||||
class Permissions(metaclass=PermissionsMetaClass):
|
||||
|
||||
# Special permission
|
||||
ADMIN = OctoPrintPermission(
|
||||
"Admin",
|
||||
|
||||
@@ -362,7 +362,6 @@ from .systeminfo import cli as systeminfo_commands # noqa: E402
|
||||
@click.version_option(version=octoprint.__version__, allow_from_autoenv=False)
|
||||
@click.pass_context
|
||||
def octo(ctx, **kwargs):
|
||||
|
||||
if ctx.invoked_subcommand is None:
|
||||
# We have to support calling the octoprint command without any
|
||||
# sub commands to remain backwards compatible.
|
||||
|
||||
@@ -63,8 +63,8 @@ class Daemon:
|
||||
sys.stdout.flush()
|
||||
sys.stderr.flush()
|
||||
si = open(os.devnull, encoding="utf-8")
|
||||
so = open(os.devnull, "at+", encoding="utf-8")
|
||||
se = open(os.devnull, "at+", encoding="utf-8")
|
||||
so = open(os.devnull, "a+", encoding="utf-8")
|
||||
se = open(os.devnull, "a+", encoding="utf-8")
|
||||
|
||||
os.dup2(si.fileno(), sys.stdin.fileno())
|
||||
os.dup2(so.fileno(), sys.stdout.fileno())
|
||||
@@ -160,7 +160,7 @@ class Daemon:
|
||||
|
||||
def set_pid(self, pid):
|
||||
"""Write the pid to the pidfile."""
|
||||
with open(self.pidfile, "wt+", encoding="utf-8") as f:
|
||||
with open(self.pidfile, "w+", encoding="utf-8") as f:
|
||||
f.write(str(pid) + "\n")
|
||||
|
||||
def remove_pidfile(self):
|
||||
|
||||
@@ -167,7 +167,7 @@ class EnvironmentDetector:
|
||||
|
||||
dumped_environment = yaml.dump(environment, pretty=True).strip()
|
||||
environment_lines = "\n".join(
|
||||
map(lambda l: f"| {l}", dumped_environment.split("\n"))
|
||||
map(lambda x: f"| {x}", dumped_environment.split("\n"))
|
||||
)
|
||||
return "Detected environment is Python {} under {} ({}). Details:\n{}".format(
|
||||
environment["python"]["version"],
|
||||
|
||||
@@ -2,6 +2,5 @@ __license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agp
|
||||
|
||||
|
||||
class FileDestinations:
|
||||
|
||||
SDCARD = "sdcard"
|
||||
LOCAL = "local"
|
||||
@@ -8,7 +8,6 @@ class TornadoAccessFilter(logging.Filter):
|
||||
status, request_line, rtt = record.args
|
||||
|
||||
if status == 409:
|
||||
|
||||
_, url, _ = request_line.split()
|
||||
u = urllib.parse.urlparse(url)
|
||||
if u.path in ("/api/printer",):
|
||||
|
||||
@@ -66,7 +66,6 @@ class OctoPrintStreamHandler(AsyncLogHandlerMixin, logging.StreamHandler):
|
||||
class TriggeredRolloverLogHandler(
|
||||
AsyncLogHandlerMixin, logging.handlers.RotatingFileHandler
|
||||
):
|
||||
|
||||
do_rollover = False
|
||||
suffix_template = "%Y-%m-%d_%H-%M-%S"
|
||||
file_pattern = re.compile(r"^\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2}$")
|
||||
|
||||
@@ -2350,7 +2350,8 @@ class EntryPointMetadata(pkginfo.Distribution):
|
||||
warnings.warn(
|
||||
"No package metadata found for package {}".format(
|
||||
self.entry_point.module_name
|
||||
)
|
||||
),
|
||||
stacklevel=2,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -331,6 +331,18 @@ class TemplatePlugin(OctoPrintPlugin, ReloadNeedingPlugin):
|
||||
wrapper div and the link in the navigation will have the additional classes and styles applied as defined via the
|
||||
configuration through :func:`get_template_configs`.
|
||||
|
||||
Webcam
|
||||
Plugins can provide a custom webcam view for watching a camera stream, which will be embedded into the "Control"
|
||||
panel of OctoPrint's default UI.
|
||||
|
||||
The included template must be called ``<plugin identifier>_webcam.jinja2`` (e.g. ``myplugin_webcam.jinja2``) unless
|
||||
overridden by the configuration supplied through :func:`get_template_configs`.
|
||||
|
||||
The template will be already wrapped into the necessary structure, plugins just need to supply the pure content. The
|
||||
wrapper div will have the additional classes and styles applied as defined via the configuration through :func:`get_template_configs`.
|
||||
|
||||
.. versionadded:: 1.9.0
|
||||
|
||||
Wizards
|
||||
Plugins may define wizard dialogs to display to the user if necessary (e.g. in case of missing information that
|
||||
needs to be queried from the user to make the plugin work). Note that with the current implementation, all
|
||||
@@ -518,12 +530,22 @@ class TemplatePlugin(OctoPrintPlugin, ReloadNeedingPlugin):
|
||||
.. list-table::
|
||||
:widths: 5 95
|
||||
|
||||
* - classes_link
|
||||
- Like ``classes`` but only applied to the link in the navigation.
|
||||
* - classes_content
|
||||
- Like ``classes`` but only applied to the content pane itself.
|
||||
* - styles_content
|
||||
- Like ``styles`` but only applied to the content pane itself.
|
||||
* - classes_link
|
||||
- Like ``classes`` but only applied to the link in the navigation.
|
||||
* - styles_link
|
||||
- Like ``styles`` but only applied to the link in the navigation.
|
||||
|
||||
``webcam`` type
|
||||
|
||||
.. list-table::
|
||||
:widths: 5 95
|
||||
|
||||
* - classes_content
|
||||
- Like ``classes`` but only applied to the content pane itself.
|
||||
* - styles_content
|
||||
- Like ``styles`` but only applied to the content pane itself.
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ class ActionCommandPromptPlugin(
|
||||
octoprint.plugin.SimpleApiPlugin,
|
||||
octoprint.plugin.TemplatePlugin,
|
||||
):
|
||||
|
||||
COMMAND = "M876"
|
||||
CAP_PROMPT_SUPPORT = "PROMPT_SUPPORT"
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@ class AnnouncementPlugin(
|
||||
octoprint.plugin.TemplatePlugin,
|
||||
octoprint.plugin.EventHandlerPlugin,
|
||||
):
|
||||
|
||||
# noinspection PyMissingConstructor
|
||||
def __init__(self):
|
||||
self._cached_channel_configs = None
|
||||
|
||||
@@ -60,7 +60,6 @@ class BackupPlugin(
|
||||
octoprint.plugin.StartupPlugin,
|
||||
octoprint.plugin.WizardPlugin,
|
||||
):
|
||||
|
||||
_pip_caller = None
|
||||
|
||||
_backup_in_progress = threading.Lock()
|
||||
@@ -168,7 +167,6 @@ class BackupPlugin(
|
||||
@no_firstrun_access
|
||||
@Permissions.PLUGIN_BACKUP_ACCESS.require(403)
|
||||
def create_backup(self):
|
||||
|
||||
data = flask.request.json
|
||||
exclude = data.get("exclude", [])
|
||||
filename = self._build_backup_filename(settings=self._settings)
|
||||
@@ -922,7 +920,6 @@ class BackupPlugin(
|
||||
)
|
||||
|
||||
with cls._backup_in_progress:
|
||||
|
||||
if name is None:
|
||||
name = cls._build_backup_filename(settings)
|
||||
|
||||
@@ -971,7 +968,9 @@ class BackupPlugin(
|
||||
final_path = os.path.join(datafolder, name)
|
||||
|
||||
own_folder = datafolder
|
||||
defaults = [os.path.join(basedir, "config.yaml"),] + [
|
||||
defaults = [
|
||||
os.path.join(basedir, "config.yaml"),
|
||||
] + [
|
||||
os.path.join(basedir, folder)
|
||||
for folder in default_settings["folder"].keys()
|
||||
]
|
||||
@@ -1179,7 +1178,6 @@ class BackupPlugin(
|
||||
on_restore_start(path)
|
||||
|
||||
try:
|
||||
|
||||
with zipfile.ZipFile(path, "r") as zip:
|
||||
# read metadata
|
||||
try:
|
||||
|
||||
@@ -16,7 +16,6 @@ class CoreWizardPlugin(
|
||||
octoprint.plugin.BlueprintPlugin,
|
||||
Subwizards,
|
||||
):
|
||||
|
||||
# ~~ TemplatePlugin API
|
||||
|
||||
def get_template_configs(self):
|
||||
|
||||
@@ -42,7 +42,6 @@ class DiscoveryPlugin(
|
||||
octoprint.plugin.BlueprintPlugin,
|
||||
octoprint.plugin.SettingsPlugin,
|
||||
):
|
||||
|
||||
ssdp_multicast_addr = "239.255.255.250" # IPv6: ff0X::c
|
||||
|
||||
ssdp_multicast_port = 1900
|
||||
@@ -688,7 +687,6 @@ class DiscoveryPlugin(
|
||||
)
|
||||
|
||||
class Request(BaseHTTPRequestHandler):
|
||||
|
||||
# noinspection PyMissingConstructor
|
||||
def __init__(self, request_text):
|
||||
self.rfile = BytesIO(request_text)
|
||||
|
||||
@@ -496,8 +496,8 @@ $(function () {
|
||||
};
|
||||
|
||||
self._configureContainerElement = function (containerElement) {
|
||||
// Prevent the default browser action for the mouse wheel down event. The desired behavor is to have the
|
||||
// gocde canvas pan on mouse down + drag, which happens. But if we don't prevent the default action, the browser
|
||||
// Prevent the default browser action for the mouse wheel down event. The desired behavior is to have the
|
||||
// gcode canvas pan on mouse down + drag, which happens. But if we don't prevent the default action, the browser
|
||||
// will also scroll the entire page.
|
||||
containerElement.mousedown(function (event) {
|
||||
// Middle mouse button
|
||||
|
||||
@@ -23,7 +23,6 @@ class LoggingPlugin(
|
||||
octoprint.plugin.TemplatePlugin,
|
||||
octoprint.plugin.BlueprintPlugin,
|
||||
):
|
||||
|
||||
# Additional permissions hook
|
||||
|
||||
def get_additional_permissions(self):
|
||||
|
||||
@@ -114,7 +114,6 @@ class PluginManagerPlugin(
|
||||
octoprint.plugin.BlueprintPlugin,
|
||||
octoprint.plugin.EventHandlerPlugin,
|
||||
):
|
||||
|
||||
ARCHIVE_EXTENSIONS = (".zip", ".tar.gz", ".tgz", ".tar", ".gz", ".whl")
|
||||
PYTHON_EXTENSIONS = (".py",)
|
||||
JSON_EXTENSIONS = (".json",)
|
||||
@@ -1823,7 +1822,6 @@ class PluginManagerPlugin(
|
||||
additional_args = self._settings.get(["pip_args"])
|
||||
|
||||
if additional_args is not None:
|
||||
|
||||
inapplicable_arguments = self.__class__.PIP_INAPPLICABLE_ARGUMENTS.get(
|
||||
args[0], list()
|
||||
)
|
||||
|
||||
@@ -230,7 +230,6 @@ class SoftwareUpdatePlugin(
|
||||
or self._configured_checks is None
|
||||
or self._check_overlays_stale
|
||||
):
|
||||
|
||||
self._refresh_configured_checks = False
|
||||
|
||||
overlays = self._get_check_overlays()
|
||||
@@ -933,7 +932,6 @@ class SoftwareUpdatePlugin(
|
||||
return 9
|
||||
|
||||
def on_settings_migrate(self, target, current=None):
|
||||
|
||||
if current is None or current < 6:
|
||||
# up until & including config version 5 we didn't set the method parameter for the octoprint check
|
||||
# configuration
|
||||
@@ -1656,7 +1654,6 @@ class SoftwareUpdatePlugin(
|
||||
continue
|
||||
|
||||
for future in futures.as_completed(futures_to_result):
|
||||
|
||||
target, populated_check = futures_to_result[future]
|
||||
if future.exception() is not None:
|
||||
self._logger.error(
|
||||
@@ -2033,7 +2030,6 @@ class SoftwareUpdatePlugin(
|
||||
return to_be_updated, check_data
|
||||
|
||||
def _update_worker(self, checks, check_targets, force):
|
||||
|
||||
restart_type = None
|
||||
|
||||
credentials = self._settings.get(["credentials"], merged=True)
|
||||
|
||||
@@ -231,7 +231,7 @@ def _rescue_changes(git_executable, folder):
|
||||
)
|
||||
)
|
||||
|
||||
with open(patch, "wt", encoding="utf-8", errors="replace") as f:
|
||||
with open(patch, "w", encoding="utf-8", errors="replace") as f:
|
||||
for line in stdout:
|
||||
f.write(line)
|
||||
|
||||
|
||||
@@ -1817,7 +1817,7 @@ class VirtualPrinter:
|
||||
|
||||
handle = None
|
||||
try:
|
||||
handle = open(file, "wt", encoding="utf-8")
|
||||
handle = open(file, "w", encoding="utf-8")
|
||||
except Exception:
|
||||
self._send("error writing to file")
|
||||
self._writingToSdHandle = handle
|
||||
@@ -2150,7 +2150,7 @@ class VirtualEEPROM:
|
||||
else:
|
||||
# no eeprom file, make new one with defaults
|
||||
data = self.get_default_settings()
|
||||
with open(self._eeprom_file_path, "wt", encoding="utf-8") as eeprom_file:
|
||||
with open(self._eeprom_file_path, "w", encoding="utf-8") as eeprom_file:
|
||||
eeprom_file.write(to_unicode(json.dumps(data)))
|
||||
return data
|
||||
|
||||
@@ -2261,7 +2261,7 @@ class VirtualEEPROM:
|
||||
|
||||
def save_settings(self):
|
||||
# M500 behind-the-scenes
|
||||
with open(self._eeprom_file_path, "wt", encoding="utf-8") as eeprom_file:
|
||||
with open(self._eeprom_file_path, "w", encoding="utf-8") as eeprom_file:
|
||||
eeprom_file.write(to_unicode(json.dumps(self._eeprom)))
|
||||
|
||||
def read_settings(self):
|
||||
|
||||
@@ -197,7 +197,6 @@ class PrintTimeEstimator:
|
||||
|
||||
|
||||
class TimeEstimationHelper:
|
||||
|
||||
STABLE_THRESHOLD = 0.1
|
||||
STABLE_COUNTDOWN = 250
|
||||
STABLE_ROLLING_WINDOW = 250
|
||||
|
||||
@@ -360,7 +360,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
for name, hook in self._handle_connect_hooks.items():
|
||||
try:
|
||||
if hook(
|
||||
self, port=port, baudrate=baudrate, profile=profile, *args, **kwargs
|
||||
self, *args, port=port, baudrate=baudrate, profile=profile, **kwargs
|
||||
):
|
||||
self._logger.info(f"Connect signalled as handled by plugin {name}")
|
||||
return
|
||||
@@ -403,7 +403,6 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
self._firmware_info = None
|
||||
|
||||
def get_transport(self, *args, **kwargs):
|
||||
|
||||
if self._comm is None:
|
||||
return None
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ class RatioEnum(str, Enum):
|
||||
|
||||
@with_attrs_docs
|
||||
class WebcamCompatibility(BaseModel):
|
||||
|
||||
streamTimeout: int = 5
|
||||
"""The timeout of the stream in seconds"""
|
||||
|
||||
@@ -43,7 +42,6 @@ class WebcamCompatibility(BaseModel):
|
||||
|
||||
@with_attrs_docs
|
||||
class Webcam(BaseModel):
|
||||
|
||||
name: str
|
||||
"""Identifier of this webcam"""
|
||||
|
||||
|
||||
@@ -2741,10 +2741,10 @@ class Server:
|
||||
permission = PluginOctoPrintPermission(
|
||||
permission_name(plugin_info.name, definition),
|
||||
description,
|
||||
*roles_and_permissions,
|
||||
plugin=plugin_info.key,
|
||||
dangerous=dangerous,
|
||||
default_groups=default_groups,
|
||||
*roles_and_permissions,
|
||||
)
|
||||
setattr(
|
||||
octoprint.access.permissions.Permissions,
|
||||
@@ -2752,10 +2752,10 @@ class Server:
|
||||
PluginOctoPrintPermission(
|
||||
permission_name(plugin_info.name, definition),
|
||||
description,
|
||||
*roles_and_permissions,
|
||||
plugin=plugin_info.key,
|
||||
dangerous=dangerous,
|
||||
default_groups=default_groups,
|
||||
*roles_and_permissions,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@@ -1289,9 +1289,7 @@ def deleteGcodeFile(filename, target):
|
||||
|
||||
def _abortWithException(error):
|
||||
if type(error) is StorageError:
|
||||
logging.getLogger(__name__).error(
|
||||
f"{error.message}: {error.code}", exc_info=error.cause
|
||||
)
|
||||
logging.getLogger(__name__).error(f"{error}: {error.code}", exc_info=error.cause)
|
||||
if error.code == StorageError.INVALID_DIRECTORY:
|
||||
abort(400, description="Could not create folder, invalid directory")
|
||||
elif error.code == StorageError.INVALID_FILE:
|
||||
@@ -1311,7 +1309,7 @@ def _abortWithException(error):
|
||||
elif error.code == StorageError.UNKNOWN:
|
||||
abort(500, description=str(error.cause).split(":")[0])
|
||||
else:
|
||||
abort(500, description=error.message)
|
||||
abort(500, description=error)
|
||||
else:
|
||||
logging.getLogger(__name__).exception(error)
|
||||
abort(500, description=str(error).split(":")[0])
|
||||
|
||||
@@ -153,7 +153,6 @@ def uploadLanguagePack():
|
||||
@no_firstrun_access
|
||||
@Permissions.SETTINGS.require(403)
|
||||
def deleteInstalledLanguagePack(locale, pack):
|
||||
|
||||
if pack == "_core":
|
||||
target_path = os.path.join(settings().getBaseFolder("translations"), locale)
|
||||
else:
|
||||
|
||||
@@ -274,7 +274,6 @@ class ReverseProxiedEnvironment:
|
||||
server=None,
|
||||
port=None,
|
||||
):
|
||||
|
||||
# sensible defaults
|
||||
if header_prefix is None:
|
||||
header_prefix = ["x-script-name", "x-forwarded-prefix"]
|
||||
@@ -1723,7 +1722,6 @@ class PluginAssetResolver(flask_assets.FlaskResolver):
|
||||
|
||||
|
||||
class SettingsCheckUpdater(webassets.updater.BaseUpdater):
|
||||
|
||||
updater = "always"
|
||||
|
||||
def __init__(self):
|
||||
|
||||
@@ -77,7 +77,6 @@ class PrinterStateConnection(
|
||||
LoginStatusListener,
|
||||
GroupChangeListener,
|
||||
):
|
||||
|
||||
_event_permissions = {
|
||||
Events.USER_LOGGED_IN: [Permissions.ADMIN],
|
||||
Events.USER_LOGGED_OUT: [Permissions.ADMIN],
|
||||
|
||||
@@ -92,7 +92,6 @@ def fix_websocket_check_origin():
|
||||
|
||||
|
||||
class RequestlessExceptionLoggingMixin(tornado.web.RequestHandler):
|
||||
|
||||
LOG_REQUEST = False
|
||||
|
||||
def log_exception(self, typ, value, tb, *args, **kwargs):
|
||||
@@ -1616,7 +1615,6 @@ class SystemInfoBundleHandler(CorsSupportMixin, tornado.web.RequestHandler):
|
||||
|
||||
|
||||
class GlobalHeaderTransform(tornado.web.OutputTransform):
|
||||
|
||||
HEADERS = {}
|
||||
FORCED_HEADERS = {}
|
||||
REMOVED_HEADERS = []
|
||||
|
||||
@@ -961,7 +961,6 @@ class Settings:
|
||||
self.remove_overlay(key)
|
||||
|
||||
if deprecated is not None:
|
||||
|
||||
self._logger.debug(
|
||||
f"Marking all (recursive) paths in this overlay as deprecated: {overlay}"
|
||||
)
|
||||
@@ -2099,7 +2098,7 @@ def _validate_folder(folder, create=True, check_writable=True, deep_check_writab
|
||||
# to determine whether things are *actually* writable
|
||||
testfile = os.path.join(folder, ".testballoon.txt")
|
||||
try:
|
||||
with open(testfile, "wt", encoding="utf-8") as f:
|
||||
with open(testfile, "w", encoding="utf-8") as f:
|
||||
f.write("test")
|
||||
os.remove(testfile)
|
||||
except Exception:
|
||||
|
||||
@@ -1008,6 +1008,11 @@ $(function () {
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.webcamCompat.hasOwnProperty(observable)) {
|
||||
// webcam compat layer, skip
|
||||
return;
|
||||
}
|
||||
|
||||
if (mapping && mapping[key] && _.isFunction(mapping[key])) {
|
||||
result[key] = mapping[key]();
|
||||
flag = true;
|
||||
|
||||
@@ -23,7 +23,6 @@ def system_command_manager():
|
||||
|
||||
|
||||
class SystemCommandManager:
|
||||
|
||||
SERVER_RESTART_COMMAND = "serverRestartCommand"
|
||||
SYSTEM_RESTART_COMMAND = "systemRestartCommand"
|
||||
SYSTEM_SHUTDOWN_COMMAND = "systemShutdownCommand"
|
||||
|
||||
@@ -536,7 +536,7 @@ class Timelapse:
|
||||
eventManager().subscribe(Events.PRINT_FAILED, self.on_print_done)
|
||||
eventManager().subscribe(Events.PRINT_DONE, self.on_print_done)
|
||||
eventManager().subscribe(Events.PRINT_RESUMED, self.on_print_resumed)
|
||||
for (event, callback) in self.event_subscriptions():
|
||||
for event, callback in self.event_subscriptions():
|
||||
eventManager().subscribe(event, callback)
|
||||
|
||||
@property
|
||||
@@ -560,7 +560,7 @@ class Timelapse:
|
||||
eventManager().unsubscribe(Events.PRINT_FAILED, self.on_print_done)
|
||||
eventManager().unsubscribe(Events.PRINT_DONE, self.on_print_done)
|
||||
eventManager().unsubscribe(Events.PRINT_RESUMED, self.on_print_resumed)
|
||||
for (event, callback) in self.event_subscriptions():
|
||||
for event, callback in self.event_subscriptions():
|
||||
eventManager().unsubscribe(event, callback)
|
||||
|
||||
def on_print_started(self, event, payload):
|
||||
@@ -951,7 +951,6 @@ class TimedTimelapse(Timelapse):
|
||||
|
||||
|
||||
class TimelapseRenderJob:
|
||||
|
||||
render_job_lock = threading.RLock()
|
||||
|
||||
def __init__(
|
||||
|
||||
@@ -887,7 +887,6 @@ def dict_filter(dictionary, filter_function):
|
||||
# Source: http://stackoverflow.com/a/6190500/562769
|
||||
class DefaultOrderedDict(collections.OrderedDict):
|
||||
def __init__(self, default_factory=None, *a, **kw):
|
||||
|
||||
if default_factory is not None and not callable(default_factory):
|
||||
raise TypeError("first argument must be callable")
|
||||
collections.OrderedDict.__init__(self, *a, **kw)
|
||||
|
||||
@@ -2714,7 +2714,6 @@ class MachineCom:
|
||||
or line.startswith("T0:")
|
||||
or ((" B:" in line or line.startswith("B:")) and "A:" not in line)
|
||||
):
|
||||
|
||||
if (
|
||||
not disable_external_heatup_detection
|
||||
and not self._temperature_autoreporting
|
||||
@@ -3049,7 +3048,6 @@ class MachineCom:
|
||||
else:
|
||||
self._consecutive_not_sd_printing = 0
|
||||
if self.isSdFileSelected():
|
||||
|
||||
# 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.
|
||||
@@ -4485,7 +4483,7 @@ class MachineCom:
|
||||
enqueued_something = False
|
||||
|
||||
# process all but the last ...
|
||||
for (cmd, cmd_type, gcode, subcode, tags) in results:
|
||||
for cmd, cmd_type, gcode, subcode, tags in results:
|
||||
enqueued_something = (
|
||||
process(cmd, cmd_type, gcode, subcode, tags=tags)
|
||||
or enqueued_something
|
||||
|
||||
@@ -53,6 +53,7 @@ def clean_ansi(line: Union[str, bytes]) -> Union[str, bytes]:
|
||||
warnings.warn(
|
||||
"Calling clean_ansi with bytes is deprecated, call with str instead",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return to_bytes(_ANSI_REGEX.sub("", to_unicode(line)))
|
||||
return _ANSI_REGEX.sub("", line)
|
||||
|
||||
@@ -219,7 +219,6 @@ def is_prerelease(version):
|
||||
|
||||
|
||||
def normalize_version(version):
|
||||
|
||||
# Debian has the python version set to 2.7.15+ which is not PEP440 compliant (bug 914072)
|
||||
if version.endswith("+"):
|
||||
version = version[:-1]
|
||||
|
||||
@@ -31,7 +31,7 @@ def load_from_file(
|
||||
def _save_to_file_base(data, file=None, path=None, pretty=False, **kwargs):
|
||||
if path is not None:
|
||||
assert file is None
|
||||
with open(path, "wt", encoding="utf-8") as f:
|
||||
with open(path, "w", encoding="utf-8") as f:
|
||||
return _save_to_file_base(data, file=f, pretty=pretty, **kwargs)
|
||||
|
||||
if file is not None:
|
||||
|
||||
@@ -833,7 +833,7 @@ class LocalStorageTest(unittest.TestCase):
|
||||
# prepare
|
||||
import yaml
|
||||
|
||||
with open(yaml_path, "wt") as f:
|
||||
with open(yaml_path, "w") as f:
|
||||
yaml.safe_dump(metadata, f)
|
||||
|
||||
# migrate
|
||||
|
||||
@@ -8,10 +8,10 @@ const credentials = {
|
||||
const expect = base.expect;
|
||||
|
||||
exports.test = base.test.extend({
|
||||
loginApi: async ({context}, use) => {
|
||||
loginApi: async ({context, baseURL}, use) => {
|
||||
const loginApi = {
|
||||
login: async (username, password) => {
|
||||
return await context.request.post("/api/login", {
|
||||
return await context.request.post(baseURL + "/api/login", {
|
||||
data: {
|
||||
user: username,
|
||||
pass: password
|
||||
@@ -20,7 +20,7 @@ exports.test = base.test.extend({
|
||||
},
|
||||
|
||||
logout: async () => {
|
||||
return await context.request.post("/api/logout");
|
||||
return await context.request.post(baseURL + "/api/logout");
|
||||
},
|
||||
|
||||
loginDefault: async () => {
|
||||
@@ -36,12 +36,12 @@ exports.test = base.test.extend({
|
||||
await use(loginApi);
|
||||
},
|
||||
|
||||
connectionApi: async ({context}, use) => {
|
||||
connectionApi: async ({context, baseURL}, use) => {
|
||||
const connectionApi = {
|
||||
connect: async (port, baudrate) => {
|
||||
port = port || "AUTO";
|
||||
baudrate = baudrate || 0;
|
||||
return await context.request.post("/api/connection", {
|
||||
return await context.request.post(baseURL + "/api/connection", {
|
||||
data: {
|
||||
command: "connect",
|
||||
port: port,
|
||||
@@ -51,7 +51,7 @@ exports.test = base.test.extend({
|
||||
},
|
||||
|
||||
disconnect: async () => {
|
||||
return await context.request.post("/api/connection", {
|
||||
return await context.request.post(baseURL + "/api/connection", {
|
||||
data: {
|
||||
command: "disconnect"
|
||||
}
|
||||
@@ -61,10 +61,12 @@ exports.test = base.test.extend({
|
||||
await use(connectionApi);
|
||||
},
|
||||
|
||||
filesApi: async ({context}, use) => {
|
||||
filesApi: async ({context, baseURL}, use) => {
|
||||
const filesApi = {
|
||||
ensureFileUnknown: async (location, name) => {
|
||||
return await context.request.delete(`/api/files/${location}/${name}`);
|
||||
return await context.request.delete(
|
||||
baseURL + `/api/files/${location}/${name}`
|
||||
);
|
||||
}
|
||||
};
|
||||
await use(filesApi);
|
||||
@@ -74,16 +76,16 @@ exports.test = base.test.extend({
|
||||
await use(credentials);
|
||||
},
|
||||
|
||||
ui: async ({page, util, loginApi}, use) => {
|
||||
ui: async ({page, util, loginApi, baseURL}, use) => {
|
||||
const ui = {
|
||||
gotoLogin: async () => {
|
||||
await page.goto("/?l10n=en");
|
||||
await page.goto(baseURL + "/?l10n=en");
|
||||
await ui.loginHasLoaded();
|
||||
},
|
||||
|
||||
gotoLoggedInCore: async () => {
|
||||
await loginApi.loginDefault();
|
||||
await page.goto("/?l10n=en");
|
||||
await page.goto(baseURL + "/?l10n=en");
|
||||
await ui.coreHasLoaded();
|
||||
},
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ def _load_yaml(fname):
|
||||
|
||||
|
||||
def _dump_yaml(fname, config):
|
||||
with open(fname, "wt", encoding="utf-8") as f:
|
||||
with open(fname, "w", encoding="utf-8") as f:
|
||||
yaml.safe_dump(config, f)
|
||||
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ class ExpectedExit(BaseException):
|
||||
|
||||
class DaemonTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
|
||||
run_method = mock.MagicMock()
|
||||
echo_method = mock.MagicMock()
|
||||
error_method = mock.MagicMock()
|
||||
@@ -19,10 +18,10 @@ class DaemonTest(unittest.TestCase):
|
||||
def run(self):
|
||||
run_method()
|
||||
|
||||
def echo(cls, line):
|
||||
def echo(self, line):
|
||||
echo_method(line)
|
||||
|
||||
def error(cls, line):
|
||||
def error(self, line):
|
||||
error_method(line)
|
||||
|
||||
self.pidfile = "/my/pid/file"
|
||||
@@ -132,8 +131,8 @@ class DaemonTest(unittest.TestCase):
|
||||
mock_open.mock_calls,
|
||||
[
|
||||
mock.call(mock_devnull, encoding="utf-8"),
|
||||
mock.call(mock_devnull, "at+", encoding="utf-8"),
|
||||
mock.call(mock_devnull, "at+", encoding="utf-8"),
|
||||
mock.call(mock_devnull, "a+", encoding="utf-8"),
|
||||
mock.call(mock_devnull, "a+", encoding="utf-8"),
|
||||
],
|
||||
)
|
||||
self.assertListEqual(
|
||||
@@ -448,7 +447,7 @@ class DaemonTest(unittest.TestCase):
|
||||
self.daemon.set_pid(pid)
|
||||
|
||||
# assert
|
||||
m.assert_called_once_with(self.pidfile, "wt+", encoding="utf-8")
|
||||
m.assert_called_once_with(self.pidfile, "w+", encoding="utf-8")
|
||||
handle = m()
|
||||
handle.write.assert_called_once_with(f"{pid}\n")
|
||||
|
||||
@@ -461,7 +460,7 @@ class DaemonTest(unittest.TestCase):
|
||||
self.daemon.set_pid(pid)
|
||||
|
||||
# assert
|
||||
m.assert_called_once_with(self.pidfile, "wt+", encoding="utf-8")
|
||||
m.assert_called_once_with(self.pidfile, "w+", encoding="utf-8")
|
||||
handle = m()
|
||||
handle.write.assert_called_once_with(f"{pid}\n")
|
||||
|
||||
|
||||
@@ -129,7 +129,6 @@ class TimelapseTest(unittest.TestCase):
|
||||
|
||||
@mock.patch("os.scandir")
|
||||
def test_get_finished_timelapses(self, mock_listdir):
|
||||
|
||||
## prepare
|
||||
|
||||
mocked_path = "/path/to/timelapse"
|
||||
@@ -215,7 +214,6 @@ class TimelapseTest(unittest.TestCase):
|
||||
return result
|
||||
|
||||
def test_ffmpeg_parse(self):
|
||||
|
||||
# Test strings
|
||||
noChange1Str = " built on Jan 7 2014 22:07:02 with gcc 4.8.2 (GCC)"
|
||||
durationStr = (
|
||||
|
||||
@@ -554,7 +554,7 @@ class IsHiddenPathTest(unittest.TestCase):
|
||||
"path_always_hidden",
|
||||
):
|
||||
path = getattr(self, attr)
|
||||
with open(path, "wt+", encoding="utf-8") as f:
|
||||
with open(path, "w+", encoding="utf-8") as f:
|
||||
f.write(attr)
|
||||
|
||||
if sys.platform == "win32":
|
||||
|
||||