From d27517218fbb265812e2849c670aea8e5f4c8dfc Mon Sep 17 00:00:00 2001 From: malnvenshorn Date: Sat, 13 Jan 2018 14:09:23 +0100 Subject: [PATCH 1/5] Using jQueries detach method to move the webcam stream No template file is required anymore --- octoprint_webcamtab/__init__.py | 2 +- octoprint_webcamtab/static/js/webcamtab.js | 15 ++++---- .../templates/webcamtab_tab.jinja2 | 36 ------------------- 3 files changed, 9 insertions(+), 44 deletions(-) delete mode 100644 octoprint_webcamtab/templates/webcamtab_tab.jinja2 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.") }} -
From 3dba7d07b013bce3f9af96b72b508c347b55b0dd Mon Sep 17 00:00:00 2001 From: malnvenshorn Date: Sat, 13 Jan 2018 14:09:39 +0100 Subject: [PATCH 2/5] Updated README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d567213..7e9ec98 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. ## Setup From d875770d28ffae6afd7b7ec4d180a6ef1de16237 Mon Sep 17 00:00:00 2001 From: malnvenshorn Date: Wed, 17 Jan 2018 18:57:20 +0100 Subject: [PATCH 3/5] Updated README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7e9ec98..7801031 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # OctoPrint-WebcamTab -This OctoPrint plugin moves the webcam stream from the controls into its own tab. Keyboard control is still possible. +This OctoPrint plugin moves the webcam stream from the controls into its own tab. Keyboard control is still possible and it is compatible to the [FullScreen Plugin](https://github.com/BillyBlaze/OctoPrint-FullScreen). ## Setup From 799d69cba05f1c770de689a8cf56e0e9eed9414a Mon Sep 17 00:00:00 2001 From: Sven Lohrmann Date: Wed, 17 Jan 2018 19:40:51 +0100 Subject: [PATCH 4/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7801031..62f304b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # OctoPrint-WebcamTab -This OctoPrint plugin moves the webcam stream from the controls into its own tab. Keyboard control is still possible and it is compatible to the [FullScreen Plugin](https://github.com/BillyBlaze/OctoPrint-FullScreen). +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 From 87afd384a863cbf3a977a6a74051abcccda0c5f6 Mon Sep 17 00:00:00 2001 From: malnvenshorn Date: Thu, 18 Jan 2018 12:00:00 +0100 Subject: [PATCH 5/5] Prepare release of 0.1.2 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"