diff --git a/openflexure_microscope/api/static/.eslintrc.js b/openflexure_microscope/api/static/.eslintrc.js index e7ec7f8b..8f072613 100644 --- a/openflexure_microscope/api/static/.eslintrc.js +++ b/openflexure_microscope/api/static/.eslintrc.js @@ -1,30 +1,14 @@ module.exports = { root: true, - env: { node: true }, - - extends: [ - "plugin:vue/recommended", - "eslint:recommended", - "prettier/vue", - "plugin:prettier/recommended", - "plugin:vue/essential", - "@vue/prettier" - ], - - rules: { - "vue/component-name-in-template-casing": ["error", "PascalCase"], - "no-console": process.env.NODE_ENV === "production" ? "warn" : "off", - "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off" - }, - - globals: { - $nuxt: true - }, - + extends: ["plugin:vue/recommended", "eslint:recommended", "@vue/prettier"], parserOptions: { parser: "babel-eslint" + }, + rules: { + "no-console": process.env.NODE_ENV === "production" ? "warn" : "off", + "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off" } }; diff --git a/openflexure_microscope/api/static/package-lock.json b/openflexure_microscope/api/static/package-lock.json index d40891cb..3a127fda 100644 --- a/openflexure_microscope/api/static/package-lock.json +++ b/openflexure_microscope/api/static/package-lock.json @@ -13760,9 +13760,9 @@ } }, "vue-loader-v16": { - "version": "npm:vue-loader@16.0.0-rc.1", - "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.0.0-rc.1.tgz", - "integrity": "sha512-yR+BS90EOXTNieasf8ce9J3TFCpm2DGqoqdbtiwQ33hon3FyIznLX7sKavAq1VmfBnOeV6It0Htg4aniv8ph1g==", + "version": "npm:vue-loader@16.0.0-rc.2", + "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.0.0-rc.2.tgz", + "integrity": "sha512-cz8GK4dgIf1UTC+do80pGvh8BHcCRHLIQVHV9ONVQ8wtoqS9t/+H02rKcQP+TVNg7khgLyQV2+8eHUq7/AFq3g==", "dev": true, "optional": true, "requires": { @@ -13862,12 +13862,6 @@ "resolved": "https://registry.npmjs.org/vue-observe-visibility/-/vue-observe-visibility-0.4.6.tgz", "integrity": "sha512-xo0CEVdkjSjhJoDdLSvoZoQrw/H2BlzB5jrCBKGZNXN2zdZgMuZ9BKrxXDjNP2AxlcCoKc8OahI3F3r3JGLv2Q==" }, - "vue-plugin-load-script": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/vue-plugin-load-script/-/vue-plugin-load-script-1.3.2.tgz", - "integrity": "sha512-UQcFanuWBf72/339LxgsPZbMsT5LKUjBzkQfV3xf4ni5fc6Nnx5GNYclODFaQ9FHtOjWhu423bhHrlBHz4MIFg==", - "dev": true - }, "vue-style-loader": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/vue-style-loader/-/vue-style-loader-4.1.2.tgz", diff --git a/openflexure_microscope/api/static/package.json b/openflexure_microscope/api/static/package.json index 3e8d753d..00371b74 100644 --- a/openflexure_microscope/api/static/package.json +++ b/openflexure_microscope/api/static/package.json @@ -7,8 +7,8 @@ "scripts": { "serve": "vue-cli-service serve --mode development", "build": "vue-cli-service build --mode production", - "lint": "vue-cli-service lint", - "prettier": "vue-cli-service lint --fix" + "lint": "vue-cli-service lint --no-fix", + "lint:fix": "vue-cli-service lint --fix" }, "dependencies": { "material-design-icons": "^3.0.1", @@ -24,7 +24,6 @@ "babel-eslint": "^10.1.0", "css-loader": "^3.6.0", "eslint": "^6.8.0", - "eslint-config-prettier": "^6.15.0", "eslint-plugin-prettier": "^3.1.4", "eslint-plugin-vue": "^6.2.2", "less": "^3.12.2", @@ -34,7 +33,6 @@ "uikit": "^3.5.9", "vue": "^2.6.12", "vue-friendly-iframe": "^0.17.0", - "vue-plugin-load-script": "^1.3.2", "vue-template-compiler": "^2.6.12", "vue-tour": "^1.5.0", "vuejs-paginate": "^2.1.0", diff --git a/openflexure_microscope/api/static/src/assets/less/app.less b/openflexure_microscope/api/static/src/assets/less/app.less deleted file mode 100644 index f762eda0..00000000 --- a/openflexure_microscope/api/static/src/assets/less/app.less +++ /dev/null @@ -1,18 +0,0 @@ -// Theming specific to the electron app - -.menubar-menu-container { - box-shadow: 0.5px 1px 4px 0px rgba(0, 0, 0, 0.3) !important; -} - -.menubar-menu-container>* { - box-shadow: none !important; -} - -.menubar-menu-container .action-menu-item, -.menubar-menu-container .action-label { - cursor: default -} - -.menubar-menu-container a:hover { - text-decoration: none; -} \ No newline at end of file diff --git a/openflexure_microscope/api/static/src/assets/less/theme.less b/openflexure_microscope/api/static/src/assets/less/theme.less index 9c96d036..54a22eef 100644 --- a/openflexure_microscope/api/static/src/assets/less/theme.less +++ b/openflexure_microscope/api/static/src/assets/less/theme.less @@ -4,9 +4,6 @@ // Highlight.js @import "./highlight.less"; -// Electron app theming -@import "./app.less"; - // Custom OpenFlexure theming // diff --git a/openflexure_microscope/api/static/src/components/appContent.vue b/openflexure_microscope/api/static/src/components/appContent.vue index 6410db42..08209ffc 100644 --- a/openflexure_microscope/api/static/src/components/appContent.vue +++ b/openflexure_microscope/api/static/src/components/appContent.vue @@ -267,9 +267,9 @@ export default { window.location.hostname ) ) { - this.$store.commit("changeSetting", ["disableStream", true]); - this.$store.commit("changeSetting", ["autoGpuPreview", true]); - this.$store.commit("changeSetting", ["trackWindow", true]); + this.$store.commit("changeDisableStream", true); + this.$store.commit("changeAutoGpuPreview", true); + this.$store.commit("changeTrackWindow", true); } // Update plugins this.updatePlugins().then(() => { diff --git a/openflexure_microscope/api/static/src/components/tabContentComponents/captureComponents/paneCapture.vue b/openflexure_microscope/api/static/src/components/tabContentComponents/captureComponents/paneCapture.vue index ba030908..34abb9f6 100644 --- a/openflexure_microscope/api/static/src/components/tabContentComponents/captureComponents/paneCapture.vue +++ b/openflexure_microscope/api/static/src/components/tabContentComponents/captureComponents/paneCapture.vue @@ -242,7 +242,7 @@ -
+
{ this.handleCapture(); @@ -439,21 +435,6 @@ export default { }); }, - updateScanStepSize: function() { - axios - .get(this.settingsFovUri) // Get the microscope FOV - .then(response => { - this.scanStepSize = { - x: parseInt(0.5 * response.data[0]), - y: parseInt(0.5 * response.data[1]), - z: 50 - }; - }) - .catch(error => { - this.modalError(error); // Let mixin handle error - }); - }, - onScanSubmit: function() {}, onScanResponse: function(responseData) { diff --git a/openflexure_microscope/api/static/src/components/tabContentComponents/settingsComponents/appSettings.vue b/openflexure_microscope/api/static/src/components/tabContentComponents/settingsComponents/appSettings.vue index 2041c16a..6b547d44 100644 --- a/openflexure_microscope/api/static/src/components/tabContentComponents/settingsComponents/appSettings.vue +++ b/openflexure_microscope/api/static/src/components/tabContentComponents/settingsComponents/appSettings.vue @@ -29,7 +29,7 @@ export default { return this.$store.state.globalSettings.appTheme; }, set(value) { - this.$store.commit("changeSetting", ["appTheme", value]); + this.$store.commit("changeAppTheme", value); } } }, diff --git a/openflexure_microscope/api/static/src/components/tabContentComponents/settingsComponents/featuresSettings.vue b/openflexure_microscope/api/static/src/components/tabContentComponents/settingsComponents/featuresSettings.vue index db0945c3..8b131607 100644 --- a/openflexure_microscope/api/static/src/components/tabContentComponents/settingsComponents/featuresSettings.vue +++ b/openflexure_microscope/api/static/src/components/tabContentComponents/settingsComponents/featuresSettings.vue @@ -32,7 +32,7 @@ export default { return this.$store.state.globalSettings.IHIEnabled; }, set(value) { - this.$store.commit("changeSetting", ["IHIEnabled", value]); + this.$store.commit("changeIHIEnabled", value); this.$root.$emit("globalSafeTogglePreview", value); } } diff --git a/openflexure_microscope/api/static/src/components/tabContentComponents/settingsComponents/streamSettings.vue b/openflexure_microscope/api/static/src/components/tabContentComponents/settingsComponents/streamSettings.vue index 1d4be9d4..4814dc3e 100644 --- a/openflexure_microscope/api/static/src/components/tabContentComponents/settingsComponents/streamSettings.vue +++ b/openflexure_microscope/api/static/src/components/tabContentComponents/settingsComponents/streamSettings.vue @@ -64,7 +64,7 @@ export default { return this.$store.state.globalSettings.disableStream; }, set(value) { - this.$store.commit("changeSetting", ["disableStream", value]); + this.$store.commit("changeDisableStream", value); } }, @@ -73,7 +73,7 @@ export default { return this.$store.state.globalSettings.autoGpuPreview; }, set(value) { - this.$store.commit("changeSetting", ["autoGpuPreview", value]); + this.$store.commit("changeAutoGpuPreview", value); this.$root.$emit("globalSafeTogglePreview", value); } }, @@ -83,7 +83,7 @@ export default { return this.$store.state.globalSettings.trackWindow; }, set(value) { - this.$store.commit("changeSetting", ["trackWindow", value]); + this.$store.commit("changeTrackWindow", value); } } } diff --git a/openflexure_microscope/api/static/src/components/tabContentComponents/streamContent.vue b/openflexure_microscope/api/static/src/components/tabContentComponents/streamContent.vue index 820521b1..833c3247 100644 --- a/openflexure_microscope/api/static/src/components/tabContentComponents/streamContent.vue +++ b/openflexure_microscope/api/static/src/components/tabContentComponents/streamContent.vue @@ -46,7 +46,6 @@ export default { isVisible: false, displaySize: [0, 0], displayPosition: [0, 0], - fov: [0, 0], resizeTimeoutId: setTimeout(this.doneResizing, 500) }; }, @@ -104,8 +103,6 @@ export default { console.log(`${this._uid} created`); // Send a request to start/stop GPU preview based on global setting this.safePreviewRequest(this.$store.state.globalSettings.autoGpuPreview); - // Get FOV from settings - this.updateFov(); }, beforeDestroy: function() { @@ -136,7 +133,7 @@ export default { }, clickMonitor: function(event) { - // Calculate steps from event coordinates and store config FOV + // Calculate steps from event coordinates let xCoordinate = event.offsetX; let yCoordinate = event.offsetY; @@ -299,21 +296,6 @@ export default { this.modalError(error); // Let mixin handle error }); } - }, - - updateFov: function() { - console.log("Updating FOV"); - // Get the current field-of-view setting from the server - axios - .get(`${this.settingsUri}/fov`) - .then(response => { - if (response.data) { - this.fov = response.data; - } - }) - .catch(error => { - this.modalError(error); // Let mixin handle error - }); } } }; diff --git a/openflexure_microscope/api/static/src/store.js b/openflexure_microscope/api/static/src/store.js index 961bddfa..8b92ca38 100644 --- a/openflexure_microscope/api/static/src/store.js +++ b/openflexure_microscope/api/static/src/store.js @@ -9,13 +9,11 @@ export default new Vuex.Store({ available: false, waiting: false, error: "", - globalSettings: { - disableStream: false, - autoGpuPreview: false, - trackWindow: true, - IHIEnabled: false, - appTheme: "system" - }, + disableStream: false, + autoGpuPreview: false, + trackWindow: true, + IHIEnabled: false, + appTheme: "system", activeStreams: {} }, @@ -26,8 +24,20 @@ export default new Vuex.Store({ changeWaiting(state, waiting) { state.waiting = waiting; }, - changeSetting(state, [key, value]) { - state.globalSettings[key] = value; + changeDisableStream(state, disabled) { + state.disableStream = disabled; + }, + changeAutoGpuPreview(state, enabled) { + state.autoGpuPreview = enabled; + }, + changeTrackWindow(state, enabled) { + state.trackWindow = enabled; + }, + changeAppTheme(state, theme) { + state.appTheme = theme; + }, + changeIHIEnabled(state, enabled) { + state.IHIEnabled = enabled; }, resetState(state) { state.waiting = false; diff --git a/openflexure_microscope/microscope.py b/openflexure_microscope/microscope.py index 17ee25a0..737be46d 100644 --- a/openflexure_microscope/microscope.py +++ b/openflexure_microscope/microscope.py @@ -37,8 +37,6 @@ class Microscope: self.captures = CaptureManager() - self.fov = [0, 0] #: Microscope field-of-view in stage motor steps - # Store settings and configuration files self.settings_file = settings self.configuration_file = configuration @@ -217,8 +215,6 @@ class Microscope: self.id = settings.pop("id") if "name" in settings: self.name = settings.pop("name") - if "fov" in settings: - self.fov = settings.pop("fov") # Extension settings if "extensions" in settings: @@ -241,7 +237,6 @@ class Microscope: settings_current = { "id": self.id, "name": self.name, - "fov": self.fov, "extensions": self.extension_settings, }