xraypy / xraylarch

Larch: Applications and Python Library for Data Analysis of X-ray Absorption Spectroscopy (XAS, XANES, XAFS, EXAFS), X-ray Fluorescence (XRF) Spectroscopy and Imaging, and more.
https://xraypy.github.io/xraylarch
Other
127 stars 62 forks source link

[xas_viewer] settings not kept when switching groups #449

Open maurov opened 1 year ago

maurov commented 1 year ago

When switching from one group to another some settings are lost:

1) Normalization panel: the Victoreen order is resetted to default, not kept to the chosen value:

2) Linear combo panel: fit range resetted to default

@newville I wanted to fix this by myself, but I got lost in the Wx GUI. Please, could you tell me what is the method that is called when clicking on a Group in the list of groups panel?

PS: by the way on Linux and WSL there is still this annoying problem that the highlight of the selected group is lost as soon one clicks on the plot window. Then one has to look at the title in the main window to know what is the current highlighted group. Any news if this can be solved? Or is possible to use another method to highlight the current group in the list of groups?

newville commented 1 year ago

@maurov For 1: In xasnorm_panel there are basically "read_form()" and "process()" methods - I would guess the problem with victoreen order (nvict) is there, somewhere....

For 2: probably the "fit range" is just not being set for the group (groupA) before the fit... Again there should basically be "read_form" and "process". There will also be "fill_form", meaning "fill the form from the current group configuration".

For the "loss of highlight" in the File List : I'll look again, but if I recall it was a pretty low-level wxPython setting and that there just wasn't a setting that worked. I'll look again, but I'm not 100% sure how easy this is to fix.

maurov commented 1 year ago

For the "loss of highlight" in the File List : I'll look again, but if I recall it was a pretty low-level wxPython setting and that there just wasn't a setting that worked. I'll look again, but I'm not 100% sure how easy this is to fix.

Yes, this is a low-level wxPython limitation. Would then be possible to add a behavior to put in "bold" the group which is highlighted? I mean, we keep the current "background highlight", which is working for Mac and Windows and we add the "bold highlight" on the group name, which should be visible on Linux (I hope!).

newville commented 1 year ago

@maurov

Yes, this is a low-level wxPython limitation. Would then be possible to add a behavior to put in "bold" the group which is highlighted? I mean, we keep the current "background highlight", which is working for Mac and Windows and we add the "bold highlight" on the group name, which should be visible on Linux (I hope!).

I'm not sure.... I'll look again, but I think I basically hit a dead end the last time I looked.

FWIW, I do have "preserving nvict" fixed. I'm looking into and hoping to fix "energy ranges". Once those are done, I will probably tag and push 0.9.71 -- there were sort of a lot of people who needed "hot fixes". Hopefully by this weekend.

maurov commented 1 year ago

FWIW, I do have "preserving nvict" fixed. I'm looking into and hoping to fix "energy ranges". Once those are done, I will probably tag and push 0.9.71 -- there were sort of a lot of people who needed "hot fixes". Hopefully by this weekend.

Great, thanks! I have seen https://github.com/xraypy/xraylarch/commit/046f62e9b8e9b3596ef4c42f5ca79de1f2f48fd8

newville commented 1 year ago

@maurov, I think these are both fixed in 0.9.71.

maurov commented 1 year ago

@maurov, I think these are both fixed in 0.9.71.

@newville, thanks for working on these. Bug 1 is fixed, but bug 2 is still there (tested only on WSL).

newville commented 1 year ago

@maurov OK, thanks. I looked at this again. For me, the fitting ranges are remembered for a group once a fit has been done. Changing the value without doing a fit does appear to not automatically push that value to the "saved configuration", but doing a fit does.

This should be fixed to set the configuration value as soon as the value is changed. But at least the fit remembers the range now.

maurov commented 1 year ago

@newville thanks, I understand now. Indeed, I did the test without doing a fit.

On Fri, Jul 7, 2023, 2:29 PM Matt Newville @.***> wrote:

@maurov https://github.com/maurov OK, thanks. I looked at this again. For me, the fitting ranges are remembered for a group once a fit has been done. Changing the value without doing a fit does appear to not automatically push that value to the "saved configuration", but doing a fit does.

This should be fixed to set the configuration value as soon as the value is changed. But at least the fit remembers the range now.

— Reply to this email directly, view it on GitHub https://github.com/xraypy/xraylarch/issues/449#issuecomment-1625344804, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEFEDRB4MUV62H22KR5WGTXO76LTANCNFSM6AAAAAAZRS4Z6U . You are receiving this because you were mentioned.Message ID: @.***>

newville commented 1 year ago

@maurov but we should still fix that...