From ac45a84d1e78d85d75ea1971d3d32593fb3d89f0 Mon Sep 17 00:00:00 2001 From: Hugo Costa Date: Mon, 24 Jul 2023 15:55:47 +0100 Subject: [PATCH] version update, webcam fixes --- octoprint_BLOCKS/python3wifi/iwlibs.py | 2 +- octoprint_BLOCKS/static/js/BLOCKS_WebCam.js | 19 +++++-------------- setup.py | 2 +- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/octoprint_BLOCKS/python3wifi/iwlibs.py b/octoprint_BLOCKS/python3wifi/iwlibs.py index e726aee..c0b45eb 100644 --- a/octoprint_BLOCKS/python3wifi/iwlibs.py +++ b/octoprint_BLOCKS/python3wifi/iwlibs.py @@ -24,7 +24,7 @@ import array import math import errno -# import fcntl +import fcntl import os import socket import time diff --git a/octoprint_BLOCKS/static/js/BLOCKS_WebCam.js b/octoprint_BLOCKS/static/js/BLOCKS_WebCam.js index 546ecf8..ddf7568 100644 --- a/octoprint_BLOCKS/static/js/BLOCKS_WebCam.js +++ b/octoprint_BLOCKS/static/js/BLOCKS_WebCam.js @@ -52,6 +52,7 @@ $(function () { if (self.classicWebcam.webcamError()) { console.log("There was an error on the webcam"); + OctoPrint.coreui.viewmodels.controlViewModel.onBrowserTabVisibilityChange(self.webcamStatus()); } }; @@ -116,6 +117,7 @@ $(function () { self.fullScreenState = ko.observable(false); self.fullScreenButton = ko.observable(undefined); + self._webcamFixedRatio = document.querySelector(".webcam_fixed_ratio"); self._webcamFixedRatioStyle = this._webcamFixedRatio.style.paddingBottom; @@ -126,17 +128,9 @@ $(function () { if (self.fullScreenState() === false) { self.fullScreenOperations(true); self.fullScreenState(true); - // var _webcam = document.getElementsByClassName("webcam_fixed_ratio"); - self._webcamFixedRatio.style.cssText = - "padding-bottom: 49.5%;"; - // .css("padding-bottom: 49%"); - // console.log(_webcam) - console.log(_webcamFixedRatio); } else if (self.fullScreenState() === true) { self.fullScreenState(false); self.fullScreenOperations(false); - self._webcamFixedRatio.style.paddingBottom = - self._webcamFixedRatioStyle; } } catch (e) { console.log(e); @@ -152,8 +146,7 @@ $(function () { self.fullScreenStyles.ROTATOR_ON ); $("#webcam_img_container").css(self.fullScreenStyles.ON); - // $("#webcam_plugins_container").css(self.fullScreenStyles.ON); - // $("#classicwebcam_container").css(self.fullScreenStyles.ON); + self._webcamFixedRatio.style.cssText = "padding-bottom: 49.5%;"; } else { $("#webcam_rotator.webcam_rotated").css( self.fullScreenStyles.ROTATOR_OFF_PAD @@ -162,8 +155,8 @@ $(function () { self.fullScreenStyles.ROTATOR_OFF ); $("#webcam_img_container").css(self.fullScreenStyles.OFF); - // $("#webcam_plugins_container").css(self.fullScreenStyles.OFF); - // $("#classicwebcam_container").css(self.fullScreenStyles.OFF); + self._webcamFixedRatio.style.paddingBottom = + self._webcamFixedRatioStyle; } }; // This event listener serves for the full screen video player @@ -176,8 +169,6 @@ $(function () { ) { self.fullScreenState(false); self.fullScreenOperations(false); - self._webcamFixedRatio.style.paddingBottom = - self._webcamFixedRatioStyle; } }); } diff --git a/setup.py b/setup.py index 6acbd18..dd0a09e 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ plugin_name = "OctoPrint-BLOCKS" # The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module -plugin_version = "1.0.2" +plugin_version = "1.0.3" # The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin # module