From 12f3f4196659b1123ac87d0952bfda482fc3a677 Mon Sep 17 00:00:00 2001 From: Stefan Cohen Date: Thu, 26 Sep 2019 20:18:42 +0200 Subject: [PATCH] v1.5.1 Fix for plugin compatibility --- README.md | 4 +- octoprint_dashboard/__init__.py | 2 + octoprint_dashboard/static/css/dashboard.css | 20 +++- octoprint_dashboard/static/js/dashboard.js | 29 +----- .../templates/dashboard_settings.jinja2 | 1 + .../templates/dashboard_tab.jinja2 | 95 ++++++++----------- setup.py | 2 +- 7 files changed, 62 insertions(+), 91 deletions(-) diff --git a/README.md b/README.md index 24e19fc..fac58b3 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ A dashboard tab for Octoprint that displays the most relevant info regarding the * Configurable progress gauge type (Circle, Bar) * Fullscreen mode * Uses Estimates from [PrintTimeGenius](https://plugins.octoprint.org/plugins/PrintTimeGenius/) when installed -* Uses GCode analysis provided by [DisplayLayerProgress](https://plugins.octoprint.org/plugins/DisplayLayerProgress/) to get more accurate layer and fan data +* Uses GCode analysis provided by [DisplayLayerProgress](https://plugins.octoprint.org/plugins/DisplayLayerProgress/) to present layer and fan data * Theme friendly: ![Screenshot](https://github.com/StefanCohen/OctoPrint-Dashboard/blob/master/screenshot-theme.png) @@ -38,7 +38,7 @@ For release notes and release history, please visit the [wiki](https://github.co ## Dependencies -This plugin depends on [DisplayLayerProgress](https://plugins.octoprint.org/plugins/DisplayLayerProgress/) to be installed in order to provide all metrics. DisplayLayerProgress provides GCode analysis for the Dashboard. Only the events from DisplayLayerProgress are used by the Dashboard plugin so you may disable "Navigationbar" and "Printer Display" in the DisplayLayerProgress plugin settings if you want to see them in the UI. +This plugin depends on [DisplayLayerProgress](https://plugins.octoprint.org/plugins/DisplayLayerProgress/) to be installed. DisplayLayerProgress provides GCode analysis for the Fan, Layer, Height and Layer Average stats. Only the events from DisplayLayerProgress are used by the Dashboard plugin so you may disable "Navigationbar" and "Printer Display" in the DisplayLayerProgress plugin settings if you want to see them in the UI. The dashboard uses the time estimates provided by PrintTimeGenius if it is installed but it is not required. diff --git a/octoprint_dashboard/__init__.py b/octoprint_dashboard/__init__.py index 9f24ccb..a17c206 100644 --- a/octoprint_dashboard/__init__.py +++ b/octoprint_dashboard/__init__.py @@ -95,6 +95,8 @@ def __plugin_load__(): __plugin_hooks__ = { "octoprint.plugin.softwareupdate.check_config": __plugin_implementation__.get_update_information } + + global __plugin_settings_overlay__ __plugin_settings_overlay__ = dict(appearance=dict(components=dict(order=dict(tab=["plugin_dashboard", diff --git a/octoprint_dashboard/static/css/dashboard.css b/octoprint_dashboard/static/css/dashboard.css index 051795e..30fbe67 100644 --- a/octoprint_dashboard/static/css/dashboard.css +++ b/octoprint_dashboard/static/css/dashboard.css @@ -76,6 +76,18 @@ svg text { fill: #08c; } +/* Webcam */ +#dashboard_webcam_container .webcam_rotated{position:relative;width:100%;padding-bottom:100%;pointer-events:none} +#dashboard_webcam_container .webcam_rotated .webcam_fixed_ratio{position:absolute;transform:rotate(-90deg);top:0;bottom:0;pointer-events:none} +#dashboard_webcam_container .webcam_rotated .webcam_fixed_ratio .webcam_fixed_ratio_inner{width:100%;height:100%;pointer-events:none} +#dashboard_webcam_container .webcam_unrotated .webcam_fixed_ratio{width:100%;pointer-events:none;padding-bottom:100%;position:relative} +#dashboard_webcam_container .webcam_unrotated .webcam_fixed_ratio.ratio43{padding-bottom:75%} +#dashboard_webcam_container .webcam_unrotated .webcam_fixed_ratio.ratio169{padding-bottom:56.25%} +#dashboard_webcam_container .webcam_unrotated .webcam_fixed_ratio.ratio1610{padding-bottom:62.5%} +#dashboard_webcam_container .webcam_unrotated .webcam_fixed_ratio .webcam_fixed_ratio_inner{position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none} +#dashboard_webcam_container img{width:100%;height:100%;object-fit:contain} + + /* Small Screens */ @media (max-width: 700px) { @@ -132,7 +144,7 @@ svg text { transform: translateY(-50%); padding: 2vmin 0px; } -.dasboardContainer:-moz-full-screen div#webcam_container { +.dasboardContainer:-moz-full-screen div#dashboard_webcam_container { position: fixed; max-width: 65vw; max-height: calc(90vh - 4vmin); @@ -189,7 +201,7 @@ svg text { transform: translateY(-50%); padding: 2vmin 0px; } -.dasboardContainer:-ms-fullscreen div#webcam_container { +.dasboardContainer:-ms-fullscreen div#dashboard_webcam_container { position: fixed; max-width: 65vw; max-height: calc(90vh - 4vmin); @@ -244,7 +256,7 @@ svg text { transform: translateY(-50%); padding: 2vmin 0px; } -.dasboardContainer:-webkit-full-screen div#webcam_container { +.dasboardContainer:-webkit-full-screen div#dashboard_webcam_container { position: fixed; max-width: 65vw; max-height: calc(90vh - 4vmin); @@ -299,7 +311,7 @@ svg text { transform: translateY(-50%); padding: 2vmin 0px; } -.dasboardContainer:fullscreen div#webcam_container { +.dasboardContainer:fullscreen div#dashboard_webcam_container { position: fixed; max-width: 65vw; max-height: calc(90vh - 4vmin); diff --git a/octoprint_dashboard/static/js/dashboard.js b/octoprint_dashboard/static/js/dashboard.js index 89e88b0..212ce5c 100644 --- a/octoprint_dashboard/static/js/dashboard.js +++ b/octoprint_dashboard/static/js/dashboard.js @@ -112,38 +112,13 @@ $(function() { if (data.cpuTemp) { self.cpuTemp(data.cpuTemp); } }; - // jneilliii/foosel hack to fix control tab disabling the webcam. Tricks the system by making it think you've switched to the control tab by calling it's onTabChange event and then reverting the internal selectedTab variable back to the dashboard - self.onTabChange = function(current, previous) { - if ((current === "#tab_plugin_dashboard") || (current === "#control")) { - var selected = OctoPrint.coreui.selectedTab; - OctoPrint.coreui.selectedTab = "#control"; - self.controlViewModel.onTabChange("#control", previous); - OctoPrint.coreui.selectedTab = selected; - } else if (previous === "#tab_plugin_dashboard") { - self.controlViewModel.onTabChange(current, "#control"); - } - }; - - // jneilliii/foosel hack to fix control tab disabling the webcam continued - self.controlViewModel.onBrowserTabVisibilityChange = function(status) { - if (status) { - var selected = OctoPrint.coreui.selectedTab; - OctoPrint.coreui.selectedTab = "#control"; - self.controlViewModel._enableWebcam(); - OctoPrint.coreui.selectedTab = selected; - } else { - self.controlViewModel._disableWebcam(); - } - }; - self.embedUrl = function() { - if (self.settingsViewModel.settings.webcam) { - return self.settingsViewModel.settings.webcam.streamUrl() + if (self.settingsViewModel.settings.webcam && self.settingsViewModel.settings.plugins.dashboard.showWebCam) { + return self.settingsViewModel.settings.webcam.streamUrl(); } else return "ERROR: Webcam not enabled in config."; }; - self.getEta = function(seconds) { dt = new Date(); dt.setSeconds( dt.getSeconds() + seconds ) diff --git a/octoprint_dashboard/templates/dashboard_settings.jinja2 b/octoprint_dashboard/templates/dashboard_settings.jinja2 index 17e7053..e91fd12 100644 --- a/octoprint_dashboard/templates/dashboard_settings.jinja2 +++ b/octoprint_dashboard/templates/dashboard_settings.jinja2 @@ -60,6 +60,7 @@ + {{ _('Advanced Settings') }}
diff --git a/octoprint_dashboard/templates/dashboard_tab.jinja2 b/octoprint_dashboard/templates/dashboard_tab.jinja2 index 51c5b36..d958c04 100644 --- a/octoprint_dashboard/templates/dashboard_tab.jinja2 +++ b/octoprint_dashboard/templates/dashboard_tab.jinja2 @@ -7,7 +7,7 @@
- +
- +
- +
- - + +
- - + +
- - + +
@@ -45,8 +42,7 @@
- + @@ -60,7 +56,7 @@
- + @@ -72,7 +68,7 @@
- + @@ -84,7 +80,7 @@
- + @@ -96,38 +92,32 @@ -
-
+
+
- - + +
+
-
+
- +
- +
@@ -135,45 +125,35 @@
- - + +
- +
-
- +
+
- - + +
- + - +
- + - +
- - + +
@@ -183,15 +163,16 @@
- -
+ +
- +
+
\ No newline at end of file diff --git a/setup.py b/setup.py index d9ba79f..82eba7e 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ plugin_name = "OctoPrint-Dashboard" # The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module -plugin_version = "1.5.0" +plugin_version = "1.5.1" # The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin # module