Cleaned up store and removed unused FoV setting

This commit is contained in:
Joel Collins 2020-11-22 16:52:30 +00:00
parent f187a3a00d
commit a1ae94792e
13 changed files with 42 additions and 119 deletions

View file

@ -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"
}
};

View file

@ -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",

View file

@ -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",

View file

@ -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;
}

View file

@ -4,9 +4,6 @@
// Highlight.js
@import "./highlight.less";
// Electron app theming
@import "./app.less";
// Custom OpenFlexure theming
//

View file

@ -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(() => {

View file

@ -242,7 +242,7 @@
</li>
</ul>
<div v-if="scanCapture" class="uk-margin uk-margin-remove-top ">
<div v-if="scanCapture" class="uk-margin uk-margin-remove-top">
<taskSubmitter
:submit-url="scanUri"
:submit-data="scanPayload"
@ -296,9 +296,9 @@ export default {
scanStyle: "Raster",
namingStyle: "Coordinates",
scanStepSize: {
x: 0,
y: 0,
z: 0
x: 800,
y: 640,
z: 50
},
scanSteps: {
x: 3,
@ -326,9 +326,6 @@ export default {
pluginsUri: function() {
return `${this.$store.getters.baseUri}/api/v2/extensions`;
},
settingsFovUri: function() {
return `${this.$store.getters.baseUri}/api/v2/instrument/settings/fov`;
},
basePayload: function() {
var payload = {};
@ -395,7 +392,6 @@ export default {
mounted() {
this.updateScanUri();
this.updateScanStepSize();
// A global signal listener to perform a capture action
this.$root.$on("globalCaptureEvent", () => {
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) {

View file

@ -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);
}
}
},

View file

@ -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);
}
}

View file

@ -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);
}
}
}

View file

@ -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
});
}
}
};

View file

@ -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;

View file

@ -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,
}