added dict of known types; create correct entries for those
This commit is contained in:
23
scam.py
23
scam.py
@ -25,6 +25,16 @@ ENFORCED_SETTINGS = [
|
|||||||
"function"
|
"function"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
KNOWN_TYPES = {
|
||||||
|
"threshold": 0.,
|
||||||
|
"project_axis": 0,
|
||||||
|
"roi_background": [0]*4,
|
||||||
|
"roi_signal": [0]*4,
|
||||||
|
"roi_radial": [0]*4,
|
||||||
|
"radial_x0": 0,
|
||||||
|
"radial_y0": 0
|
||||||
|
}
|
||||||
|
|
||||||
SCRIPT_NAME = "spectrometer.py"
|
SCRIPT_NAME = "spectrometer.py"
|
||||||
TITLE = "SCam" if not clargs.show_all_settings else "SCam Expert Mode"
|
TITLE = "SCam" if not clargs.show_all_settings else "SCam Expert Mode"
|
||||||
|
|
||||||
@ -146,6 +156,13 @@ class MainPanel(wx.Panel):
|
|||||||
cfg = pipeline.get()
|
cfg = pipeline.get()
|
||||||
print("current config:", cfg)
|
print("current config:", cfg)
|
||||||
|
|
||||||
|
# use contents of KNOWN_TYPES to pre-fill cfg
|
||||||
|
#TODO use setdefault instead?
|
||||||
|
cfg_o = cfg
|
||||||
|
cfg_x = KNOWN_TYPES.copy()
|
||||||
|
cfg_x.update(cfg)
|
||||||
|
cfg = cfg_x
|
||||||
|
|
||||||
self.camera = camera = cfg["camera_name"]
|
self.camera = camera = cfg["camera_name"]
|
||||||
|
|
||||||
self.orig_cfg = cfg
|
self.orig_cfg = cfg
|
||||||
@ -160,6 +177,12 @@ class MainPanel(wx.Panel):
|
|||||||
|
|
||||||
self.entries.update(cfg, name_mapping)
|
self.entries.update(cfg, name_mapping)
|
||||||
|
|
||||||
|
# disable and clear lines added only from KNOWN_TYPES
|
||||||
|
for i in self.entries.children.values():
|
||||||
|
if i.name not in cfg_o:
|
||||||
|
i.disable()
|
||||||
|
i.clear()
|
||||||
|
|
||||||
# ensure background name is always set unless there is no background at all
|
# ensure background name is always set unless there is no background at all
|
||||||
bkg_setting = self.entries["image_background"]
|
bkg_setting = self.entries["image_background"]
|
||||||
if not bkg_setting.get_state():
|
if not bkg_setting.get_state():
|
||||||
|
Reference in New Issue
Block a user