diff --git a/README.md b/README.md index d567213..62f304b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # OctoPrint-WebcamTab -This OctoPrint plugin relocates the webcam stream into a separate tab. +This OctoPrint plugin moves the webcam stream from the controls into its own tab. Keyboard control is still possible and it is compatible with the [FullScreen Plugin](https://github.com/BillyBlaze/OctoPrint-FullScreen). ## Setup diff --git a/octoprint_webcamtab/__init__.py b/octoprint_webcamtab/__init__.py index e87230d..8f6934d 100644 --- a/octoprint_webcamtab/__init__.py +++ b/octoprint_webcamtab/__init__.py @@ -22,7 +22,7 @@ class WebcamTabPlugin(octoprint.plugin.AssetPlugin, def get_template_configs(self): return [ - dict(type="tab", name="Webcam") + dict(type="tab", name="Webcam", template=None) ] # Softwareupdate hook diff --git a/octoprint_webcamtab/static/js/webcamtab.js b/octoprint_webcamtab/static/js/webcamtab.js index 0c060a7..c85be92 100644 --- a/octoprint_webcamtab/static/js/webcamtab.js +++ b/octoprint_webcamtab/static/js/webcamtab.js @@ -51,14 +51,15 @@ $(function() { } }; - self.onStartup = function() { - var container = $("#control #webcam_container"); - if (container.length) { - var hint = container.next(); - if (hint.attr("data-bind") === "visible: keycontrolPossible") { - hint.remove(); + self.onAfterBinding = function() { + var tab = $("#tab_plugin_webcamtab"); + var webcam = $("#webcam_container"); + if (webcam) { + var hint = webcam.next(); + tab.append(webcam.detach()); + if (hint && hint.attr("data-bind") === "visible: keycontrolPossible") { + tab.append(hint.detach()); } - container.remove(); } }; }; diff --git a/octoprint_webcamtab/templates/webcamtab_tab.jinja2 b/octoprint_webcamtab/templates/webcamtab_tab.jinja2 deleted file mode 100644 index a1c04f4..0000000 --- a/octoprint_webcamtab/templates/webcamtab_tab.jinja2 +++ /dev/null @@ -1,36 +0,0 @@ -
-
-
-

{{ _('Webcam stream loading...') }}

-
-
-

{{ _('Webcam stream not loaded') }}

-

{{ _('It might not be correctly configured. You can change the URL of the stream under "Settings" > "Webcam & Timelapse" > "Stream URL". If you don\'t have a webcam just set the URL to an empty value.') }}

-
-
-
-
-
- -
-
-
-
-
{{ _("Keyboard controls active") }}
-
-
- / : {{ _("X Axis") }} +/-
- / : {{ _("Y Axis") }} +/-
- W, {{ _("Page↑") }} / S, {{ _("Page↓") }}: {{ _("Z Axis") }} +/- -
-
- Home: {{ _("Home X/Y") }}
- End: {{ _("Home Z") }}
- 1, 2, 3, 4: {{ _("Stepsize") }} 0.1, 1, 10, 100mm -
-
-
-
-
- {{ _("Hint: If you move your mouse over the picture, you enter keyboard control mode.") }} -
diff --git a/setup.py b/setup.py index 04194be..ce004de 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ from setuptools import setup plugin_identifier = "webcamtab" plugin_package = "octoprint_webcamtab" plugin_name = "OctoPrint-WebcamTab" -plugin_version = "0.1.1" +plugin_version = "0.1.2" plugin_description = """Show webcam stream in separate tab""" plugin_author = "Sven Lohrmann" plugin_author_email = "malnvenshorn@gmail.com"