Only save configuration if successfully load new stage type
This commit is contained in:
parent
bbda15b08d
commit
b111a4e680
1 changed files with 6 additions and 4 deletions
|
|
@ -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,16 +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:
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue