Merge branch 'geometry-change-bug-fixes' into 'master'

Geometry change bug fixes

See merge request openflexure/openflexure-microscope-server!78
This commit is contained in:
Joel Collins 2020-10-27 17:17:58 +00:00
commit f9da19fb7f
2 changed files with 14 additions and 9 deletions

View file

@ -4,7 +4,7 @@
<h3>Stage settings</h3> <h3>Stage settings</h3>
<p> <p>
<label class="uk-form-label"> <label class="uk-form-label">
Stage Geometry Stage geometry
<div v-if="stageType != 'MissingStage'"> <div v-if="stageType != 'MissingStage'">
<form @submit.prevent="setStageType"> <form @submit.prevent="setStageType">
<div class="uk-margin-small"> <div class="uk-margin-small">
@ -18,7 +18,7 @@
type="submit" type="submit"
class="uk-button uk-button-primary uk-width-1-1" class="uk-button uk-button-primary uk-width-1-1"
> >
Change stage type Change stage geometry
</button> </button>
</div> </div>
</form> </form>
@ -70,11 +70,15 @@ export default {
setStageType: function() { setStageType: function() {
console.log("Setting stage type"); console.log("Setting stage type");
axios axios
.put(this.stageTypeUri, this.stageType) .put(this.stageTypeUri, this.stageType,{
headers: {
'Content-Type': 'application/json',
}
})
.then(response => { .then(response => {
this.stageType = response.data; this.stageType = response.data;
console.log("Stage type set to " + this.stageType); console.log("Stage type set to " + this.stageType);
this.modalNotify("Stage type changed."); this.modalNotify("Stage geometry changed.");
}) })
.catch(error => { .catch(error => {
this.modalError(error); this.modalError(error);

View file

@ -144,6 +144,9 @@ class Microscope:
try: try:
logging.info("Trying SangaStage") logging.info("Trying SangaStage")
self.stage = SangaStage(port=stage_port) self.stage = SangaStage(port=stage_port)
logging.info("Saving new SangaStage type configuration")
configuration["stage"]["type"] = stage_type
self.configuration_file.save(configuration)
except Exception as e: # pylint: disable=W0703 except Exception as e: # pylint: disable=W0703
logging.error(e) logging.error(e)
logging.warning("No compatible Sangaboard hardware found.") logging.warning("No compatible Sangaboard hardware found.")
@ -151,17 +154,15 @@ class Microscope:
try: try:
logging.info("Trying SangaDeltaStage") logging.info("Trying SangaDeltaStage")
self.stage = SangaDeltaStage(port=stage_port) self.stage = SangaDeltaStage(port=stage_port)
logging.info("Saving new SangaDeltaStage type configuration")
configuration["stage"]["type"] = stage_type
self.configuration_file.save(configuration)
except Exception as e: # pylint: disable=W0703 except Exception as e: # pylint: disable=W0703
logging.error(e) logging.error(e)
logging.warning("No compatible Sangaboard hardware found.") logging.warning("No compatible Sangaboard hardware found.")
else: else:
logging.warning("The stage type is incorrectly defined.") logging.warning("The stage type is incorrectly defined.")
logging.info("Saving new stage type configuration")
configuration["stage"]["type"] = stage_type
self.configuration_file.save(configuration)
def has_real_stage(self) -> bool: def has_real_stage(self) -> bool:
""" """
Check if a real (non-mock) stage is currently attached. Check if a real (non-mock) stage is currently attached.